Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: foo_controlserver (Read 155070 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

foo_controlserver

Reply #50
Great work, bluestat. This enables me to control fb2k from my Crestron System.
What i am still missing is a command to close fb2k. Do you think it is possible to have it in a future update?
Also i would need a command like <list [playlist#] [<track#> <track#>]|> also for <listinfo >, like
<listinfo [<playlist#> <playlist#>]|>. I cannot create dynamically resizable arrays within the Crestron programming, that's why i need to receive a fixed number of list entries.
Looking forward to your answer.
Kind regards,
Wolfgang

foo_controlserver

Reply #51
Might there be any "security vulnerabilities" associated with this? Such as say, someone being able to issue windows commands? Or is the access so limited that this won't be an issue? Just wondering...

foo_controlserver

Reply #52
Might there be any "security vulnerabilities" associated with this? Such as say, someone being able to issue windows commands? Or is the access so limited that this won't be an issue? Just wondering...


The Crestron system can only do 'what the programmer intended' it to do. The user of such a system has no access to the program. Strangers do not have access to the system. So there is no security problem. I am working for several years now as a Crestron programmer, and have never heard about such problems. Hope this will be true also for the future.

Regards,
Wolfgang

foo_controlserver

Reply #53
Hey bluestat, great job! Been reading your earlier posts before you even started this thread.

I like the idea of being able to send commands to my foobar2000 on my "jukebox" pc. However, is it possible to set up foo_controlserver to allow it to add new files/cd tracks to a new playlist? Currently, each time I insert an AudioCD into my jukebox CD drive, I have to run VNC and control foobar2000 to open a new playlist, and then select "add audio CD" or "Add New Files..." to the newly created playlist.

Hope to hear from you soon. Thanks.

foo_controlserver

Reply #54
Hi bluestat,
i have tested your latest modofications.What can i say, they work like a charm!
However, the 'list' and 'listinfo' commands behave differently in how they send the feedback to the client. I have some suggestions to make them more consistent and to improve usability for the client application.

1) 'listinfo' by itself returning the 402|... is absolutely ok.

2) 'listinfo all' should return the info the following way:

400|... as is
401|... single playlist info
401|...
401|...
... as many as there are playlists
402|... for the currently playing playlist

3) 'listinfo <range>' should return the info with different headers, maybe like the following:
410|... instead of 400|...
411|... single playlist info
411|...
411|...
... as many as requested by the 'range' argument
412|... for the currently playing playlist, maybe only it is in the range

That way, the client can easily distinguish between 'all' and 'range' feedback.

The same should be applied to the 'list' command:

1) 'list' returns '600|...', then as many '601|...''s as there are tracks in the playlist. That's fine. But i would like to have appended a new '602|...' feedback for the currently playing track, same as you get with the '111, 112,113' headers.

2) 'list <range>' should return the info corresponding to the 'listinfo <range>' command:

610|...
611|...
611|...
... as many as requested by the 'range' argument
612|... for the currently playing track, maybe only it is in the range

Again, that way, the client can easily distinguish between 'all' and 'range' feedback.

And at last, the controlserver should return the current playing time every second on it's own, so no need to poll from the client. A simply format is ok, like 'XXX|00:00:00'. Maybe combined with the total time of the track, like 'XXX|00:00:00|00:00:00'

Point is that many clients like pocket pcs or control systems have limited computing power and memory. So it's best to let the pc do the demanding job and also to minimize polling from the client.

Quite a long post, but let me know what you think about it. Hope to hear from you.

Kind regards,
Wolfgang

foo_controlserver

Reply #55
Hey Wolfgang, I will take a look at your suggestions this week. I agree that would make things a bit easier to identify.

foo_controlserver

Reply #56
This script connects to the foo_controlserver telnet server and gets the data.
It's only proof-of-concept, but it puts the data in arrays so it should be more easy to parse.
Thanks to the format of the output ("|" separating fields) it is easy parseable.

The only trouble I have is the persistent connection natures of the server. Once you connect you don't know when to terminate. Currently I solved this by stopping reading data after I get the first 111 block (trackinfo).
You will be most likely using this script on a website and then you don't want to stay connected anyway.
You can optionally send commands using fwrite() to get more data.

Code: [Select]
<?php
/*
FooBar2000 Now playing script.
Requires foo_controlserver
*/

$host="some server";
$port=666;

$fs = fsockopen($host, $port, $errno, $errstr, 10);

