Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have you figured out how to play songs #3

Open
duryjames opened this issue Aug 4, 2014 · 1 comment
Open

Have you figured out how to play songs #3

duryjames opened this issue Aug 4, 2014 · 1 comment
Labels

Comments

@duryjames
Copy link

Hey,

Having a play with your API wrapper.

Like everyone else i was hoping that the logitech media server would include some kind of restful API.

I'm planning on making some kind of nice front-end interface for it, that works on mobile.

So the closest i have got with your example code is this (which isn't very far)

squeeze.on('register', function(){
    squeeze.getPlayers( function(reply) {
            var player = reply.result[0];
            squeeze.request(player.id, ["albums", 0, 1000], function (reply){
                console.log(reply.result);
            });
            squeeze.request(player.id, ["songs", 0, 1000], function (reply){
                console.log(reply.result);
            });
        }
    });
});

which returns me an array of albums and songs.

Here is an example song :

[{ id: 484,
       title: 'Btoum-Roumada',
       genre: 'Braindance',
       artist: 'Aphex Twin',
       album: 'drukqs (Disc Two)',
       duration: '116.818' }]

I was hoping that i could just do:

squeeze.request(player.id, ["play", song.id], function (reply){
       console.log(reply.result);
});

But that does nothing... but is almost in tune with how their URLs work

have you found a way to communicate with it to do this ?

In the web interface you would put in a url like this to play songs ( as its doesnt seem to go through the json request to actually play)

http://<URL>:9000/clixmlbrowser/clicmd=browselibrary+items&linktitle=BROWSE_BY_ARTIST&mode=artists/index.html?index=51.0&player=6e%3A24%3A51%3A96%3A68%3Aa2&sess=

or to just tell the players to start playing :

http://<URL>:9000/status_header.html?p0=play&player=<PLAYER ID>

I notice in your squeezeplayer.js class that you touch on the "play" but go no further.

Alternatively I could use their telnet interface to communicate with it, but in my opinion slightly overkill.

Thanks

DJ

@piotrraczynski
Copy link
Owner

Hi,

First, to play a song (no matter what source) you need to add it to playlist one or the other way. I have only used Spotify (since I stopped using local music) with LMS and see my spotify API on how to add a song to a playlist.

Notice that even in LMS web GUI, when you hit play server clears the playlist and adds your selection to the playlist (or rather play queue). You can also add a song to the queue which will append song to current queue.

Nevertheless, when it comes to operation like play,stop,next,previous, LMS operations are based on the current playing queue, then you can use play functions to play specific index (simple offset in the queue).

Hope it helps.

BTW. Development effort slowed down a little, because I'm mainly focused on another project which is only using this module as a plugin, but I'm planning to release first fully usable version soon, hopefully this/next month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants