RadioDJ - Free Radio Automation Software Forum

RadioDJ v1.7+ => Plugin Development => Topic started by: Marius on July 27, 2013, 09:50:25 PM

Title: [PLUGIN] TCP Server
Post by: Marius on July 27, 2013, 09:50:25 PM
Starting with RadioDJ 1.6.4.3 a new plugin is available: TCP Server.
This plugin allows you to send some commands to RadioDJ using the internet.

The settings are minimal:
- Server IP Address: This is the IP from which the commands are sent. If using a php for sending the commands and the script is hosted on your webserver, add the IP of your webserver.
- Port: The port used for communication. Make sure that this port is not blocked by your firewall (or router).
- Password: the password that must be received in order to execute a command'
- Auto Start: Start the server when RadioDJ starts.

Supported commands are:

Play Playlist Track
Play From Intro
Restart
Pause
Stop
Set Input (0 to disable, 1 to enable)
Add Track To Top (Track ID as argument)
Add Track To Bottom (Track ID as argument)
Load Playlist (Playlist ID as argument)
Refresh Events
Playcart By Number (Player # as argument)
Set AutoDJ (0 to disable, 1 to enable)
Set Assisted (0 to disable, 1 to enable)
Clear Playlist

The string that must be sent to RadioDJ is in this format:
Code: [Select]
ip.address.of.the.user&password&command&argument&
The argument and the ending "&" must be supplied even if its not used for all commands.

A php script is included with the plugin and also the RadioDJ Demo Script (v2.2) from the downloads is updated to support this feature.
Title: Re: Plugin TCP Server
Post by: 704djs on July 27, 2013, 10:48:36 PM
thx  will play around wit it today while it's raining
Title: Re: Plugin TCP Server
Post by: shorty.xs on July 30, 2013, 03:42:50 PM
Hi Marius,
do you have an example, how to create a php script to host on my webserver?
Is there a way to have a command to connect/ disconnect the Encoder?

Best Regards
Malte
Title: Re: Plugin TCP Server
Post by: Marius on July 30, 2013, 05:25:36 PM
In the disabled plugin folder there is a php script that contains all commands there are implemented.
I tried to keep it simple.
Title: Re: Plugin TCP Server
Post by: Marius on September 09, 2013, 10:01:40 PM
Anyone using this plugin?

I'm thinking to implement more complex responses, such as a xml formatted output containing now playing info, or the playlist content. At a point it could become a good way to control the program without dealing with database stuff.
Title: Re: Plugin TCP Server
Post by: 704djs on September 10, 2013, 02:52:16 AM
i use it everyday from my iphone
Title: Re: Plugin TCP Server
Post by: shorty.xs on September 11, 2013, 01:40:58 PM
Hi Marius,
I can not use it yet, because to use RDJ for Automation, I need some more fetures controllable via exactly this Plugin :-)

What I need at the moment is 2 things.
Remote control of the encoder connect/ disconnect (most important), so our DJs can disable the automation server.
Find attached how our interface looks like at the moment. It utilizes Curl, but fsocopen like in your example should be fine as well.

At the moment I get back very simple answers only.
You read the interface from left to right.
First Icon = Server is available (Server is functional)
2nd Icon = Radio Automation Softeare is working (ready to accept remote command)
3rd icon = Encoder Status (Connected or Try to connect or offline)

All other status is read from the server, not from the Radio Automation.

The other thing I'd need is either trigger an event or any other kind of action script.
Our DJs would like to have Fade out running track, than disconnect, so transistion sounds more smooth. The other way round, when DJ finished his show, they want to start with a new track, after encoder got connected.

Furthermore I need to change ICQ and AIM meta data inside the encoder, but this is nothing related to the TCP plugin. This is more like a sepearte feature request. If I have this function, I'd really like to switch to RDJ for our automation.

Best Regards
Malte

[attachment deleted by admin]
Title: Re: Plugin TCP Server
Post by: Marius on September 11, 2013, 01:43:00 PM
It's doable if SnowHow will implement connect/disconnect events in the plugin.
Title: Re: Plugin TCP Server
Post by: shorty.xs on September 12, 2013, 01:25:10 PM
That would be really great. :-)
Title: Re: Plugin TCP Server
Post by: 704djs on September 14, 2013, 10:00:02 AM
It's doable if SnowHow will implement connect/disconnect events in the plugin.

so that would mean connect & disconnect encoder at set time in the event correct?
Title: Re: Plugin TCP Server
Post by: SnowHow on September 14, 2013, 08:57:07 PM
I can honestly say that hadn't occurred to me.

I have remained silent on this plugin until now, but I have a couple of thoughts on this...

Besides the commands test script that comes in the Disabled Plugins folder and the Demo Script, is there another more secure script available I'm unaware of? The script works, but it's not secure. If someone found/knew of the script on a station web server, it could be accessed by an unauthorized person and RDJ taken over remotely. If connect/disconnect features of the encoder were to be added, a station could be taken down completely with a couple of mouse clicks....