$debug = '';
while (!feof($fs)) {
    // Read up until we hit a \n
    fscanf($fs, '%[ -~]\n', $line);
    $data = preg_split('/\|/', $line);
    $debug .= print_r($data, true);
        if ( preg_match('/^111|112|113$/', $data[0]) ) break;
}

fclose($fs);

echo $debug;

?>


The code above contains flaws obviously. But I have created a complete script which will list current song together with control buttons and it requires authentication in order to be used.
Just take a look

foo_controlserver

Reply #57
I'm just wondering why 'trackinfo' doesn't return the track length? Apart from the title, isn't that THE most important metadata?

foo_controlserver

Reply #58
It does list tracklength. Are you blind or something?

Se here:

111|0|151|27.20|MP3|320|298.99||Jefferson Starship|||Other|00|We Built This City
|file://D:\Min musikk\80's - Jefferson Starship - We Built This City.mp3|

It is the 7th item from the left (items delimited by | ).
The length is repored in seconds so to get the hours, minutes and seconds from this you will do
minutes = seconds / 60
hours = seconds / (60 * 60)
seconds = seconds % 60

% = modulus operator, the remainder after division

You can also configure what to output in preferences for foo_controlserver.

foo_controlserver

Reply #59
Hi there!

First of all, thanks a lot for writing this. It works liek a charm and I really had fun developing an client with the abundant telnet interface. Great work!

Secondly, I miss a function. How about adding an entry to a playlist at a given positon? Like
list add <playlistnr> <position> <entry>
That beeing said, a
list del <playlistnr> <position>
would also be handy.

This wold allow me to implement my favorite feature(s)  "enqueue as next" and "remove earlier titles" that I already coded for (uhh) WinAmp.

Cheers!

Axel

foo_controlserver

Reply #60
Secondly, I miss a function. How about adding an entry to a playlist at a given positon?


I have seen a of couple requests for this. I will investigate adding some sort of functionality like this.

Cheers!

foo_controlserver

Reply #61
any made applications for remote controlling fb2k from a remote pc whithout using telnet commands?

looking for a made application....

foo_controlserver

Reply #62
any made applications for remote controlling fb2k from a remote pc whithout using telnet commands?

looking for a made application....


I made a little Client for my Laptop using AutoIT. It's not pretty, it's not well done but it gets the job done

If anyone is interested, download it here: http://rapidshare.com/files/3072482/FooControl.rar.html
Should be self-describing, just follow the first Steps carefully.



By the way, thanks for this great plugin!

foo_controlserver

Reply #63
How can I reach my foobar from another network? (not local)

foo_controlserver

Reply #64
Nice job ict. Not a program id use all the time though, main reason I use controlserver is to control it via PSP when I cant get outa bed.

To access controlserver from across a network, by using a telnet client enter your computers ip address and port
Make sure router and firewall are configured properly. If you do intend on logging on remotely I recommend a DDNS service

foo_controlserver

Reply #65
How can I reach my foobar from another network? (not local)

Long since this was posted. Well I'll give a reply anyways...

I wondered about this a long time ago. If it's over unsecure network (like internet) then you want security.
The answer is ofcourse through SSH tunnel. I made a kind of half-baked tutorial back then. You can ofcourse use different tools to achieve this.

EDIT:
Additional info:

