From 443ce8653bfa1e826942782cd818a4d596c2a2e5 Mon Sep 17 00:00:00 2001 From: Ronald Record Date: Tue, 20 Feb 2024 16:08:59 -0800 Subject: [PATCH] Add capability to transfer zones, bump minor release, update changelog --- CHANGELOG.md | 5 +- README.md | 227 ++++++++++++++++++----------------- VERSION | 2 +- api/transfer_zone.py | 77 ++++++++++++ bin/roon | 39 ++++-- bin/transfer_zone | 63 ++++++++++ etc/postinstall | 2 +- man/man1/transfer_zone.1 | 94 +++++++++++++++ markdown/transfer_zone.1.md | 54 +++++++++ pkg/release.md | 2 + usage.txt | 228 +++++++++++++++++++----------------- 11 files changed, 564 insertions(+), 229 deletions(-) create mode 100644 api/transfer_zone.py create mode 100755 bin/transfer_zone create mode 100644 man/man1/transfer_zone.1 create mode 100644 markdown/transfer_zone.1.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 597ef86..71a6d39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,11 @@ All notable changes to this project will be documented in this file. -Unreleased : +Feb 20, 2024 : RoonCommandLine version 2.1.0 release 4 - This is a bug fix release: + This release adds the capability to transfer the current queue to another zone: + * Add 'transfer_zone' command and Python backend * Stop core discovery after core discovered Feb 14, 2024 : diff --git a/README.md b/README.md index 834b354..bef8ef0 100644 --- a/README.md +++ b/README.md @@ -645,55 +645,64 @@ is presented from which the user can select commands and queries. Here is the current output of "roon -u" which displays a usage message. ``` -Usage: roon -A album -a artist -C composer -f [on|onlog|off|status] -g genre -G zone_group -i - -l [albums|artists|artalbums|arttracks|composers|comalbums|genres|genalbums|genartists|playlists|playtracks|tags|zones] - -c [group|ungroup|play|play_all|pause|pause_all|stop|stop_all|next|previous|shuffle|repeat|mute|mute_all] - -s search -p playlist -T track -t tag -z zone -L -S -r radio - -X ex_album -x ex_artist [-EuU] +Usage: roon -A album -a artist -C composer -D destination zone + -F [from zone] -f [on|onlog|off|status] -g genre -G zone_group -i + -l [albums|artists|artalbums|arttracks|composers|comalbums| + genres|genalbums|genartists|playlists|playtracks|tags|zones] + -c [group|ungroup|play|play_all|pause|pause_all|stop|stop_all| + next|previous|shuffle|repeat|mute|mute_all] + -s search -p playlist -T track -t tag -z zone -L -S -r radio + -X ex_album -x ex_artist [-EuU] Where: - -A album selects an album to play - -a artist selects an artist to list/play - -C composer selects a composer to play - -g genre selects a genre to list/play - -i displays zone information (combine with '-z zone' for extended - info on a specified zone, otherwise display info on all zones) - -f [on|onlog|off|status] enables/disables fading/logging in specified zone - 'on' enables fading, 'onlog' fading and logging, 'off' disables fading - (combine with '-z zone' for 'fading' in that zone) - -n displays 'now playing' information for zones actively playing - -N displays 'now playing' information for all zones - (combine with '-z zone' for 'now playing' in only that zone) - -p playlist selects a playlist to play - -G zone_group specifies a zone grouping specified in roon_api.ini - -L setup roon to execute local commands rather than remote via SSH - -S Set Roon defaults in roon_api.ini - -l [albums|artists|artalbums|arttracks|composers|comalbums|genres|genalbums|genartists|playlists|playtracks|tags|zones] - indicates list albums, artists, albums by artist, composers, albums by composers, genres, albums in genre, artists in genre, playlists, tags, or Roon zones - -r radio selects a live radio stream to play - -s search specifies a term to search for in the lists retrieved with -l - -T track specifies a track to play - -t tag selects an tag to play - -z zone selects the Roon Zone in which to play - -c [group|ungroup|play|play_all|pause|pause_all|playpause|stop|stop_all|next|previous|shuffle|repeat|mute|mute_all] - issues the command in the selected zone - 'mute' toggles the zone's muted or unmuted state - 'mute_all' toggles all zones' muted or unmuted state - 'pause_all' pauses playback in all zones - 'play_all' begins playback in all zones - 'stop_all' stops playback in all zones and releases devices - 'shuffle' toggles the zone's shuffled or unshuffled setting - 'repeat' toggles the zone's looping or non-looping setting - -v volume sets the volume level in the selected zone - The volume argument has the format [g:][r:][s:]num - Where 'g' indicates set volume for all zones in the group - 'r' specifies use relative method volume setting - 's' specifies use relative_step method volume setting - 'num' can be absolute, relative, and negative or positive - -X ex_album specifies a string to exclude from album/genre names - -x ex_artist specifies a string to exclude from artist/composer/playlist names - -u displays a full usage message with examples - -U displays a usage message without examples - -E displays examples with no usage message + -A album selects an album to play + -a artist selects an artist to list/play + -C composer selects a composer to play + -D destination zone specifies the zone to transfer current queue to + -F from zone specifies the zone to transfer from (default: last played) + -g genre selects a genre to list/play + -i displays zone information (combine with '-z zone' for extended + info on a specified zone, otherwise display info on all zones) + -f [on|onlog|off|status] enables/disables fading/logging in specified zone + 'on' enables fading, 'onlog' fading and logging, 'off' disables fading + (combine with '-z zone' for 'fading' in that zone) + -n displays 'now playing' information for zones actively playing + -N displays 'now playing' information for all zones + (combine with '-z zone' for 'now playing' in only that zone) + -p playlist selects a playlist to play + -G zone_group specifies a zone grouping specified in roon_api.ini + -L setup roon to execute local commands rather than remote via SSH + -S Set Roon defaults in roon_api.ini + -l [albums|artists|artalbums|arttracks|composers|comalbums| + genres|genalbums|genartists|playlists|playtracks|tags|zones] + indicates list albums, artists, albums by artist, + composers, albums by composers, genres, albums in genre, + artists in genre, playlists, tags, or Roon zones + -r radio selects a live radio stream to play + -s search specifies a term to search for in the lists retrieved with -l + -T track specifies a track to play + -t tag selects an tag to play + -z zone selects the Roon Zone in which to play + -c [group|ungroup|play|play_all|pause|pause_all|playpause| + stop|stop_all|next|previous|shuffle|repeat|mute|mute_all] + issues the command in the selected zone + 'roon -c mute' toggles the zone's muted or unmuted state + 'roon -c mute_all' toggles all zones' muted or unmuted state + 'roon -c pause_all' pauses playback in all zones + 'roon -c play_all' begins playback in all zones + 'roon -c stop_all' stops playback in all zones and releases devices + 'roon -c shuffle' toggles the zone's shuffled or unshuffled setting + 'roon -c repeat' toggles the zone's looping or non-looping setting + -v volume sets the volume level in the selected zone + The volume argument has the format [g:][r:][s:]num + Where 'g' indicates set volume for all zones in the group + 'r' specifies use relative method volume setting + 's' specifies use relative_step method volume setting + 'num' can be absolute, relative, and negative or positive + -X ex_album specifies a string to exclude from album/genre names + -x ex_artist specifies a string to exclude from artist/composer/playlist names + -u displays a full usage message with examples + -U displays a usage message without examples + -E displays examples with no usage message Combine '-a artist' and '-A album' to play an album by a specified artist Combine '-a artist' and '-T track' to play a track by a specified artist Combine '-a artist' or '-A album' with '-g genre' to play an artist or album in a specified genre @@ -702,67 +711,67 @@ Special search term __all__ matches all entries Special name default plays the default setting in roon_api.ini Example invocations - Play artist: - roon -a "Deep Purple" - Play album by artist: - roon -a "Deep Purple" -A Burn - Play track by artist: - roon -a "Aretha Franklin" -T Think - Play artist in specified zone: - roon -a "Jethro Tull" -z "Mac Pro DAC" - Play genre: - roon -g Classical - Play default live radio: - roon -r default - Play playlist: - roon -p "Bowie Favs" - Play next track: - roon -c next - Stop play in specified zone: - roon -c stop -z Kitchen - Mute/Unmute a specified zone: - roon -c mute -z "Mac Pro DAC" - Mute/Unmute all zones: - roon -c mute_all - List all playlists containing the string 'Best': - roon -l playlists -s Best - List albums by artist: - roon -l artalbums -a "Deep Purple" - List artists containing the string 'Will' in the 'Country' genre: - roon -l genartists -a Will -g Country - List albums containing the string 'Magic' in the 'Rock' genre: - roon -l genalbums -A Magic -g Rock - Play artist containing the string 'Willie' in the 'Country' genre: - roon -a Willie -g Country - Play album containing the string 'Magic' in the 'Rock' genre: - roon -A Magic -g Rock - Group the zones listed in roon_api.ini Group_foobar: - roon -G foobar -c group - Set the volume level to 50 in the currently active zone - roon -v 50 - Decrease the volume level by 10 in the currently active zone - roon -v r:-10 - Set the volume level to 40 in all zones grouped with the zone named 'Mac Pro DAC' - roon -v g:40 -z 'Mac Pro DAC' - Increase the volume level by 20 in all zones grouped with the zone named 'Mac Pro DAC' - roon -v g:r:20 -z 'Mac Pro DAC' - Get info on all Roon zones - roon -i - Get extended info on Roon zone named 'Mac Pro DAC' - roon -i -z 'Mac Pro DAC' - Get now playing info on all zones regardless of state - roon -N - Get now playing info on all zones actively playing - roon -n - Get now playing info on Roon zone named 'Mac Pro DAC' - roon -n -z 'Mac Pro DAC' - Enable volume fading in default Roon zone - roon -f on - Disable volume fading in default Roon zone - roon -f off - NOTE: Use quotes to specify media names which contain spaces. - For example, to play the album 'Love Bomb': - roon -A "Love Bomb" + Play artist: + roon -a "Deep Purple" + Play album by artist: + roon -a "Deep Purple" -A Burn + Play track by artist: + roon -a "Aretha Franklin" -T Think + Play artist in specified zone: + roon -a "Jethro Tull" -z "Mac Pro DAC" + Play genre: + roon -g Classical + Play default live radio: + roon -r default + Play playlist: + roon -p "Bowie Favs" + Play next track: + roon -c next + Stop play in specified zone: + roon -c stop -z Kitchen + Mute/Unmute a specified zone: + roon -c mute -z "Mac Pro DAC" + Mute/Unmute all zones: + roon -c mute_all + List all playlists containing the string 'Best': + roon -l playlists -s Best + List albums by artist: + roon -l artalbums -a "Deep Purple" + List artists containing the string 'Will' in the 'Country' genre: + roon -l genartists -a Will -g Country + List albums containing the string 'Magic' in the 'Rock' genre: + roon -l genalbums -A Magic -g Rock + Play artist containing the string 'Willie' in the 'Country' genre: + roon -a Willie -g Country + Play album containing the string 'Magic' in the 'Rock' genre: + roon -A Magic -g Rock + Group the zones listed in roon_api.ini Group_foobar: + roon -G foobar -c group + Set the volume level to 50 in the currently active zone + roon -v 50 + Decrease the volume level by 10 in the currently active zone + roon -v r:-10 + Set the volume level to 40 in all zones grouped with the zone named 'Mac Pro DAC' + roon -v g:40 -z 'Mac Pro DAC' + Increase the volume level by 20 in all zones grouped with the zone named 'Mac Pro DAC' + roon -v g:r:20 -z 'Mac Pro DAC' + Get info on all Roon zones + roon -i + Get extended info on Roon zone named 'Mac Pro DAC' + roon -i -z 'Mac Pro DAC' + Get now playing info on all zones regardless of state + roon -N + Get now playing info on all zones actively playing + roon -n + Get now playing info on Roon zone named 'Mac Pro DAC' + roon -n -z 'Mac Pro DAC' + Enable volume fading in default Roon zone + roon -f on + Disable volume fading in default Roon zone + roon -f off + NOTE: Use quotes to specify media names which contain spaces. + For example, to play the album 'Love Bomb': + roon -A "Love Bomb" ``` When playing media from the command line it is possible to specify a substring diff --git a/VERSION b/VERSION index bc8c19e..b0d9dc1 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ VERSION=2.1.0 -RELEASE=3 +RELEASE=4 diff --git a/api/transfer_zone.py b/api/transfer_zone.py new file mode 100644 index 0000000..df8bb4c --- /dev/null +++ b/api/transfer_zone.py @@ -0,0 +1,77 @@ +import argparse +import configparser +from os import path +import sys +from roonapi import RoonApi + +config = configparser.ConfigParser() +config.read('/usr/local/Roon/etc/roon_api.ini') + +# Set to IP address of your Roon Core +server = config['DEFAULT']['RoonCoreIP'] +# Set to Port of your Roon Core +port = config['DEFAULT']['RoonCorePort'] +# Name of the file that holds a Roon API token +tokenfile = config['DEFAULT']['TokenFileName'] + +parser = argparse.ArgumentParser() +parser.add_argument("-f", "--source", help="from zone") +parser.add_argument("-t", "--to", help="to zone") +args = parser.parse_args() + +if args.source: + fromzone = args.source +else: + fromzone = config['DEFAULT']['DefaultZone'] +if args.to: + tozone = args.to +else: + tozone = config['DEFAULT']['DefaultZone'] + +version = config['DEFAULT']['RoonCommandLineVersion'] +release = config['DEFAULT']['RoonCommandLineRelease'] +fullver = version + "-" + release + +appinfo = { + "extension_id": "roon_command_line", + "display_name": "Python library for Roon", + "display_version": fullver, + "publisher": "RoonCommandLine", + "email": "roon@ronrecord.com", + "website": "https://github.com/doctorfree/RoonCommandLine", +} + +# Can be None if you don't yet have a token +if path.exists(tokenfile): + token = open(tokenfile).read() +else: + token = "None" + +roonapi = RoonApi(appinfo, token, server, port) + +# save the token for next time +with open(tokenfile, "w") as f: + f.write(str(roonapi.token)) + +# get to and from zone output_ids +outputs = roonapi.outputs + +from_output_id = None +to_output_id = None +for (k, v) in outputs.items(): + if fromzone in v["display_name"]: + from_output_id = k + if tozone in v["display_name"]: + to_output_id = k + +if from_output_id is None: + err = "No zone found matching " + fromzone + sys.exit(err) + +if to_output_id is None: + err = "No zone found matching " + tozone + sys.exit(err) +else: + # Transfer zones + print("Transfering from zone", fromzone, "to zone", tozone) + roonapi.transfer_zone(from_output_id, to_output_id) diff --git a/bin/roon b/bin/roon index 64c4864..ea90867 100755 --- a/bin/roon +++ b/bin/roon @@ -44,6 +44,8 @@ artalbumlist= arttracklist= composerlist= comalbumlist= +dest_zone= +from_zone= exalbum= exartist= genrelist= @@ -70,8 +72,8 @@ have_rich=$(type -p rich) usage() { [ "${showusage}" ] && { if [ "${have_rich}" ]; then - rich "[bold]Usage:[/] [bold italic green]roon[/] [cyan]-A[/] [yellow]album[/] [cyan]-a[/] [yellow]artist[/] [cyan]-C[/] [yellow]composer[/]" --print - rich " [cyan]-f[/] [yellow]\[on|onlog|off|status][/] [cyan]-g[/] [yellow]genre[/] [cyan]-G[/] [yellow]zone_group[/] [cyan]-i[/]" --print + rich "[bold]Usage:[/] [bold italic green]roon[/] [cyan]-A[/] [yellow]album[/] [cyan]-a[/] [yellow]artist[/] [cyan]-C[/] [yellow]composer[/] [cyan]-D[/] [yellow]destination zone[/]" --print + rich " [cyan]-F[/] [yellow]\[from zone][/] [cyan]-f[/] [yellow]\[on|onlog|off|status][/] [cyan]-g[/] [yellow]genre[/] [cyan]-G[/] [yellow]zone_group[/] [cyan]-i[/]" --print rich " [cyan]-l[/] [yellow]\[albums|artists|artalbums|arttracks|composers|comalbums|[/]" --print rich " [yellow]genres|genalbums|genartists|playlists|playtracks|tags|zones][/]" --print rich " [cyan]-c[/] [yellow]\[group|ungroup|play|play_all|pause|pause_all|stop|stop_all|[/]" --print @@ -79,10 +81,11 @@ usage() { rich " [cyan]-s[/] [yellow]search[/] [cyan]-p[/] [yellow]playlist[/] [cyan]-T[/] [yellow]track[/] [cyan]-t[/] [yellow]tag[/] [cyan]-z[/] [yellow]zone[/] [cyan]-L[/] [cyan]-S[/] [cyan]-r[/] [yellow]radio[/]" --print rich " [cyan]-X[/] [yellow]ex_album[/] [cyan]-x[/] [yellow]ex_artist[/] [cyan]\[-EuU][/]" --print rich "[bold]Where:[/]" --print - printf "\n" rich " [cyan]-A[/] [yellow]album[/] selects an album to play" --print rich " [cyan]-a[/] [yellow]artist[/] selects an artist to list/play" --print rich " [cyan]-C[/] [yellow]composer[/] selects a composer to play" --print + rich " [cyan]-D[/] [yellow]destination zone[/] specifies the zone to transfer current queue to" --print + rich " [cyan]-F[/] [yellow]from zone[/] specifies the zone to transfer from (default: last played)" --print rich " [cyan]-g[/] [yellow]genre[/] selects a genre to list/play" --print rich " [cyan]-i[/] displays zone information (combine with '[cyan]-z[/] [yellow]zone[/]' for extended" --print rich " info on a specified zone, otherwise display info on all zones)" --print @@ -135,8 +138,8 @@ usage() { rich "Special name [bold italic green]default[/] plays the default setting in roon_api.ini" --print printf "\n" else - printf "\nUsage: roon -A album -a artist -C composer" - printf "\n\t-f [on|onlog|off|status] -g genre -G zone_group -i" + printf "\nUsage: roon -A album -a artist -C composer -D destination zone" + printf "\n\t-F [from zone] -f [on|onlog|off|status] -g genre -G zone_group -i" printf "\n\t-l [albums|artists|artalbums|arttracks|composers|comalbums|" printf "\n\t genres|genalbums|genartists|playlists|playtracks|tags|zones]" printf "\n\t-c [group|ungroup|play|play_all|pause|pause_all|stop|stop_all|" @@ -146,6 +149,8 @@ usage() { printf "\nWhere:\n\t-A album selects an album to play" printf "\n\t-a artist selects an artist to list/play" printf "\n\t-C composer selects a composer to play" + printf "\n\t-D 'destination zone' specifies the zone to transfer current queue to" + printf "\n\t-F 'from zone' specifies the zone to transfer from (default: last played)" printf "\n\t-g genre selects a genre to list/play" printf "\n\t-i displays zone information (combine with '-z zone' for extended" printf "\n\t\tinfo on a specified zone, otherwise display info on all zones)" @@ -415,7 +420,7 @@ select_zone() { zone_options+=("Defaults Menu" "Main Menu" "Quit (q)") while true; do [ "${have_rich}" ] && { - rich "[bold][cyan]RoonCommandLine Zones[/cyan][/bold]" -p -a rounded -c -C + rich "[bold][cyan]Select Roon Zone[/cyan][/bold]" -p -a rounded -c -C } PS3="${BOLD}Please enter the Roon zone you wish to use (numeric or text): ${NORMAL}" select opt in "${zone_options[@]}"; do @@ -1091,7 +1096,7 @@ info= now_playing= fading= logfade= -while getopts A:a:c:C:f:g:G:inNp:T:t:z:l:s:LSr:v:x:X:EuU flag; do +while getopts A:a:c:C:D:f:F:g:G:inNp:T:t:z:l:s:LSr:v:x:X:EuU flag; do case $flag in A) album="$OPTARG" @@ -1105,6 +1110,12 @@ while getopts A:a:c:C:f:g:G:inNp:T:t:z:l:s:LSr:v:x:X:EuU flag; do C) composer="$OPTARG" ;; + D) + dest_zone="$OPTARG" + ;; + F) + from_zone="$OPTARG" + ;; f) fading="$OPTARG" case ${fading} in @@ -1322,6 +1333,20 @@ done fi } +# Transfer Zone +[ "$dest_zone" ] && { + [ "$from_zone" ] || from_zone="${ROON_ZONE}" + if [ "${LOCAL}" = true ]; then + ${ROON}/bin/transfer_zone "$from_zone" "$dest_zone" + else + ssh $user@$server bash -l -c "${ROON}/bin/transfer_zone \"$from_zone\" \"$dest_zone\"" + fi + status=$? + [ ${status} -eq 0 ] || { + echo "Unable to transfer zone to zone = $dest_zone" + } +} + [ "${fading}" ] && { [ "${fading}" == "status" ] && fading= if [ "${LOCAL}" = true ]; then diff --git a/bin/transfer_zone b/bin/transfer_zone new file mode 100755 index 0000000..2e4dd89 --- /dev/null +++ b/bin/transfer_zone @@ -0,0 +1,63 @@ +#!/bin/bash +# +# shellcheck disable=SC1090,SC2220 + +ROON=/usr/local/Roon +ROONAPI=${ROON}/api +ROONETC=${ROON}/etc +ROONCONF=${ROONETC}/pyroonconf +TRAN=transfer_zone.py +FROM_ZONE= +TO_ZONE= + +[ -d ${ROONAPI} ] || exit 1 + +cd ${ROONAPI} || exit 1 + +[ -f $TRAN ] || exit 2 + +# First argument is from zone, second is to zone (required) +# If only one argument, use default zone as from and argument as to +if [ "$2" ]; then + FROM_ZONE="$1" + TO_ZONE="$2" +else + TO_ZONE="$1" +fi +[ "${TO_ZONE}" ] || { + printf "\nUsage: transfer_zone " + printf "\nAt least required. Exiting.\n" + exit 1 +} + +# Use a Python virtual environment +[ -f ${ROON}/venv/bin/activate ] && source ${ROON}/venv/bin/activate +[[ ":$PATH:" == *":/usr/local/Roon/venv/bin:"* ]] || { + export PATH=/usr/local/Roon/venv/bin:${PATH} +} + +# Get the zone if it is set +if [ -f ${ROONCONF} ] +then + . ${ROONCONF} +else + DEFZONE=$(grep ^DefaultZone ${ROONETC}/roon_api.ini | awk -F '=' ' { print $2 } ') + ${ROON}/bin/set_zone "${DEFZONE}" + . ${ROONCONF} +fi + +# Get the default from zone if one is not provided +[ "${FROM_ZONE}" ] || { + FROM_ZONE="${ROON_ZONE}" + # Remove leading and trailing spaces in FROM_ZONE + FROM_ZONE="$(echo -e "${FROM_ZONE}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" +} + +have_python3=$(type -p python3) +if [ "${have_python3}" ] +then + python3 $TRAN -f "$FROM_ZONE" -t "$TO_ZONE" +else + python $TRAN -f "$FROM_ZONE" -t "$TO_ZONE" +fi +${ROON}/bin/set_zone "${TO_ZONE}" diff --git a/etc/postinstall b/etc/postinstall index f093f17..5163190 100755 --- a/etc/postinstall +++ b/etc/postinstall @@ -55,7 +55,7 @@ if [ -f "${ROON_DOC}/VERSION" ]; then else # Should not happen but if it did we fake it version="2.1.0" - release="3" + release="4" fi # Copy in distributed roon_api.ini template if no previous one exists diff --git a/man/man1/transfer_zone.1 b/man/man1/transfer_zone.1 new file mode 100644 index 0000000..5b193f1 --- /dev/null +++ b/man/man1/transfer_zone.1 @@ -0,0 +1,94 @@ +.\" Automatically generated by Pandoc 2.19.2 +.\" +.\" Define V font for inline verbatim, using C font in formats +.\" that render this, and otherwise B font. +.ie "\f[CB]x\f[]"x" \{\ +. ftr V B +. ftr VI BI +. ftr VB B +. ftr VBI BI +.\} +.el \{\ +. ftr V CR +. ftr VI CI +. ftr VB CB +. ftr VBI CBI +.\} +.TH "TRANSFER_ZONE" "1" "February 20, 2024" "transfer_zone 2.0.1" "User Manual" +.hy +.SH NAME +.PP +transfer_zone - Transfer the current queue from one zone to another +.IP +.nf +\f[C] + from_zone_or_output_id - The source zone or output + to_zone_or_output_id - The destination zone or output + \[dq]\[dq]\[dq] + data = { + \[dq]from_zone_or_output_id\[dq]: from_zone_or_output_id, + \[dq]to_zone_or_output_id\[dq]: to_zone_or_output_id, + } + return self._request(SERVICE_TRANSPORT + \[dq]/transfer_zone\[dq], data) +\f[R] +.fi +.SH SYNOPSIS +.PP +\f[B]transfer_zone\f[R] [ FROM_ZONE ] TO_ZONE +.SH DESCRIPTION +.PP +Transfers the current queue from one Roon zone to another. +The first argument specifies the source zone and the second argument +specifies the destination zone. +If no source zone is specified then the source zone is set to the last +played zone and the destination zone is set to the first argument. +.SH COMMAND LINE OPTIONS +.TP +\f[B]FROM_ZONE\f[R] +The source Roon zone can be specified on the command line as the first +argument. +If no second argument is provided then the source zone is the last +played zone. +.TP +\f[B]TO_ZONE\f[R] +The destination Roon zone can be specified on the command line as the +second argument or, if no source zone is provided as the first argument +then the first argument is taken to be the destination zone. +.SH EXAMPLES +.TP +\f[B]transfer_zone HomePod \[dq]WiiM Pro\[dq]\f[R] +Transfers the current queue from the Roon zone \[dq]HomePod\[dq] to the +Roon zone \[dq]WiiM Pro\[dq] +.SH AUTHORS +.PP +Written by Ronald Record +.SH LICENSING +.PP +TRANSFER_ZONE is distributed under an Open Source license. +See the file LICENSE in the TRANSFER_ZONE source distribution for +information on terms & conditions for accessing and otherwise using +TRANSFER_ZONE and for a DISCLAIMER OF ALL WARRANTIES. +.SH BUGS +.PP +Submit bug reports online at: + +.SH SEE ALSO +.PP +\f[B]clone_pyroon\f[R](1), \f[B]get_core_ip\f[R](1), +\f[B]get_zone_info\f[R](1), \f[B]now_playing\f[R](1), +\f[B]list_albums\f[R](1), \f[B]list_artist_albums\f[R](1), +\f[B]list_artists\f[R](1), \f[B]list_composers\f[R](1), +\f[B]list_genre_albums\f[R](1), \f[B]list_genre_artists\f[R](1), +\f[B]list_genres\f[R](1), \f[B]list_playlists\f[R](1), +\f[B]list_radio\f[R](1), \f[B]list_tags\f[R](1), +\f[B]list_zones\f[R](1), \f[B]play_album\f[R](1), +\f[B]play_artist\f[R](1), \f[B]play_artist_album\f[R](1), +\f[B]play_artist_track\f[R](1), \f[B]play_composer\f[R](1), +\f[B]play_genre\f[R](1), \f[B]play_genre_album\f[R](1), +\f[B]play_genre_artist\f[R](1), \f[B]play_playlist\f[R](1), +\f[B]play_radio\f[R](1), \f[B]play_tag\f[R](1), \f[B]roon\f[R](1), +\f[B]set_zone\f[R](1), \f[B]set_zone_group\f[R](1), +\f[B]zone_command\f[R](1) +.PP +Full documentation and sources at: + diff --git a/markdown/transfer_zone.1.md b/markdown/transfer_zone.1.md new file mode 100644 index 0000000..6ff7c45 --- /dev/null +++ b/markdown/transfer_zone.1.md @@ -0,0 +1,54 @@ +--- +title: TRANSFER_ZONE +section: 1 +header: User Manual +footer: transfer_zone 2.0.1 +date: February 20, 2024 +--- +# NAME +transfer_zone - Transfer the current queue from one zone to another + + from_zone_or_output_id - The source zone or output + to_zone_or_output_id - The destination zone or output + """ + data = { + "from_zone_or_output_id": from_zone_or_output_id, + "to_zone_or_output_id": to_zone_or_output_id, + } + return self._request(SERVICE_TRANSPORT + "/transfer_zone", data) + + +# SYNOPSIS +**transfer_zone** [ FROM_ZONE ] TO_ZONE + +# DESCRIPTION +Transfers the current queue from one Roon zone to another. The first argument specifies the source zone and the second argument specifies the destination zone. If no source zone is specified then the source zone is set to the last played zone and the destination zone is set to the first argument. + +# COMMAND LINE OPTIONS +**FROM_ZONE** +: The source Roon zone can be specified on the command line as the first argument. If no second argument is provided then the source zone is the last played zone. + +**TO_ZONE** +: The destination Roon zone can be specified on the command line as the second argument or, if no source zone is provided as the first argument then the first argument is taken to be the destination zone. + +# EXAMPLES +**transfer_zone HomePod "WiiM Pro"** +: Transfers the current queue from the Roon zone "HomePod" to the Roon zone "WiiM Pro" + +# AUTHORS +Written by Ronald Record github@ronrecord.com + +# LICENSING +TRANSFER_ZONE is distributed under an Open Source license. +See the file LICENSE in the TRANSFER_ZONE source distribution +for information on terms & conditions for accessing and +otherwise using TRANSFER_ZONE and for a DISCLAIMER OF ALL WARRANTIES. + +# BUGS +Submit bug reports online at: https://github.com/doctorfree/RoonCommandLine/issues + +# SEE ALSO +**clone_pyroon**(1), **get_core_ip**(1), **get_zone_info**(1), **now_playing**(1), **list_albums**(1), **list_artist_albums**(1), **list_artists**(1), **list_composers**(1), **list_genre_albums**(1), **list_genre_artists**(1), **list_genres**(1), **list_playlists**(1), **list_radio**(1), **list_tags**(1), **list_zones**(1), **play_album**(1), **play_artist**(1), **play_artist_album**(1), **play_artist_track**(1), **play_composer**(1), **play_genre**(1), **play_genre_album**(1), **play_genre_artist**(1), **play_playlist**(1), **play_radio**(1), **play_tag**(1), **roon**(1), **set_zone**(1), **set_zone_group**(1), **zone_command**(1) + +Full documentation and sources at: https://github.com/doctorfree/RoonCommandLine + diff --git a/pkg/release.md b/pkg/release.md index addd4f2..2cbea8c 100644 --- a/pkg/release.md +++ b/pkg/release.md @@ -1,5 +1,7 @@ # RoonCommandLine Release Notes +RoonCommandLine version 2.1.0 release 4 adds the capability to transfer the current queue from one Roon zone to another + RoonCommandLine version 2.1.0 release 3 moves to a Python virtual environment to support Ubuntu 23.04, Debian 12, and later RoonCommandLine version 2.0.8 release 5 is a minor bug fix release and provides PEP 8 conformance diff --git a/usage.txt b/usage.txt index 83739dd..9a20034 100644 --- a/usage.txt +++ b/usage.txt @@ -1,52 +1,61 @@ -Usage: roon -A album -a artist -C composer -f [on|onlog|off|status] -g genre -G zone_group -i - -l [albums|artists|artalbums|arttracks|composers|comalbums|genres|genalbums|genartists|playlists|playtracks|tags|zones] - -c [group|ungroup|play|play_all|pause|pause_all|stop|stop_all|next|previous|shuffle|repeat|mute|mute_all] - -s search -p playlist -T track -t tag -z zone -L -S -r radio - -X ex_album -x ex_artist [-EuU] +Usage: roon -A album -a artist -C composer -D destination zone + -F [from zone] -f [on|onlog|off|status] -g genre -G zone_group -i + -l [albums|artists|artalbums|arttracks|composers|comalbums| + genres|genalbums|genartists|playlists|playtracks|tags|zones] + -c [group|ungroup|play|play_all|pause|pause_all|stop|stop_all| + next|previous|shuffle|repeat|mute|mute_all] + -s search -p playlist -T track -t tag -z zone -L -S -r radio + -X ex_album -x ex_artist [-EuU] Where: - -A album selects an album to play - -a artist selects an artist to list/play - -C composer selects a composer to play - -g genre selects a genre to list/play - -i displays zone information (combine with '-z zone' for extended - info on a specified zone, otherwise display info on all zones) - -f [on|onlog|off|status] enables/disables fading/logging in specified zone - 'on' enables fading, 'onlog' fading and logging, 'off' disables fading - (combine with '-z zone' for 'fading' in that zone) - -n displays 'now playing' information for zones actively playing - -N displays 'now playing' information for all zones - (combine with '-z zone' for 'now playing' in only that zone) - -p playlist selects a playlist to play - -G zone_group specifies a zone grouping specified in roon_api.ini - -L setup roon to execute local commands rather than remote via SSH - -S Set Roon defaults in roon_api.ini - -l [albums|artists|artalbums|arttracks|composers|comalbums|genres|genalbums|genartists|playlists|playtracks|tags|zones] - indicates list albums, artists, albums by artist, composers, albums by composers, genres, albums in genre, artists in genre, playlists, tags, or Roon zones - -r radio selects a live radio stream to play - -s search specifies a term to search for in the lists retrieved with -l - -T track specifies a track to play - -t tag selects an tag to play - -z zone selects the Roon Zone in which to play - -c [group|ungroup|play|play_all|pause|pause_all|playpause|stop|stop_all|next|previous|shuffle|repeat|mute|mute_all] - issues the command in the selected zone - 'mute' toggles the zone's muted or unmuted state - 'mute_all' toggles all zones' muted or unmuted state - 'pause_all' pauses playback in all zones - 'play_all' begins playback in all zones - 'stop_all' stops playback in all zones and releases devices - 'shuffle' toggles the zone's shuffled or unshuffled setting - 'repeat' toggles the zone's looping or non-looping setting - -v volume sets the volume level in the selected zone - The volume argument has the format [g:][r:][s:]num - Where 'g' indicates set volume for all zones in the group - 'r' specifies use relative method volume setting - 's' specifies use relative_step method volume setting - 'num' can be absolute, relative, and negative or positive - -X ex_album specifies a string to exclude from album/genre names - -x ex_artist specifies a string to exclude from artist/composer/playlist names - -u displays a full usage message with examples - -U displays a usage message without examples - -E displays examples with no usage message + -A album selects an album to play + -a artist selects an artist to list/play + -C composer selects a composer to play + -D destination zone specifies the zone to transfer current queue to + -F from zone specifies the zone to transfer from (default: last played) + -g genre selects a genre to list/play + -i displays zone information (combine with '-z zone' for extended + info on a specified zone, otherwise display info on all zones) + -f [on|onlog|off|status] enables/disables fading/logging in specified zone + 'on' enables fading, 'onlog' fading and logging, 'off' disables fading + (combine with '-z zone' for 'fading' in that zone) + -n displays 'now playing' information for zones actively playing + -N displays 'now playing' information for all zones + (combine with '-z zone' for 'now playing' in only that zone) + -p playlist selects a playlist to play + -G zone_group specifies a zone grouping specified in roon_api.ini + -L setup roon to execute local commands rather than remote via SSH + -S Set Roon defaults in roon_api.ini + -l [albums|artists|artalbums|arttracks|composers|comalbums| + genres|genalbums|genartists|playlists|playtracks|tags|zones] + indicates list albums, artists, albums by artist, + composers, albums by composers, genres, albums in genre, + artists in genre, playlists, tags, or Roon zones + -r radio selects a live radio stream to play + -s search specifies a term to search for in the lists retrieved with -l + -T track specifies a track to play + -t tag selects an tag to play + -z zone selects the Roon Zone in which to play + -c [group|ungroup|play|play_all|pause|pause_all|playpause| + stop|stop_all|next|previous|shuffle|repeat|mute|mute_all] + issues the command in the selected zone + 'roon -c mute' toggles the zone's muted or unmuted state + 'roon -c mute_all' toggles all zones' muted or unmuted state + 'roon -c pause_all' pauses playback in all zones + 'roon -c play_all' begins playback in all zones + 'roon -c stop_all' stops playback in all zones and releases devices + 'roon -c shuffle' toggles the zone's shuffled or unshuffled setting + 'roon -c repeat' toggles the zone's looping or non-looping setting + -v volume sets the volume level in the selected zone + The volume argument has the format [g:][r:][s:]num + Where 'g' indicates set volume for all zones in the group + 'r' specifies use relative method volume setting + 's' specifies use relative_step method volume setting + 'num' can be absolute, relative, and negative or positive + -X ex_album specifies a string to exclude from album/genre names + -x ex_artist specifies a string to exclude from artist/composer/playlist names + -u displays a full usage message with examples + -U displays a usage message without examples + -E displays examples with no usage message Combine '-a artist' and '-A album' to play an album by a specified artist Combine '-a artist' and '-T track' to play a track by a specified artist Combine '-a artist' or '-A album' with '-g genre' to play an artist or album in a specified genre @@ -55,64 +64,65 @@ Special search term __all__ matches all entries Special name default plays the default setting in roon_api.ini Example invocations - Play artist: - roon -a "Deep Purple" - Play album by artist: - roon -a "Deep Purple" -A Burn - Play track by artist: - roon -a "Aretha Franklin" -T Think - Play artist in specified zone: - roon -a "Jethro Tull" -z "Mac Pro DAC" - Play genre: - roon -g Classical - Play default live radio: - roon -r default - Play playlist: - roon -p "Bowie Favs" - Play next track: - roon -c next - Stop play in specified zone: - roon -c stop -z Kitchen - Mute/Unmute a specified zone: - roon -c mute -z "Mac Pro DAC" - Mute/Unmute all zones: - roon -c mute_all - List all playlists containing the string 'Best': - roon -l playlists -s Best - List albums by artist: - roon -l artalbums -a "Deep Purple" - List artists containing the string 'Will' in the 'Country' genre: - roon -l genartists -a Will -g Country - List albums containing the string 'Magic' in the 'Rock' genre: - roon -l genalbums -A Magic -g Rock - Play artist containing the string 'Willie' in the 'Country' genre: - roon -a Willie -g Country - Play album containing the string 'Magic' in the 'Rock' genre: - roon -A Magic -g Rock - Group the zones listed in roon_api.ini Group_foobar: - roon -G foobar -c group - Set the volume level to 50 in the currently active zone - roon -v 50 - Decrease the volume level by 10 in the currently active zone - roon -v r:-10 - Set the volume level to 40 in all zones grouped with the zone named 'Mac Pro DAC' - roon -v g:40 -z 'Mac Pro DAC' - Increase the volume level by 20 in all zones grouped with the zone named 'Mac Pro DAC' - roon -v g:r:20 -z 'Mac Pro DAC' - Get info on all Roon zones - roon -i - Get extended info on Roon zone named 'Mac Pro DAC' - roon -i -z 'Mac Pro DAC' - Get now playing info on all zones regardless of state - roon -N - Get now playing info on all zones actively playing - roon -n - Get now playing info on Roon zone named 'Mac Pro DAC' - roon -n -z 'Mac Pro DAC' - Enable volume fading in default Roon zone - roon -f on - Disable volume fading in default Roon zone - roon -f off - NOTE: Use quotes to specify media names which contain spaces. - For example, to play the album 'Love Bomb': - roon -A "Love Bomb" + Play artist: + roon -a "Deep Purple" + Play album by artist: + roon -a "Deep Purple" -A Burn + Play track by artist: + roon -a "Aretha Franklin" -T Think + Play artist in specified zone: + roon -a "Jethro Tull" -z "Mac Pro DAC" + Play genre: + roon -g Classical + Play default live radio: + roon -r default + Play playlist: + roon -p "Bowie Favs" + Play next track: + roon -c next + Stop play in specified zone: + roon -c stop -z Kitchen + Mute/Unmute a specified zone: + roon -c mute -z "Mac Pro DAC" + Mute/Unmute all zones: + roon -c mute_all + List all playlists containing the string 'Best': + roon -l playlists -s Best + List albums by artist: + roon -l artalbums -a "Deep Purple" + List artists containing the string 'Will' in the 'Country' genre: + roon -l genartists -a Will -g Country + List albums containing the string 'Magic' in the 'Rock' genre: + roon -l genalbums -A Magic -g Rock + Play artist containing the string 'Willie' in the 'Country' genre: + roon -a Willie -g Country + Play album containing the string 'Magic' in the 'Rock' genre: + roon -A Magic -g Rock + Group the zones listed in roon_api.ini Group_foobar: + roon -G foobar -c group + Set the volume level to 50 in the currently active zone + roon -v 50 + Decrease the volume level by 10 in the currently active zone + roon -v r:-10 + Set the volume level to 40 in all zones grouped with the zone named 'Mac Pro DAC' + roon -v g:40 -z 'Mac Pro DAC' + Increase the volume level by 20 in all zones grouped with the zone named 'Mac Pro DAC' + roon -v g:r:20 -z 'Mac Pro DAC' + Get info on all Roon zones + roon -i + Get extended info on Roon zone named 'Mac Pro DAC' + roon -i -z 'Mac Pro DAC' + Get now playing info on all zones regardless of state + roon -N + Get now playing info on all zones actively playing + roon -n + Get now playing info on Roon zone named 'Mac Pro DAC' + roon -n -z 'Mac Pro DAC' + Enable volume fading in default Roon zone + roon -f on + Disable volume fading in default Roon zone + roon -f off + NOTE: Use quotes to specify media names which contain spaces. + For example, to play the album 'Love Bomb': + roon -A "Love Bomb" +