• Welcome to RadioDJ - Free Radio Automation Software Forum. Please log in or sign up.

[PLUGIN] TCP Server

Started by Marius, July 27, 2013, 09:50:25 PM

Marius

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:
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.
DOWNLOADS PAGE

HOW TO FIX RADIODJ DATABASE
----------------
Please don't PM me for support requests. Use the forums instead.

704djs

thx  will play around wit it today while it's raining
Beat 94.7/Hot 107.9  fm banging the hitz that you wanna hear.

shorty.xs

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

Marius

In the disabled plugin folder there is a php script that contains all commands there are implemented.
I tried to keep it simple.
DOWNLOADS PAGE

HOW TO FIX RADIODJ DATABASE
----------------
Please don't PM me for support requests. Use the forums instead.

Marius

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.
DOWNLOADS PAGE

HOW TO FIX RADIODJ DATABASE
----------------
Please don't PM me for support requests. Use the forums instead.

704djs

i use it everyday from my iphone
Beat 94.7/Hot 107.9  fm banging the hitz that you wanna hear.

shorty.xs

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]

Marius

It's doable if SnowHow will implement connect/disconnect events in the plugin.
DOWNLOADS PAGE

HOW TO FIX RADIODJ DATABASE
----------------
Please don't PM me for support requests. Use the forums instead.

shorty.xs

That would be really great. :-)

704djs

Quote from: Marius on September 11, 2013, 01:43:00 PM
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?
Beat 94.7/Hot 107.9  fm banging the hitz that you wanna hear.

SnowHow

#10
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-

Marius

#11
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.  :)
DOWNLOADS PAGE

HOW TO FIX RADIODJ DATABASE
----------------
Please don't PM me for support requests. Use the forums instead.

SnowHow

Quote from: Marius on September 14, 2013, 09:21:43 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-


Marius

DOWNLOADS PAGE

HOW TO FIX RADIODJ DATABASE
----------------
Please don't PM me for support requests. Use the forums instead.

shorty.xs

@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.  :(