729 lines
16 KiB
Markdown
729 lines
16 KiB
Markdown
# soco-cli
|
||
|
||
|
||
|
||
https://github.com/avantrec/soco-cli
|
||
|
||
|
||
|
||
### Installation
|
||
|
||
On crée un environnement virtuel:
|
||
|
||
```bash
|
||
~/Documents/venv master* ⇡
|
||
❯ python3 -m venv soco-cli
|
||
```
|
||
|
||
On l'active:
|
||
|
||
```bash
|
||
~/Documents/venv master* ⇡
|
||
❯ source soco-cli/bin/activate
|
||
```
|
||
|
||
On met à jour pip et setuptools:
|
||
|
||
```bash
|
||
~/Documents/venv/soco-cli/bin master* ⇡
|
||
soco-cli ❯ pip3 install -U pip setuptools
|
||
```
|
||
|
||
On installe soco-cli:
|
||
|
||
```bash
|
||
~/Documents/venv/soco-cli/bin master* ⇡ 10s
|
||
soco-cli ❯ pip3 install -U soco-cli
|
||
```
|
||
|
||
soco et soco-cli sont disponibles, ainsi que leurs alias sonos et sonos-discover.
|
||
```bash
|
||
~/Documents/venv/soco-cli master* ⇡
|
||
soco-cli ❯ ls bin
|
||
Activate.ps1 easy_install python sonos-discover
|
||
activate easy_install-3.8 python3 tabulate
|
||
activate.csh pip soco
|
||
activate.fish pip3 soco-discover
|
||
chardetect pip3.8 sonos
|
||
```
|
||
|
||
On peut linker sonos dans /usr/local/bin pour avoir la commande directement
|
||
|
||
```bash
|
||
~/Documents/venv master* ⇡
|
||
❯ ln -s /Users/bruno/Documents/venv/soco-cli/bin/sonos /usr/local/bin
|
||
```
|
||
|
||
et créer un alias pour sonos-discover dans .zshrc ou .bashrc
|
||
|
||
```bash
|
||
alias sonos-discover="/Users/bruno/Documents/venv/soco-cli/bin/sonos-discover -t 256 -n 1.0 -m 24"
|
||
```
|
||
|
||
|
||
|
||
### Commande **sonos-discover**
|
||
|
||
Permet de découvrir les appareils Sonos sur le réseau:
|
||
|
||
```bash
|
||
❯ sonos-discover -t 256 -n 1.0 -m 24
|
||
|
||
Networks searched: [IPv4Network('192.168.1.0/24')]
|
||
|
||
Sonos Household: Sonos_MmiahLD8Lavgm9ypGrX1Zx99sy
|
||
|
||
Room/Zone Name IP Address Device Model Visibility SW Version
|
||
|
||
---------------- ------------ -------------- ------------ ------------
|
||
|
||
Salon 192.168.1.17 One Visible 12.1
|
||
|
||
1 Sonos Household(s) found
|
||
1 Sonos device(s) found
|
||
|
||
Saved speaker data at: /Users/bruno/.soco-cli/speakers_v2.pickle
|
||
```
|
||
|
||
|
||
|
||
### Commande **sonos** (ou **soco**)
|
||
|
||
```bash
|
||
$ sonos <enceinte> <commande>
|
||
```
|
||
|
||
|
||
|
||
#### Enceintes et Système Sonos Info:
|
||
|
||
Afficher les alarmes:
|
||
|
||
```
|
||
❯ sonos Salon alarms
|
||
|
||
Speaker Start Time Duration Title Volume Enabled Play Mode Recurrence Include Grouped
|
||
|
||
--------- ------------ ---------- ------- -------- --------- ----------- ------------ -----------------
|
||
|
||
Salon 06:00 01:00 Unknown 25 Yes SHUFFLE WEEKDAYS No
|
||
```
|
||
|
||
Infos sur l'enceinte (IP, version...)
|
||
|
||
```bash
|
||
❯ sonos Salon info
|
||
balance = (100, 100)
|
||
bass = 0
|
||
cross_fade = False
|
||
display_version = 12.1
|
||
grouped_or_paired = False
|
||
hardware_version = 1.26.1.7-2.2
|
||
household_id = Sonos_MmiahLD8Lavgm9ypGrX1Zx99sy
|
||
ip_address = 192.168.1.17
|
||
is_coordinator = True
|
||
is_playing_line_in = False
|
||
is_playing_radio = True
|
||
is_playing_tv = False
|
||
is_soundbar = False
|
||
is_visible = True
|
||
loudness = True
|
||
mac_address = 48-A6-B8-F0-26-62
|
||
model_name = Sonos One
|
||
model_number = S18
|
||
mute = True
|
||
night_mode = None
|
||
player_icon = /img/icon-S18.png
|
||
player_name = Salon
|
||
serial_number = 48-A6-B8-F0-26-62:G
|
||
software_version = 60.3-81140
|
||
state = PLAYING
|
||
status_light = True
|
||
title = franceinter-midfi.mp3?ID=76zqey582k
|
||
treble = 0
|
||
uid = RINCON_48A6B8F0266201400
|
||
volume = 21
|
||
zone_name = Salon
|
||
```
|
||
|
||
Afficher tous les groupes du système Sonos:
|
||
|
||
```bash
|
||
❯ sonos Salon groups
|
||
[Salon] : Salon (192.168.1.17)
|
||
```
|
||
|
||
Liste des partages:
|
||
|
||
```bash
|
||
❯ sonos Salon shares
|
||
1: //DS916/music
|
||
|
||
# shares, libraries
|
||
```
|
||
|
||
Tableau d'info sur toutes les enceintes du système:
|
||
|
||
```bash
|
||
❯ sonos Salon sysinfo
|
||
|
||
Report generated on: 2020-11-01 12:08 UTC (Sunday)
|
||
|
||
Zone Name IP Address Visible CoOrd CoOrd IP Vol. Mute State Model Name Model No. HW Version SW Version
|
||
|
||
----------- ------------ --------- ------- ---------- ------ ------ ------- ------------ ----------- ------------ -----------------
|
||
|
||
Salon 192.168.1.17 Yes Yes 21 True PLAYING One S18 1.26.1.7-2.2 60.3-81140 (12.1)
|
||
|
||
Sonos model numbers present: S18.
|
||
Device counts: 1 total Sonos device(s), 1 unique model(s).
|
||
```
|
||
|
||
|
||
|
||
#### Radios:
|
||
|
||
On peut jouer des radios en les ajoutant aux Favoris Sonos
|
||
|
||
```bash
|
||
❯ sonos Salon play_fav "france inter"
|
||
|
||
# play_fav, play_favourite, pf
|
||
```
|
||
|
||
ou en les ajoutant à la playlist "My Radio Stations" de Tune-In
|
||
|
||
```bash
|
||
❯ sonos Salon play_favourite_radio_station "france inter"
|
||
|
||
# play_favourite_radio_station, pfrs
|
||
```
|
||
|
||
Liste des radios favorites:
|
||
|
||
```bash
|
||
❯ sonos Salon favourite_radio_stations
|
||
|
||
1: France Inter 95.9 (Émissions-débats France)
|
||
2: K6 FM 101.6 (Musique Locale)
|
||
3: RTL 104.2 (Monde)
|
||
|
||
# favourite_radio_stations, frs, lfrs
|
||
```
|
||
|
||
|
||
|
||
#### Favoris et playlists:
|
||
|
||
Afficher les Favoris Sonos:
|
||
|
||
```bash
|
||
❯ sonos Salon list_favs
|
||
|
||
1: France Inter 95.9 (Émissions-débats France)
|
||
2: K6 FM 101.6 (Musique Locale)
|
||
3: Les Introuvables
|
||
4: RTL 104.2 (Monde)
|
||
5: Rire et Chansons 91.8 (Comédie)
|
||
6: Shaka Ponk
|
||
7: franceinfo 101.2 (Émissions-débats France)
|
||
```
|
||
|
||
Afficher toutes les pistes de toutes les playlist Sonos:
|
||
|
||
```bash
|
||
❯ sonos Salon list_all_playlist_tracks
|
||
|
||
Sonos Playlist: plex 1
|
||
======================
|
||
|
||
1: Artist: Renaud | Album: Boucan d'enfer | Title: Docteur Renaud Mister Renaud
|
||
2: Artist: Renaud | Album: Boucan d'enfer | Title: Petit pede
|
||
```
|
||
|
||
Afficher les playlist Sonos:
|
||
|
||
```bash
|
||
❯ sonos Salon list_playlists
|
||
|
||
1: plex 1
|
||
|
||
# list_playlists, playlists, lp
|
||
```
|
||
|
||
|
||
|
||
#### Musiques:
|
||
|
||
Liste des albums:
|
||
|
||
```bash
|
||
❯ sonos Salon list_albums
|
||
|
||
Sonos Music Library Albums
|
||
===========================
|
||
|
||
1: Album: ¡Dos! | Artist: Green Day
|
||
2: Album: "Portrait d'artiste" | Artist: Lynda Lemay
|
||
3: Album: (No Reason To Cry) | Artist: Eric Clapton
|
||
4: Album: 10 | Artist: Stranglers
|
||
5: Album: 100th Window | Artist: Massive Attack
|
||
...
|
||
|
||
# list_albums, albums
|
||
```
|
||
|
||
Liste des artistes:
|
||
|
||
```bash
|
||
❯ sonos Salon list_artists
|
||
|
||
Sonos Music Library Artists
|
||
============================
|
||
|
||
1: AaRON
|
||
2: Aaron Copland
|
||
3: Adam - C de Roquemaure
|
||
4: Adele
|
||
5: Afro-Cuban Project
|
||
|
||
# list_artists, artists
|
||
```
|
||
|
||
Rechercher un artiste:
|
||
|
||
```bash
|
||
❯ sonos Salon search_artists pink
|
||
|
||
Sonos Music Library Albums including Artist: Pink Floyd
|
||
=======================================================
|
||
|
||
1: Album: A Momentary Lapse Of Reason | Artist: Pink Floyd
|
||
2: Album: A Saucerful of Secrets | Artist: Pink Floyd
|
||
3: Album: Animals | Artist: Pink Floyd
|
||
4: Album: Atom heart mother | Artist: Pink Floyd
|
||
5: Album: Echoes - The Best Of Pink Floyd | Artist: Pink Floyd
|
||
6: Album: Eclipse - Live in London | Artist: Pink Floyd
|
||
7: Album: Meddle | Artist: Pink Floyd
|
||
8: Album: Music From The Film More | Artist: Pink Floyd
|
||
9: Album: Obscured By Clouds | Artist: Pink Floyd
|
||
10: Album: The Best Of Pink Floyd - A Foot In The Door | Artist: Pink Floyd
|
||
11: Album: The Best Of Pink Floyd: A Foot In The Door (2011 Remastered Version) | Artist: Pink Floyd
|
||
12: Album: The Dark Side of the Moon | Artist: Pink Floyd
|
||
13: Album: The Division Bell | Artist: Pink Floyd
|
||
14: Album: The Final Cut | Artist: Pink Floyd
|
||
15: Album: The Later Years: 1987-2019 | Artist: Pink Floyd
|
||
16: Album: The Piper at the Gates of Dawn | Artist: Pink Floyd
|
||
17: Album: The Wall CD1 | Artist: Pink Floyd
|
||
18: Album: The Wall CD2 | Artist: Pink Floyd
|
||
19: Album: Ummagumma - Live Album | Artist: Pink Floyd
|
||
20: Album: Ummagumma - Studio Album | Artist: Pink Floyd
|
||
21: Album: Wish You Were Here | Artist: Pink Floyd
|
||
|
||
|
||
Sonos Music Library Albums including Artist: Pink Martini
|
||
=========================================================
|
||
|
||
1: Album: Sympathique | Artist: Pink Martini
|
||
|
||
Note: multiple artists found ... search not saved
|
||
|
||
# search_artists, sart
|
||
```
|
||
|
||
Rechercher un album:
|
||
|
||
```bash
|
||
❯ sonos Salon search_albums "The Wall"
|
||
|
||
Sonos Music Library Album Search: The Wall
|
||
==========================================
|
||
|
||
1: Album: The Wall CD1 | Artist: Pink Floyd
|
||
2: Album: The Wall CD2 | Artist: Pink Floyd
|
||
|
||
# search_albums, salb
|
||
```
|
||
|
||
Rechercher dans la bibliothèque:
|
||
|
||
```bash
|
||
❯ sonos Salon search_library "The Wall"
|
||
|
||
Sonos Music Library Album Search: The Wall
|
||
==========================================
|
||
|
||
1: Album: The Wall CD1 | Artist: Pink Floyd
|
||
2: Album: The Wall CD2 | Artist: Pink Floyd
|
||
|
||
|
||
Sonos Music Library Track Search: The Wall
|
||
==========================================
|
||
|
||
1: Artist: Music | Album: The Music | Title: The Walls Get Smaller
|
||
2: Artist: Dave Weckl | Album: Heads Up | Title: Against the Wall
|
||
3: Artist: Roger Waters | Album: | Title: Another Brick In The Wall
|
||
4: Artist: Pink Floyd | Album: Echoes - The Best Of Pink Floyd | Title: Another Brick In The Wall (Part 2)
|
||
5: Artist: Pink Floyd | Album: The Wall CD1 | Title: Another Brick In The Wall Pt.1
|
||
6: Artist: Pink Floyd | Album: The Best Of Pink Floyd - A Foot In The Door | Title: Another Brick In The Wall Pt.2
|
||
7: Artist: Pink Floyd | Album: The Wall CD1 | Title: Another Brick In The Wall Pt.2
|
||
8: Artist: Pink Floyd | Album: The Wall CD1 | Title: Another Brick In The Wall Pt.3
|
||
9: Artist: Green Day | Album: Revolution Radio | Title: Bouncing Off The Wall
|
||
10: Artist: Radiohead | Album: OK Computer | Title: Climbing Up the Walls
|
||
11: Artist: Collectif | Album: Pulp Fiction | Title: Flowers On The Wall / The Statler Brothers
|
||
12: Artist: Kaiser Chiefs | Album: The Future is Medieval | Title: Fly On The Wall
|
||
13: Artist: Pink Floyd | Album: The Wall CD2 | Title: Outside The Wall
|
||
|
||
# search_library, sl
|
||
```
|
||
|
||
Recherche une piste:
|
||
|
||
```bash
|
||
❯ sonos Salon search_tracks "Keep the car running"
|
||
|
||
Sonos Music Library Track Search: Keep the car running
|
||
======================================================
|
||
|
||
1: Artist: Arcade Fire | Album: Neon Bible | Title: Keep the Car Running
|
||
|
||
# search_tracks, st
|
||
```
|
||
|
||
Afficher les pistes d'un album:
|
||
|
||
```bash
|
||
❯ sonos Salon tracks_in_album "Neon bible"
|
||
|
||
Sonos Music Library Tracks in Album: Neon Bible
|
||
===============================================
|
||
|
||
1: Artist: Arcade Fire | Album: Neon Bible | Title: Black Mirror
|
||
2: Artist: Arcade Fire | Album: Neon Bible | Title: Keep the Car Running
|
||
3: Artist: Arcade Fire | Album: Neon Bible | Title: Neon Bible
|
||
4: Artist: Arcade Fire | Album: Neon Bible | Title: Intervention
|
||
5: Artist: Arcade Fire | Album: Neon Bible | Title: Black Wave/Bad Vibrations
|
||
6: Artist: Arcade Fire | Album: Neon Bible | Title: Ocean of Noise
|
||
7: Artist: Arcade Fire | Album: Neon Bible | Title: Well and the Lighthouse
|
||
8: Artist: Arcade Fire | Album: Neon Bible | Title: (Antichrist Television Blues)
|
||
9: Artist: Arcade Fire | Album: Neon Bible | Title: Windowsill
|
||
10: Artist: Arcade Fire | Album: Neon Bible | Title: No Cars Go
|
||
11: Artist: Arcade Fire | Album: Neon Bible | Title: My Body Is a Cage
|
||
|
||
# tracks_in_album, tia, lta
|
||
```
|
||
|
||
|
||
|
||
#### Volume et EQ:
|
||
|
||
Couper / remettre le son:
|
||
|
||
```bash
|
||
❯ sonos Salon mute <on|off>
|
||
```
|
||
|
||
Retourner le niveau du volume:
|
||
|
||
```bash
|
||
❯ sonos Salon volume
|
||
11
|
||
|
||
# volume 11/100
|
||
# volume, vol
|
||
```
|
||
|
||
Régler le niveau du volume:
|
||
|
||
```bash
|
||
❯ sonos Salon volume 12
|
||
|
||
# volume réglé à 12/100
|
||
# volume, vol
|
||
```
|
||
|
||
|
||
|
||
#### Jouer:
|
||
|
||
Jouer une piste:
|
||
|
||
```bash
|
||
❯ sonos Salon clear_queue : Salon queue_track "Black Mirror" : Salon play_from_queue 1
|
||
```
|
||
|
||
Jouer la prochaine piste:
|
||
|
||
```bash
|
||
❯ sonos Salon queue_track "Intervention" next : Salon play
|
||
```
|
||
|
||
Aller à la piste suivante:
|
||
|
||
```bash
|
||
❯ sonos Salon next
|
||
|
||
# next
|
||
```
|
||
|
||
Aller à la piste précédente:
|
||
|
||
```bash
|
||
❯ sonos Salon previous
|
||
|
||
# previous, prev
|
||
```
|
||
|
||
Mettre en pause:
|
||
|
||
```bash
|
||
❯ sonos Salon pause
|
||
|
||
❯ sonos Salon pause_all
|
||
# Toutes les enceintes du groupe
|
||
```
|
||
|
||
Jouer:
|
||
|
||
```bash
|
||
❯ sonos Salon play
|
||
|
||
# play, start
|
||
```
|
||
|
||
Arrêter:
|
||
|
||
```bash
|
||
❯ sonos Salon stop
|
||
|
||
# stop
|
||
```
|
||
|
||
Met en veille dans <durée>:
|
||
|
||
```bash
|
||
❯ sonos Salon sleep_timer 1.5m
|
||
❯ sonos Salon sleep_timer 00:01:30
|
||
|
||
# sleep_timer, sleep <duration|off|cancel> (s/m/h)
|
||
# Met en veille dans 90s
|
||
```
|
||
|
||
Met en veille à <heure>:
|
||
|
||
```bash
|
||
❯ sonos Salon sleep_at 17:52
|
||
|
||
# sleep_at
|
||
```
|
||
|
||
Info sur la piste jouée actuellement:
|
||
|
||
```bash
|
||
❯ sonos Salon track
|
||
Album: Neon Bible
|
||
Artist: Arcade Fire
|
||
Duration: 0:04:19
|
||
Playlist_position: 1
|
||
Position: 0:01:39
|
||
Title: Intervention
|
||
|
||
# track
|
||
```
|
||
|
||
|
||
|
||
#### Queue:
|
||
|
||
Effacer la file d'attente:
|
||
|
||
```bash
|
||
❯ sonos Salon clear_queue
|
||
|
||
# clear_queue, cq
|
||
```
|
||
|
||
Afficher les pistes dans la file d'attente:
|
||
|
||
```bash
|
||
❯ sonos Salon list_queue
|
||
|
||
1: Artist: Francis Cabrel | Album: In Extremis | Title: Azincourt
|
||
2: Artist: Renaud | Album: Boucan d'enfer | Title: Baltique
|
||
3: Artist: Arcade Fire | Album: Neon Bible | Title: Windowsill
|
||
4: Artist: Arcade Fire | Album: Neon Bible | Title: Black Mirror
|
||
5: Artist: Renaud | Album: Boucan d'enfer | Title: Manhattan-Kaboul
|
||
|
||
# list_queue, lq, q
|
||
```
|
||
|
||
Jouer la file d'attente:
|
||
|
||
```bash
|
||
❯ sonos Salon play_from_queue
|
||
|
||
# play_from_queue, pfq, pq
|
||
# joue la piste 1
|
||
```
|
||
|
||
Jouer une piste de la file:
|
||
|
||
```bash
|
||
❯ sonos Salon play_from_queue 21
|
||
|
||
# play_from_queue, pfq, pq
|
||
# joue la piste 21
|
||
```
|
||
|
||
Afficher la piste en position 2 de la file:
|
||
|
||
```bash
|
||
❯ sonos Salon list_queue 2
|
||
|
||
2: Artist: Francis Cabrel | Album: In Extremis | Title: Azincourt
|
||
|
||
# list_queue, lq,
|
||
```
|
||
|
||
Ajouter une piste à la file d'attente:
|
||
|
||
```bash
|
||
❯ sonos Salon queue_track "Black Mirror"
|
||
1
|
||
|
||
❯ sonos Salon queue_track "Manhattan-Kaboul"
|
||
2
|
||
|
||
# queue_track, qt
|
||
# retourne la position dans la file
|
||
```
|
||
|
||
```bash
|
||
❯ sonos Salon queue_track "Azincourt" play_next
|
||
1
|
||
# la piste est mise en dernière position de la file => prochaine piste à être lue.
|
||
|
||
# play_next | next
|
||
```
|
||
|
||
Ajouter un album à la file d'attente:
|
||
|
||
```bash
|
||
❯ sonos Salon queue_album "Wake Up And Smell The Coffee" play_next
|
||
8
|
||
|
||
# queue_album, qa <play_next|next>
|
||
```
|
||
|
||
Sauver la file d'attente comme playlist Sonos:
|
||
|
||
```bash
|
||
❯ sonos Salon save_queue "Ma playlist"
|
||
|
||
# save_queue, sq, create_playlist_from_queue
|
||
```
|
||
|
||
Supprimer la piste courante de la file:
|
||
|
||
```bash
|
||
❯ sonos Salon remove_current_track_from_queue
|
||
|
||
# remove_current_track_from_queue, rltfq
|
||
# la piste est retirée de la file, la piste suivante est jouée
|
||
```
|
||
|
||
Supprimer des pistes de la file:
|
||
|
||
```bash
|
||
# range
|
||
❯ sonos Salon remove_from_queue 15-17
|
||
|
||
# séquence
|
||
❯ sonos Salon remove_from_queue 3,9
|
||
|
||
#piste
|
||
❯ sonos Salon remove_from_queue 14
|
||
|
||
# remove_from_queue, rfq, rq
|
||
```
|
||
|
||
|
||
|
||
#### Divers:
|
||
|
||
Chainer 2 commandes:
|
||
|
||
```bash
|
||
❯ sonos Salon volume 10 : Salon play
|
||
|
||
# avec le séparateur ' : '
|
||
```
|
||
|
||
Insérer des délais:
|
||
|
||
```bash
|
||
❯ sonos Salon play : wait 3m : Salon stop
|
||
|
||
# wait <duration> (10s, 30m, 1.5h, 2:30, 0:1:25)
|
||
|
||
❯ sonos Salon play : wait_until 18:35:00 : Salon stop
|
||
|
||
# wait_until <time> (HH:MM, HH:MM:SS)
|
||
```
|
||
|
||
Attendre que la lecture ait démarré / stoppé:
|
||
|
||
```bash
|
||
❯ sonos Salon wait_stop : Salon volume 15
|
||
|
||
# attend que la lecture s'arrête puis règle le volume à 15
|
||
|
||
❯ sonos Salon wait_start : Salon volume 13
|
||
|
||
# attend que la lecture démarre (appui sur le bouton >|| ) puis règle le volume à 13
|
||
|
||
```
|
||
|
||
Attendre arrêté pendant <durée>:
|
||
|
||
```bash
|
||
❯ sonos Salon wait_stopped_for 30m : Salon play
|
||
|
||
# wait_stopped_for, wsf <duration>
|
||
```
|
||
|
||
Boucles:
|
||
|
||
```bash
|
||
loop
|
||
loop <iterations>
|
||
loop_for <duration>
|
||
loop_until <time>
|
||
loop_to_start
|
||
```
|
||
|
||
Conditions:
|
||
|
||
```bash
|
||
❯ sonos Salon if_stopped volume 15
|
||
|
||
# Ajuste le volume à 15 seulement quand Salon sera arrêté.
|
||
|
||
❯ sonos Salon if_playing volume 15
|
||
|
||
# Ajuste le volume à 15 seulement si Salon joue.
|
||
```
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
| | |
|
||
| ---- | ----------------------------------- |
|
||
| sfi | sonos Salon play_fav "france inter" |
|
||
| | |
|
||
| ss | sonos Salon stop |
|
||
|