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_httpcontrol (Read 946669 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

foo_httpcontrol

Reply #1025
Hi guys,

Question here, hopefully related to foo_httpcontrol.

How about HTTP in the other direction?
That is, is it possible to make fb2k report playlist advances via HTTP requests?

I'm thinking of getting a list of recently played songs on my website, so I first looked at some way to access fb2k playback history to copy the tail of it to my website by a schell script, but didn't find a way to access such history by an external script.

foo_httpcontrol

Reply #1026
Hi oblikoamorale !

I control foobar 2K with your plugin from two different screens. One is a 12'' display connected in VGA mode on the server motherboard, and the second is a HP Touchpad tablet.
Of course when I give a command on the touchpad webpage, the webpage on the server display doesn't refresh itself.

My (stupid ?) question is: is there a way to force refresh on the server display when I give a command on the Touchpad ? I wouldn't like to have an automatic refresh like "<meta http-equiv=refresh content=blabla>", but a refresh only when a new command is given from the tablet (= a change in foobar status).
Is it possible ?

Cheers !


foo_httpcontrol

Reply #1027
I think that's not possible. As far as I understood it is a main dogma of AJAX based server-client systems, that the server may never give commands to the client. The client may only request something from the server (from security reasons).

So, the only solution is, to make the client request updates from time to time.

Edit: my statement is based on the assumption, that what you call "server display" is just another client of foobar2000 httprequest server.

foo_httpcontrol

Reply #1028
Edit: my statement is based on the assumption, that what you call "server display" is just another client of foobar2000 httprequest server.


Thanks for your answer !

Yes, the server display is just another client.

I had this idea when I saw a chat. On a chat all the clients are refreshed each time one does write something, so I imagined that it could be possible to do the same thing with two clients on the foobar http server.
But I have no idea how a chat is made.......

foo_httpcontrol

Reply #1029
So, the only solution is, to make the client request updates from time to time.


No, it doesn't work. I've installed the addon "Reload Every" on the server side client (Firefox), but every time it reloads the page, it sends the command "stop" to Foobar, so when I send the command "Play" with the other Firefox client on my tablet, Foobar stops with the next "reload" from the server Firefox client.
Seems to be impossible to resolve the problem........ 

foo_httpcontrol

Reply #1030
I've got a HTPC connected via HDMI to a receiver which is turned off when I'm not listening to music through fb2k or watching a movie. I've got an IR setup with a remote control to launch and control fb2k just fine at home. Recently I decided that I'd like to be able to listen to my music library when I'm at work too. I installed foo_httpcontrol and foo_vorbisstream and set up icecast. It worked great over the internet when I was at home, but when I got to work I realized that when the receiver was turned off and I attempted to play a song using foo_httpcontrol I had no DS output device and therefore nothing would play. To get it to play with the receiver turned off I had to enable Null Device as the output, and then things worked fine.

This is less than ideal because when I'm home I need to switch the output device and remember to set it back when I leave. There's no way I can figure out to switch output devices using menu commands or anything else either... I have to grab my mouse, go through the preferences and do it manually.

Here's my questions:
1) Is there some way to change or at least automate changing output devices using foo_httpcontrol? I'm not afraid to modify a theme to do this. I'm assuming this can't be done though.
2) Is there some other component that would allow me to do this by adding some kind of menu command which I could then script (even if it only worked when I was home and using the remote)?
3) If I were to buy a powered HDMI splitter to stick between the receiver and HTPC would that obviate my need to even do this? I.e., would my DS output device stick around in that case and allow me to play music even though nothing was really listening on the other end?

Thanks.

foo_httpcontrol

Reply #1031
staki: server-client communication mode is not implemented. if you want to reflect the server-side changes on multiple clients, you're stuck with sending periodic update from each client to server to see what's changed.

MordredKLB, I might be wrong, but it seems that changing output device is not possible in fb2k SDK. there's unhealthy workaround though, you can write the automation script (Autohotkey, Autoit etc) which changes the device and invoke it using foo_cmd or some other means.

foo_httpcontrol

Reply #1032
staki: server-client communication mode is not implemented. if you want to reflect the server-side changes on multiple clients, you're stuck with sending periodic update from each client to server to see what's changed.


It doesn't work. Everytime I make an update from a client, it does send the "stop" command to the server, even if I don't click on any command on the webpage. I don't understand why........
(The update is made by the plugin "Reload Every" for Firefox).

foo_httpcontrol

Reply #1033
you should instruct this plugin not to resend the page form data. it should just reload the page without any additional activities.

anyways, assuming you're using default template, it's very easy to add automatic page refresh. just put
Code: [Select]
setTimeout('pc()',1000);
anywhere within the foo_httpcontrol_controls_tpl.html javascript block. 1000 is one second refresh interval.

foo_httpcontrol

Reply #1034
You are right, it works !
But I got another problem ! On the server screen (local pc) the page reloads itself very fast, it is invisible. But on my touchpad tablet, because of the wifi speed delay and the slow speed of the tablet itself (I think so...), the page blinks on every reload, it is just horrible !

I think that it is impossible to do what I wanted. 
Anyway, thank you very much for your advice oblikoamorale !

foo_httpcontrol

Reply #1035
just try other self-refreshing templates like vakata2 and so on, they might suit you better. or not.

foo_httpcontrol

Reply #1036
Yes I will try some of the other templates.
But I like yours very much, I use it, and I just made some changes in the html and the css to suit it for ma tablet, and it works perfectly.......
No problem, I just forget my idea.

