RadioDJ - Free Radio Automation Software Forum

RadioDJ v1.7+ => Plugin Development => Topic started by: Marius on November 04, 2014, 02:10:52 PM

Title: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on November 04, 2014, 02:10:52 PM
Due the problems with TCP Server plugin, i decided myself to re-write it and make it more powerful.

This plugin will replace soon the TCP server plugin, as it's much easier to use and allows you to interact in a more advanced way with RadioDJ.

The plugin settings are kept simple, you must enter the local IP:port to which the plugin will listen for commands, eg: http://127.0.0.1:7000 for localhost. Also, you must enter a password for command validation, like in plugin TCP server.

There are 4 implemented sections:
1. Commands section, which can be accessed like this:
http://127.0.0.1:7000/opt?auth=[password]&command=[command]&arg=[argument]

You must replace the brackets and its content with the password, command and when needed with the argument, like this:
http://127.0.0.1:7000/opt?auth=changeme&command=PlayPlaylistTrack&arg=0

The implemented commands so far are:

Code: [Select]
        PlayPlaylistTrack 'Zero based track number from playlist
        RemovePlaylistTrack 'Zero based track number from playlist
        StopPlayer
        PausePlayer 'arg=0 to unpause, 1 to pause
        RestartPlayer
        PlayFromIntro
        ClearPlaylist
        LoadTrackToTop 'Song ID as argument
        LoadTrackToBottom 'Song ID as argument
        LoadPlaylist 'Playlist ID as argument
        EnableAutoDJ 'arg=0 to disable, 1 to enable
        EnableAssisted 'arg=0 to disable, 1 to enable
        EnableEvents 'arg=0 to disable, 1 to enable
        RefreshEvents
        EnableInput 'arg=0 to disable, 1 to enable
        PlaycartByNumber 'cart number as argument
        StatusAutoDJ 'Get the status of AutoDJ option as boolean
        StatusAssisted 'Get the status of Assisted option as boolean
        StatusInput 'Get the status of Input option as boolean
        StatusQueue 'Get queue playlist number of tracks
        ShowMessage 'Display a message in RadioDJ. Message as argument

The second section is for getting the now playing details and can be accessed like this:
http://127.0.0.1:7000/np?auth=[password]

The third section is for getting the playlist:
http://127.0.0.1:7000/p?auth=[password]

[UPDATE] From version 1.1 of the plugin, the playlist will contain at the first position the now playing track in order to avoid multiple queries.

And, the last section is for getting details about a specific track from the playlist:
http://127.0.0.1:7000/pitem?auth=[password]&arg=[zero based track number from the playlist]

For each section the response is XML formatted, so it's much easier to parse it.

For example the now playing section will return something like:

Code: (xml) [Select]
<?xml version="1.0" encoding="UTF-8"?>
<SongData xmlns="http://schemas.datacontract.org/2004/07/rdjInterface" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
   <Album>Bravo Hits Vol. 86</Album>
   <AlbumArt />
   <Artist>Clean Bandit Feat. Sharna Bass</Artist>
   <ArtistPlayed>2014-11-04T19:01:24</ArtistPlayed>
   <AutoFree>true</AutoFree>
   <AutoStop>false</AutoStop>
   <BPM>0</BPM>
   <BuyLink />
   <Comments />
   <Composer />
   <Copyright />
   <CountPlayed>0</CountPlayed>
   <CueTimes>&amp;sta=0.01&amp;xta=254.382358276644&amp;end=255.872358276644&amp;fin=0&amp;fou=1.49000000000001</CueTimes>
   <DatePlayed>2002-01-01T00:00:01</DatePlayed>
   <DateRequested>0001-01-01T00:00:00</DateRequested>
   <DiscNo>0</DiscNo>
   <Duration>254.372358276644</Duration>
   <Elapsed>194.80102040816328</Elapsed>
   <Enabled>true</Enabled>
   <EndDate>2002-01-01T00:00:01</EndDate>
   <FadeIn>0</FadeIn>
   <FadeOut>1.49000000000001</FadeOut>
   <FadeType>0</FadeType>
   <HasHooks>false</HasHooks>
   <HighPrecision>0</HighPrecision>
   <ID>268</ID>
   <IDGenre>168</IDGenre>
   <IDSubcat>6</IDSubcat>
   <Isrc />
   <LimitAction>0</LimitAction>
   <OriginalArtist />
   <Path>Y:\music\03 Club &amp; House\17 - HOUSE 2014\Clean Bandit Feat. Sharna Bass - Extraordinary.mp3</Path>
   <PlayLimit>0</PlayLimit>
   <PlayOnMainMixer>true</PlayOnMainMixer>
   <PlayerID>-1342177134</PlayerID>
   <Position>194.81102040816327</Position>
   <Publisher />
   <Remaining>59.571337868480725</Remaining>
   <RequestMessage />
   <RequestUser />
   <StartDate>2002-01-01T00:00:01</StartDate>
   <Sweepers />
   <Title>Extraordinary</Title>
   <TrackNo>0</TrackNo>
   <TrackType>Music</TrackType>
   <Weight>50</Weight>
   <WithLoop>false</WithLoop>
   <Year>2014</Year>
   <bCueDuration>45134120</bCueDuration>
   <bCueEnd>45135884</bCueEnd>
   <bCueIntro>0</bCueIntro>
   <bCueLoopIn>0</bCueLoopIn>
   <bCueLoopOut>0</bCueLoopOut>
   <bCueNext>44873048</bCueNext>
   <bCueOutro>0</bCueOutro>
   <bCueStart>1764</bCueStart>
   <bPosition>34364664</bPosition>
   <bcueHookIN>0</bcueHookIN>
   <bcueHookOut>0</bcueHookOut>
   <cueEnd>255.872358276644</cueEnd>
   <cueHookIN>0</cueHookIN>
   <cueHookOut>0</cueHookOut>
   <cueIntro>0</cueIntro>
   <cueLoopIn>0</cueLoopIn>
   <cueLoopOut>0</cueLoopOut>
   <cueNext>254.382358276644</cueNext>
   <cueOutro>0</cueOutro>
   <cueStart>0.01</cueStart>
   <isOverlay>0</isOverlay>
   <isPodcast>0</isPodcast>
   <swFirst>false</swFirst>
   <swID>-100</swID>
   <swName />
   <swPlay>0</swPlay>
   <vtID>0</vtID>
   <vtName />
   <vtPlay>-100</vtPlay>
</SongData>

As you see, it exposes all internal data about the track.

The plugin can be downloaded from the downloads page.

PS: In order to use this plugin from the internet, you will need to make sure that the used port is open on your firewalls.

PS2: The ShowMessage command will only work with the next version of RadioDJ.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on November 04, 2014, 03:16:11 PM
A simple now playing info implementation using this plugin (needs php5+) (Updated for plugin Rest Server v1.1):

Code: [Select]
<!DOCTYPE html>
<head>
    <title>Now Playing Info</title>
<meta charset="utf-8">
</head>
<body>

<?php

$xml
=simplexml_load_file("http://127.0.0.1:7000/np?auth=changeme");
//print_r($xml) . "<br>";
echo "Artist: " $xml->Artist "<br>";
echo 
"Title: " $xml->Title "<br>";
echo 
"Album: " $xml->Album "<br>";
echo 
"Track Type: " $xml->TrackType "<br>";
echo 
"Remaining: " gmdate("H:i:s"round($xml->Remaining)) . "<br>";
?>


</body>
</html>