Before we get too carried away, I would like to see more security implemented as far as commands to RDJ goes before we add any more control actions to the script/plugin.

My (excessively paranoid) two cents...  ;)

J-
Title: Re: Plugin TCP Server
Post by: Marius on September 14, 2013, 09:21:43 PM
Even if the plugin itself is simple enough, it has a few security levels that must be passed in order to send a command:

- First, the plugin will accept connections only from a IP address that the user will set, so even if you know the plugin port, if the IP address that sends the command will not match with the IP from the plugin configuration, the connection will be closed.
- There is the password that also must match with the one from the plugin configuration, if not, again the connection will be closed.

So, if i will add the IP of my webserver, even if you know the port and the password, if you try to access the plugin from another host, it will not work.

In other words, the plugin itself authenticates by IP the source of the commands (the php host), from there it's your job to secure it further, to take care of which users have access to the script.

The included php script is there to give you an idea how to communicate with the plugin, but you can use various ways to send those commands as long you respect the format of the data you will send. I tried also to connect to the plugin directly with putty and it works as long the IP is allowed in the plugin. You can even make a desktop program to be used as a remote, or an android application, or you name it...

I tried to avoid bloating the php script with authentications stuff, because it would seem too complex, i implemented there just the commands protocol.

Also, if you have ideas to increase the security, you can always share them.  :)
Title: Re: Plugin TCP Server
Post by: SnowHow on September 14, 2013, 09:43:46 PM

- First, the plugin will accept connections only from a IP address that the user will set, so even if you know the plugin port, if the IP address that sends the command will not match with the IP from the plugin configuration, the connection will be closed.
- There is the password that also must match with the one from the plugin configuration, if not, again the connection will be closed.

So, if i will add the IP of my webserver, even if you know the port and the password, if you try to access the plugin from another host, it will not work.

In other words, the plugin itself authenticates by IP the source of the commands (the php host), from there it's your job to secure it further, to take care of which users have access to the script.


Aha. That's more like it. Thanks for clearing it up.  :)

I'll play around with some ideas for remote connect/disconnect functions. I like the events idea too.


J-

Title: Re: Plugin TCP Server
Post by: Marius on September 14, 2013, 09:46:41 PM
Great  :-*
Title: Re: Plugin TCP Server
Post by: shorty.xs on September 18, 2013, 01:08:54 PM
@SnowHow, what do you think about the remote connect/ disconnect feature? To hook your encopder into the TCP Plugin?

We run our Automation on a Virtual Server, so I can not use any virtual soundcard, becasue you can not install any virtual hardware on a virtual Windows computer. So I have to use a built in Encoder, that get it's source directly within RDJ.

Unfortuneately it is not very common for hosters (at least in germany) to use technology like VMWARE or VirtualBox. These would allow me to install virtual sound card and could make my life way easier, but as a hobby project, we are not able to pay such servers.  :(

Title: Re: Plugin TCP Server
Post by: SnowHow on September 18, 2013, 07:40:16 PM
@SnowHow, what do you think about the remote connect/ disconnect feature? To hook your encopder into the TCP Plugin?


It's a good idea and I can see how it would be useful. My schedule has been full recently, which is why I haven't updated anything. As soon as I get through a few issues I'm dealing with, I will start updating all my stuff.

Thanks for your patience! :)

J-

Title: Re: Plugin TCP Server
Post by: shorty.xs on September 24, 2013, 04:46:25 PM
This is good news.  :ok:
I am always patient with people that spend thair free time in developing applications that are provided for free.

It is done, when it's done. I don't care for any schedule.
Title: Re: Plugin TCP Server
Post by: RezoVY on September 26, 2013, 08:02:27 AM
After research and testing I finally found what was blocking.  ;)
My tests are inconclusive. :)
Thank you all and you Marius .... :ok:
Title: Re: Plugin TCP Server
Post by: Elvis on October 10, 2013, 09:02:45 PM
Hi Marius,

I am upgrading Radio DJ from 1.6.0 to 1.6.5 and found out that PlayNextTrack command was not implemented in this plugin.
Can you please implement it? It is very useful to me.

Thank you very much and keep the great work!

Regards,
Elvis
Title: Re: Plugin TCP Server
Post by: Marius on October 10, 2013, 10:03:30 PM
In the plugins folder you have an example php file which contains all implemented commands.
Play next file is replaced by "PlayPlaylistTrack" and you must pass the zero based playlist item number to be played, for example if you want to play next songs, the command is:
Code: [Select]
PlayPlaylistTrack&0
Title: Re: Plugin TCP Server
Post by: Elvis on October 10, 2013, 10:07:51 PM
Thanks for the quick reply Marius. I thought this command was something else. :)
Title: Re: Plugin TCP Server
Post by: aus10hollis on October 10, 2013, 10:52:37 PM
I'm having troubles sending the commands. Using the demo script, I get no response.
Title: Re: Plugin TCP Server
Post by: Elvis on October 10, 2013, 11:21:37 PM
One thing I noticed that used to work and is not anymore is to allow multiple ips to connect separated by ;.
Are you doing that?
Title: Re: Plugin TCP Server
Post by: aus10hollis on October 10, 2013, 11:32:00 PM
No, just the IP address of the server.

