soco-cli 0.4.83__tar.gz → 0.4.84__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {soco_cli-0.4.83/soco_cli.egg-info → soco_cli-0.4.84}/PKG-INFO +2 -2
- {soco_cli-0.4.83 → soco_cli-0.4.84}/README.md +15 -13
- {soco_cli-0.4.83 → soco_cli-0.4.84}/requirements.txt +1 -1
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/__init__.py +1 -1
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/action_processor.py +26 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/interactive.py +14 -6
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/utils.py +15 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84/soco_cli.egg-info}/PKG-INFO +2 -2
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli.egg-info/SOURCES.txt +1 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli.egg-info/requires.txt +1 -1
- soco_cli-0.4.84/tests/test_comprehensive.py +958 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/LICENSE +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/MANIFEST.in +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/PYPI_README.md +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/pyproject.toml +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/setup.cfg +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/setup.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/__main__.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/alarms.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/aliases.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/api.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/check_for_update.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/cmd_parser.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/http_api.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/keystroke_capture.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/m3u_parser.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/match_speaker_names.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/play_local_file.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/play_local_file_lists.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/sonos.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/sonos_discover.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/speaker_info.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/speakers.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/track_follow.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli/wait_actions.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli.egg-info/dependency_links.txt +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli.egg-info/entry_points.txt +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/soco_cli.egg-info/top_level.txt +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/tests/test_cli.py +0 -0
- {soco_cli-0.4.83 → soco_cli-0.4.84}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: soco-cli
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.84
|
|
4
4
|
Summary: Sonos command line control utility, based on SoCo
|
|
5
5
|
Author-email: Avantrec Ltd <soco_cli@avantrec.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/avantrec/soco-cli
|
|
@@ -12,7 +12,7 @@ Requires-Python: >=3.5
|
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: soco==0.27.1; python_version < "3.6"
|
|
15
|
-
Requires-Dist: soco>=0.
|
|
15
|
+
Requires-Dist: soco>=0.31.0; python_version >= "3.6"
|
|
16
16
|
Requires-Dist: ifaddr==0.1.7; python_version < "3.7"
|
|
17
17
|
Requires-Dist: ifaddr>=0.2.0; python_version >= "3.7"
|
|
18
18
|
Requires-Dist: tabulate
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* [Queue Actions](#queue-actions)
|
|
30
30
|
* [Favourites and Playlists](#favourites-and-playlists)
|
|
31
31
|
* [TuneIn Radio Station Favourites](#tunein-radio-station-favourites)
|
|
32
|
-
* [Grouping and
|
|
32
|
+
* [Grouping, Stereo Pairing, and Surround (Satellite) Speakers](#grouping-stereo-pairing-and-surround-satellite-speakers)
|
|
33
33
|
* [Alarms](#alarms)
|
|
34
34
|
* [Music Library Search Functions](#music-library-search-functions)
|
|
35
35
|
* [Speaker and Sonos System Information](#speaker-and-sonos-system-information)
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
* [Resources](#resources)
|
|
86
86
|
|
|
87
87
|
<!-- Created by https://github.com/ekalinin/github-markdown-toc -->
|
|
88
|
-
<!-- Added by: pwt, at: Sun
|
|
88
|
+
<!-- Added by: pwt, at: Sun Apr 5 10:16:32 BST 2026 -->
|
|
89
89
|
|
|
90
90
|
<!--te-->
|
|
91
91
|
|
|
@@ -197,7 +197,7 @@ alias ss="sonos Study"
|
|
|
197
197
|
alias sd="sonos-discover"
|
|
198
198
|
```
|
|
199
199
|
|
|
200
|
-
This allows the use of shorthand like `sk stop`, to stop playback on the Kitchen speaker. Note, however, that this won't work with sequences of commands using a single `sonos` invocation, separated with ` : ` (see [Multiple Sequential Commands](#multiple-sequential-commands)), only for the first command in such a sequence. (Normal,
|
|
200
|
+
This allows the use of shorthand like `sk stop`, to stop playback on the Kitchen speaker. Note, however, that this won't work with sequences of commands using a single `sonos` invocation, separated with ` : ` (see [Multiple Sequential Commands](#multiple-sequential-commands)), only for the first command in such a sequence. (Normal, multiple `sonos` invocation, shell sequences using `;` or `&&` as separators will work, of course.)
|
|
201
201
|
|
|
202
202
|
### Options for the `sonos` Command
|
|
203
203
|
|
|
@@ -348,7 +348,7 @@ sonos Kitchen play_from_queue 5
|
|
|
348
348
|
- **`bass`**: Returns the bass setting of the speaker, from -10 to 10.
|
|
349
349
|
- **`bass <number>`**: Sets the bass setting of the speaker to `<number>`. Values must be between -10 and 10.
|
|
350
350
|
- **`dialog_mode`** (or **`dialog`**, **`dialogue_mode`**, **`dialogue`**): Returns the dialog mode setting of the speaker, 'on' or 'off' (if applicable).
|
|
351
|
-
- **`dialog_mode <on|off>`** (or **`dialog`**, **`dialogue_mode`**, **`dialogue`**): Sets the dialog mode setting of the speaker to 'on'
|
|
351
|
+
- **`dialog_mode <on|off>`** (or **`dialog`**, **`dialogue_mode`**, **`dialogue`**): Sets the dialog mode setting of the speaker to 'on' or 'off' (if applicable).
|
|
352
352
|
- **`fixed_volume`**: Returns whether the speaker's Fixed Volume feature is enabled, 'on' or 'off'. (Applies to Sonos Connect and Port devices only.)
|
|
353
353
|
- **`fixed_volume <on|off>`**: Sets whether the speaker's Fixed Volume feature is enabled.
|
|
354
354
|
- **`group_mute`**: Returns the group mute state of a group of speakers, 'on' or 'off'.
|
|
@@ -365,9 +365,9 @@ sonos Kitchen play_from_queue 5
|
|
|
365
365
|
- **`night_mode <on|off>`** (or **`night`**): Sets the night mode setting of the speaker to 'on' or 'off' (if applicable).
|
|
366
366
|
- **`playing_tv`** (or **`is_playing_tv`**): Returns whether the speaker is currently playing from its TV input source, 'yes' or 'no'.
|
|
367
367
|
- **`ramp_to_volume <volume>` (or `ramp`)**: Gently raise or reduce the volume to `<volume>`, which is between 0 and 100. Returns the number of seconds to complete the ramp.
|
|
368
|
-
- **`relative_bass <adjustment>` (or `rel_bass`, `rb`)
|
|
369
|
-
- **`relative_sub_gain <adjustment>` (or `rel_sub_gain`, `rsg`)
|
|
370
|
-
- **`relative_treble <adjustment>` (or `rel_treble`, `rt`)
|
|
368
|
+
- **`relative_bass <adjustment>` (or `rel_bass`, `rb`)**: Increase or reduce the bass setting by `<adjustment>`, a value between -10 and 10.
|
|
369
|
+
- **`relative_sub_gain <adjustment>` (or `rel_sub_gain`, `rsg`)**: Increase or reduce a Sub's gain setting by `<adjustment>`, a value between -15 and 15.
|
|
370
|
+
- **`relative_treble <adjustment>` (or `rel_treble`, `rt`)**: Increase or reduce the treble setting by `<adjustment>`, a value between -10 and 10.
|
|
371
371
|
- **`relative_volume <adjustment>` (or `rel_vol`, `rv`)**: Raises or lowers the volume by `<adjustment>`, which must be a number from -100 to 100.
|
|
372
372
|
- **`sub_enabled`**: Returns `on` if the zone's subwoofer is enabled, otherwise `off`.
|
|
373
373
|
- **`sub_enabled <on|off>`**: Enables or disables a zone's subwoofer.
|
|
@@ -382,10 +382,10 @@ sonos Kitchen play_from_queue 5
|
|
|
382
382
|
- **`surround_volume_tv`**: Reports the value of the volume level for surround speakers, when playing TV sources, from `-15` to `+15`.
|
|
383
383
|
- **`surround_volume_tv <level>`**: Sets the value of the volume level for surround speakers, when playing TV sources, from `-15` to `+15`.
|
|
384
384
|
- **`treble`**: Returns the treble setting of the speaker, from -10 to 10.
|
|
385
|
-
- **`treble <number>`**: Sets the
|
|
385
|
+
- **`treble <number>`**: Sets the treble setting of the speaker to `<number>`. Values must be between -10 and 10.
|
|
386
386
|
- **`trueplay`**: Returns whether a speaker's Trueplay profile is enabled, 'on' or 'off'.
|
|
387
387
|
- **`trueplay <on|off>`**: Sets whether a speaker's Trueplay profile is enabled. Can only be set to 'on' for speakers that have a current Trueplay tuning profile available.
|
|
388
|
-
- **`volume` (or `vol`)**: Returns the current volume setting of the speaker (0 to 100)
|
|
388
|
+
- **`volume` (or `vol`)**: Returns the current volume setting of the speaker (0 to 100).
|
|
389
389
|
- **`volume <volume>` (or `vol`)**: Sets the volume of the speaker to `<volume>` (0 to 100).
|
|
390
390
|
|
|
391
391
|
### Playback Control
|
|
@@ -455,7 +455,7 @@ When items are added to the queue successfully, the queue position of the first
|
|
|
455
455
|
The available actions are:
|
|
456
456
|
|
|
457
457
|
- **`add_playlist_to_queue <playlist_name> [<position>]`** (or **`queue_playlist`, `add_pl_to_queue`, `apq`**): Add `<playlist_name>` to the queue. Name matching is case-insensitive, and will work on partial matches.
|
|
458
|
-
- **`add_library_playlist_to_queue <playlist_name>
|
|
458
|
+
- **`add_library_playlist_to_queue <playlist_name> [<position>]`** (or **`alpq`**): As above, but targets local library imported playlists instead of Sonos playlists.
|
|
459
459
|
- **`add_sharelink_to_queue <sharelink> [<position>]`** (or **`sharelink`**): Add a **Spotify**, **Tidal**, **Deezer**, or **Apple Music** link (for a track, album, playlist, etc.) to the queue. Returns the queue position of the first track. Supported links formats are: `https://open.spotify.com/track/6cpcorzV5cmVjBsuAXq4wD`, `spotify:album:6wiUBliPe76YAVpNEdidpY`, `https://tidal.com/browse/album/157273956`, `https://www.deezer.com/en/playlist/5390258182`, `https://music.apple.com/dk/album/black-velvet/217502930?i=217503142`.
|
|
460
460
|
- **`add_uri_to_queue <uri> [<position>]`** Adds a URI to the queue.
|
|
461
461
|
- **`clear_queue`** (or **`cq`**): Clears the current queue
|
|
@@ -503,12 +503,14 @@ The following operate on the stations in TuneIn's 'My Radio Stations' list.
|
|
|
503
503
|
- **`play_favourite_radio_station <station_name>`** (or **`play_favorite_radio_station`, `pfrs`**): Play a favourite radio station.
|
|
504
504
|
- **`play_fav_radio_station_no <station_number>`** (or **`pfrsn`**): Play a favourite radio station by its number.
|
|
505
505
|
|
|
506
|
-
### Grouping and
|
|
506
|
+
### Grouping, Stereo Pairing, and Surround (Satellite) Speakers
|
|
507
507
|
|
|
508
|
+
- **`add_satellite_speakers <left_rear_speaker> <right_rear_speaker>`** (or **`add_satellites`**): Bonds `<left_rear_speaker>` and `<right_rear_speaker>` as rear satellite speakers to the target soundbar. The target speaker must be a soundbar. Example: `sonos "Arc" add_satellites "Era 100 L" "Era 100 R"`.
|
|
508
509
|
- **`group <master_speaker>`(or `g`)**: Groups the speaker with `<master_speaker>`, which acts as the coordinator.
|
|
509
510
|
- **`multi_group <slave_speaker> [<slave_speaker> ...]`**: Groups one or more speakers with the target speaker, which acts as the coordinator.
|
|
510
511
|
- **`pair <right_hand_speaker>`**: Creates a stereo pair, where the target speaker becomes the left-hand speaker of the pair and `<right_hand_speaker>` becomes the right-hand of the pair. Can be used to pair dissimilar Sonos devices (e.g., to stereo-pair a Play:1 with a One). The left-hand speaker becomes the coordinator speaker, and the stereo pair will adopt its name.
|
|
511
512
|
- **`party_mode` (or `party`)**: Adds all speakers in the system into a single group. The target speaker becomes the group coordinator. Remove speakers individually using `ungroup`, or use `ungroup_all`.
|
|
513
|
+
- **`separate_satellite_speakers`** (or **`separate_satellites`**): Removes all bonded satellite speakers from the target soundbar. The target speaker must be a soundbar. Note: this will reset the Trueplay tuning for the device.
|
|
512
514
|
- **`transfer_playback <target_speaker>` (or `transfer_to`, `transfer`)**: Transfers playback to <target_speaker>. This is achieved by grouping and ungrouping the speakers, and swapping the group coordinator. It's a convenience shortcut for `speaker1 group speaker2 : speaker1 ungroup`.
|
|
513
515
|
- **`ungroup` (or `ug`, `u`)**: Removes the speaker from a group.
|
|
514
516
|
- **`ungroup_all`**: Removes all speakers in the target speaker's household from all groups.
|
|
@@ -932,7 +934,7 @@ Note that if you have speakers with the same names in multiple Sonos systems (Ho
|
|
|
932
934
|
|
|
933
935
|
### Refreshing the Local Speaker List
|
|
934
936
|
|
|
935
|
-
If your speakers change in some way (e.g., they are renamed, are assigned different IP addresses, or you add/remove speakers), you can refresh the discovery cache using the `--refresh-speaker-list` or `-r` option. Note that this option only has an effect when combined with the `-l` option. You can also use the `sonos-discover` command (below).
|
|
937
|
+
If your speakers change in some way (e.g., they are renamed, are assigned different IP addresses, or you add/remove speakers), you can refresh the discovery cache using the `--refresh-local-speaker-list` or `-r` option. Note that this option only has an effect when combined with the `-l` option. You can also use the `sonos-discover` command (below).
|
|
936
938
|
|
|
937
939
|
**Example:** `sonos -lr "living room" volume 50` will refresh the discovery cache before executing the `sonos` command.
|
|
938
940
|
|
|
@@ -1203,7 +1205,7 @@ The macro file can be reloaded using the `/macros/reload` endpoint (e.g.: `http:
|
|
|
1203
1205
|
Successful invocation of a macro will return the sonos command that was executed, and the result(s) of the actions that were performed (or the error output(s) in the case of a failure), in JSON format, e.g.:
|
|
1204
1206
|
|
|
1205
1207
|
```
|
|
1206
|
-
{"command": "sonos Kitchen volume", result": "30"}
|
|
1208
|
+
{"command": "sonos Kitchen volume", "result": "30"}
|
|
1207
1209
|
```
|
|
1208
1210
|
|
|
1209
1211
|
#### Listing Macros
|
|
@@ -929,6 +929,22 @@ def group_or_pair(speaker, action, args, soco_function, use_local_speaker_list):
|
|
|
929
929
|
return True
|
|
930
930
|
|
|
931
931
|
|
|
932
|
+
@two_parameters
|
|
933
|
+
def add_satellite_speakers(
|
|
934
|
+
speaker, action, args, soco_function, use_local_speaker_list
|
|
935
|
+
):
|
|
936
|
+
left_rear = get_speaker(args[0], use_local_speaker_list)
|
|
937
|
+
if not left_rear:
|
|
938
|
+
error_report("Speaker '{}' not found".format(args[0]))
|
|
939
|
+
return False
|
|
940
|
+
right_rear = get_speaker(args[1], use_local_speaker_list)
|
|
941
|
+
if not right_rear:
|
|
942
|
+
error_report("Speaker '{}' not found".format(args[1]))
|
|
943
|
+
return False
|
|
944
|
+
getattr(speaker, soco_function)(left_rear, right_rear)
|
|
945
|
+
return True
|
|
946
|
+
|
|
947
|
+
|
|
932
948
|
@one_or_more_parameters
|
|
933
949
|
def multi_group(speaker, action, args, soco_function, use_local_speaker_list):
|
|
934
950
|
"""
|
|
@@ -2991,6 +3007,16 @@ actions = {
|
|
|
2991
3007
|
"groups": SonosFunction(groups, "groups"),
|
|
2992
3008
|
"pair": SonosFunction(group_or_pair, "create_stereo_pair"),
|
|
2993
3009
|
"unpair": SonosFunction(no_args_no_output, "separate_stereo_pair"),
|
|
3010
|
+
"add_satellite_speakers": SonosFunction(
|
|
3011
|
+
add_satellite_speakers, "add_satellite_speakers"
|
|
3012
|
+
),
|
|
3013
|
+
"add_satellites": SonosFunction(add_satellite_speakers, "add_satellite_speakers"),
|
|
3014
|
+
"separate_satellite_speakers": SonosFunction(
|
|
3015
|
+
no_args_no_output, "separate_satellite_speakers"
|
|
3016
|
+
),
|
|
3017
|
+
"separate_satellites": SonosFunction(
|
|
3018
|
+
no_args_no_output, "separate_satellite_speakers"
|
|
3019
|
+
),
|
|
2994
3020
|
"delete_playlist": SonosFunction(playlist_operations, "remove_sonos_playlist"),
|
|
2995
3021
|
"remove_playlist": SonosFunction(playlist_operations, "remove_sonos_playlist"),
|
|
2996
3022
|
"clear_playlist": SonosFunction(playlist_operations, "clear_sonos_playlist"),
|
|
@@ -37,10 +37,12 @@ from soco_cli.keystroke_capture import get_keystroke
|
|
|
37
37
|
from soco_cli.utils import (
|
|
38
38
|
RewindableList,
|
|
39
39
|
docs,
|
|
40
|
+
get_ctrl_c_interrupted,
|
|
40
41
|
get_readline_history,
|
|
41
42
|
get_speaker,
|
|
42
43
|
local_speaker_list,
|
|
43
44
|
save_readline_history,
|
|
45
|
+
set_ctrl_c_interrupted,
|
|
44
46
|
set_interactive,
|
|
45
47
|
set_single_keystroke,
|
|
46
48
|
set_suspend_sighandling,
|
|
@@ -311,8 +313,8 @@ def interactive_loop(
|
|
|
311
313
|
continue
|
|
312
314
|
|
|
313
315
|
if command_lower == "exec":
|
|
314
|
-
if len(command) > 1:
|
|
315
|
-
|
|
316
|
+
if len(command) > 1 and _exec(command[1:]):
|
|
317
|
+
break
|
|
316
318
|
continue
|
|
317
319
|
|
|
318
320
|
if command_lower == "cd":
|
|
@@ -489,7 +491,8 @@ def interactive_loop(
|
|
|
489
491
|
action in ACTIONS_TO_EXEC
|
|
490
492
|
or action in ACTIONS_TO_EXEC_NO_SPEAKER
|
|
491
493
|
):
|
|
492
|
-
_exec_action(speaker.ip_address, action, args)
|
|
494
|
+
if _exec_action(speaker.ip_address, action, args):
|
|
495
|
+
break
|
|
493
496
|
else:
|
|
494
497
|
exit_code, output, error_msg = run_command(
|
|
495
498
|
speaker,
|
|
@@ -820,11 +823,14 @@ def _rescan(use_local_speaker_list=False, max_scan=False):
|
|
|
820
823
|
print("Rescan failed: please check your network connection [{}]".format(e))
|
|
821
824
|
|
|
822
825
|
|
|
823
|
-
def _exec(command_args: List[str]) ->
|
|
826
|
+
def _exec(command_args: List[str]) -> bool:
|
|
824
827
|
"""Runs a command as a subprocess, in its own shell.
|
|
825
828
|
|
|
826
829
|
Args:
|
|
827
830
|
command_args (list): The command to execute.
|
|
831
|
+
|
|
832
|
+
Returns:
|
|
833
|
+
bool: True if the subprocess was interrupted by CTRL-C, False otherwise.
|
|
828
834
|
"""
|
|
829
835
|
|
|
830
836
|
# Check for spaces within any of the command line args,
|
|
@@ -836,6 +842,7 @@ def _exec(command_args: List[str]) -> None:
|
|
|
836
842
|
# Convert command list to a unified command line
|
|
837
843
|
command_line = " ".join(command_args)
|
|
838
844
|
|
|
845
|
+
set_ctrl_c_interrupted(False)
|
|
839
846
|
set_suspend_sighandling(suspend=True)
|
|
840
847
|
try:
|
|
841
848
|
logging.info("Running command: '{}'".format(command_line))
|
|
@@ -843,12 +850,13 @@ def _exec(command_args: List[str]) -> None:
|
|
|
843
850
|
except Exception as e:
|
|
844
851
|
print(e)
|
|
845
852
|
set_suspend_sighandling(suspend=False)
|
|
853
|
+
return get_ctrl_c_interrupted()
|
|
846
854
|
|
|
847
855
|
|
|
848
856
|
CTRL_C_MSG_ISSUED = False
|
|
849
857
|
|
|
850
858
|
|
|
851
|
-
def _exec_action(speaker_ip: str, action: str, args: List[str]) ->
|
|
859
|
+
def _exec_action(speaker_ip: str, action: str, args: List[str]) -> bool:
|
|
852
860
|
# Commands to run in a subprocess, to allow CTRL-C
|
|
853
861
|
# to exit the subprocess only, and not the shell.
|
|
854
862
|
|
|
@@ -865,7 +873,7 @@ def _exec_action(speaker_ip: str, action: str, args: List[str]) -> None:
|
|
|
865
873
|
print("(Use CTRL-C to return to the Sonos shell prompt.)")
|
|
866
874
|
CTRL_C_MSG_ISSUED = True
|
|
867
875
|
|
|
868
|
-
_exec(command_line)
|
|
876
|
+
return _exec(command_line)
|
|
869
877
|
|
|
870
878
|
|
|
871
879
|
def _exec_command_line(command_line: str) -> None:
|
|
@@ -260,6 +260,19 @@ def set_suspend_sighandling(suspend=True):
|
|
|
260
260
|
suspend_sighandling = suspend
|
|
261
261
|
|
|
262
262
|
|
|
263
|
+
# Flag set when CTRL-C interrupts a suspended-sighandling subprocess
|
|
264
|
+
_ctrl_c_interrupted = False
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
def set_ctrl_c_interrupted(value=True):
|
|
268
|
+
global _ctrl_c_interrupted
|
|
269
|
+
_ctrl_c_interrupted = value
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
def get_ctrl_c_interrupted():
|
|
273
|
+
return _ctrl_c_interrupted
|
|
274
|
+
|
|
275
|
+
|
|
263
276
|
# Stop a stream if playing a local file
|
|
264
277
|
speaker_playing_local_file = None
|
|
265
278
|
|
|
@@ -279,6 +292,8 @@ def sig_handler(signal_received, frame):
|
|
|
279
292
|
logging.info("Caught signal: {}".format(signal_received))
|
|
280
293
|
|
|
281
294
|
if suspend_sighandling:
|
|
295
|
+
if signal_received == signal.SIGINT:
|
|
296
|
+
set_ctrl_c_interrupted(True)
|
|
282
297
|
logging.info("Signal handling suspended ... ignoring")
|
|
283
298
|
return
|
|
284
299
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: soco-cli
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.84
|
|
4
4
|
Summary: Sonos command line control utility, based on SoCo
|
|
5
5
|
Author-email: Avantrec Ltd <soco_cli@avantrec.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/avantrec/soco-cli
|
|
@@ -12,7 +12,7 @@ Requires-Python: >=3.5
|
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: soco==0.27.1; python_version < "3.6"
|
|
15
|
-
Requires-Dist: soco>=0.
|
|
15
|
+
Requires-Dist: soco>=0.31.0; python_version >= "3.6"
|
|
16
16
|
Requires-Dist: ifaddr==0.1.7; python_version < "3.7"
|
|
17
17
|
Requires-Dist: ifaddr>=0.2.0; python_version >= "3.7"
|
|
18
18
|
Requires-Dist: tabulate
|