HydrogenAudio

Hosted Forums => foobar2000 => 3rd Party Plugins - (fb2k) => Topic started by: bluestat on 2005-10-21 18:15:58

Title: foo_controlserver
Post by: bluestat on 2005-10-21 18:15:58
This is a simple plugin I wrote that controls foobar2000 over a TCP/IP connection.
The source code is included.

Please PM me any problems or irregularities.

changes in 1.0.1
- nothing major has changed; just recompiled with the latest SDK

1.0.1 (for foobar 0.9) - December 4, 2006
Title: foo_controlserver
Post by: popplynogood on 2005-10-30 01:43:11
I have a simple remote client, that works off the old Telnet control server. I have been modifying it to use this newer (hopefully supported) TCP/IP version.

It works identically, which is nice, but I've noticed a small bug.

When you get the trackinfo on connect its correct, when you issue a play command the response is correct and when you issue a 'next' its also correct.

But if the player simply ends a song and starts the next, the trackinfo that is broadcast is for the OLD song that just finished, rather than the one that just started. So if you are simply monitoring what the player is doing, its always one song behind.

Can you check this please.

Also I have a crude way to enqueue a song so it starts when the current song ends. Is there a way in the SDk to implement a queue command that overrides the current playlist, but doesn't start until the current song ends? I like to have all my songs in a large single playlist that shuffles, but I want to be able to play a song as the next item on occasion.

Thanks, in advance,

Richard
Title: foo_controlserver
Post by: synth7 on 2005-10-30 01:48:21
I installed this...now what do I do?
Title: foo_controlserver
Post by: foosion on 2005-10-30 10:10:58
Quote
Is there a way in the SDk to implement a queue command that overrides the current playlist, but doesn't start until the current song ends?[a href="index.php?act=findpost&pid=338163"][{POST_SNAPBACK}][/a]

In 0.9 there is, but not in 0.8.3 and older.
Title: foo_controlserver
Post by: Mr_Rabid_Teddybear on 2005-10-30 13:43:28
Quote
I have a simple remote client, that works off the old Telnet control server. I have been modifying it to use this newer (hopefully supported) TCP/IP version.

It works identically, which is nice, but I've noticed a small bug.

When you get the trackinfo on connect its correct, when you issue a play command the response is correct and when you issue a 'next' its also correct.

But if the player simply ends a song and starts the next, the trackinfo that is broadcast is for the OLD song that just finished, rather than the one that just started. So if you are simply monitoring what the player is doing, its always one song behind.

Can you check this please.
[{POST_SNAPBACK}][/a] (http://index.php?act=findpost&pid=338163")

popplynogood's all night flight?  (Terry Riley's piece are still a good one...)

