Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Senior Member
    Join Date
    Mar 2014
    Posts
    205

    Plugin track playlist state

    Hi

    As part of my home automation plugin, I want to send current playlist.

    I suppose I must add an input in the setting to tell how many songs in the playlist the user want.

    So the first question is how to subscribe to playlist event (add, remove, clear, move...) ? I tried
    Slim::Control::Request::subscribe( \&commandCallbackPlaylist, [['playlist']]);
    but it didn't seem to be trigger.

    The second one, how to retrieve songs of playlist ? Must I send CLI request or the informations are here

    Thank for your help !

    Sent from my ONEPLUS A3003 using Tapatalk

  2. #2
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,779

    Plugin track playlist state

    > As part of my home automation plugin, I want to send current playlist.

    Send the playlist to the home automation system?

    > So the first question is how to subscribe to playlist event (add,
    > remove, clear, move...) ? I tried
    > Slim::Control::Request::subscribe( \&commandCallbackPlaylist,
    > [['playlist']]);
    > but it didn't seem to be trigger.


    That's exactly how it's being done. If it doesn't work, then your either
    not calling above call in the right place, or your callback is buggy.
    Please share your code.

    > The second one, how to retrieve songs of playlist ? Must I send CLI
    > request or the informations are here


    Check out the "status" query. And see eg.
    https://github.com/Logitech/slimserv...aylist.pm#L182
    - that's where the playlist is being rendered for the web UI.


    --

    Michael

  3. #3
    Senior Member
    Join Date
    Mar 2014
    Posts
    205
    Thanks it work great with the web UI method !

    Just one question, is it possible to retrieve all playlist without indicate an end number ?

    For my home automation, I will show you the result after this

    Sent from my ONEPLUS A3003 using Tapatalk

  4. #4
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,779

    Plugin track playlist state

    > Just one question, is it possible to retrieve all playlist without
    > indicate an end number ?


    No. You could of course just tell it to return all date from 1 to track
    999999. But I'm not sure performance would be great. LMS is single
    threaded. If you had to process thousands of tracks in one go, you'd
    risk to stall the streaming. Unless you do call one of those idle() methods.

    --

    Michael

  5. #5
    Senior Member
    Join Date
    Mar 2014
    Posts
    205
    Yes I add an input in settings to tell how many items return.

    Another question, is it possible to add a song directly to an index or must I add it to the end and after move ?

    Sent from my ONEPLUS A3003 using Tapatalk

  6. #6
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,779

    Plugin track playlist state

    > Another question, is it possible to add a song directly to an index or
    > must I add it to the end and after move ?


    I think that's the way you have to use.

    --

    Michael

  7. #7
    Senior Member
    Join Date
    Mar 2014
    Posts
    205
    And if I understand there is no way to tell automatically to the move function to take the last item ?

    "-" take the first index :/

    Sent from my ONEPLUS A3003 using Tapatalk

  8. #8
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,779

    Plugin track playlist state

    > And if I understand there is no way to tell automatically to the move
    > function to take the last item ?


    I'm not sure I understand? You want to tell it to "move last item to
    index 5", rather than "move item 92384 to index 5"? No, there's no such
    shortcut.

    --

    Michael

  9. #9
    Senior Member
    Join Date
    Mar 2014
    Posts
    205
    At first I wanted to say : "add item 92384 to index 5" but there's no such function.

    So I wanted : "add item 92384 to the end" (I know it's possible) and after "move last index to index 5" but I don't know the last index.

    There's an easy way to do this or must I query playlist length ?

    Sent from my ONEPLUS A3003 using Tapatalk

  10. #10
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,779

    Plugin track playlist state

    > There's an easy way to do this or must I query playlist length ?

    Yes, you'll have to query the playlist length.

    --

    Michael

Posting Permissions

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