Home of the Squeezebox™ & Transporter® network music players.
Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22
  1. #11
    Senior Member
    Join Date
    Sep 2005
    Posts
    2,848
    Quote Originally Posted by tuc View Post
    Wow, so cool! Thanks!
    Just to be sure.
    We are talking/writing about the same.

    A saved Playlist is an entirely different kind of flying altogether! ;-)

  2. #12
    Member
    Join Date
    Nov 2009
    Location
    Denmark
    Posts
    53
    Quote Originally Posted by DJanGo View Post
    We are talking/writing about the same.

    A saved Playlist is an entirely different kind of flying altogether! ;-)
    Again thank you!
    I have now digested the command you provided (at least to some degree:-)). It is the first time I have thought about what the CLI can really do - amazing!

    It made me think about another feature that I have been wishing for for a long time:
    Sometimes I (or friends) accidentally zap the active playlist by pressing "play" to an item found by a search in the music library. I would like to be able to "go back" to the previous active playlist. Now, this is quite tricky since it would require every update to the active playlist to be "saved to disk" and also require functionality to make the "playlist saved to disk available".

    As a poor man's solution: Saving the current playlist once a day among the "real" playlist pointed to by LMS settings. Such a playlist could have a filename containing the date. I would then delete older playlist. This could be achieved through CLI and crontab (I just don't know how to turn an active playlist into a named playlist).

    If you are still up for helping me ...

    Best
    -thomas

    PS: I will try your solution to my original post later today and let you know how it went.
    PPS: Long live LMS :-)
    --
    Server: Raspberry Pi 3 running LMS 7.9.0
    Players: SB receiver + 4 SB boom, two groups: Group1: 3 SB Boom + 1receiver, Group2: 1 SB Boom
    Remotes: Mobile phone 1+ 3 and Asus tablet with SqueezeCtrl, Orange Squeeze and SqueezeCommander

    Apps:
    Tidal

  3. #13
    Senior Member
    Join Date
    Sep 2005
    Posts
    2,848
    Quote Originally Posted by tuc View Post
    Sometimes I (or friends) accidentally zap the active playlist by pressing "play" to an item found by a search in the music library. I would like to be able to "go back" to the previous active playlist. Now, this is quite tricky since it would require every update to the active playlist to be "saved to disk" and also require functionality to make the "playlist saved to disk available".
    PPS: Long live LMS :-)
    Quote Originally Posted by tuc View Post
    PS: I will try your solution to my original post later today and let you know how it went.
    PPS: Long live LMS :-)
    first please make sure you've got an answer
    Code:
    which nc
    which sed
    otherwise you need to install nc / sed before any further action.

    save the script, make it executable and let it run

    The last line is not working because of the # in front
    If you remove that # your lms starts scanning your playlists - snce your runing a rpi i wasnt sure if you really want that.

    Feel free to test it before you add it as a cronjob. You should end in a playlist in your playlistfolder for every player named playername_hour.m3u.
    If you run it always @ the same hour it should do what you want.

    Code:
    #!/bin/bash
    
    ##vars
    port=9090
    server=127.0.0.1
    hour=`date +%H`
    playlistdir=$(grep "playlistdir:" /var/lib/squeezeboxserver/prefs/server.prefs|grep '/'|cut -d ' ' -f2)
    players=$(printf "player count ?\nexit\n" | nc $server $port | cut -d ' ' -f 3)
    
    for((i=0; i<$players; i++))
       do
       playerID=$(printf "player id $i ?\nexit\n"|nc $server $port|cut -d ' ' -f 4|sed 's/%3A/:/g')
       player_ID=$(echo $playerID|sed 's/://g')
       playername=$(printf "$playerID name ?\nexit\n" | nc $server $port | cut -d ' ' -f 3)
       playlist=$(echo $day $playername|sed 's/ /_/g')
       printf "$playerID playlist move 0 1\n $playerID playlist move 1 0\nexit \n"|nc $server $port
       if [ `wc -l /var/lib/squeezeboxserver/prefs/clientplaylist_$player_ID.m3u  | awk '{print $1}'` -ge "4" ]
          then
          cp -p /var/lib/squeezeboxserver/prefs/clientplaylist_$player_ID.m3u $playlistdir/$playlist.m3u
       fi
    done
    
    scanstatus=$(printf "rescan ?\nexit\n"|nc $server $port|cut -d ' ' -f2)
    if [ "$scanstatus" = "1" ]
       then
       echo "lms is already scanning ..aborting"
       exit 0
    fi
    
    #find "$playlistdir/" -iname "*_$hour.m3u" -mtime 0 && squeezeboxserver-scanner --playlists --novideo --noimage --priority 20 >/dev/null
    Last edited by DJanGo; 2018-11-17 at 02:15. Reason: minor bug in the scrpt fixed

  4. #14
    Senior Member
    Join Date
    Sep 2005
    Posts
    2,848
    Quote Originally Posted by DJanGo View Post
    save the script, make it executable and let it run
    btw: there is a "issue" in the script....

    it always move the first tracks to 2.nd postion when there is a 2nd Track and moves it back to its org. position to ensure dstm filled playlists are updated.
    By doing this the filestamp of the playlist is changed before copied to the playlistdir.
    And that makes the check for newer files later a little bit useless.

    Other than that it should work

  5. #15
    Member
    Join Date
    Nov 2009
    Location
    Denmark
    Posts
    53
    Quote Originally Posted by DJanGo View Post
    We are talking/writing about the same.

    A saved Playlist is an entirely different kind of flying altogether! ;-)
    I tried your one-liner yesterday and it works!
    Thanks a lot.
    -thomas
    --
    Server: Raspberry Pi 3 running LMS 7.9.0
    Players: SB receiver + 4 SB boom, two groups: Group1: 3 SB Boom + 1receiver, Group2: 1 SB Boom
    Remotes: Mobile phone 1+ 3 and Asus tablet with SqueezeCtrl, Orange Squeeze and SqueezeCommander

    Apps:
    Tidal

  6. #16
    Member
    Join Date
    Nov 2009
    Location
    Denmark
    Posts
    53
    Quote Originally Posted by DJanGo View Post
    btw: there is a "issue" in the script....

    it always move the first tracks to 2.nd postion when there is a 2nd Track and moves it back to its org. position to ensure dstm filled playlists are updated.
    By doing this the filestamp of the playlist is changed before copied to the playlistdir.
    And that makes the check for newer files later a little bit useless.

    Other than that it should work
    DJanGo you are a star!
    I will experiment with how to use your script (how often to run it, how often to rescan playlist etc.).
    FYI: nc is already installed (it used in your one-liner solution too). I think sed is also installed but I will install it if not (same for awk).

    Thanks for the inspiration to use shell scripts and CLI togehter. Perhaps I can think of other ways of enhancing LMS functionality with these tools in hand.
    Have a great weekend.
    -thomas
    --
    Server: Raspberry Pi 3 running LMS 7.9.0
    Players: SB receiver + 4 SB boom, two groups: Group1: 3 SB Boom + 1receiver, Group2: 1 SB Boom
    Remotes: Mobile phone 1+ 3 and Asus tablet with SqueezeCtrl, Orange Squeeze and SqueezeCommander

    Apps:
    Tidal

  7. #17
    Senior Member
    Join Date
    Jan 2006
    Posts
    230

    seems like that's just a bug in Don't Stop The Music..

    Quote Originally Posted by DJanGo View Post
    That moves the 1st file to 2.nd place and back again.
    And that move is recon by lms and it saves the cached playlist.
    Nice that you found that work-around, but it really seems to just be a bug in DSTM.
    I haven't used DSTM but I think maybe Michael wrote that plugin?
    I would post on the plugins forum and see if you can get him to just fix it..

    Greg
    Last edited by gregklanderman; 2018-11-10 at 09:47. Reason: typo

  8. #18
    Senior Member
    Join Date
    Jan 2006
    Posts
    230

    save copy of playlist just before clearing for "play" command?

    Quote Originally Posted by tuc View Post
    It made me think about another feature that I have been wishing for for a long time:
    Sometimes I (or friends) accidentally zap the active playlist by pressing "play" to an item found by a search in the music library. I would like to be able to "go back" to the previous active playlist. Now, this is quite tricky since it would require every update to the active playlist to be "saved to disk" and also require functionality to make the "playlist saved to disk available".
    Great idea, I cannot tell you how many times I've accidentally hit play instead of add over these many years.

    I'm not sure you really have to intercept every update to the current playlist, possibly just intercepting the clear playlist that happens when you "play" would be sufficient, and you probably only need to keep the single most recent one. I'd be happy to have it saved to a fixed name under the playlists menu.

    Greg

  9. #19
    Member
    Join Date
    Nov 2009
    Location
    Denmark
    Posts
    53
    Quote Originally Posted by gregklanderman View Post
    Great idea, I cannot tell you how many times I've accidentally hit play instead of add over these many years.

    I'm not sure you really have to intercept every update to the current playlist, possibly just intercepting the clear playlist that happens when you "play" would be sufficient, and you probably only need to keep the single most recent one. I'd be happy to have it saved to a fixed name under the playlists menu.

    Greg
    YES! Great Greg. I asked this question some years back and the replies I got was that it was really difficult. Intercepting the "clear playlist" seems less difficult. I just have no experience with LMS code and I am not sure if one could achieve it without revising the actual LMS code (i.e. not sure if plugin can do it alone)

    -thomas
    --
    Server: Raspberry Pi 3 running LMS 7.9.0
    Players: SB receiver + 4 SB boom, two groups: Group1: 3 SB Boom + 1receiver, Group2: 1 SB Boom
    Remotes: Mobile phone 1+ 3 and Asus tablet with SqueezeCtrl, Orange Squeeze and SqueezeCommander

    Apps:
    Tidal

  10. #20
    Senior Member JJZolx's Avatar
    Join Date
    Apr 2005
    Location
    Colorado
    Posts
    11,531

Tags for this Thread

Posting Permissions

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