Yes. I observed [a href="http://www.hydrogenaudio.org/forums/index.php?showtopic=22248&view=findpost&p=219308]the same[/url].

Quote
Also I have a crude way to enqueue a song so it starts when the current song ends. Is there a way in the SDk to implement a queue command that overrides the current playlist, but doesn't start until the current song ends? I like to have all my songs in a large single playlist that shuffles, but I want to be able to play a song as the next item on occasion.
[{POST_SNAPBACK}][/a] (http://index.php?act=findpost&pid=338163")

In pre 0.9 the only thing there is for enque are (slightly buggy) 3d party plugin [a href="http://www.hydrogenaudio.org/forums/index.php?showtopic=12124&view=findpost&p=123693]foo_temple[/url] (newest version here (http://www.hydrogenaudio.org/forums/index.php?showtopic=12124&view=findpost&p=301445)).

Quote
I installed this...now what do I do?
[{POST_SNAPBACK}][/a] (http://index.php?act=findpost&pid=338165")

Try telneting to port 3333 (or whatever port you set up). More info is revealed by the use of [a href="http://www.hydrogenaudio.org/forums/index.php?act=Search&CODE=show&searchid=50cfc605d48117cc6fc63302703619eb&search_in=posts&result_type=topics&highlite=foo_controlserver]search on "foo_controlserver"[/url].
Title: foo_controlserver
Post by: bluestat on 2005-10-31 19:35:51
Quote
But if the player simply ends a song and starts the next, the trackinfo that is broadcast is for the OLD song that just finished, rather than the one that just started. So if you are simply monitoring what the player is doing, its always one song behind.

I cannot seem to replicate this with my current setup right now; but I will try to take a look at it.

Quote
Yes. I observed the same (http://www.hydrogenaudio.org/forums/index.php?showtopic=22248&view=findpost&p=219308).

I may not post a lot but I visit the board every day. Not sure how I missed your thread tho. Your email was probably lost in my spam filter. PM's are good tho;) Do you still experience the problem with commands having to be issued multiple times? I cannot seem to duplicate that with my current setup.
Title: foo_controlserver
Post by: popplynogood on 2005-11-01 18:27:51
Quote
I cannot seem to replicate this with my current setup right now; but I will try to take a look at it.


bluestat,

I have been using the previous control server for months with my client and it has always worked fine. Its the latest version you posted a week or so ago, that is causing the incorrect song to be detailed and its ONLY when the player changes of its own accord - any time I command it to play a track or go to the next track, its the correct song that gets reported.

I wonder if its a timing issue - it looks like the code for handling a trackinfo request from the user is pretty much identical to the handletrackupdate, which is initiated by the player message. Is it possible that you get the trackupdate message and execute the get_now_playing() request so quickly that the player hasn't updated that info yet. If I issue a 'trackinfo' request a second after I see the incorrect track update, I get the correct info - so the code seems to work OK, except in that circumstance. My other machine is slower, so maybe its that, or maybe the previous version did more before it got around to executing that now_playing request? Just my thoughts...


Hope this helps,
Richard
Title: foo_controlserver
Post by: bluestat on 2005-11-01 21:35:43
Quote
I wonder if its a timing issue - it looks like the code for handling a trackinfo request from the user is pretty much identical to the handletrackupdate, which is initiated by the player message. Is it possible that you get the trackupdate message and execute the get_now_playing() request so quickly that the player hasn't updated that info yet. If I issue a 'trackinfo' request a second after I see the incorrect track update, I get the correct info - so the code seems to work OK, except in that circumstance. My other machine is slower, so maybe its that, or maybe the previous version did more before it got around to executing that now_playing request? Just my thoughts...
[a href="index.php?act=findpost&pid=338794"][{POST_SNAPBACK}][/a]


Thanks for the detailed symptoms, that should give me a good run at it!
Title: foo_controlserver
Post by: Mr_Rabid_Teddybear on 2005-11-02 16:04:10
Quote
I may not post a lot but I visit the board every day. Not sure how I missed your thread tho. Your email was probably lost in my spam filter. PM's are good tho;) Do you still experience the problem with commands having to be issued multiple times? I cannot seem to duplicate that with my current setup.
[a href="index.php?act=findpost&pid=338583"][{POST_SNAPBACK}][/a]

Right now I'm not using it that much, but I probably will again later. However, I've been using Putty for interfacing with foo_controlserver, and it seems (as mention otherplace in that thread) that unchecking "Return key sends telnet New Line instead of ^M" in Puttys settings under "Telnet" reduces this problem to a minimum.....
Title: foo_controlserver
Post by: TZOTZIOY on 2005-11-10 23:20:50
Quote
But if the player simply ends a song and starts the next, the trackinfo that is broadcast is for the OLD song that just finished, rather than the one that just started. So if you are simply monitoring what the player is doing, its always one song behind.


This is verified on my machine too, but there is a way to circumvent this (while the bug exists).

Any reply that comes from a command you issue, starts with the code '112', while notifications on track change start with '111', so whenever you get a '111' just issue a 'trackinfo' command for the correct info.  This is what I did in my own song attribute manager (think matching songs a la www.last.fm tags or www.pandora.com).  Another bug is that not all track changes are reported...

foo_controlserver was what I really needed to finally drop winamp (its winampcom was the last reason to still use it with my app).
Title: foo_controlserver
Post by: bluestat on 2006-03-21 21:22:43
I have almost finished updating this with the new 0.9 SDK; however I would like someone to help test it before I post it. If anyone would like to please send me a PM. I believe I may have fixed some of the previous irregularities reported.

Thanks!
Title: foo_controlserver
Post by: Hamallainen on 2006-03-25 00:48:26
Quote
I have almost finished updating this with the new 0.9 SDK; however I would like someone to help test it before I post it. If anyone would like to please send me a PM. I believe I may have fixed some of the previous irregularities reported.
[a href="index.php?act=findpost&pid=373559"][{POST_SNAPBACK}][/a]


Thanks a lot for porting this component for 0.9 

I ve just quickly tried the new version and of course i have some questions/bug reports/features requets    sorry

question:
Did you definitively removed the commands "order" & "order type" or will they be back in a next version ?


bug:
I have a problem with the trackinfo command, it keeps displaying the first track played

ie: i start playing song#1
        -> in the console it displays "song#1"
then i type the command "next"
        -> song#2 plays
        -> in the console if i type "trackinfo" it displays "song#1"
and so on , i can type "next" or "prev" 10 times, it will still displays "song#1"

now if i go back to foobar and double click on song#4, the "trackinfo" command will always display "song#4"

i dont know if i m clear 

feature request:
Is it possible to add the command "playlist" which would display all playlists names (with a number) and the command "playlist #" to switch to the playlist number # (found with the command requested just before)

EDIT: Damn me, i m sorry , i had not read the first post of this topic which answers most of the question i asked
Title: foo_controlserver
Post by: bluestat on 2006-03-25 01:08:25
Quote
Did you definitively removed the commands "order" & "order type" or will they be back in a next version ?

These should be back once I figure out how to do it in the new SDK.

Quote
I have a problem with the trackinfo command, it keeps displaying the first track played

Could you please PM me a detailed scenario of this, it could probably happen;) ie. right from starting foobar, to how you started playing the song etc. I was unable to reproduce as I tested quickly, thanks!

Quote
Is it possible to add the command "playlist" which would display all playlists names (with a number) and the command "playlist #" to switch to the playlist number # (found with the command requested just before)

I plan to do that in the future yep!
Title: foo_controlserver
Post by: bluestat on 2006-03-25 04:35:44
Found the problem with trackinfo command mentioned above.  Please enable "cursor follows playback" until I can sort out a fix. Thanks Hamallainen!
Title: foo_controlserver
Post by: bluestat on 2006-03-25 16:38:33
Quote
Found the problem with trackinfo command mentioned above.  Please enable "cursor follows playback" until I can sort out a fix. Thanks Hamallainen!
[a href="index.php?act=findpost&pid=375010"][{POST_SNAPBACK}][/a]

Fixed this; however now if the same track is repeated in a playlist foo_controlserver will display the playlist index of the first one it encounters (when it could be a latter index it is playing) Oh la la! Maybe we should just get rid of it displaying the playlist index for the track! If anyone has any ideas I am all ears;)
Title: foo_controlserver
Post by: Shade[ST] on 2006-03-26 22:17:49
How about parsing the playlist and creating an internal number for yourself, and treating the external (playlist number) as the same type of data as the rest?

On a side note, is it possible to change playlists with this?
Title: foo_controlserver
Post by: bluestat on 2006-03-28 00:59:08
Quote
How about parsing the playlist and creating an internal number for yourself, and treating the external (playlist number) as the same type of data as the rest?

On a side note, is it possible to change playlists with this?
[a href="index.php?act=findpost&pid=375534"][{POST_SNAPBACK}][/a]


Uploaded a new version today that supports playlists. Probably some issues with it;) Please PM me if you find them!
Title: foo_controlserver
Post by: anissina on 2006-03-30 08:36:42
I've been using foo_controlserver together with icecast and oddcast, and I absolutely love it (^^)

However, it would be quite nice if someone took the time to implement a few more features into the controlserver, especially to be able to edit metatags.

e.g. edittag <field> <content> [<playlist_number> <item_number>]

if <playlist_number> is left out it uses the current playlist
if <item_number> is left out it uses the track currently playing

not to mention seeking

e.g. seek <direction> <seconds>
    f = forward
    b = back

...just a thought (^^)
Title: foo_controlserver
Post by: bluestat on 2006-03-30 16:25:41
Quote
not to mention seeking

e.g. seek <direction> <seconds>
    f = forward
    b = back

...just a thought (^^)
[a href="index.php?act=findpost&pid=376990"][{POST_SNAPBACK}][/a]


Just uploaded a new version that has seeking support, thanks.
Title: foo_controlserver
Post by: Shade[ST] on 2006-03-31 01:53:58
Another thing to add : Searching for strings (currently, searching a text with spaces doesn't work...)

Maybe detect if you have quotation marks (" ") and parse that as a string?

I'm not sure, also, but I don't know what codepage your plugin uses, for treating text... : If I want to have accented characters ("é", "à", etc...), I can't currently search for them with the default telnet client.


Also, I wanted to make a gui for your plugin, (In Java, so that it's easily portable), and was wondering how I can connect, etc.

Can anyone with java / telnet experience PM me, or offer me a guide to how to do this?

Thanks.
Title: foo_controlserver
Post by: TZOTZIOY on 2006-04-04 14:05:12
Quote
I'm not sure, also, but I don't know what codepage your plugin uses, for treating text... : If I want to have accented characters ("é", "à", etc...), I can't currently search for them with the default telnet client.

[a href="index.php?act=findpost&pid=377296"][{POST_SNAPBACK}][/a]

I believe the encoding used is UTF-8, so basically all the unicode range is supported (not only iso8859-1 characters, but even chinese, japanese etc)
Title: foo_controlserver
Post by: bluestat on 2006-04-04 15:18:32
Quote
Another thing to add : Searching for strings (currently, searching a text with spaces doesn't work...)

Maybe detect if you have quotation marks (" ") and parse that as a string?

I'm not sure, also, but I don't know what codepage your plugin uses, for treating text... : If I want to have accented characters ("é", "à", etc...), I can't currently search for them with the default telnet client.

[a href="index.php?act=findpost&pid=377296"][{POST_SNAPBACK}][/a]


Sorry; bit slow response. Searching is limited to 'one word' right now but I could look at doing more. For output you can toggle between/utf8 and lower ascii however for input everything is stripped to lower ascii so searching for accented characters is not working at the moment. I plan on fixing this. They are replaced by ? now on input.
Title: foo_controlserver
Post by: Cradle22 on 2006-04-06 12:10:03
Hi!

I've just experimented with the source of latest version, mostly trying to implement a proper playlist-index-handling.

The author of this component is right, so far I have not been able to get the list_index for the currently playing item. I tried getting the playlist-titleformat for the currently playing item, but playback_format_title also does not see the correct number, as the list_index is being rendered as "?"...

Since the list_index value is being displayed correctly inside the playlist, I can only assume that somehow all index / selection / focus values do not work outside the playlistwindow.

Maybe I will also post a new topic concerning this issue, since for my purposes (using foo_controlserver or anything else) Foobar2000 0.9 is not usable if my program is not able to get the correct list_index (if the playlist has more than one entry of a song).

Bye,

Arndt
Title: foo_controlserver
Post by: Byan on 2006-04-07 19:36:36
it would be nice if you could change playlists ect.

basically-

ListPlaylist
would return the list of playlists, with numbers infront of them

Playlist N
would change the playlist to whichever one is number N; if called without a argument, it would return the current playlist

I don't really have a use for this atm, but when I do I guess I could just add this myself, shouldn't be too hard...
Title: foo_controlserver
Post by: phyber on 2006-04-12 03:28:17
I'm trying to write a perl script to control foobar2000/show info on playing MP3, etc from another computer.
The showing the info part is proving quite difficult since at the moment you just drop fields out of the returned line if the specific info doesn't exist in the file that's playing.

For example, you might get
Code: [Select]
111|1|14547|0.00|MP3|192|303.57|Q-Strange|Creation to ExeQtion|0|Other|15|Eternal Bliss|

from the server.
Then you listen to the next track and get:
Code: [Select]
111|1|16134|0.00|MP3|192|415.92|Squarepusher|Ultravisitor|2004|Dance|Iambic 9 Poetry|

Notice that the field where the track number should be has been completly dropped instead of just being left blank.
This makes it really difficult to write a script based on this plugins output.

If you could, it would be nice if you left in blank fields, for example, that last track should appear as:
Code: [Select]
111|1|16134|0.00|MP3|192|415.92|Squarepusher|Ultravisitor|2004|Dance||Iambic 9 Poetry|

This makes it parsable.

Thanks.
(If an option to leave these blank fields in already exists, please point it out to me, it's 3AM and i couldn't find it when I was looking).
Title: foo_controlserver
Post by: bluestat on 2006-04-12 04:23:58
(If an option to leave these blank fields in already exists, please point it out to me, it's 3AM and i couldn't find it when I was looking).


Thanks, I will add an option for that and post it tomorrow for you. Please let me know of any other inconsitencies you may find.
Title: foo_controlserver
Post by: bluestat on 2006-04-13 01:27:55

(If an option to leave these blank fields in already exists, please point it out to me, it's 3AM and i couldn't find it when I was looking).


Thanks, I will add an option for that and post it tomorrow for you. Please let me know of any other inconsitencies you may find.


Posted a new version (beta6) with this option.
Title: foo_controlserver
Post by: Shade[ST] on 2006-04-13 02:16:00
I'm getting garbled unicode characters : Th+¬+ótre is supposed to be "Théâtre";  A solution to this would be to make the codepage selectable.

Also, searching for strings still doesn't work.  Would it be possible to check if quotation marks are included in the search string and automatically parse the rest as a string if there are? right now, I get a
"999|Invalid index one conversion|" error.
Title: foo_controlserver
Post by: bluestat on 2006-04-13 02:43:47
Quote
' date='Apr 12 2006, 09:16 PM' post='381843']
I'm getting garbled unicode characters : Th+¬+ótre is supposed to be "Théâtre";  A solution to this would be to make the codepage selectable.

Also, searching for strings still doesn't work.  Would it be possible to check if quotation marks are included in the search string and automatically parse the rest as a string if there are? right now, I get a
"999|Invalid index one conversion|" error.


You need a client that can support UTF-8. If you are using PuTTy go to Window-> Translation, Asuume data to be in character set UTF-8.
You can only search for one word at a time at the moment; have not gotten to that yet.
Title: foo_controlserver
Post by: bluestat on 2006-04-19 03:54:13
Uploaded a new version beta7; searching support for phrases.
Title: foo_controlserver
Post by: Shade[ST] on 2006-04-19 04:48:50
Uploaded a new version beta7; searching support for phrases.

You rock my socks!

Now I can make a GUI for this (I'll make it in Java) -- anyone who wants it can contact me in two weeks.  You can also PM me to make me do it, 'cos I'll probaly forget
Title: foo_controlserver
Post by: lucia on 2006-04-21 14:28:32
Nice plugin..  any plans for authentication or source ip check?
Title: foo_controlserver
Post by: Maarten on 2006-04-25 12:20:11
Hi Bluestat!

Your controlserver almost works as a charm, on foobar0.9. I have one feature request and one bug.

Sometimes, after a while, the server does not do any broadcasts anymore (when vol setting changed, next track starts, etc.) so my client doesn't get updated. Could you look into this?

Furthermore, please make the max number of connection a setting in the foobar control panel, instead of a fixed 4.

Thanks again,
Maarten
Title: foo_controlserver
Post by: bluestat on 2006-04-27 05:49:29
I will work on adding a configurable number of clients and also an ip restriction setting (currently I just have rules in my firewall to handle this;) I have not seen the problem described where updates are no longer sent; however most of my testing is just done with one socket connection to the server. If you could PM any more details with regards how to replicate what you are seeing that would help.

Thanks!
Title: foo_controlserver
Post by: bluestat on 2006-05-03 21:41:35
I will work on adding a configurable number of clients and also an ip restriction setting (currently I just have rules in my firewall to handle this;) I have not seen the problem described where updates are no longer sent; however most of my testing is just done with one socket connection to the server. If you could PM any more details with regards how to replicate what you are seeing that would help.

Thanks!


Just a small update! I have implemented the above functions and also fixed the problem that existed if a track was listed multiple times on a playlist (it would always display the index of the first one). Also fixed a problem where some configuration options were not being saved. I need to do some more testing; but should have this posted for you all in a couple days!
Title: foo_controlserver
Post by: bluestat on 2006-05-04 19:55:20
I need to do some more testing; but should have this posted for you all in a couple days!


Posted; please PM me if you encounter any problems or irregularities. A lot was changed; so it would not surprise me;)

Thanks!
Title: foo_controlserver
Post by: philibuster on 2006-05-16 09:51:40
I'm having a few issues with the search function in this version. I'm using 0.9.1 with the latest beta 9 of this plugin, running xp pro, no windows firewall, blah blah blah. When I enter some search terms it works as expected. Other times when I search, it crashes my foobar hard, with the error message "unhandled excepion : bad allocation".

Doing some more testing, when I check the UTF-8 box, it works all the time. When the box is unchecked, it doesn't work with certain search terms. I think the solution is to use the UTF-8 encoding...  Anybody duplicate these problems?

Also, what about a backspace? Us ham-fisted typists like to undo.
Title: foo_controlserver
Post by: bluestat on 2006-05-16 14:31:46
I'm having a few issues with the search function in this version. I'm using 0.9.1 with the latest beta 9 of this plugin, running xp pro, no windows firewall, blah blah blah. When I enter some search terms it works as expected. Other times when I search, it crashes my foobar hard, with the error message "unhandled excepion : bad allocation".

Doing some more testing, when I check the UTF-8 box, it works all the time. When the box is unchecked, it doesn't work with certain search terms. I think the solution is to use the UTF-8 encoding...  Anybody duplicate these problems?

Also, what about a backspace? Us ham-fisted typists like to undo.


If you could PM me the details with regards to what search terms are causing the error (if they are the same ones all the time) this could help me find the problem. Thanks!
Title: foo_controlserver
Post by: JJongma on 2006-05-18 04:07:52
I have noticed that for some songs, no information is present through controlserver. It has a title in foobar (didn't look at the real tags or anything) but not in the telnet to controlserver. I would request that if no information is found, title becomes filename or something?

Great work!
Title: foo_controlserver
Post by: philibuster on 2006-05-18 09:15:38
New update works perfectly.  Thanks!
Title: foo_controlserver
Post by: philibuster on 2006-05-22 08:57:38
I have noticed that for some songs, no information is present through controlserver. It has a title in foobar (didn't look at the real tags or anything) but not in the telnet to controlserver. I would request that if no information is found, title becomes filename or something?

Great work!

You could always add a FILENAME to your output config. But then that would always show up for all files. It's not perfect. The other way around this is to tag your files....
Title: foo_controlserver
Post by: JJongma on 2006-05-24 12:52:51
As one solution I added the pathraw field. FILENAME doesn't seem to work... Any chance of getting a field in the next version that just returns the filename without the path?

(as my goal is using it over possible bluetooth (and maybe even GPRS but I doubt that) every byte that can be snooped off is a good byte )
Title: foo_controlserver
Post by: bluestat on 2006-05-24 16:25:16
New update works perfectly.  Thanks!

Glad it is working correctly now for you; thanks for pointing that out!

As one solution I added the pathraw field. FILENAME doesn't seem to work... Any chance of getting a field in the next version that just returns the filename without the path?

I have uploaded a new version with improved output configuration. You may now output with various title format strings. This should make it much more flexible. Unfortunately this will break the simple configurations from before; but it is not too much work to rewrite them using the title formatting.
Title: foo_controlserver
Post by: JJongma on 2006-05-25 15:49:53
Works great, thanks!

One thing though: %_length_seconds% now returns a number in seconds only. For example if a song was 1 minute, 2 seconds, and 300 milliseconds, it would have returned "62.30" in the old version, where it returns "62" now. Dont know if it's a bug or a feature () just thought I'd mention it.
Title: foo_controlserver
Post by: rhempel on 2006-05-26 02:24:12
This is a simple plugin I wrote that controls foobar2000 over a TCP/IP connection.
The source code is included.


I just downloaded this and it's EXACTLY what I'm looking for. It worked the first time
I tried using it to drive FOOBAR on my wife's computer upstairs.

She really wants a way to get audio all through the house, and I figured it's
cheaper to buy a Ramsey FM30 and tune the radios in the house to
our own private station than to run wires all through the place.

Streaming audio works, but each PC has different delays, and you need a
computer in every room.

So far, the foobar200 and controlserver does exactly what I need, and creating
a little Tcl or Lua shell around it would be fairly easy.

Ralph
Title: foo_controlserver
Post by: ExcelSun on 2006-05-26 05:01:39
This plugin has gotten me exctied. I'm attempting to use my MidpSSH (http://www.xk72.com/midpssh/)-armed BlackBerry as a remote control for my Foobar2000.

I've set up all the port forwarding in the router and made the appropriate firewall changes. But, the client doesn't connect and the plugin reports
Code: [Select]
WARNING : foo_controlserver: rejected connection from 170.***.224.***


I added this IP to the allowed list, and it still won't accept the connection. I know it's a security risk to do this (expecially without a user/pass), but well, the idea is so cool!
Title: foo_controlserver
Post by: bluestat on 2006-05-26 05:23:45
Code: [Select]
WARNING : foo_controlserver: rejected connection from 170.***.224.***


What do you have defined in the "Allow Addresses" field? If you are using * as a wildcard, there should just be one * for each segment. For example 192.168.1.*

If you have multiple addresses they should be delimited by a comma. For example 209.9.*.*,192.168.1.*,127.0.0.1

If you could PM me further details that could help me identify what is occurring.  Thanks!
Title: foo_controlserver
Post by: ExcelSun on 2006-05-26 06:50:19

Code: [Select]
WARNING : foo_controlserver: rejected connection from 170.***.224.***


What do you have defined in the "Allow Addresses" field? If you are using * as a wildcard, there should just be one * for each segment. For example 192.168.1.*

If you have multiple addresses they should be delimited by a comma. For example 209.9.*.*,192.168.1.*,127.0.0.1

If you could PM me further details that could help me identify what is occurring.  Thanks!

Wow, thanks for the quick response! You know what? It's working now.

The asterisks I included were to protect my security, not wildcards. My "Allow Addresses" field showed "127.0.0.1,170.206.224.58", 1 allowed clients.

I tried changing "Allow Addresses" = "*.*.*.*" and 4 allowed clients, then a Foobar restart. Then it worked right away. I then tried the 170.206.224.58 address in there again, wouldn't accept the connection. Looks like I'll live without access control.

I worked on this for 3 hours today before I posted, thinking I'd find an answer. Now I feel kinda dumb. Thanks for writing this. If you need anymore testing, I'll be around.
Title: foo_controlserver
Post by: bluestat on 2006-05-26 15:08:42
Just a couple other thoughts; you need to enable/disable the server (or restart foobar) from the configuration page for any changes in the "Allow Addresses" field to take effect. Other than that; not sure why you are having troubles. I will do some more testing today on it.
Title: foo_controlserver
Post by: philibuster on 2006-05-27 10:17:46
I am definitely liking the title formatting strings support. This little plugin is becoming more and more powerful. Thanks for the hard work and bugfixes.
Title: foo_controlserver
Post by: wgrumblat on 2006-05-30 18:31:19
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
Title: foo_controlserver
Post by: philibuster on 2006-05-30 22:06:50
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...
Title: foo_controlserver
Post by: wgrumblat on 2006-05-30 23:26:49
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
Title: foo_controlserver
Post by: mirx on 2006-06-05 13:25:46
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.
Title: foo_controlserver
Post by: wgrumblat on 2006-06-05 19:45:00
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
Title: foo_controlserver
Post by: bluestat on 2006-06-07 01:45:04
Hey Wolfgang, I will take a look at your suggestions this week. I agree that would make things a bit easier to identify.
Title: foo_controlserver
Post by: saivert on 2006-07-28 09:01:17
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 (http://beta.saivert.com/foobar2000%20webui/index.php?showsource)
Title: foo_controlserver
Post by: SirReal on 2006-07-30 17:57:47
I'm just wondering why 'trackinfo' doesn't return the track length? Apart from the title, isn't that THE most important metadata?
Title: foo_controlserver
Post by: saivert on 2006-07-31 03:26:39
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.
Title: foo_controlserver
Post by: unseenuniversity on 2006-08-23 14:19:16
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
Title: foo_controlserver
Post by: bluestat on 2006-08-24 04:15:47
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!
Title: foo_controlserver
Post by: lucia on 2006-10-02 00:40:17
any made applications for remote controlling fb2k from a remote pc whithout using telnet commands?

looking for a made application....
Title: foo_controlserver
Post by: ict on 2006-11-11 20:12:11
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 (http://rapidshare.com/files/3072482/FooControl.rar.html)
Should be self-describing, just follow the first Steps carefully.

(http://img156.imageshack.us/img156/208/frcjz1.jpg)

By the way, thanks for this great plugin!
Title: foo_controlserver
Post by: epinosa on 2006-11-14 14:23:04
How can I reach my foobar from another network? (not local)
Title: foo_controlserver
Post by: TREX6662k6 on 2006-11-16 02:15:04
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
Title: foo_controlserver
Post by: Mr_Rabid_Teddybear on 2006-12-04 08:42:33
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 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=22248&view=findpost&p=219224) 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 (http://pigtail.net/LRP/printsrv/cygwin-sshd.html).
This will ofcourse be a lot bigger install than the SSHWindows (http://sshwindows.sourceforge.net/), 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.
Title: foo_controlserver
Post by: eyebex on 2006-12-30 09:38:30
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.
Title: foo_controlserver
Post by: er0k on 2007-01-18 15:38:02
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 
Title: foo_controlserver
Post by: bluestat on 2007-01-18 15:59:08
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.
Title: foo_controlserver
Post by: Adi Corrales on 2007-07-30 16:23:18
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!
Title: foo_controlserver
Post by: bluestat on 2007-07-31 01:37:16
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!
Title: foo_controlserver
Post by: Adi Corrales on 2007-08-15 21:33:40
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....
Title: foo_controlserver
Post by: freelancer42 on 2007-10-06 00:04:09
This is a great plugin! I'm currently developing a client with "brumal treeline" looks, I'll post here when it's finished.
Title: foo_controlserver
Post by: freelancer42 on 2007-10-06 16:04:39
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).
Title: foo_controlserver
Post by: saivert on 2008-03-16 21:14:25
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/ (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).
Title: foo_controlserver
Post by: Mastermnd on 2009-08-03 19:15:02
Hi! The plugin still works very well as far as I can tell, but the settings page is now unusable in Win7 RTM. I am using the smallest( 100%) DPI setting, and all other tabs look pefect, it's just the one for this plugin. Can it be fixed please? I guess it's just the font the page is using. Thanks
(http://i203.photobucket.com/albums/aa228/Mastermnd_/ControlServer.png)
Title: foo_controlserver
Post by: q_b6 on 2010-01-08 19:19:26
Is it possible to modify this component to be compatible with MPD (Music Player Daemon) ?
Title: foo_controlserver
Post by: 2kw on 2010-06-10 10:55:02
Hi,

Great piece of software. I'm using it with my AMX system. 

I have one request. Can you include a track's duration in with it's info ?? ( unless it's obtainable some other way that I'm missing ). I could then make a bargraph to show relative progress, and be able to seek properly.

Cheers,

Paul.
Title: foo_controlserver
Post by: Mastermnd on 2010-06-10 12:04:17
Hi! The plugin still works very well as far as I can tell, but the settings page is now unusable in Win7 RTM. I am using the smallest( 100%) DPI setting, and all other tabs look pefect, it's just the one for this plugin. Can it be fixed please? I guess it's just the font the page is using. Thanks


It turns out it was a windows bug... when installing with a card/monitor that supports very high resolutions, the system fonts for 100% dpi are incorrect. I fixed it by editing my registry. If anyone else is having this problem, send me a PM and i'll send you the fix.
Title: foo_controlserver
Post by: 2kw on 2010-06-13 05:57:02
Hi,

Great piece of software. I'm using it with my AMX system. 

I have one request. Can you include a track's duration in with it's info ?? ( unless it's obtainable some other way that I'm missing ). I could then make a bargraph to show relative progress, and be able to seek properly.

Cheers,

Paul.


Found out how to do it. 

Cheers,
Paul.
Title: foo_controlserver
Post by: croccodillo on 2010-06-22 09:12:50
Hello all,

I'm new here and a new, happy foobar2000 user.
it is amazing, a really great piece of software.
It completely overwhelm WinAmp I was used to use.
Now Iìm playing winfoo_controlserver, another great component.
I really like it, I'm now designing a nice (at least, for me) interface for my PDA (Windows mobile) ein .NET.

I have a question for you: I'd like to have also the medialibrary on my PDA, so it would be fantastic to have few new commands to parse the library, something like listartist, listalbum [artist], listtracks [album], in manner I can build the medialibrary on the PDA screen.
is it feasible?
Or do I have to add it in source code by myself?
Anyone else interested, or has anybody else already did it?
Thank you all in advance.

Ciao,
Giovanni (from Italy)
Title: foo_controlserver
Post by: rdeckard on 2012-02-07 23:24:03
Hi -

Not sure if anyone's poking around on this thread anymore, but I just switched from Winamp to foobar2000 and am loving it.
I had a Telnet plugin for Winamp, but it had no where near the same capabilities.

One thing I am missing is a way to fast forward through a track.
Unless I am missing something, it looks like you can only seek into the track by X number of seconds relative to the beginning.
Is it possible to have the seek command keep advancing by 5 seconds (for example) every time you send it?

Also, my apologies if this is a dumb question, but what exactly is the 'delta' parameter in the seek command for?
Is that where you would specify forward or back? If so, what is the syntax?

Aside from that, some examples for some of the more involved commands would be great, but overall I am very happy with this and hope that it continues to be supported.

Thanks!