A nice tutorial on how to install a regular Cygwin SSH server on Windows can be found here.
This will ofcourse be a lot bigger install than the SSHWindows, but also more versatile and updated.
As mentioned in the tutorial you should install the obligatory base system (the default install when installing Cygwin), plus packages "openssh", "openssl" and "tcp_wrappers" from category "Net", and package "zlib" (hm, it's in category "Base" and all packages in that category should be installed anyways). In addition to those mentioned one should atleast install package "shutdown", infact all (currently only 4) packages in category "Admin", and then atleast "vim" and/or "nano" from category "Editors", I would also recommend install of packages "emacs" and "mc" from same category. Else things are covered in the tutorial mentioned.
"ONLY THOSE WHO ATTEMPT THE IMPOSSIBLE WILL ACHIEVE THE ABSURD"
        - Oceania Association of Autonomous Astronauts

foo_controlserver

Reply #66
Having another companion plug-in, something like "foo_controlclient", to forward all actions done in one foobar instance on a PC to another PC running foobar with foo_controlserver would be great. This way, the two foobar instances could playback the same songs synchronized.

foo_controlserver

Reply #67
Hello, great plugin bluestat

mirx asked this a few posts up but I didn't see an answer anywhere: Is it possible to add a command to add files?
ie. open C:\music\playlist.m3u would be excellent 

foo_controlserver

Reply #68
Hello, great plugin bluestat

mirx asked this a few posts up but I didn't see an answer anywhere: Is it possible to add a command to add files?
ie. open C:\music\playlist.m3u would be excellent 


Hi! I think that is a neat idea, and I will take a look! As another suggested I would also like to output when a client changes the queue (not sure if there is an event for when someone from the gui changes the playback queue tho). Moving, but I will try to find some time for this.

foo_controlserver

Reply #69
Hi everybody:  I just want to say that this componente definitely allows me to delete winamp from my old media server, as i can have remote  control from my Palm T5 and foobar! Thank you very much for this!!!                now, the question:

I have a playlist tree query that manages a "shuffle" playlist.  It allow foobar to pick a random song, check if it was not played in a time, and check if the artist is not in the playlist, to avoid repeated artist be played.  This playlists keeps a max number of songs (said 150) and when it reach the end of the playlist (play now item is 150)  It adds a new track, and removes the first item, allowing the artist be played again.

The problem is that Controlserver is sending me data of the next track.  This is expected, as when the track start to play it was 150, but a few seconds after, it becomes, the 149, the server "thinks" the now playing is still the 150 (but actually is the new added track to the list, and playing now is 149)

I know this is not a bug or a problem...  just want to know if someone have an idea how can I turn around this problem, as i love my shuffle query (that allow me to hear an infinite cycle of songs, but not get tired to get the same artist to often) and I want ti keep using it.  This can be recreate by manually removing an item and send trackinfo... You'll see that the actual playing position (in seconds) correspond to the playing now, but all other data, are from the next track...

I hope that somebody can help me with this.

Thanks in advance!

foo_controlserver

Reply #70
I am about to go on vacation for two weeks, but I will think about this for you and take a look when I am back!

Cheers!

Hi everybody:  I just want to say that this componente definitely allows me to delete winamp from my old media server, as i can have remote  control from my Palm T5 and foobar! Thank you very much for this!!!                now, the question:

I have a playlist tree query that manages a "shuffle" playlist.  It allow foobar to pick a random song, check if it was not played in a time, and check if the artist is not in the playlist, to avoid repeated artist be played.  This playlists keeps a max number of songs (said 150) and when it reach the end of the playlist (play now item is 150)  It adds a new track, and removes the first item, allowing the artist be played again.

The problem is that Controlserver is sending me data of the next track.  This is expected, as when the track start to play it was 150, but a few seconds after, it becomes, the 149, the server "thinks" the now playing is still the 150 (but actually is the new added track to the list, and playing now is 149)

I know this is not a bug or a problem...  just want to know if someone have an idea how can I turn around this problem, as i love my shuffle query (that allow me to hear an infinite cycle of songs, but not get tired to get the same artist to often) and I want ti keep using it.  This can be recreate by manually removing an item and send trackinfo... You'll see that the actual playing position (in seconds) correspond to the playing now, but all other data, are from the next track...

I hope that somebody can help me with this.

Thanks in advance!

foo_controlserver

Reply #71
I am about to go on vacation for two weeks, but I will think about this for you and take a look when I am back!

Cheers!


Hi! still on vacation?  just checking....

Regards everybody!

Edit: typo....

foo_controlserver

Reply #72
This is a great plugin! I'm currently developing a client with "brumal treeline" looks, I'll post here when it's finished.

foo_controlserver

Reply #73
bluestat, if you reading this, here my wishlist: 
Get notified at order change (shuffle, repeat, etc)
Get/set "Stop after current" setting
Get/set equalizer settings
Modify playlist (not top priority, but still...)
Get console output (really low priority)

*edit*
Also, it would be really helpful to be notified when the playback queue changes (for example when the next track in the queue is actually played).

foo_controlserver

Reply #74
LONG TIME NO SEE?

After a long while, I decided to pick up on some PHP programming again. Since programming is just a hobby I want to keep it fun, so I had to take a break from it when it became cumbersome.
Then I rediscovered my old PHP powered Web frontend to foo_controlserver and decided to add some AJAX to it for great lulz.  So here is the updated version live and running on my own webserver:

http://beta.saivert.com/foobar2000%20webui/

Updated: Had to reorganize my webserver so all my various small projects are located at beta.saivert.com now.

Source code is as always just a hyperlink away (on the page that is).