foo_httpcontrol

Reply #1037
Yeah !!! Finally I've found a solution for my problem ! 

The trick is to use two different template folders, with different names, for example one "local", and one "remote". The content is exactly the same in both folders, except for the  "foo_httpcontrol_controls_tpl.html" file. The one in the "local" folder has the instruction "setTimeout('pc()',1000);" in the javascript code, whereas the one in the "remote" folder doesn't have it.

After that the browser on the local server points towards the "local" folder address, and the browser on the tablet points towards the "remote" folder address.
And it works ! I can give a command on my tablet to foobar, and the browser page on the local server is immediately refreshed and shows the actual state of foobar (playing, paused, stopped.....).
That's exactly what I wanted ! 

Thanks again oblikoamorale for the instruction "setTimeout('pc()',1000);" ! 

foo_httpcontrol

Reply #1038
Hi Folks,

i got Problems getting Albumarts on my Android Device.
Everything works fine but the "Foobar2000 Controller" APP for Android doesnt show me any Album Art.

All Files are Tagged with the Cover-Pictures but all i get is a black Square on my Smartphone.
the PC shows it all!

How can i solve it ?

foo_httpcontrol

Reply #1039
news from anamon:

- an iPad remote control (all features of the iPhone remote)
- the iPhone remote was updated: 'force scroll' to switch playlist pages, better performance, biography and a more 'applish' gui...
- the Vertigo iPhone/iPad remote now is FREE!
- watch 3 new demo videos here

foo_httpcontrol

Reply #1040
that's some really nice things you've achieved, congratulations.

foo_httpcontrol

Reply #1041
thanks a lot! 

foo_httpcontrol

Reply #1042
Here is one for you :

- For a long time i try to create command to add for example 8-th track (active playlist) to playing qeue.

And i do such a command :

Code: [Select]
http.request("http://192.168.81.178:8888/ajquery/?cmd=QueueItems[8]")


But it dont work at all ;/ Can someone tell me what Am I doing wrong ?

Also i have command
Code: [Select]
http.request("http://192.168.81.178:8888/ajquery/?cmd=PlayOrPause")

And this one works just fine.

Also is there a command to play the specific track for example 8-th and than stop ?

foo_httpcontrol

Reply #1043
let's quote the manual http://code.google.com/p/foo-httpcontrol/wiki/Commands :
Code: [Select]
QueueItems

Put active playlist items to playback queue.
param1=item indexes separated by any delitemeter

example: http://ip/.../?cmd=QueueItems&param1=8

to stop playback after current track, you have to issue stop after current command. the following command sequence does the job:
http://ip/.../?cmd=SAC&param1=1
http://ip/.../?cmd=Start&param1=8

foo_httpcontrol

Reply #1044
I instaled Foobar2000 and controler and it worked instantly - but after I added network drive to Library, I get error an my Android. When I navigate with PC to Foobar PC, port 8888 I get notice that there is possible error in template. How do I restore correct template on a PC running Foobar2000? I tried installing PC control again - didn't work.

On a PC I get this from http://pc:8888

/////Installed templates:

$RECYCLE.BIN [config not found]
00_Upload [config not found]
Apollo 440 - Gettin' High On Your Own Sluppy [config not found]
ART [config not found]
Cuba [config not found]
David Hudson - Rainbow serpent [config not found]
....
(this are maps on the network drive)
//////////////


foo_httpcontrol

Reply #1046
but after I added network drive to Library


what exactly did you change in component preferences?

you don't have to change anything in preferences http://code.google.com/p/foo-httpcontrol/wiki/Preferences when adding library to fb2k.



I idnt' change intentionally - but I saw my network folder was set  in place of templates folder. I put everything default and it works now, thanks

foo_httpcontrol

Reply #1047
Is there any way to view the entire media library?

I see an interface for it in the Foobar SDK, but I don't see any of those functions being exposed by foo_httpcontrol.

I made a feeble attempt at adding a function to return the entire library, but only succeeded in making Foobar crash. Seeing how all of the data from ui.cpp does not come directly from the Foobar API, I'm guessing that I can't call Foobar functions from ui.cpp.

foo_httpcontrol

Reply #1048
Is there any way to view the entire media library?

clarify what do you mean with 'view'. right now it's possible to search for ALL and your Query playlist will have the whole medialibrary. or you can play with query steps, they will return json formatted results array of your request. it's not very reliable though as I might have forgotten to encode a special char or two which single-handedly ruins json formatting

I made a feeble attempt at adding a function to return the entire library, but only succeeded in making Foobar crash. Seeing how all of the data from ui.cpp does not come directly from the Foobar API, I'm guessing that I can't call Foobar functions from ui.cpp.

this kind of SDK requests should really be made from main thread. basically all player interaction goes to commands.cpp, while ui.cpp just translates internal buffers to results feedable to a human or a parser.

foo_httpcontrol

Reply #1049
clarify what do you mean with 'view'. right now it's possible to search for ALL and your Query playlist will have the whole medialibrary. or you can play with query steps, they will return json formatted results array of your request. it's not very reliable though as I might have forgotten to encode a special char or two which single-handedly ruins json formatting


Thanks, that is what I needed. I want the user to be able to browse the entire library from my application.

I will probably still need to look at adding to the plugin at some point though so I can create some sort of mechanism for the client to receive updates on changes to the library instead of having to reload the entire library. Then I could persist the library information in a SQLite database in my application.