Closed pzim-devdata closed 1 year ago
Thanks for the comments!
if_coordinator
conditional modifier. Note that some commands already get automatically redirected to the coordinator for a group/pair.if_queue
and if_no_queue
conditional modifiersrelative_bass
(rb
) and relative_treble
(rt
) actions already existed, but I've added the rel_bass
and rel_treble
synonymsrelative_sub_gain
(rel_sub_gain
, rsg
) action_all_
speaker redirect. E.g., sonos _all_ info
will run the info
action for all speakers, although this doesn't quite have the selection of fields you're interested in.sonos _all_ track
will report the results of the track
action for all speakersmulti_group
(mg
) action that will group more than two speakers in a single action. Note that the target speaker will become the coordinator and the remaining speakers are the ones to be grouped (i.e., it operates differently to the group
action): sonos <coordinator_spkr> multi_group <grouped_spkr_one> <grouped_spkr_two> ...
. These changes are all released in soco-cli v0.4.65. Let me know if you encounter any problems.
It was so fast ! It’s more than I could imagine. Thank you so much ! It will be very usefull for me. I have tried and everything works fine. all info and all track works well but if speakers are grouped we just see the name of the coordinator, so we don’t know what are the states of the grouped speakers. i have tried sonos $speaker mg all but it didn’t worked but there is already party_mode and all means all not all-coordinator so it’s perfect ! Thank you again 😊
Thanks for testing.
_all_
info and_all_
track works well but if speakers are grouped we just see the name of the coordinator, so we don’t know what are the states of the grouped speakers.
I've modified the behaviour of _all_
to include non-coordinator speakers, which I think is probably more logical. Released in v0.4.66.
sonos _all_ info
andsonos _all_ track
works well.
There is a little print problem when using "line in" with sonos _all_ track
:
sonos _all_ track
:
AA:
Playback is stopped:
Channel: Radio.com
Elapsed: 0:00:00
BB: Using Line In (state: PAUSED_PLAYBACK)
CC: Using Line In (state: PAUSED_PLAYBACK)
DD: Using Line In (state: PAUSED_PLAYBACK)
EE: Using Line In (state: PAUSED_PLAYBACK)
FF:
Playback is stopped:
Elapsed: 0:00:00
GG:
Playback is paused:
Artist: Kalax
Album: Kalax
Title: Carousel (feat. World Wild)
Playlist Position: 1
Duration: 0:04:00
Elapsed: 0:00:01
instead of :
AA:
Playback is stopped:
Channel: Radio.com
Elapsed: 0:00:00
BB:
Using Line In (state: PAUSED_PLAYBACK)
CC:
Using Line In (state: PAUSED_PLAYBACK)
DD:
Using Line In (state: PAUSED_PLAYBACK)
EE:
Using Line In (state: PAUSED_PLAYBACK)
FF:
Playback is stopped:
Elapsed: 0:00:00
GG:
Playback is paused:
Artist: Kalax
Album: Kalax
Title: Carousel (feat. World Wild)
Playlist Position: 1
Duration: 0:04:00
Elapsed: 0:00:01
And for AA I don't know if "Elapsed" is justified if "Playback is stopped" because it's a radio and not a track, but it's not a real problem
I'm using the output of sonos _all_ track
like this and it's perfect there is no print error in that way :
zenity --info --no-wrap --text="\n$(sonos _all_ track | sed ':a;N;$!ba;s/\n/\n\n/g')" --title="Titre de la musique"
Thank you so much :-)
I love your concept so much that I have created a CLI program with the same concept for Somfy’s Tahoma devices: https://github.com/pzim-devdata/tahoma
I have another problem : with search_artists
and search_albums
sonos $speaker search_artists "cinnamon chasers"
:
Sonos Music Library Albums including Artist: Cinnamon Chasers
=============================================================
1: Album: A Million Miles from Home | Artist: Cinnamon Chasers
2: Album: Aether | Artist: Cinnamon Chasers
3: Album: Anjunadeep 08 | Artist: Cinnamon Chasers
4: Album: Best of... | Artist: Cinnamon Chasers
5: Album: Burn the Fire | Love Is Gone | Artist: Cinnamon Chasers
6: Album: Doorways | Artist: Cinnamon Chasers
7: Album: Dreams & Machines | Artist: Cinnamon Chasers
8: Album: Drench | Artist: Cinnamon Chasers
9: Album: Edits | Artist: Cinnamon Chasers
10: Album: Electro Classics 2.0 (House, Deep-House, Techno, Minimal, Electronica, Future Bass and Many | Artist: Cinnamon Chasers
11: Album: Exclusive Unreleased Music 2008 to 2012, Vol. 1 | Artist: Cinnamon Chasers
12: Album: Exclusive Unreleased Tracks 2008 to 2012, Vol. 2 | Artist: Cinnamon Chasers
13: Album: Excuse My French (Remixes) | Artist: Cinnamon Chasers
14: Album: Falcon | Artist: Cinnamon Chasers
15: Album: Great Escape | Artist: Cinnamon Chasers
16: Album: Great Escape (Summer 2015 Mix) | Artist: Cinnamon Chasers
17: Album: Group Therapy 215 | Artist: Cinnamon Chasers
18: Album: Highway Pacific | Artist: Cinnamon Chasers
19: Album: Hunter | Artist: Cinnamon Chasers
20: Album: Hurts Too Much EP | Artist: Cinnamon Chasers
21: Album: I Like Watching You (Diamond Cut Remix) | Artist: Cinnamon Chasers
22: Album: Jetstreams | Artist: Cinnamon Chasers
23: Album: Jody Wisternoff: The Story So Far | Artist: Cinnamon Chasers
24: Album: Luv Deluxe Remixes | Artist: Cinnamon Chasers
25: Album: Myracom | Artist: Cinnamon Chasers
26: Album: Perfectly High | Artist: Cinnamon Chasers
27: Album: Remix Competition: The Winners | Artist: Cinnamon Chasers
28: Album: Reworks, Vol. 1 (A special collection of new reworks, edits & unreleased gems) | Artist: Cinnamon Chasers
29: Album: Science | Artist: Cinnamon Chasers
30: Album: Science Remixes, Part. 1 | Artist: Cinnamon Chasers
31: Album: Science Remixes, Vol. 2 | Artist: Cinnamon Chasers
32: Album: Set the Sky on Fire | Artist: Cinnamon Chasers
33: Album: She Loves | Artist: Cinnamon Chasers
34: Album: So Hard to Say (EP) | Artist: Cinnamon Chasers
35: Album: Speeder | Artist: Cinnamon Chasers
36: Album: Sunset Drive - EP | Artist: Cinnamon Chasers
37: Album: The Archives, Vol. 4: Analog Soundscapes | Artist: Cinnamon Chasers
38: Album: The Day That Never Came Ep | Artist: Cinnamon Chasers
39: Album: The Elements | Artist: Cinnamon Chasers
40: Album: Time.Body.Tears | Artist: Cinnamon Chasers
41: Album: Two Hours Time | Artist: Cinnamon Chasers
Sonos Music Library Albums including Artist: Americans In Paris; Cinnamon Chasers
=================================================================================
1: Album: Excuse My French (Remixes) | Artist: Americans In Paris; Cinnamon Chasers
Sonos Music Library Albums including Artist: Swimming Pools; Cinnamon Chasers
=============================================================================
1: Album: Move to Love Remixed | Artist: Swimming Pools; Cinnamon Chasers
Note: multiple artists found ... search not saved
instead of :
Sonos Music Library Albums including Artist: Cinnamon Chasers
=============================================================
1: Album: A Million Miles from Home | Artist: Cinnamon Chasers
2: Album: Aether | Artist: Cinnamon Chasers
3: Album: Anjunadeep 08 | Artist: Cinnamon Chasers
4: Album: Best of... | Artist: Cinnamon Chasers
5: Album: Burn the Fire | Love Is Gone | Artist: Cinnamon Chasers
6: Album: Doorways | Artist: Cinnamon Chasers
7: Album: Dreams & Machines | Artist: Cinnamon Chasers
8: Album: Drench | Artist: Cinnamon Chasers
9: Album: Edits | Artist: Cinnamon Chasers
10: Album: Electro Classics 2.0 (House, Deep-House, Techno, Minimal, Electronica, Future Bass and Many | Artist: Cinnamon Chasers
11: Album: Exclusive Unreleased Music 2008 to 2012, Vol. 1 | Artist: Cinnamon Chasers
12: Album: Exclusive Unreleased Tracks 2008 to 2012, Vol. 2 | Artist: Cinnamon Chasers
13: Album: Excuse My French (Remixes) | Artist: Cinnamon Chasers
14: Album: Falcon | Artist: Cinnamon Chasers
15: Album: Great Escape | Artist: Cinnamon Chasers
16: Album: Great Escape (Summer 2015 Mix) | Artist: Cinnamon Chasers
17: Album: Group Therapy 215 | Artist: Cinnamon Chasers
18: Album: Highway Pacific | Artist: Cinnamon Chasers
19: Album: Hunter | Artist: Cinnamon Chasers
20: Album: Hurts Too Much EP | Artist: Cinnamon Chasers
21: Album: I Like Watching You (Diamond Cut Remix) | Artist: Cinnamon Chasers
22: Album: Jetstreams | Artist: Cinnamon Chasers
23: Album: Jody Wisternoff: The Story So Far | Artist: Cinnamon Chasers
24: Album: Luv Deluxe Remixes | Artist: Cinnamon Chasers
25: Album: Myracom | Artist: Cinnamon Chasers
26: Album: Perfectly High | Artist: Cinnamon Chasers
27: Album: Remix Competition: The Winners | Artist: Cinnamon Chasers
28: Album: Reworks, Vol. 1 (A special collection of new reworks, edits & unreleased gems) | Artist: Cinnamon Chasers
29: Album: Science | Artist: Cinnamon Chasers
30: Album: Science Remixes, Part. 1 | Artist: Cinnamon Chasers
31: Album: Science Remixes, Vol. 2 | Artist: Cinnamon Chasers
32: Album: Set the Sky on Fire | Artist: Cinnamon Chasers
33: Album: She Loves | Artist: Cinnamon Chasers
34: Album: So Hard to Say (EP) | Artist: Cinnamon Chasers
35: Album: Speeder | Artist: Cinnamon Chasers
36: Album: Sunset Drive - EP | Artist: Cinnamon Chasers
37: Album: The Archives, Vol. 4: Analog Soundscapes | Artist: Cinnamon Chasers
38: Album: The Day That Never Came Ep | Artist: Cinnamon Chasers
39: Album: The Elements | Artist: Cinnamon Chasers
40: Album: Time.Body.Tears | Artist: Cinnamon Chasers
41: Album: Two Hours Time | Artist: Cinnamon Chasers
Sonos Music Library Albums including Artist: Americans In Paris; Cinnamon Chasers
=================================================================================
**42**: Album: Excuse My French (Remixes) | Artist: Americans In Paris; Cinnamon Chasers
Sonos Music Library Albums including Artist: Swimming Pools; Cinnamon Chasers
=============================================================================
**43**: Album: Move to Love Remixed | Artist: Swimming Pools; Cinnamon Chasers
It's the same with sonos $speaker search_albums "cinnamon chasers"
but works well with search_tracks
So I can't play with :
sonos $speaker queue_search_number \"$num\" play_next : $speaker shuffle off : $speaker next : $speaker play
This is my last request, I promise!!! 😊
This one is intentional -- single line outputs aren't surrounded by blank lines.
BB: Using Line In (state: PAUSED_PLAYBACK)
CC: Using Line In (state: PAUSED_PLAYBACK)
DD: Using Line In (state: PAUSED_PLAYBACK)
EE: Using Line In (state: PAUSED_PLAYBACK)
FF:
Playback is stopped:
Elapsed: 0:00:00
However, I can make this a little neater by adding a blank line after a sequence of one or more single line outputs, i.e.:
BB: Using Line In (state: PAUSED_PLAYBACK)
CC: Using Line In (state: PAUSED_PLAYBACK)
DD: Using Line In (state: PAUSED_PLAYBACK)
EE: Using Line In (state: PAUSED_PLAYBACK)
FF:
Playback is stopped:
Elapsed: 0:00:00
The 'multiple artists found' issue is a limitation of the current rather lazy, implementation for saving search results (hinted at by the warning Note: multiple artists found ... search not saved
).
I'll have a look at whether it can be Improved, although I think it might require some major code surgery.
Ok thank you. It was very helpfull to me.
It’s not an emergency so when you will find the time it would be great to be able to use search_artists
and search_albums
with a single number for each result and why not a search_and_play
command which include : sonos $speaker queue_search_number \"$num\" play_next : $speaker shuffle off : $speaker next : $speaker play
after we enter a number in a prompt 😊.
_all_ track
will be perfect like this.
Thank you again for all this usefull improvement 😉
The search_artists
action now saves its search results if there are multiple artist matches. It turned out not to be too bad to implement. Note that search_albums
already saved its search results correctly.
Yes it’s perfect now. search_artists
and search_albums
works well.
Do you know if there is a way to add to the queue all results of search_artists
?
For now I search the artist then copy the name of the album then search the album for having more than one song in the queue. But it’s ok I will stop asking you so many requests, I understand it’s a lot. Thank you very much again, I really appriciate what you have done. 😊
Do you know if there is a way to add to the queue all results of
search_artists
?
There's a new action called queue_multiple_search_results
(or qmsr
) that allows all results from the last search to be queued, or specific items and/or item ranges can be specified, e.g.:
sonos <speaker> qmsr all
sonos <speaker> qmsr 1,3,5
sonos <speaker> qmsr 1-3,7-10
Thank you it's working perfectly.
I will finally be able to enjoy a customized playlist simply and quickly on my Sonos speakers ! ;-)
Unfortunately, the play_next
function has disappeared when using qmsr
, so to play music, you have to do a clear_queue
before the qmsr
command and then play_from_queue 1
because the songs are added to the end of the queue and not next to the played song.
In this case, the solution is to create a new queue like this: `sonos $speaker clear_queue : $speaker queue_multiple_search_results all : $speaker play_from_queue 1 : $speaker if_stopped play".
Thank you again ! 😊
Unfortunately, the play_next function has disappeared when using qmsr, so to play music, you have to do a clear_queue before the qmsr command and then play_from_queue 1 because the songs are added to the end of the queue.
Yes, this is a little tricky to implement for multiple queue additions, so I've omitted it for now.
Note that you can play from the queue at the point of the last additions using pfq last_added
. This will use the queue position of the first track of the set that were added.
Doing it this way without the play_next
command is perfect because we can listen to the songs we have chosen and play them in shuffle mode without the risk of playing another artist or album.
I didn't know the pfq last_added
I will try.
So with the pfq last_added
all is fine.
I really appreciate the work you have done, it has greatly improved my Sonos installation. I wish you all the best in your projects. If I have other ideas to improve soco-cli, I will let you know, but not right away because it is already more than enough compared to what I expected.
Thank you for everything :-)
If I had time I will implement a Chat-GPT plugin to Soco-cli to install in addition, but not now. I will call it soco-cli-gpt. I will see in the futur because I have no more money. I have spent to much on Chat-GPT. Like this it will be possible to simply ask to Chat-GPT : "search 'Genesis' and play only all there songs with a volume set to 20 in my room 6 and activate shuffle mode...." I will see if I have enough money and time for this. Thanks :-)
Let me know if you make progress with the ChatGPT front-end -- would be very cool.
If I decide to invest significant further time in SoCo-CLI, it will probably be to add Sonos Cloud API integration, which I think is probably required to get good streaming service integration.
Now, I've done some tidying up and consolidated all the queue search result actions under a single action called queue_search_results
(qsr
), which now covers both single and multiple item use cases. (Don't worry, all the previous action names are still there and will remain so, but I've removed them from the README.)
I also figured out how to enable next|play_next
for multiple selections, so that option is back.
Finally, there is now a strict
option for all the music library searches, in case an exact match is preferred.
queue_search_results all play_next
and queue_search_results 1 play_next
work very well. It's easier this way, and you are right; there's no need to put an if [ "$num" = all ]
condition for playing the search results anymore.play_next
command doesn't play the next song but puts it after the current song, similar to next
. It's a little confusing, and it would be more logical if play_next
played the next music and next
put the music next to the current one. However, it's okay; you can simply add next
and play
commands after a play_next
command to achieve the desired behavior.if_coordinator
. I'd like to do something like: sonos AA group BB if_coordinator
or sonos BB if_coordinator multi_group AA CC
. Additionally, having an option like is_not_coordinator
for sonos AA if_not_coordinator group BB
would be helpful. This is because when I use the line-in with a Sonos connect, it automatically becomes the coordinator when music comes from the line-in, causing a problem when another Sonos device was already the coordinator before.search_albums "AA BB" strict
and search_artists "CC DD" strict
work fine.soco-cli-gpt
, but I'm not sure how to do it. I will explore this possibility in the future if Chat-GPT becomes less expensive to develop an API.The play_next command doesn't play the next song but puts it after the current song, similar to next. It's a little confusing, and it would be more logical if play_next played the next music and next put the music next to the current one. However, it's okay; you can simply add next and play commands after a play_next command to achieve the desired behavior.
This is intentional -- it's to allow tracks to be queued to be played next, without interrupting the currently playing track, and play_next
/next
are just synonyms. I guess I could change the behaviour of play_next
to advance playback to the just-added track(s), but as you note, one can just use the next
action to do this.
I'm facing another small issue with if_coordinator. I'd like to do something like: sonos AA group BB if_coordinator or sonos BB if_coordinator multi_group AA CC. Additionally, having an option like is_not_coordinator for sonos AA if_not_coordinator group BB would be helpful. This is because when I use the line-in with a Sonos connect, it automatically becomes the coordinator when music comes from the line-in, causing a problem when another Sonos device was already the coordinator before.
It's easy to add if_not_coordinator
, so that will be in the next release (i.e., I've coded it but not yet released it).
ok thank you it will be perfect with if_not_coordinator
command. No matter with play_next
; indeed, it would be confusing to modify a command for users who already use this command.
Have a nice summer & a good continuation in your project
It's easy to add
if_not_coordinator
, so that will be in the next release (i.e., I've coded it but not yet released it).
This is released now.
Thanks. If_not_coordinator
work perfectly. And sonos AA if_coordinator mg BB
work too and also sonos AA if_ not_coordinator mg BB
Hello, thank you for sonos-cli I love it !
It would be so nice if you could add some commands like this one :
if_coordinator
: I must do :if [[ $(sonos $speaker if_playing info | grep 'is_coordinator = True') ]] then;
for example for grouping to the coordinator but it take a long time to executeif_queued
andif_not_queued
: For example for not adding to queue every time we want to play the queue : `sonos $speaker if_queued play_queue : $speaker if_not_queued add_playlist_to queue playlist : play_queuerel_subgain
: I must dobass_sub_level=$(sonos $speaker sub_gain); new_bass_sub_level=$((bass_sub_level-5)); sonos $speaker sub_gain $new_bass_sub_level"
and it's very long toorel_treble
: I must dotreble_level=$(sonos $speaker treble); new_treble_level=$((treble_level-5)); sonos $speaker treble $new_treble_level
rel_bass
And also some commands for having the state of all speaker : For example :
info_state
: which return for example :speaker_2 : is_coordinator = True Using Line In (state: PAUSED_PLAYBACK Volume : 60 Treble : 0 Bass : -3 Balance : -25 Loudness : off
speaker_3 : Using Line In (state: PAUSED_PLAYBACK) Volume : 60 Treble : 0 Bass : -3 Balance : 25 Loudness : on
speaker_4 : Using Line In (state: PAUSED_PLAYBACK) Volume : 25 Treble : -1 Bass : 0 Balance : 0 Loudness : on
speaker_5 : Playback is stopped Volume : 25 Treble : 0 Bass : 0 Balance : 0 Loudness : on
speaker_6 : Playback is stopped: Channel: Radio.com Elapsed: 0:00:00 Volume : 25 Treble : -3 Bass : 0 Balance : 0 Loudness : on
speaker_Sub : on Volume : 2
speaker_1 : Playback is in progress: Artist: xx Album: Untitled Title: xxxx
speaker_2 : Using Line In (state: PAUSED_PLAYBACK)
speaker_3 : Using Line In (state: PAUSED_PLAYBACK)
speaker_4 : Using Line In (state: PAUSED_PLAYBACK)
speaker_5 : Playback is stopped: Elapsed: 0:00:00
speaker_6 : Playback is stopped: Channel: Radio.com Elapsed: 0:00:00