Home of the Squeezebox™ & Transporter® network music players.
Page 4 of 4 FirstFirst ... 234
Results 31 to 35 of 35
  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,005
    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,005
    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,005
    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.

Posting Permissions

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