In the XML file, what is the WebIP for?
Title: Re: Plugin TCP Server
Post by: aus10hollis on October 10, 2013, 11:49:48 PM
I was using the TCP plugin from 1.6.5.0 and I just replaced it with one from a previous version and it's now working.
Title: Re: [PLUGIN] TCP Server
Post by: marcopsq on December 05, 2013, 12:11:48 AM
How can I use remote control (TCP) with another computer in the same net (192.168.1.2)?

with the first pc with the database i use this: http://127.0.0.1:4444/radiodj161&password&PlayPlaylistTrack  and it works great!
Title: Re: [PLUGIN] TCP Server
Post by: irizzi on December 05, 2013, 11:44:20 AM
Hi all, sorry in advance for my bad english.
I need to interface radiodj to another application that can send only one string per event (and cannot be modified  :()

Radiodj, when receives this string, shoud:
- clear playlist;
- open line in;
- execute a little external program;
- stop current execution;
- wait until it not receives a PlayPlaylistTrack&0 or a Restart command

With a manual event and a LoadPlaylist tcp command I'm able to cover all but immediate playout (I've to wait the end of current track)

Is there a way to execute a manual event directly by tcp server?
Or... any suggestion?

Thanks in advance.

Filippo
Title: Re: [PLUGIN] TCP Server
Post by: bakeri666 on December 12, 2013, 08:55:34 PM
SetAssisted does not actually change the RadioDJ assisted status...

Also, why is the IP address sent in the command message when it is ignored by the plugin? Is there a way to allow multiple IP's, or to use the message ip as the security check as a work around?

I am trying to connect without a php server in the middle, and my IP address is dynamic

thanks
Title: Re: [PLUGIN] TCP Server
Post by: romain25300 on February 03, 2014, 02:51:18 PM
Hi and Thanks for your beautiful work.

Where can I download this plugin ?

Thank you in advance.
Title: Re: [PLUGIN] TCP Server
Post by: Marius on February 03, 2014, 02:59:18 PM
It should be located in radioDJ folder under "Disabled Plugins".
Title: Re: [PLUGIN] TCP Server
Post by: romain25300 on February 04, 2014, 12:44:21 PM
Thanks and Congratulation for Soshi   ;D
Title: Re: [PLUGIN] TCP Server
Post by: Daviscd01 on February 05, 2014, 03:56:18 PM
You can install Virtual sound on a windows virtual computer. You just can't use remote desktop.  you would have to use something like teamviewer or log-in or something similar that gives you
access via the console screen
Title: Re: [PLUGIN] TCP Server
Post by: Daviscd01 on February 17, 2014, 05:11:30 PM
If you install realVNC or Teamviewer you can access the server for the console and install a Virtual Sound Card. 
RDP is not suitable for a number of different installed (Virtual sounds, RealVNC, etc).

I just when thru it on a 2k8 server.  I install tight VNC  and then once I logged into the 2k8 console and install RealVNC.

everything is working fine. I have more than one instance of RDJ running with no hickups 
Title: Re: [PLUGIN] TCP Server
Post by: romain25300 on April 07, 2014, 01:06:09 PM
Thanks Marius, we are in final testing. Go to prod next Monday :D.

I want to send Rotation ID, but we don't have this command ?

Thanks,
Romain
Title: Re: [PLUGIN] TCP Server
Post by: Hansen on November 07, 2014, 07:07:53 PM
omg im trying to config the tcp sever but im getting errors

what ip port should it use?
Radiodj and database uses :3306 should the tcp use that too? someone have 2 minutes to show me?
 i have teamwiever 
 
Title: Re: [PLUGIN] TCP Server
Post by: Marius on November 07, 2014, 07:29:34 PM
This plugin will be replaced very soon with REST SERVER PLUGIN. Please use that. You can find it in downloads page.
Title: Re: [PLUGIN] TCP Server
Post by: Hansen on November 07, 2014, 09:51:15 PM
thats the one that i use marius, and i just canĀ“t make it work...
Title: Re: [PLUGIN] TCP Server
Post by: AndyDeGroo on November 07, 2014, 10:55:15 PM
what ip port should it use?
Radiodj and database uses :3306 should the tcp use that too? someone have 2 minutes to show me?
TCP port 3306 is used by MySQL and it is impossible for more than one service to listen on same port. Default port 7000 should work as long as Windows permits to use that endpoint.
Title: Re: [PLUGIN] TCP Server
Post by: Hansen on November 07, 2014, 11:10:06 PM
AndyDeGroo once again you come to my rescue.....

now i just have to figure out how to make buttons and make it work from my website.....

do you have have an idea how to do this?
Title: Re: [PLUGIN] TCP Server
Post by: pedrazadixon on October 07, 2020, 08:13:37 PM
any way to get some plugin  similar actually? in v1.8.x or 2.x ?