The output is this:
Code: [Select]
Artist: Skepta Feat D Double E, Tempa T, President T, Sox & Jay
Title: That's Not Me (Remix)(Explicit Edit)
Album: The Official Uk Top 40 Singles Chart 15-06-2014
Track Type: Music
Remaining: 00:02:24
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: TQ on November 04, 2014, 03:45:25 PM
Bravo Marius
TQ
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on November 05, 2014, 09:28:38 PM
I released a new version (v1.1) which is more faster and i added to the archive also the Monitor utility.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: nemoradio on November 05, 2014, 09:58:24 PM
Hi Marius !
Great job as usually ! I cannot get it working, see the attached windows error). What can i do ? Thank you !

[attachment deleted by admin]
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on November 05, 2014, 10:20:34 PM
Try to run rdj as administrator. It seems that the plugin doesn't have the necessary rights to run.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: aus10hollis on November 06, 2014, 12:35:27 AM
From quickly testing it, I like the idea! The monitor is really neat :) Do you plan on putting any buttons into the monitor? Thanks for what you do!!
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on November 06, 2014, 11:04:59 AM
Hmm, the idea of the monitor is not to control the system, but having the option to see what is playing and what is will play next. Maybe useful for bigger studios where the presenter is not at the rdj computer. For that scenario may be unpleasant if someone else would modify the playlist or start/stop the system by accident...

But reading your needs from the other topic, i will figure out a way to safely combine them
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: aus10hollis on November 07, 2014, 12:45:13 AM
Just wanted to say thanks again for adding the REST plugin.

I'm going to start working on a web interface for our radio station tomorrow and when I finish, I'll upload the source code for others to use.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: starm on November 07, 2014, 11:07:26 AM
I have a probleme

i am french, my english is very bad

i am Windows Vista sp2

[attachment deleted by admin]
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on November 07, 2014, 12:10:23 PM
Please press details button when the error appears and post the content here.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: starm on November 07, 2014, 12:16:12 PM
Code: [Select]
Consultez la fin de ce message pour plus de détails sur l'appel du débogage
juste-à-temps (JIT) à la place de cette boîte de dialogue.

************** Texte de l'exception **************
System.InvalidCastException: La conversion de la chaîne "157.90009070294747" en type 'Double' n'est pas valide. ---> System.FormatException: Le format de la chaîne d'entrée est incorrect.
   à Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat)
   à Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble(String Value, NumberFormatInfo NumberFormat)
   --- Fin de la trace de la pile d'exception interne ---
   à Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble(String Value, NumberFormatInfo NumberFormat)
   à Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble(String Value)
   à RadioDJ_Monitor.MainForm.UpdateData()
   à RadioDJ_Monitor.MainForm.Timer1_Tick(Object sender, EventArgs e)
   à System.Windows.Forms.Timer.OnTick(EventArgs e)
   à System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   à System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Assemblys chargés **************
mscorlib
    Version de l'assembly : 2.0.0.0
    Version Win32 : 2.0.50727.4253 (VistaSP2GDR.050727-4200)
    CodeBase : file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
RadioDJ Monitor
    Version de l'assembly : 1.0.0.0
    Version Win32 : 1.0.0.0
    CodeBase : file:///E:/RadioDJ/Plugins/RadioDJ%20Monitor/RadioDJ%20Monitor.exe
----------------------------------------
Microsoft.VisualBasic
    Version de l'assembly : 8.0.0.0
    Version Win32 : 8.0.50727.4252 (VistaSP2GDR.050727-4200)
    CodeBase : file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
    Version de l'assembly : 2.0.0.0
    Version Win32 : 2.0.50727.4253 (VistaSP2GDR.050727-4200)
    CodeBase : file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
    Version de l'assembly : 2.0.0.0
    Version Win32 : 2.0.50727.4252 (VistaSP2GDR.050727-4200)
    CodeBase : file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Version de l'assembly : 2.0.0.0
    Version Win32 : 2.0.50727.4252 (VistaSP2GDR.050727-4200)
    CodeBase : file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
    Version de l'assembly : 2.0.0.0
    Version Win32 : 2.0.50727.4252 (VistaSP2GDR.050727-4200)
    CodeBase : file:///C:/Windows/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
System.Windows.Forms.resources
    Version de l'assembly : 2.0.0.0
    Version Win32 : 2.0.50727.4016 (NetFxQFE.050727-4000)
    CodeBase : file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_fr_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------
System.Data
    Version de l'assembly : 2.0.0.0
    Version Win32 : 2.0.50727.4252 (VistaSP2GDR.050727-4200)
    CodeBase : file:///C:/Windows/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Xml
    Version de l'assembly : 2.0.0.0
    Version Win32 : 2.0.50727.4253 (VistaSP2GDR.050727-4200)
    CodeBase : file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
    Version de l'assembly : 2.0.0.0
    Version Win32 : 2.0.50727.4252 (VistaSP2GDR.050727-4200)
    CodeBase : file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
mscorlib.resources
    Version de l'assembly : 2.0.0.0
    Version Win32 : 2.0.50727.4253 (VistaSP2GDR.050727-4200)
    CodeBase : file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Microsoft.VisualBasic.resources
    Version de l'assembly : 8.0.0.0
    Version Win32 : 8.0.50727.4016 (NetFxQFE.050727-4000)
    CodeBase : file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic.resources/8.0.0.0_fr_b03f5f7f11d50a3a/Microsoft.VisualBasic.resources.dll
----------------------------------------

************** Débogage JIT **************
Pour activer le débogage juste-à-temps (JIT), le fichier de configuration pour cette
application ou cet ordinateur (machine.config) doit avoir la valeur
jitDebugging définie dans la section system.windows.forms.
L'application doit également être compilée avec le débogage
activé.

Par exemple :

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

Lorsque le débogage juste-à-temps est activé, les exceptions non gérées
seront envoyées au débogueur JIT inscrit sur l'ordinateur
plutôt que d'être gérées par cette boîte de dialogue.

Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on November 07, 2014, 01:08:04 PM
The only way i could replicate the problem was to set my location to France, so it could be something related to your locales. However i fixed it.
Please download RadioDJ monitor v1.1 from here: http://www.radiodj.ro/download/beta-utils/RadioDJMonitorV1.1.zip (http://www.radiodj.ro/download/beta-utils/RadioDJMonitorV1.1.zip)
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: nemoradio on November 07, 2014, 01:24:09 PM
Hi !

I'm also french and i also couldn't make it work yesterday. RDJ interface was frozen while le music was keep playing when i tried to connect. But without any error message from my windows 7 pro 64bits. I'll try this new version ASAP ! Thanks Marius !
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: starm on November 07, 2014, 02:27:29 PM
Thank you Marius
The software works well with this version

 ;D
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on November 07, 2014, 02:34:05 PM
Thanks for the feedback! Enjoy it! :)
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: starm on November 07, 2014, 02:57:52 PM
hello
me again, here is the small idea:  :P

-hidden the password
-RADIODJ software clock (time server on the RadioDJ)
-Colour of Time intro and song length
-An emergency button that starts a sound software RadioDj
-a drop-down menu to select multiple radioDJ machine (in the case of Internet radio remote)
-a witness in connection RadioDj software (a test every 5 seconds)

Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: aus10hollis on November 07, 2014, 09:31:01 PM
I put a little web interface together and it works with the REST plugin. It's not the best because I needed to get something together quickly for our radio program, but I'll keep updating it and post the updates for others to use.

Just change your information in the config.php file.

