Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Jul 2010
    Posts
    7

    Question: How to play Favorites from pyLMS?

    Hi All-

    I'd like to be able to play Pandora or Tune-in Radio stations that I have saved as "Favorites" using pyLMS.

    The CLI works fine for this in the following example:
    (echo "b8:27:eb:42:f3:82 favorites playlist play item_id:4"; echo "exit") | nc $(192.168.0.107) 9090

    However, I'm coding a small project with a unique interface using python and would like to use pyLMS for this function.

    I probably have a "mental block" on this. After much googling and reading the pyLMS docs, I cannot understand how pyLMS even loads/starts a user-defined playlist, let alone something from the Favorites playlist.

    Any help, examples or clarification?

    TIA

  2. #2
    Have you got pyLMS running at all? i.e. have you created a server and player object?

    If so, you could just do:
    Code:
    player.request("favorites playlist play item_id:4")
    You could also take a look at my LMSTools library (which has documentation to show how to create player objects). The same command as above should then work for you.

    Using LMSTools would look like this:
    Code:
    from LMSTools import LMSServer, LMSPlayer
    
    server = LMSServer("192.168.0.107")
    player = LMSPlayer("b8:27:eb:42:f3:82", server)
    
    # Play favourites
    player.request("favorites playlist play item_id:4")
    PyLMS is similar:
    Code:
    from pylms.server import Server
    from pylms.player import Player
    
    sc = Server(hostname="192.168.0.107")
    sc.connect()
    
    sq = sc.get_player("b8:27:eb:42:f3:82")
    
    sq.request("favorites playlist play item_id:4")
    Last edited by elParaguayo; 2017-04-06 at 23:28.

  3. #3
    Junior Member
    Join Date
    Jul 2010
    Posts
    7
    Thanks, elParaguayo! This is exactly what I needed.

    I did already have pyLMS working with code similar to your example. I was "sort of" on the right track in my wandering around - I had successfully tested a command-line telnet connection with the favorites playlist load function. I just had not found the player request function in the pyLMS docs yet.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •