Home of the Squeezebox™ & Transporter® network music players.
Page 4 of 4 FirstFirst ... 234
Results 31 to 38 of 38
  1. #31
    Quote Originally Posted by Errik128 View Post
    how to get from the player volume level in Tasker variable????

    I can change volume, and create tasker shortcuts on phone desktop
    http://192.168.1.36:9000/
    p0=mixer
    p1=volume
    p2=+5
    player=%PLAYER
    Code:
    '-volume' =>
          {
    	 help    => "set the player's volume (absolute or relative, use \'?\' to query the current volume)",
    	 do_shift => 1,
    	 command  =>
    	    sub
    	    {
    	       my $vol = shift;
    	       if ( $vol ne '?' )
    	       {
    		  if ( ! ( $vol =~ m/^[+-]?[0-9]{1,}$/ ) )
    		     { die "squeezy -volume: invalid volume specifier ($vol)\n"; }
    		  if ( 100 < $vol || $vol < -100)
    		     { die "squeezy -volume: invalid volume specifier ($vol, should be min/max 100)\n"; }
    		  send_command urlencode($player)." mixer volume $vol";
    	       }
    	       report 'volume', pick_field 3, send_command urlencode($player)." mixer volume ?";
    	    }
          },
    Does your '+' need to be encoded? , I just send the delta.
    For a volume query p2 blank or '?' ?

    Phill.

  2. #32
    Senior Member
    Join Date
    Apr 2008
    Location
    Paris, France
    Posts
    2,111
    Hey thanks for Squeezy!
    I was ready to dig out one of my old perl scripts and painfully process the JSON commands I needed, but I had the good idea to check out what squeezy was about, and it's great.
    It has helped me a lot.

    I wanted (among other things) to reset a group of players and start them as a syncgroup via a crontab. Yes, alarms can do sort-of-that, but a script is better in my case.
    I am not using discovery at all in squeezy.conf, neither for server nor players. I found out that "-sync" wasn't working in this case (player->{$pid} is not created at startup). Here is my patch (against squeezy current, AFAIK):
    Code:
    diff ./squeezy /home/admin/squeezy-master/squeezy
    309,310d308
    < #JPM
    < 	    if ( $#arg == 4 ) { push @{$group[$arg[1]]}, { name=>$arg[2], pid=>$arg[4] }; next; };
    In addition, a config file must look like this :
    Code:
    grep '^player' /usr/local/bin/squeezy.conf 
    playerdiscover no
    player 0 zipp 192.168.1.161 aa:aa:b5:31:46:62
    player 0 Berlin-Boombox 192.168.1.161 02:02:02:43:ef:99
    ...
    Other things I missed:
    • Player "on" without actually starting: in the syncgroup if the leader starts and only after the other players are started, there is a bit of rebuffering. I worked my way around by setting all players in the group to "-play playlistplay://clear" and then starting them. Last, I load my chosen lead player with an actual playlist and the group takes off gently.
    • FadeInSecs parameter in playlistplay: there is a "-sleep" command that fades out, I would have liked a "-wakeup" equivalent. I tried hacking another version of "-play" to handle something like "-fadein_play randomplay://tracks 120" but only got back "squeezy error: unknown argument (120)" and left it at that.


    Again, thanks a lot for this utility. It works great and offers a great balance of simplicity vs. features.

    EDIT. I can achieve fade-in with the stock functions " squeezy -zipp -json 'playlist play randomplay://tracks Program 60' " -- Great!
    Last edited by epoch1970; 2017-04-25 at 05:08.
    3 SB 3 • Libratone Loop, Zipp Mini • iPeng (iPhone + iPad) • LMS 7.9 (linux) with plugins: CD Player, WaveInput, Triode's BBC iPlayer by bpa • IRBlaster by Gwendesign (Felix) • Server Power Control by Gordon Harris • Smart Mix, Music Walk With Me, What Was That Tune? by Michael Herger • PowerSave by Jason Holtzapple • Song Info, Song Lyrics by Erland Isaksson • AirPlay Bridge by philippe_44 • WeatherTime by Martin Rehfeld • Auto Dim Display, SaverSwitcher, ContextMenu by Peter Watkins.

  3. #33
    Hi,

    Thanks for the patches and info,

    I would think pid not being defined is an artifact of no player discovery, it should probably be populated if missing before certain commands,
    From memory the sync command is one of the few that requires a player id and will not take a name(server end).

    The smooth take off for sync groups we can also look at,

    The wake option is probably only a minor tweak.

    I will dig out my dev kit.

    Phill.

    Quote Originally Posted by epoch1970 View Post
    Hey thanks for Squeezy!
    I was ready to dig out one of my old perl scripts and painfully process the JSON commands I needed, but I had the good idea to check out what squeezy was about, and it's great.
    It has helped me a lot.

    I wanted (among other things) to reset a group of players and start them as a syncgroup via a crontab. Yes, alarms can do sort-of-that, but a script is better in my case.
    I am not using discovery at all in squeezy.conf, neither for server nor players. I found out that "-sync" wasn't working in this case (player->{$pid} is not created at startup). Here is my patch (against squeezy current, AFAIK):
    Code:
    diff ./squeezy /home/admin/squeezy-master/squeezy
    309,310d308
    < #JPM
    < 	    if ( $#arg == 4 ) { push @{$group[$arg[1]]}, { name=>$arg[2], pid=>$arg[4] }; next; };
    In addition, a config file must look like this :
    Code:
    grep '^player' /usr/local/bin/squeezy.conf 
    playerdiscover no
    player 0 zipp 192.168.1.161 aa:aa:b5:31:46:62
    player 0 Berlin-Boombox 192.168.1.161 02:02:02:43:ef:99
    ...
    Other things I missed:
    • Player "on" without actually starting: in the syncgroup if the leader starts and only after the other players are started, there is a bit of rebuffering. I worked my way around by setting all players in the group to "-play playlistplay://clear" and then starting them. Last, I load my chosen lead player with an actual playlist and the group takes off gently.
    • FadeInSecs parameter in playlistplay: there is a "-sleep" command that fades out, I would have liked a "-wakeup" equivalent. I tried hacking another version of "-play" to handle something like "-fadein_play randomplay://tracks 120" but only got back "squeezy error: unknown argument (120)" and left it at that.


    Again, thanks a lot for this utility. It works great and offers a great balance of simplicity vs. features.

    EDIT. I can achieve fade-in with the stock functions " squeezy -zipp -json 'playlist play randomplay://tracks Program 60' " -- Great!

  4. #34
    Senior Member
    Join Date
    Apr 2008
    Location
    Paris, France
    Posts
    2,111
    Quote Originally Posted by pssc View Post
    I will dig out my dev kit.
    Very cool.
    I will soon post the crons I plan on using end and beginning of the day, horrible shell script but I think you'll have a view of what I am (was) after.
    Right now the machine is powered off. Me too...
    3 SB 3 • Libratone Loop, Zipp Mini • iPeng (iPhone + iPad) • LMS 7.9 (linux) with plugins: CD Player, WaveInput, Triode's BBC iPlayer by bpa • IRBlaster by Gwendesign (Felix) • Server Power Control by Gordon Harris • Smart Mix, Music Walk With Me, What Was That Tune? by Michael Herger • PowerSave by Jason Holtzapple • Song Info, Song Lyrics by Erland Isaksson • AirPlay Bridge by philippe_44 • WeatherTime by Martin Rehfeld • Auto Dim Display, SaverSwitcher, ContextMenu by Peter Watkins.

  5. #35
    Senior Member
    Join Date
    Apr 2008
    Location
    Paris, France
    Posts
    2,111
    So here is the crontab I plan to use in the morning. The idea is to "reboot" the audio setup every morning: redefine sync groups, possibly reset volume, and start playing.
    I found the group concept in Squeezy very handy to rebuild sync groups. With one Squeezy group per "zone" where players should play in sync, the Squeezy config file offers the reference setup, and then LMS sync groups are built with what players are effectively online that morning.

    There is a mix of long and fast actions, so the bash script is made of multiple loops among the different zones. It's an eyesore so here are the key statements, in "pseudo-code" (which it is, really...)
    Code:
    # Runs as a cron job once a day
    
    # Work on these groups as per squeezy.conf
    SQUEEZY_GROUPS=( 0 1 )
    # What will each group play?
    GROUP_PROGS=( 'randomplay://tracks' 'playlistplay://LFS3' )
    
    for G in "${SQUEEZY_GROUPS[@]}"; do
    	# Get players configured in Squeezy for the group
    	DATA=$("${SQUEEZY}" -group "$(( G ))" -power 2>/dev/null)
    	# Grab the name of the 1st player in this group actually alive - 'power ?'
    	# means squeezy has a player configured that does not exist in LMS.
    	mapfile -t LEADER < <(echo "${DATA}" | grep -m 1 -v "power ?" | awk '{print $1}')
    	# Names of all online players in the Squeezy group (incl. the leader)
    	mapfile -t FOLLOWERS < <(echo "${DATA}" | grep -v "power ?" | awk '{print $1}')
    	# Sleep all players - We need to reconfigure the group
    	DELAY=2 # in minutes
    	"${SQUEEZY}" -silent -group "$(( G ))" -sleep "$(( DELAY ))"
    done
    # Now we wait for players to have fade-out
    sleep $(( DELAY * 60 ))
    
    for G in "${SQUEEZY_GROUPS[@]}"; do
    	# Assert power off just in case
    	"${SQUEEZY}" -silent -group "$(( G ))" -off
    	# Break sync among players
    	"${SQUEEZY}" -silent -group "$(( G ))" -unsync
    	# With this, players in the group are ready to play 'nothing'
    	"${SQUEEZY}" -silent -group "$(( G ))" -play "playlistplay://clear"
    	# Power on players in group. Now they are all on, in stop mode; with Squeezy "on" means "on+play"
    	"${SQUEEZY}" -group "$(( G ))" -silent -on
    	# Grab the lead player and resync it with all the others available in the group
    	for P in ${FOLLOWERS[$G]}; do
    		[[ "${P}" == "${LEADER[$G]}" ]] && continue
    		"${SQUEEZY}" -silent -"${LEADER[$G]}" -sync "${P}"
    	done
    	# Set our leader on the chosen program. All synced players will follow.
    	"${SQUEEZY}" -silent -"${LEADER[$G]}" -json "playlist add ${GROUP_PROGS[$(( G ))]}"
    done
    
    for G in "${SQUEEZY_GROUPS[@]}"; do
    	# Start our leaders - Fade-in max is 119 secs apparently.
    	FADEIN=119
    	"${SQUEEZY}" -silent -"${LEADER[$G]}" -json "play $(( FADEIN ))"
    done
    (The actual code has to "eval" the JSON statements, because there is need to interpolate variables and also pass quotes literally. Urgh.)

    The config file that goes with it looks like this, players-wise:
    Code:
    playerdiscover no
    # Group 0: Zone #1
    player 0 pcp1R 192.168.1.150 b8:27:eb:01:01:01
    player 0 pcp2R 192.168.1.151 b8:27:eb:02:02:02
    player 0 pcp3R 192.168.1.152 b8:27:eb:03:03:03
    # Group 1: Zone #2
    player 1 pcp1L 192.168.1.153 b8:27:eb:05:05:05
    player 1 pcp2L 192.168.1.154 b8:27:eb:06:06:06
    # Group 2: elsewhere
    player 2 Berlin-Boombox 192.168.1.155 02:02:02:43:ef:99
    I've run the actual code and it does produce smooth take-off of the sync groups.
    3 SB 3 • Libratone Loop, Zipp Mini • iPeng (iPhone + iPad) • LMS 7.9 (linux) with plugins: CD Player, WaveInput, Triode's BBC iPlayer by bpa • IRBlaster by Gwendesign (Felix) • Server Power Control by Gordon Harris • Smart Mix, Music Walk With Me, What Was That Tune? by Michael Herger • PowerSave by Jason Holtzapple • Song Info, Song Lyrics by Erland Isaksson • AirPlay Bridge by philippe_44 • WeatherTime by Martin Rehfeld • Auto Dim Display, SaverSwitcher, ContextMenu by Peter Watkins.

  6. #36
    Senior Member teeitup's Avatar
    Join Date
    Dec 2007
    Location
    S.F. Bay Area
    Posts
    142
    I have had a lot of fun configuring my system withe various cron jobs, aliases, and shortcuts.
    With the help of posts to this thread I've been able to automate continuous random play (my favorite mode), radio station for morning wake up, and even my wife's Pandora station for evening play.

    The only function I haven't been able to figure out is clearing the playlist. Removing an individual track is easy but clearing the playlist has proved to be elusive.

    Shutting off the players works but is clumsy when there are multiple players in a sync group.

    Any ideas?

    Thanks,
    ----------------------------------------------------------
    Logitech Media Server Version: 7.9.1 - 1503129892 @ Sun Aug 20 04:39:12 UTC 2017
    OS: Debian - EN - utf8
    Platform: i686-linux
    Perl Version: 5.24.1 - i686-linux-gnu-thread-multi-64int
    Database Version: DBD::SQLite 1.34_01 (sqlite 3.7.7.1)
    Total Players Recognized: 4

    Squeezebox3:
    Firmware: 137

    Duet: (2 receivers, 1 controller)
    Firmware: 77

    Boom
    Firmware: 57
    ----------------------------------------------------------

  7. #37
    Senior Member
    Join Date
    Apr 2008
    Location
    Paris, France
    Posts
    2,111
    For me this works:
    Code:
    $ squeezy -pcp3l -play playlist://clear
    keys on reference is experimental at /usr/local/bin/squeezy line 812.
    pcp3l selected
    pcp3l genre 
    pcp3l artist 
    pcp3l album 
    pcp3l title 
    pcp3l duration 
    pcp3l time 0
    pcp3l remote 
    pcp3l current_title 
    pcp3l path
    However I have slightly modified (uncommented) stuff in squeezy.pl around line 812. Does it work for you as is?

    And while I am at it, note to myself: CLI query to assign a player to a virtual library.
    Last edited by epoch1970; 2017-07-15 at 03:07.
    3 SB 3 • Libratone Loop, Zipp Mini • iPeng (iPhone + iPad) • LMS 7.9 (linux) with plugins: CD Player, WaveInput, Triode's BBC iPlayer by bpa • IRBlaster by Gwendesign (Felix) • Server Power Control by Gordon Harris • Smart Mix, Music Walk With Me, What Was That Tune? by Michael Herger • PowerSave by Jason Holtzapple • Song Info, Song Lyrics by Erland Isaksson • AirPlay Bridge by philippe_44 • WeatherTime by Martin Rehfeld • Auto Dim Display, SaverSwitcher, ContextMenu by Peter Watkins.

  8. #38
    Senior Member teeitup's Avatar
    Join Date
    Dec 2007
    Location
    S.F. Bay Area
    Posts
    142
    squeezy -pcp3l -play playlist://clear
    Initial CLI testing has been successful. I will incorporate it into the cronjob.

    Thank you,
    ----------------------------------------------------------
    Logitech Media Server Version: 7.9.1 - 1503129892 @ Sun Aug 20 04:39:12 UTC 2017
    OS: Debian - EN - utf8
    Platform: i686-linux
    Perl Version: 5.24.1 - i686-linux-gnu-thread-multi-64int
    Database Version: DBD::SQLite 1.34_01 (sqlite 3.7.7.1)
    Total Players Recognized: 4

    Squeezebox3:
    Firmware: 137

    Duet: (2 receivers, 1 controller)
    Firmware: 77

    Boom
    Firmware: 57
    ----------------------------------------------------------

Posting Permissions

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