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 154641 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

foo_controlserver

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

foo_controlserver

Reply #1
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

foo_controlserver

Reply #2
I installed this...now what do I do?

 

foo_controlserver

Reply #3
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.

foo_controlserver

Reply #4
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]

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]

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).

Quote
I installed this...now what do I do?
[{POST_SNAPBACK}][/a]

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].
"ONLY THOSE WHO ATTEMPT THE IMPOSSIBLE WILL ACHIEVE THE ABSURD"
        - Oceania Association of Autonomous Astronauts

foo_controlserver

Reply #5
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.

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.

foo_controlserver

Reply #6
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

foo_controlserver

Reply #7
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!

foo_controlserver

Reply #8
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.....
"ONLY THOSE WHO ATTEMPT THE IMPOSSIBLE WILL ACHIEVE THE ABSURD"
        - Oceania Association of Autonomous Astronauts

foo_controlserver

Reply #9
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).

foo_controlserver

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

foo_controlserver

Reply #11
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

foo_controlserver

Reply #12
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!

foo_controlserver

Reply #13
Found the problem with trackinfo command mentioned above.  Please enable "cursor follows playback" until I can sort out a fix. Thanks Hamallainen!

foo_controlserver

Reply #14
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;)

foo_controlserver

Reply #15
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?

foo_controlserver

Reply #16
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!

foo_controlserver

Reply #17
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 (^^)

foo_controlserver

Reply #18
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.

foo_controlserver

Reply #19
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.

foo_controlserver

Reply #20
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)

foo_controlserver

Reply #21
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.

foo_controlserver

Reply #22
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

foo_controlserver

Reply #23
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...

foo_controlserver

Reply #24
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).