[attachment deleted by admin]
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: AndyDeGroo on November 07, 2014, 11:20:32 PM
I'm also hitting the same security error when trying to start the server.
That is the exact limitation of HttpListener (http://stackoverflow.com/questions/169904/can-i-listen-on-a-port-using-httplistener-or-other-net-code-on-vista-without) I mentioned when Marius and I discussed development of RESTful server plugin. And that is also the main reason I was looking for TcpListener based web server to use in my HTTP server plugin.

(http://i.imgur.com/Ln2fv9p.png) (http://prntscr.com/542clm)

Running RadioDJ as admin in not a solution and should not be required. This is the main reason I tried to avoid HttpListener in when I started to develop the HTTP server plugin.

However, HttpListener ACLs can be controlled using netsh http command group. For default setting with port 7000 the following command should be run in elevated command console (as Administrator):
Code: [Select]
netsh http add urlacl url=http://+:7000/ user=YourUserName listen=yes

Just replace YourUserName with your actual username and the plugin should work.

@Marius I'm a little bit disappointed that your plugin does not provide JSON data. I had already added JSON.Net (https://json.codeplex.com/) to my solution for this purpose but it look like I'm not going to develop my plugin as it seems pointless now.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Hansen on November 07, 2014, 11:36:48 PM
I get that message when i start up RadioDJ AndyDeGroo
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: AndyDeGroo on November 07, 2014, 11:46:43 PM
I get that message when i start up RadioDJ AndyDeGroo
You should have stated that when you posted the first time. The error message is related to how latest Windows versions handle HTTP endpoint security.
To get rid of the message you should open command prompt as Administrator and run the netsh command line that I provided in my previous post. Just remember to use your actual username. To get your Windows username, just run whoami command in command prompt.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Hansen on November 08, 2014, 12:22:42 AM
done now i get another error #001 

losely translated....

"server error #001 an attempt was made to access a socket in a way that is prohibited by the sockets of access"
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: AndyDeGroo on November 08, 2014, 12:31:46 AM
"server error #001 an attempt was made to access a socket in a way that is prohibited by the sockets of access"
That must be error form the old TCP server plugin, not the REST server plugin. You should remove the old one if you're using REST plugin.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on November 08, 2014, 10:13:10 AM
@Marius I'm a little bit disappointed that your plugin does not provide JSON data. I had already added JSON.Net (https://json.codeplex.com/) to my solution for this purpose but it look like I'm not going to develop my plugin as it seems pointless now.

I needed a solution to retrieve the now playing and the playlist without allowing another connection to the database, that's the reason i wrote this plugin. For the output i just return an existing class from rdj which works well for xml, but when i set it to json it returns nothing. I didn't had the time to see why json didn't worked and for my particular case xml was perfect since i find it's structure more easy to read and why not, more logical (yeah, i'm old school :) ). I also used WCF  because it requires minimum coding.

Running the program as administrator or not, is the decision which every user of this plugin will decide for itself. For now, this is the limitation of this approach. If the user consider that giving remote access to it's database to retrieve the information provided by this plugin is better (or safer?), they are free to do so. I just tried to offer an easy alternative.

About writing you own plugin, in no case i would consider it useless, because as you said, you want to use a different approach which may be more flexible. If we would never try to improve something that already exist, we would not evolve, right? You proved this also with the wp plugin which is great.  ;)
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: starm on November 08, 2014, 11:33:05 AM
This message is for aus10 hollis  :P
you're doing a great job, I saw a small bug  :'(, time music shifts in time, the web page is delayed ...
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on November 08, 2014, 01:45:57 PM
It is normal to have a delay because it takes a certain amount of time to send the request, receive the answer and display the result. But it shouldn't be very noticeable.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: starm on November 08, 2014, 02:19:18 PM
Marius thank you for your answer  :)

My mysql should not be fast, I'll ask him to make a little effort  :hihi:
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: maurocal on November 08, 2014, 05:27:55 PM
Hello everyone,
I'm trying the plugin RestServer on radiodj 1.7.5.
I get this error when I open radiodj as in the image.
can you tell me what causes this error?

the operating system is XP

Thanks.

Mauro

[attachment deleted by admin]
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: maurocal on November 09, 2014, 12:15:26 PM
Hello everyone,
I'm trying the plugin RestServer on radiodj 1.7.5.
I get this error when I open radiodj as in the image.
can you tell me what causes this error?

the operating system is XP

Thanks.

Mauro

Do you have any idea what may 'be my problem?
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: AndyDeGroo on November 09, 2014, 03:08:25 PM
Do you have any idea what may 'be my problem?
You biggest problem is that you're using Windows XP, which has reached its end of support in April. The error message seems to indicate that the plugin relies on features no available in .Net framework on XP and it might not work on XP at all.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: maurocal on November 09, 2014, 03:32:56 PM
Thanks AndyDeGroo,
I know XP is very old.
for now we do not have the money to change their original licenses.
  Thanks again.
Mauro
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: TQ on November 09, 2014, 04:40:09 PM
If it's any help, I'm still running on XP 64bit (I know it's really a windoz server 2003 cut-down) which was cut off from updates at the same time as the 32bit version and all is well for me.

I purchased a 64bit Win7 replacement license but I just can't face rebuilding my station PC from scratch as I have sooo much else on it. I've decided to wait until I can buy a new bare-bones PC use the license on that.

TQ
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: maurocal on November 10, 2014, 12:16:38 PM
If it can be useful to someone, I solved my problem by installing .NET Framwork 3.5 SP1, whereas before it was only installed 3.5.

also wanted to point out:
if, while radiodj monitor is open, you squeeze Connect again, everything stops. it is necessary to terminate the process and reopen again.

If the History of radiodj is empty does not connect. you need to start at least a song or jingle to fill the History.

if you can increase the font size for someone like me who is short-sighted. :hihi:

Thanks Marius, it's a wonderful job and we will use it once in a live performance.

PS. when you talk about messages, it means that the director is able to send messages to the speaker?

Mauro
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: shorty.xs on November 19, 2014, 01:19:25 PM
Hi Marius,
to make it more secure wouldn't it be better to use basic http authentication instead of just passing User and password in the address line?
Also I guess it is a bit more handy to use, because you don't have to athenticate with every command (as far as I understood the process).

Just my 2 cents to a great new plugin!

Cheers
Malte
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: AndyDeGroo on November 20, 2014, 09:14:10 PM
Hi Marius,
to make it more secure wouldn't it be better to use basic http authentication instead of just passing User and password in the address line?
Also I guess it is a bit more handy to use, because you don't have to athenticate with every command (as far as I understood the process).
Great suggestion but why do you think basic authentication is any better than sending plaintext password in URL params? In essence it's the same thing only base64 encoded, which is easily reversible. The only way to secure it would be by using HTTPS or via VPN/SSH tunnelling.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: AndyDeGroo on November 21, 2014, 03:23:40 AM
Well, I'm testing the plugin right now but I can't get ShowMessage command to do anything. It returns status code 200 but nothing is happening.
There is a message in Plugin_RestServer_log.txt stating that all went well:
Quote
Command received from auth: p@$$W0rd, command: ShowMessage, argument: Hello World!
but nothing in event logs or exceptions whatsoever.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: aus10hollis on November 21, 2014, 09:59:30 PM
In the opening post, I missed it too, it says:
Quote
PS2: The ShowMessage command will only work with the next version of RadioDJ.

I assume he's meaning it will only work in the version after 1.7.5.0
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on November 21, 2014, 10:16:31 PM
In the released versions s not implemented yet. The new version is on the way, however...  ;D
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: AndyDeGroo on November 21, 2014, 11:08:17 PM
In the released versions s not implemented yet. The new version is on the way, however...  ;D
That's great news!
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: gert-jan221 on November 24, 2014, 03:49:30 PM
I have radio dj 1.7.5 but when I connect with the rdj monitor tool I get this error:


Code: [Select]
Zie het einde van dit bericht voor meer informatie over het aanroepen
van JIT-foutopsporing (Just In Time) in plaats van dit dialoogvenster.

************** Tekst van uitzondering **************
System.OverflowException: TimeSpan is overgelopen omdat de duur te lang is.
   bij System.TimeSpan.Interval(Double value, Int32 scale)
   bij RadioDJ_Monitor.MainForm.FormatTime(Double seconds)
   bij RadioDJ_Monitor.MainForm.UpdateData()
   bij RadioDJ_Monitor.MainForm.Timer1_Tick(Object sender, EventArgs e)
   bij System.Windows.Forms.Timer.OnTick(EventArgs e)
   bij System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   bij System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Geladen assembly's **************
mscorlib
    Assembly-versie: 2.0.0.0
    Win32-versie: 2.0.50727.5472 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
RadioDJ Monitor
    Assembly-versie: 1.0.0.0
    Win32-versie: 1.0.0.0
    CodeBase: file:///C:/Users/Gert-Jan/Desktop/RadioDJ%20Monitor/RadioDJ%20Monitor.exe
----------------------------------------
Microsoft.VisualBasic
    Assembly-versie: 8.0.0.0
    Win32-versie: 8.0.50727.5420 (Win7SP1.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
    Assembly-versie: 2.0.0.0
    Win32-versie: 2.0.50727.5467 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
    Assembly-versie: 2.0.0.0
    Win32-versie: 2.0.50727.5468 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly-versie: 2.0.0.0
    Win32-versie: 2.0.50727.5467 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
    Assembly-versie: 2.0.0.0
    Win32-versie: 2.0.50727.5420 (Win7SP1.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
System.Windows.Forms.resources
    Assembly-versie: 2.0.0.0
    Win32-versie: 2.0.50727.5420 (Win7SP1.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_nl_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------
System.Data
    Assembly-versie: 2.0.0.0
    Win32-versie: 2.0.50727.5420 (Win7SP1.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Xml
    Assembly-versie: 2.0.0.0
    Win32-versie: 2.0.50727.5476 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
    Assembly-versie: 2.0.0.0
    Win32-versie: 2.0.50727.5476 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
mscorlib.resources
    Assembly-versie: 2.0.0.0
    Win32-versie: 2.0.50727.5472 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------

************** JIT-foutopsporing **************
Als u JIT-foutopsporing wilt inschakelen, moet in het configuratiebestand voor deze
toepassing of computer (machine.config) de waarde
jitDebugging in het gedeelte system.windows.forms zijn ingesteld.
De toepassing moet ook zijn gecompileerd terwijl foutopsporing
was ingeschakeld.

Bijvoorbeeld:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

Wanneer JIT-foutopsporing is ingeschakeld, worden onverwerkte uitzonderingen
naar het JIT-foutopsporingsprogramma gestuurd dat op de computer is geregistreerd
en worden niet door dit dialoogvenster verwerkt.
What do i wrong?

Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on November 24, 2014, 04:54:24 PM
From the first page:

Quote
The only way i could replicate the problem was to set my location to France, so it could be something related to your locales. However i fixed it.
Please download RadioDJ monitor v1.1 from here: http://www.radiodj.ro/download/beta-utils/RadioDJMonitorV1.1.zip
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: murugan on December 08, 2014, 02:35:40 PM
hai!
How to use REST SERVER Plugin on Raid DJ.I copy and paste plugins into plugun Folder but it doesnt work.Can Anybody help????????
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on December 08, 2014, 02:38:37 PM
If you need help, please detail the problem because no one can guess what you have there.
- What version of rdj?
- How did you tested the plugin and came to the conclusion that it don't works?
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Jared5595 on December 10, 2014, 07:07:59 AM
Great plugin, as well as great software! How easy would it be to implement polling to see if events are enabled or disabled? Reason I'm asking is because I do a little bit of remote broadcasting, and I use the plugin to load in the internet stream that I broadcast to from RDJ on my laptop, when I'm on location with aus10hollis' web interface. As of current, I've dusted off my very rusty CSS and HTML skills to add two buttons to the page, below the playlist to enable and disable (which does fine for what little I need it for). Anyways, I really enjoy not having to use VNC now to do remote broadcasts!  :ok:

Also, for authentication (on the web interface), I just run a small apache server on the RDJ machine with https (since I have a static IP address to assign a domain and ssl cert to, but this can be achieved easily with a free dynamic dns subdomain). I put an .htaccess on it, and now I can login from anywhere and check it securely! (I also have SFTP setup so I can manage pretty much everything remotely and safely)


Anyways, great work Marius and aus!
~Jared
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: aus10hollis on December 10, 2014, 04:57:53 PM
You can use a little bit of JavaScript to poll every few seconds and then change your button colors depending on what the response it. Just use the StatusAssisted and StatusAutoDJ REST command.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: vipermetcaff on December 11, 2014, 03:23:25 AM
I put a little web interface together and it works with the REST plugin. It's not the best because I needed to get something together quickly for our radio program, but I'll keep updating it and post the updates for others to use.

Just change your information in the config.php file.
Looks good so far thanks keep up the great  work
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on December 12, 2014, 10:13:38 PM
I attached a very basic remote control for android. It allows to run the basic commands like play, stop, pause, play from intro, restart and start/stop first 10 cart players.
After installing, go to options and set the hostname in the format IP:PORT (like 191.168.1.5:7000) without using "http". Then set the password and save. If the radiodj computer firewall port is open is should work without any problem.

The file is on downloads page at utilities.

Have fun!
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: TQ on December 15, 2014, 10:35:47 AM
I attached a very basic remote control for android. It allows to run the basic commands like play, stop, pause, play from intro, restart and start/stop first 10 cart players.
After installing, go to options and set the hostname in the format IP:PORT (like 191.168.1.5:7000) without using "http". Then set the password and save. If the radiodj computer firewall port is open is should work without any problem.

The file is on downloads page at utilities.

Have fun!

Hi Marius,

I'm amazed that no one has responded to this post even though it's been downloaded 68 times at time of writing this.

It worked perfectly on wifey's tablet although I couldn't get the screen to rotate, maybe that's programming thing rather than a tablet thing?

I'm sure your next version will include super pretty images/layout just as the main RDJ interface has. Whilst I'm on that subject, maybe the sweepers & rotation dropdowns in RDJ should be white on black rather than black on white (like the TTS dropdown).

I'm interested to know what environment you programmed it in, maybe you could mention it here?

TQ
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on December 15, 2014, 10:48:13 PM
That's no secret: i use B4A.
Regarding the screen rotation, on my tablet and phone works as expected, but then again, i have a lot to learn about android and maybe i missed something.
The UI is ugly i know, i concentrated more on the code than on the user interface. It was my first test.  :)
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: wonderboygr on January 26, 2015, 04:24:36 PM
Hello, just a quick note. once the plugin is placed in the right folder and the port is opened in the router, when i run radiodj as administrator it works fine, if i run normally it doesn't work

is there a way to make the plugin such that the radiodj software  would not need to bu runed as admin?
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: starm on February 14, 2015, 12:24:47 PM
Hello Marius

Request formulated with Google, I am French, my English is not that great.

A friend and I are working on RadioDJ Web Interface (see image attached). Now, Song Intro Time is available and Server Time too.

The cartwall sounds can only be played but not stopped :
Already Exists : http://127.0.0.1:7000/opt?auth=changeme&command=PlaycartByNumber&arg=xxxxx
Asked command : http://127.0.0.1:7000/opt?auth=changeme&command=StopcartByNumber&arg=xxxxx


As we can play a song with the following command :
http://127.0.0.1:7000/opt?auth=changeme&command=PlayPlaylistTrack&arg=xxx

I'd like to know if it was possible to retrieve the Track's List with the ID, Title, Artists in JSON format or XML from Database like for example :
http://127.0.0.1:7000/opt?auth=changeme&command=ListTrack&arg=song


We could remotely control RadioDJ.


Friendly.

[attachment deleted by admin]
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: starm on February 15, 2015, 11:51:13 PM
Hello

Marius you read the previous one post?  :P


I would like a fairly quick response ...

please :angel:
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on February 16, 2015, 11:27:41 AM
The cart buttons are toggled by that call. So if you call
Code: [Select]
http://127.0.0.1:7000/opt?auth=changeme&command=PlaycartByNumber&arg=1the #1 cart will start and if you call it again will stop it.

Can i ask you why do you need to load the track details from their ID's? If its the reason i suspect (listing files), you will simply kill the main program. For such things it's better to connect directly to the database.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: starm on February 16, 2015, 11:58:16 AM
good morning
thank you for that answer

 :)
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: laurent-CETARadio on March 01, 2015, 11:29:21 AM
Hi,
i have a question.
We would like to launch REST links to do OutsideBroadcasting with RadioDJ.
i explain: in the studio, we have our pc with RadioDJ playing music, outside we have a team with radiodj connected to the same database, a studio shoutcast server is used to relay the OB. Studio RadioDJ launch
We created events with links (OB RadioDJ) to control playlists (to relay OBstream) and next tracks (Studio RadioDJ).
Is there a more simple way to do OB with RadioDJ on the two side?
REST links opens a browser, is there a solution to launch them in the web browser plugin (in RadioDJ)?

Thanks a lot!
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Chris.Z on July 25, 2015, 05:05:45 PM
Hi,
i have a question.
We would like to launch REST links to do OutsideBroadcasting with RadioDJ.
i explain: in the studio, we have our pc with RadioDJ playing music, outside we have a team with radiodj connected to the same database, a studio shoutcast server is used to relay the OB. Studio RadioDJ launch
We created events with links (OB RadioDJ) to control playlists (to relay OBstream) and next tracks (Studio RadioDJ).
Is there a more simple way to do OB with RadioDJ on the two side?
REST links opens a browser, is there a solution to launch them in the web browser plugin (in RadioDJ)?

Thanks a lot!



Chris
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: minimalradio on July 25, 2015, 11:49:49 PM
in the RadioDJ monitor to display the time to be integrated. ;)
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: starm on August 13, 2015, 10:25:38 AM
Hello, Marius,
It is possible to get to the next event in radioDJ by using the REST plugin Server ?


Pending read you, thank you to you.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Echers on August 13, 2015, 01:41:48 PM
Works perfectly for when I have guests in the studio. I don't have to use Teamviewer to share my monitor nomore.
This is a fantastic tool! Thank you!
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: starm on August 13, 2015, 09:25:53 PM
Hello,

This plugin was designed to avoid the teamviewer ...

This is part of radioDJ improvements :P

Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: rogra on October 04, 2015, 08:58:10 PM
Can the plugin work with version 1.8.2? I get a error 'The endpoint is not found' in browser and with RadioDJ monitor doesn't work.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: starm on October 05, 2015, 09:49:04 AM
Hello, yes, the plugin works well with version 1.8.2 of radiodj, did you launch your radiodj much as "administrator"?

Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: rogra on October 05, 2015, 07:13:39 PM
Hello, yes, the plugin works well with version 1.8.2 of radiodj, did you launch your radiodj much as "administrator"?

Yes, radiodj was started with administrator rights. What are the requirements for using this plugin?
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: starm on October 06, 2015, 09:43:53 AM
Viewing the file Plugin_RestServer.xml

the password is he single or with lots of special character?
what is your port?


<?xml version="1.0" standalone="yes"?>
<NewDataSet>
  <Settings>
    <Key>IP</Key>
    <Value>http://127.0.0.1:7070</Value>
  </Settings>
  <Settings>
    <Key>Pass</Key>
    <Value>radiodj</Value>
  </Settings>
  <Settings>
    <Key>AutoStart</Key>
    <Value>True</Value>
  </Settings>
  <Settings>
    <Key>LogEnabled</Key>
    <Value>True</Value>
  </Settings>
</NewDataSet>
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: rogra on October 06, 2015, 10:13:23 PM
Viewing the file Plugin_RestServer.xml

the password is he single or with lots of special character?
what is your port?


<?xml version="1.0" standalone="yes"?>
<NewDataSet>
  <Settings>
    <Key>IP</Key>
    <Value>http://127.0.0.1:7070</Value>
  </Settings>
  <Settings>
    <Key>Pass</Key>
    <Value>radiodj</Value>
  </Settings>
  <Settings>
    <Key>AutoStart</Key>
    <Value>True</Value>
  </Settings>
  <Settings>
    <Key>LogEnabled</Key>
    <Value>True</Value>
  </Settings>
</NewDataSet>

The password is single, commands from the browser works for now, maybe he gives me a xml file. RadioDJ monitor says unknown command.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: starm on October 07, 2015, 10:05:08 AM
Hello,

the monitor should also be run in administrator and can be run on the same computer as the one the software RadioDJ ...

The monitor allows viewing only, and not control ...

Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: reinvanhaaren on October 07, 2015, 11:34:31 AM
Hello,

How can i use the LoadPlaylist-command? When i save a database playlist, and it has id 1, i run the command 'http://127.0.0.1:7000/opt?auth=password&command=LoadPlaylist&arg=1' and then... nothing happens.

Many thanks in advance,
Rein.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Jungoy on February 20, 2016, 05:49:13 AM
Is there any chance of updating Plugin Rest Server and add a LOAD ROTATION command?

Like this:  http://12:0.0.1:8080/opt?auth=password&command=LoadRotation&arg=  ??? ---argument would be the rotations ID.

Thank You.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on February 20, 2016, 08:20:16 AM
Sure!  :)
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Jungoy on February 20, 2016, 01:53:42 PM
WOW!!!

Thanks Marius...I am EXCITED for the next update  :ok:

It's the last feature that I wanted to add in my android RadioDJ control app that I am developing right now  :)

(https://www.dropbox.com/s/cg8tjtdn48o0pr1/screenie.png?dl=1)
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on February 20, 2016, 02:34:04 PM
Niceee!  ;)
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: cutmaster on March 09, 2016, 06:24:46 PM
Dear all,
I'm sure my eyes are closed to dark, because I can't see the download link for the REST server plugin for RadioDJ in the download page.
The only link I can see talking about "REST" is : "Radio DJ Monitor V1.1 (Works with REST Server Plugin Only)"
I'm very interested in this to create an IOS controller app for RadioDJ.
Can you please help me ?
Thanks a lot.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Jhonny on March 09, 2016, 07:43:44 PM
Look in the folder Disabled Plugins
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: starm on March 09, 2016, 08:03:36 PM
Hello,

I do a RadioDJ SERVER REST web interface for phpbb

[attachment deleted by admin]
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: cutmaster on March 09, 2016, 09:09:12 PM
Hi Jhonny,

On the disabled plugins folder (RDJ v1.8.2), there's only the following, but no REST_Server plugin :(
(https://www.dropbox.com/s/f42fgebpexs5c3f/Capture%20d%27%C3%A9cran%202016-03-09%2021.07.19.png?dl=1)
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Capt_Fuzzy on March 09, 2016, 10:18:14 PM
What version of RDJ are you using?
I have the current version, and it's in my Disabled Plugins folder...

EDIT:
Hi Jhonny,

On the disabled plugins folder (RDJ v1.8.2), there's only the following, but no REST_Server plugin :(
(https://www.dropbox.com/s/f42fgebpexs5c3f/Capture%20d%27%C3%A9cran%202016-03-09%2021.07.19.png?dl=1)
Sorry, missed the version number you listed.., regardless, it should have been in there...
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Jhonny on March 10, 2016, 06:02:15 AM
Rest server

[attachment deleted by admin]
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: JoshTheRadioDude on March 11, 2016, 11:18:43 AM
Would there be any way to integrate the controls of the Android app into the monitor application?  Those of us who don't have Android devices would be most appreciative!
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: DJ Garybaldy on March 11, 2016, 12:36:59 PM
Would there be any way to integrate the controls of the Android app into the monitor application?  Those of us who don't have Android devices would be most appreciative!

Any Android app that may have been advertised on these forums are written by a 2nd party so you would have to PM or email the developer of any app to ask if he would include a feature in his application.

It's not something Marius develops.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: JoshTheRadioDude on March 11, 2016, 12:42:57 PM
I understand, but that wasn't what I was asking  :)

What I'm looking for is a version of the monitor app that Marius wrote for the REST server that includes commands like those in the Android app.  Sort of a Windows-based remote control for RadioDJ.  It appeared that Austin had written a PHP-based version of the same concept, and that would work, too, but the link to it seems to have disappeared.  Besides, with the monitor app already in existence and using the same protocol, as it were, it would seem to make sense if those functions were just added on there for all to use.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: starm on March 11, 2016, 05:41:29 PM
Hello
I code an extension for phpbb

This is extension running phpbb 3.1
(Benefits or constraints)
and will be free.

[attachment deleted by admin]
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: JoshTheRadioDude on March 12, 2016, 08:52:21 AM
That's a nice proof of concept, but I wouldn't want to set up a whole PHPbb installation just for that purpose.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Valdis on March 12, 2016, 09:07:32 AM
That's a nice proof of concept, but I wouldn't want to set up a whole PHPbb installation just for that purpose.
I don't think @starm replied to your post. He simply reminded that he is working on PHPbb integration.


If by "Austin had written a PHP-based version of the same concept" you meant the REST Web Panel, here it is - REST-Web_Panel.zip (https://dl.dropboxusercontent.com/u/9294655/REST-Web_Panel.zip).
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: JoshTheRadioDude on March 12, 2016, 09:09:59 AM
Ah, thanks!
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Jungoy on March 12, 2016, 11:32:27 AM
@JoshTheRadioDude

I created a temporary four button remote control for you to test...(UI design is also temporary)

Buttons are:
1. PAUSE/PLAY
2. STOP
3. NEXT
4. MONITOR = this will execute the "RadioDJ Monitor.exe" created by Marius

How to use:
Unzip RDJControl.zip and copy RDJControl.exe to the RadioDJ Monitor.exe directory. My program will parse settings.xml automatically.

Please let me know if this works for you and I will add the remaining REST plug-in commands.

Tested only in Windows10.

[attachment deleted by admin]
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: JoshTheRadioDude on March 12, 2016, 11:38:28 AM
Hey, thanks, Jungoy!  I'll have to get back to you on it... for some reason my primary machine isn't able to connect to the REST server, and I'm trying to troubleshoot that at the moment.  But in a little while I'll copy it over to the RadioDJ machine to test it out locally.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Jungoy on March 12, 2016, 12:36:35 PM
Hey, thanks, Jungoy!  I'll have to get back to you on it... for some reason my primary machine isn't able to connect to the REST server, and I'm trying to troubleshoot that at the moment.  But in a little while I'll copy it over to the RadioDJ machine to test it out locally.

Make sure you set-up the settings correctly in settings.xml also located in RadioDJ Monitor directory....(host, port and pass)

 :ok:
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: JoshTheRadioDude on March 12, 2016, 12:41:42 PM
They are, it's just that I'm working with a crappy old 2WIRE modem/router that doesn't always like to cooperate and my RadioDJ machine is an XP box from the late 00's that doesn't always like to participate on the network.  I'm hoping rebooting both the computer and the router will fix it.  Y'know, short of having the $600 it would take to replace it all with new equipment  :D
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: DJ Garybaldy on March 12, 2016, 12:52:37 PM
Quote
Y'know, short of having the $600 it would take to replace it all with new equipment

You can get new or refurbished Windows computers much cheaper than that if you shop smart. The PC we use to run RadioDJ is a windows 10 box (was windows 7) and it only cost about £100 for a 2GB ram Intel processor.

We don't have any issues networking between the Windows box and my Linux box.

If you search you might find a "barebones deal even cheaper." ... Add hard drives and go type options.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: JoshTheRadioDude on March 12, 2016, 01:01:22 PM
The $600 I'm estimating includes a new modem and a new router, plus the new computer I've already picked out to replace the old one.  I know barebones boxes can be built out on the cheap, but I've already priced out the features that I want, and there's an ASUS mini-PC that has them all and is less expensive than building my own.  I'm pretty certain the networking issues have nothing to do with the OS involved, it's just that the machine and router are both old and don't always like to work together.  As far as money goes, even going the barebones route, I'd have to save up for a while.  I'm working on a very tight budget.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: DJAntares on March 18, 2016, 07:24:44 PM
After I'ive installed the db server on a Virtualbox VM I 've configurated all plugins that i want bute this presents a problem very irritating.  :(
Tested in two different machines with the same db, with windows 10 x64 if RDJ go lanch normally it start very great   8) but the rest plugin don't start...
If i launch the RDJ "as administrator", the REST plugin start normally but RDJ is down (don't play anything) and the files that's catalogated as startion id comes disactived and can't be reactived.
If i close RDJ as administrator and if i reset these flags to database and then I launch RDJ normally from an user of administartor group, it starts normally but no the plugin.
Windows suggest this http://go.micorsoft.com/fwlink/?Linkld=70353 for this inconvenient but enabling also the .net 3.5 and the 2.0 on my machine this problem isn't solved  :'(
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marcob88 on April 01, 2016, 04:21:14 PM
Hello

I wanted today to get the rest server working i thought it would be easy....serves me right .

Be as simple as i can.

I have just tried this on the local pc before worrying about network

I added Restserver from disabled plug ins to  the plug ins folder

I opened RDJ and went to the options and set a password, saved, closed RDJ, and rebooted RDJ

I went to the monitor utility opened up added the password and it comes up with  error...remote server returned an error( 400) bad request

I have done this opening RDJ normally as administrator and same with the monitor - if the ip is wrong it says it cannot connect to server , if i change the password it doesnt liek it and wants to close

I have just left default settings and changed password  in the rdj plug in options and matched it with monitor
monitor doesnt have http:// but i think that snormal
its not clear if you should be changing the ip to somehting specific, or it works with any ip or the default, the same with the port

i didnt think this would be sucha difficult task on a local machine

please help!
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marcob88 on April 01, 2016, 05:23:13 PM
REolved!

For anyone with the same problem, make sure you are not over thinking this

I got the error because nothing was playing!

Now thats working i would like the rest server to listen to commands from another problem...this will be fun...sleep first...
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: DJAntares on April 11, 2016, 10:46:31 AM
Problem Solved!!!
It's necessary start a cmd as administrator and lunch this command:

netsh http add urlacl url="http://+:7000" user=user

 ;D
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: cutmaster on May 29, 2016, 10:40:20 AM
Hi everybody,
Tried to create a WordPress Web plugin to control RadioDJ but I'm facing an issue I don't actually know how to handle.
When I call RDJ, through a web interface, by calling its URL, say for exemple http://1.2.3.4:1234/np?auth=ThePassword the result is good, the page shows an XML with the now playing info.
Now, if I call the same URL through an ajax jQuery GET call, I get the following error :
Code: [Select]
XMLHttpRequest cannot load http://1.2.3.4:1234/np?auth=ThePassword. http://1.2.3.4 is not allowed by Access-Control-Allow-OriginHow is it possible to fix this ?
Thanks for your help.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Marius on May 29, 2016, 12:17:58 PM
Quote from: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
For security reasons, browsers restrict cross-origin HTTP requests initiated from within scripts.  For example, XMLHttpRequest follows the same-origin policy. So, a web application using XMLHttpRequest could only make HTTP requests to its own domain.

I'm not a js expert, so sadly i cannot give you a solution, but from what i read, you can use JSONP for GET requests methods, or CORS which has more methods, but i never test it.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: cutmaster on May 29, 2016, 12:57:39 PM
Yes think this is the way... It seems to be a common problem with REST servers using jQuery calls (or ajax one)... The problem seems to be the asynchronous call and the solution seems to be found in frames calling... I'm investigating and let everybody know the results here...
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Valdis on May 31, 2016, 09:39:38 AM
Now, if I call the same URL through an ajax jQuery GET call, I get the following error :
Code: [Select]
XMLHttpRequest cannot load http://1.2.3.4:1234/np?auth=ThePassword. http://1.2.3.4 is not allowed by Access-Control-Allow-OriginHow is it possible to fix this ?

Same-origin policy of AJAX calls is there for a reason - security. In theory RadioDJ REST server could allow cross-site AJAX calls by sending Access-Control-Allow-Origin: * response header, but that would require modifications of REST server plugin.
Easiest workaround would be to make all AJAX calls to a PHP script which forwards HTTP requests to RadioDJ server. PHP doesn't care about HTTP access control. You should take care to not expose the password in JavaScript and don't allow to call any random URLs using the PHP script.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: cutmaster on June 03, 2016, 02:10:26 PM
Hi Marius,
Is there a way for you to make 2 or 3 modifications in the plugin REST like :
- Sending Allow-Control-Allow-Origin:*
- Add a command like command=wvf&id=[id of song] that will return say 512 values from 0 to 128 to represent briefly the waveform ?
- Add a command that lists the available playlist (meaning there's one to change it but no one to get them)
- Same for genres & subgenres ?
- Add a search command ?
- Maybe Add a command to get an xml returning only the artist name, title & id of a specified category ?
I'm trying to create an iOS app to control RadioDJ distantly and it would help to have a very sexy application around RadioDJ.
Thanks a lot :)
Have a nice day

[EDIT] also the ability to get the name of the instant players to add the ability to create a "touchable-launcher" should be great :)
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: cutmaster on June 11, 2016, 02:43:22 PM
Hi Guys (and Marius),
As explained in my post here : http://www.radiodj.ro/community/index.php?topic=8757.0 (http://www.radiodj.ro/community/index.php?topic=8757.0)
I'm creating an iOS App for controlling RDJ through the REST plugin.
It is actually working not bad, but it should be very great if REST can do a little bit more (for exemple getting the name & colors of the Instant players, or the actual state of RDJ regarding the mode AutoDJ, etc).
Marius, is there a way for you to add such functionalities... or for us to help you so ?
Thanks a lot to all.
Best :)

Laurent.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Feiko on June 15, 2016, 03:09:02 PM
Hi There,

Is it possible to start a rotation with the RestServer ??

Tnx
Feiko
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: cutmaster on August 11, 2016, 09:45:07 PM
As I actually know, it isn't possible unfortunately...
Really looking for more options on it too.
Marius, maybe can you provide us the source so we will be able to enhance it as a team ?
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Valdis on August 11, 2016, 11:16:06 PM
As I actually know, it isn't possible unfortunately...
Really looking for more options on it too.
Marius, maybe can you provide us the source so we will be able to enhance it as a team ?
I'm developing an improved RESTful server plugin. It responds with JSON, CORS (Access-Control-Allow-Origin and other headers) is already implemented and there is also basic authentication support. I'm currently working on command calls. This would be a good time to write down your wishlist.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: cutmaster on August 12, 2016, 07:16:03 PM
Hi Valdis,
This is really interesting. Well actually what can be a sort of help should be to add to the actual REST plugin commands (meaning don't remove the old one) :
- Get All Status in one command (and results to one xml) to limit the calls meaning :
    - Calling something like action=getAllStatus
    - Receiving XML having the information on actually playing or not, what is the current title (and time, remaining, etc same way like the actual REST plugin), AutoDJ is ON/OFF, Automated is ON/OFF, Input is ON/OFF, Instant Players informations (player id, song id, artist, title, duration)
    - Having the ability to request a search and get a result, even with limiting its contents per page (for example if the answer should return more than 100 tracks, add a <TotalResults>355</TotalResults> and a <StartedResultsFrom>0</StartedResultsFrom> so we can move on the page
    - Having the category list (id, name)
    - Having the ability to get the tracks contained in a category
    - Having the ability to get the rotation list and to change it
    - Having the ability to add a sweeper to a track
    - Being able to get the song history (limited by 100 maybe)

I think it should be sooooooo great :)

Thanks for that...
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Valdis on August 12, 2016, 10:52:21 PM
This is really interesting. Well actually what can be a sort of help should be to add to the actual REST plugin commands (meaning don't remove the old one) :
I've intended to retain commands from original REST plugin and add new ones.

- Get All Status in one command (and results to one xml) to limit the calls meaning :
    - Calling something like action=getAllStatus
    - Receiving XML having the information on actually playing or not, what is the current title (and time, remaining, etc same way like the actual REST plugin), AutoDJ is ON/OFF, Automated is ON/OFF, Input is ON/OFF, Instant Players informations (player id, song id, artist, title, duration)
Combined status is available in original plugin. It is returned from /state URI, but does not have main player playing/stopped status and no current track. I have that in my plugin and I found a way to detect if main player is playing or stopped. I'm not sure if is possible to get paused status.

I have already implemented access to cart players (aka instant players) under /carts/{id} endpoint in my plugin.
The endpoint returns following JSON:
Code: [Select]
[
  {
    "Artist": "Radio Station",
    "ButtonIndex": 1,
    "CartID": 15,
    "Color": -32704,
    "Duration": 5.28771,
    "Title": "Some jingle",
    "TrackID": 31
  },
  {
    "Artist": "Radio Station",
    "ButtonIndex": 2,
    "CartID": 16,
    "Color": -65281,
    "Duration": 2.40365,
    "Title": "Other Jingle",
    "TrackID": 35
  }
]
It should be enough to reflect same information as RadioDJ carts plugin.

It makes sense to combined interface status with current track data and instant players. I'll add it to my TODO list.

    - Having the ability to request a search and get a result, even with limiting its contents per page (for example if the answer should return more than 100 tracks, add a <TotalResults>355</TotalResults> and a <StartedResultsFrom>0</StartedResultsFrom> so we can move on the page
    - Having the category list (id, name)
    - Having the ability to get the tracks contained in a category
    - Having the ability to get the rotation list and to change it
    - Having the ability to add a sweeper to a track
    - Being able to get the song history (limited by 100 maybe)
Some of these are already implemented and I've added track search with pagination to my TODO list.

I have no plans to implement XML responses. To add optional XML responses, I would have to duplicate code all over the place, because I'm using WCF WebServiceHost with ServiceContract bindings. Using WCF is a pain and there are no alternatives for developing REST services on .NET 3.5.

I prefer JSON, because it is compact compared to XML and widely supported.

Do you prefer XML over JSON? If so, why?
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: cutmaster on August 13, 2016, 12:36:41 PM
Hey Valdis,
This seems to be perfect.
JSON could be good for me too as it is very easy to load/interpret both JSON & XML on iOS ;-)
I'm working on enhancing my current iphone apps so we can make tests...
Thanks a lot for your work...
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: cutmaster on August 13, 2016, 07:15:41 PM
Valdis, just remembered a question I've asked also to Marius to enhance its plugin : the ability to get 256 values of smallint (-127..+128) representing the waveform of the current playing file ;-)
If you can access this information it could be such a piece of cake ;-)
Thanks :p
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Valdis on August 13, 2016, 07:47:54 PM
Valdis, just remembered a question I've asked also to Marius to enhance its plugin : the ability to get 256 values of smallint (-127..+128) representing the waveform of the current playing file ;-)
If you can access this information it could be such a piece of cake ;-)
Thanks :p
You probably mean array of int values that represents waveform. There is no such information available in RadioDJ plugin interface but it might be possible to get something from Bass.Net library. Don't hold your breath, because I don't know if it is possible to get the waveform data.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: cutmaster on August 13, 2016, 09:40:21 PM
Yep exactly.
It seems that RDJ (can) stores a short result inside the audio file (surely encapsulated in an extended MP3 sub-chunk).
In other way, you're right, BASS can return a quick'n fast waveform representation.
i've already done this but it is in Objective-C (and a lot of years ago in Delphi :p ), not sure it can help you.
But it has several methods that should help on this :
- WaveForm object contains a lot of helping function ( http://www.bass.radio42.com/help/html/6a20df3a-a6fd-486b-74e7-3a0a65f7e545.htm (http://www.bass.radio42.com/help/html/6a20df3a-a6fd-486b-74e7-3a0a65f7e545.htm) )
- RenderStart to scan the audio file ( http://www.bass.radio42.com/help/html/2b9bbb5e-dcf2-96a7-60c8-f43e8b9fdc3f.htm (http://www.bass.radio42.com/help/html/2b9bbb5e-dcf2-96a7-60c8-f43e8b9fdc3f.htm) )
- CreateBitmap Method ( http://www.bass.radio42.com/help/html/d2c1d026-00bc-558a-c334-3ef1cb204c52.htm (http://www.bass.radio42.com/help/html/d2c1d026-00bc-558a-c334-3ef1cb204c52.htm) )

Hope it can help you ;-)
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Valdis on August 13, 2016, 11:36:30 PM
AFAIK, RadioDJ saves generated waveform in a separate file with .wfrm extension, if that option is enabled in cue editor.

Thanks for the links. It looks like WaveForm.Wave property might be what I need to generate an array of values. CreateBitmap method generates a bitmap and that's not useful for getting numeric values. At first I thought that WaveFormSaveToMemory could return right data but I can't make much sense of returned byte array. It must be a serialised WaveForm object, not just the WaveBuffer values.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: FoxFrenzy on November 12, 2016, 09:19:33 AM
The only thing agitating about this is that it's written in PHP.  The host provider for my website doesn't allow PHP..  I think it's time to move away from Yola and get into Wordpress.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: eczb on January 20, 2017, 08:31:21 PM
I think that there is an error in the xml called by http://ip:port/p?auth=[]

In the example here under cueOutro = 181.7607 is equal to &out=181.7607 but, following the same rule used for the calculation of cueIntro, it should be cueOutro = &out - &sta = 181.7607 - 0.2015 = 181,5593

bye bye

Code: [Select]
<CueTimes>
&sta=0.201473922902494&int=8.88297052154195&out=181.760702947846&xta=200.468344671202&end=201.48052154195&fin=0&fou=1.01217687074831
</CueTimes>
...
<cueEnd>201.48052154195</cueEnd>
<cueHookIN>0</cueHookIN>
<cueHookOut>0</cueHookOut>
<cueIntro>8.6814965986394554</cueIntro>
<cueLoopIn>0</cueLoopIn>
<cueLoopOut>0</cueLoopOut>
<cueNext>200.468344671202</cueNext>
<cueOutro>181.760702947846</cueOutro>
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: neverever on May 17, 2017, 01:32:16 PM
Also, you must enter a password for command validation, like in plugin TCP server.

Hm, I don't get it... where can I change default "changeme" password?
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Jhonny on May 17, 2017, 02:09:51 PM
double click on the rest server line in the plugin screen.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: neverever on May 17, 2017, 02:58:11 PM
double click on the rest server line in the plugin screen.

Ouch, I feel ashamed :bash: Thanks! Don't ask me how I missed that :D
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Jhonny on May 17, 2017, 05:23:43 PM
How did you miss that?  :huh:

Too busy with dark things, I know from experience!  :hihi:
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: Qboy61 on November 04, 2017, 04:40:09 AM
Noob question?  I have been able to get the following REST server command to work when issued from a browser.

http://127.0.0.1:7000/opt?auth=changeme&command=ClearPlaylist

It clears the playlist and since auto dj is active it refills as expected.  I think the plugin appears to be configured correctly.  But...  I was trying to get the StatusQueue command to work but I never get a list back.  Are there arguments required here?  Maybe an example would be helpful.  Also tried the RadioDJ Monitor but that does not respond at all, and then it times out.  I am missing something here.   :-[
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: RFU on April 19, 2018, 01:36:23 PM
Where can the last / latest version for 1.8.2 be downloaded from?
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: flix on February 18, 2019, 03:09:10 PM
Hi! First time poster here. I recently sent a module request to Bitfocus's Companion to implement RadioDJ as a module in the software. I did some preliminary testing on the module, but there are a few hiccups.https://github.com/bitfocus/companion/issues/483#issuecomment-464533092 (https://github.com/bitfocus/companion/issues/483#issuecomment-464533092)
They are having some trouble in implementing the REST Server plugin. Is there a possibility to Bitfocus's team to gain some insight on what is and what isn't working at the moment. Perhaps getting some insight into the API, so it can properly implemented into Bitfocus's Companion.
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: DJAntares on January 28, 2020, 07:49:09 PM
Hi guys,
the Rest Server plugin is very powerful specially in web application, but i can't to sent any command if the url is in https protocol.
I try out to search how can set the WCF in https but various howto are for IIS server.
Someone can solve already this problem?  It's possible to set the Rest Server with Apache or Nginx for example?
Thanks to all  :)
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: pedrazadixon on October 07, 2020, 08:24:47 PM
hi,
where i can download lasted version of this plugin?
is compatible with 2.x versions?
Title: Re: Plugin REST Server for RDJ 1.7.5+
Post by: pedrazadixon on October 07, 2020, 11:40:58 PM
hi,
where i can download lasted version of this plugin?
is compatible with 2.x versions?

This work for me: Place the Rest Server plugin from the Disabled Plugins folder in your Plugins folder.