soco-cli 0.4.80__tar.gz → 0.4.82__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.80/soco_cli.egg-info → soco_cli-0.4.82}/PKG-INFO +4 -3
- {soco_cli-0.4.80 → soco_cli-0.4.82}/README.md +18 -17
- {soco_cli-0.4.80 → soco_cli-0.4.82}/requirements.txt +1 -1
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/__init__.py +1 -1
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/api.py +25 -13
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/interactive.py +5 -5
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/play_local_file_lists.py +1 -1
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/sonos.py +3 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/utils.py +2 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82/soco_cli.egg-info}/PKG-INFO +4 -3
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli.egg-info/requires.txt +1 -1
- {soco_cli-0.4.80 → soco_cli-0.4.82}/LICENSE +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/MANIFEST.in +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/PYPI_README.md +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/pyproject.toml +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/setup.cfg +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/setup.py +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/__main__.py +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/action_processor.py +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/alarms.py +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/aliases.py +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/check_for_update.py +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/cmd_parser.py +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/http_api.py +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/keystroke_capture.py +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/m3u_parser.py +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/match_speaker_names.py +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/play_local_file.py +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/sonos_discover.py +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/speaker_info.py +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/speakers.py +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/track_follow.py +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli/wait_actions.py +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli.egg-info/SOURCES.txt +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli.egg-info/dependency_links.txt +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli.egg-info/entry_points.txt +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/soco_cli.egg-info/top_level.txt +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/tests/test_cli.py +0 -0
- {soco_cli-0.4.80 → soco_cli-0.4.82}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: soco-cli
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.82
|
|
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.30.
|
|
15
|
+
Requires-Dist: soco>=0.30.13; 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
|
|
@@ -20,6 +20,7 @@ Requires-Dist: rangehttpserver
|
|
|
20
20
|
Requires-Dist: xmltodict
|
|
21
21
|
Requires-Dist: fastapi; python_version >= "3.7"
|
|
22
22
|
Requires-Dist: uvicorn; python_version >= "3.7"
|
|
23
|
+
Dynamic: license-file
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
# SoCo-CLI: Control Sonos from the Command Line
|
|
@@ -202,7 +202,7 @@ This allows the use of shorthand like `sk stop`, to stop playback on the Kitchen
|
|
|
202
202
|
### Options for the `sonos` Command
|
|
203
203
|
|
|
204
204
|
- **`--version, -v`**: Print the versions of SoCo-CLI, SoCo, and Python.
|
|
205
|
-
- **`--
|
|
205
|
+
- **`--check-for-update`**: Check for a more recent version of SoCo-CLI.
|
|
206
206
|
- **`--actions`**: Print the list of available actions.
|
|
207
207
|
- **`--docs`**: Print the URL of this README documentation, for the version of SoCo-CLI being used.
|
|
208
208
|
- **`--log <level>`**: Turn on logging. Available levels are `NONE` (default), `CRITICAL`, `ERROR`, `WARN`, `INFO`, `DEBUG`, in order of increasing verbosity. `INFO` level logging tends to be the most useful when troubleshooting SoCo-CLI issues.
|
|
@@ -211,13 +211,13 @@ The following options are for use with the cached discovery mechanism:
|
|
|
211
211
|
|
|
212
212
|
- **`--use-local-speaker-list, -l`**: Use the local speaker list instead of SoCo discovery. The speaker list will first be created and saved if it doesn't already exist.
|
|
213
213
|
- **`--refresh-local-speaker-list, -r`**: In conjunction with the `-l` option, the speaker list will be regenerated and saved.
|
|
214
|
-
- **`--
|
|
215
|
-
- **`--
|
|
216
|
-
- **`--
|
|
214
|
+
- **`--network-discovery-threads, -t`**: The maximum number of parallel threads used to scan the local network.
|
|
215
|
+
- **`--network-discovery-timeout, -n`**: The timeout used when scanning each host on the local network (how long to wait for a socket connection on port 1400 before giving up).
|
|
216
|
+
- **`--min-netmask, -m`**: The minimum netmask to use when scanning networks. Used to constrain the IP search space.
|
|
217
217
|
|
|
218
218
|
Note that the `sonos-discover` utility (discussed below) can also be used to manage the local speaker list. This is the recommended way of using cached discovery: first run `sonos-discover` to create the local speaker database, then use `sonos` with the `-l` option to use the local database when invoking `sonos` actions.
|
|
219
219
|
|
|
220
|
-
If you set the environment variable **`USE_LOCAL_CACHE=TRUE`**, the `--
|
|
220
|
+
If you set the environment variable **`USE_LOCAL_CACHE=TRUE`**, the `--use-local-speaker-list` option will always be used.
|
|
221
221
|
|
|
222
222
|
### Firewall Rules
|
|
223
223
|
|
|
@@ -766,7 +766,8 @@ This is SoCo-CLI interactive mode. Interactive commands are as follows:
|
|
|
766
766
|
'cd' : Change the working directory of the shell, e.g. 'cd ..'.
|
|
767
767
|
Note that on Windows, backslashes must be doubled, e.g.:
|
|
768
768
|
'cd C:\\'
|
|
769
|
-
'
|
|
769
|
+
'check-for-update'
|
|
770
|
+
: Check whether an update is available
|
|
770
771
|
'docs' : Print a link to the online documentation.
|
|
771
772
|
'exec' : Run a shell command, e.g.: 'exec ls -l'.
|
|
772
773
|
'exit' : Exit the shell.
|
|
@@ -877,12 +878,12 @@ Positional arguments can be used multiple times within an action (unlikely to be
|
|
|
877
878
|
#### Saving and Loading Aliases
|
|
878
879
|
|
|
879
880
|
```
|
|
880
|
-
sonos --
|
|
881
|
-
sonos --
|
|
882
|
-
sonos --
|
|
881
|
+
sonos --save-aliases <filename>
|
|
882
|
+
sonos --load-aliases <filename>
|
|
883
|
+
sonos --overwrite-aliases <filename>
|
|
883
884
|
```
|
|
884
885
|
|
|
885
|
-
Aliases can be exported to, and loaded from, plain text files using the command line options above. The command will terminate once the file operation is complete. Option `
|
|
886
|
+
Aliases can be exported to, and loaded from, plain text files using the command line options above. The command will terminate once the file operation is complete. Option `save-aliases` will export the current aliases to the supplied filename; `load-aliases` will load a list of aliases and merge them with the current list (overwriting any duplicate alias names); `overwrite-aliases` will overwrite all current aliases with the list from the file.
|
|
886
887
|
|
|
887
888
|
The alias file format consists of lines containing `<alias_name> = <alias actions>`, e.g:
|
|
888
889
|
|
|
@@ -939,8 +940,8 @@ If your speakers change in some way (e.g., they are renamed, are assigned differ
|
|
|
939
940
|
|
|
940
941
|
The following flags can be used to adjust network discovery behaviour if the discovery process is failing:
|
|
941
942
|
|
|
942
|
-
- **`--
|
|
943
|
-
- **`--
|
|
943
|
+
- **`--network-discovery-threads, -t`**: The number of parallel threads used to scan the local network.
|
|
944
|
+
- **`--network-discovery-timeout, -n`**: The timeout used when scanning each host on the local network (how long to wait for a socket connection on port 1400 before giving up).
|
|
944
945
|
|
|
945
946
|
These options only have an effect when combined with the `-l` **and** `-r` options.
|
|
946
947
|
|
|
@@ -962,14 +963,14 @@ Discovery works by interrogating all network adapters on the device running SoCo
|
|
|
962
963
|
|
|
963
964
|
- **`--print, -p`**: Print the the current contents of the speaker cache file
|
|
964
965
|
- **`--delete-local-speaker-cache, -d`**: Delete the local speaker cache file.
|
|
965
|
-
- **`--
|
|
966
|
-
- **`--
|
|
967
|
-
- **`--
|
|
966
|
+
- **`--network-discovery-threads, -t`**: The maximum number of parallel threads used to scan the local network.
|
|
967
|
+
- **`--network-discovery-timeout, -n`**: The timeout used when scanning each host on the local network (how long to wait for a socket connection on port 1400 before giving up). Use this if `sonos-discover` is not finding all of your Sonos devices.
|
|
968
|
+
- **`--min-netmask, -m`**: The minimum netmask to use when scanning networks. Used to constrain the IP search space. (Note that this option will never **increase** the search space, e.g., if one of the attached networks is 192.168.0.0/24, supplying a `--min-netmask` value of 16 will not increase the search space to 192.168.0.0/16.)
|
|
968
969
|
- **`--version, -v`**: Print the versions of SoCo-CLI, SoCo, Python, and exit.
|
|
969
|
-
- **`--
|
|
970
|
+
- **`--check-for-update`**: Check for a more recent version of SoCo-CLI.
|
|
970
971
|
- **`--docs`**: Print the URL of this README documentation, for the version of SoCo-CLI being used.
|
|
971
972
|
- **`--log <level>`**: Turn on logging. Available levels are NONE (default), CRITICAL, ERROR, WARN, INFO, DEBUG, in order of increasing verbosity.
|
|
972
|
-
- **`--subnets <subnets_list>`**: Specify which subnet(s) to search, as a comma separated list (without spaces). E.g.: `--subnets 192.168.0.0/24,192.168.1.0/24` or `--subnets 192.168.0.30`. When this option is used, only the specified subnet(s) will be searched, and the `--
|
|
973
|
+
- **`--subnets <subnets_list>`**: Specify which subnet(s) to search, as a comma separated list (without spaces). E.g.: `--subnets 192.168.0.0/24,192.168.1.0/24` or `--subnets 192.168.0.30`. When this option is used, only the specified subnet(s) will be searched, and the `--min-netmask` option (if supplied) is ignored.
|
|
973
974
|
|
|
974
975
|
## The SoCo-CLI HTTP API Server
|
|
975
976
|
|
|
@@ -29,7 +29,8 @@ def run_command(
|
|
|
29
29
|
speaker_name: Union[str, SoCo],
|
|
30
30
|
action: str,
|
|
31
31
|
*args: str, # Means that all args are strings
|
|
32
|
-
use_local_speaker_list: bool = False
|
|
32
|
+
use_local_speaker_list: bool = False,
|
|
33
|
+
redirect_io: bool = True,
|
|
33
34
|
) -> Tuple[int, str, str]:
|
|
34
35
|
"""Use SoCo-CLI to run a sonos command.
|
|
35
36
|
|
|
@@ -43,24 +44,30 @@ def run_command(
|
|
|
43
44
|
Args:
|
|
44
45
|
speaker_name (str or SoCo): The name of the speaker, or its IP address.
|
|
45
46
|
Alternatively, a 'SoCo' object can be supplied.
|
|
46
|
-
action (str): The
|
|
47
|
+
action (str): The name of the SoCo-CLI action to perform.
|
|
47
48
|
*args (list[str]): The set of arguments that accompany the action.
|
|
48
49
|
use_local_speaker_list (bool, optional): Whether to use the local
|
|
49
50
|
speaker cache.
|
|
51
|
+
redirect_io (bool, optional): Whether to redirect stdout and stderr
|
|
52
|
+
to capture their output for inclusion in the return value. If
|
|
53
|
+
False, messages will be emitted directly to stdout & stderr
|
|
54
|
+
during execution of the command, and this content will not be
|
|
55
|
+
included in the return tuple.
|
|
50
56
|
|
|
51
57
|
Returns:
|
|
52
58
|
(int, str, str): a three-tuple of exit_code, output_string and
|
|
53
|
-
error_msg.
|
|
59
|
+
error_msg. If redirect_io is false, output_string will be empty.
|
|
54
60
|
"""
|
|
55
61
|
|
|
56
62
|
# Prevent errors from causing exit
|
|
57
63
|
set_api()
|
|
58
64
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
if redirect_io:
|
|
66
|
+
# Capture stdout and stderr for the duration of this command
|
|
67
|
+
output = StringIO()
|
|
68
|
+
sys.stdout = output
|
|
69
|
+
error = StringIO()
|
|
70
|
+
sys.stderr = error
|
|
64
71
|
|
|
65
72
|
speaker = None
|
|
66
73
|
exception_error = None
|
|
@@ -88,8 +95,12 @@ def run_command(
|
|
|
88
95
|
logging.info("Exception: {}".format(e))
|
|
89
96
|
exception_error = e
|
|
90
97
|
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
if redirect_io:
|
|
99
|
+
output_msg = output.getvalue().rstrip()
|
|
100
|
+
error_out = error.getvalue().rstrip()
|
|
101
|
+
else:
|
|
102
|
+
output_msg = ""
|
|
103
|
+
error_out = ""
|
|
93
104
|
|
|
94
105
|
if output_msg != "":
|
|
95
106
|
lines = output_msg.splitlines()
|
|
@@ -118,9 +129,10 @@ def run_command(
|
|
|
118
129
|
"Speaker '{}' not found: {}".format(speaker_name, exception_error),
|
|
119
130
|
)
|
|
120
131
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
132
|
+
if redirect_io:
|
|
133
|
+
# Restore stdout and stderr
|
|
134
|
+
sys.stdout = sys.__stdout__
|
|
135
|
+
sys.stderr = sys.__stderr__
|
|
124
136
|
|
|
125
137
|
logging.info("Return value: {}".format(return_tuple))
|
|
126
138
|
|
|
@@ -264,7 +264,7 @@ def interactive_loop(
|
|
|
264
264
|
docs()
|
|
265
265
|
continue
|
|
266
266
|
|
|
267
|
-
if command_lower in ["
|
|
267
|
+
if command_lower in ["check-for-update"]:
|
|
268
268
|
print_update_status()
|
|
269
269
|
continue
|
|
270
270
|
|
|
@@ -526,7 +526,7 @@ SHELL_COMMANDS = [
|
|
|
526
526
|
"actions",
|
|
527
527
|
"alias ",
|
|
528
528
|
"cd",
|
|
529
|
-
"
|
|
529
|
+
"check-for-update",
|
|
530
530
|
"docs",
|
|
531
531
|
"exec",
|
|
532
532
|
"exit",
|
|
@@ -575,8 +575,7 @@ def _set_actions_and_commands_list(use_local_speaker_list=False):
|
|
|
575
575
|
include_loop_actions=True,
|
|
576
576
|
include_wait_actions=True,
|
|
577
577
|
include_track_follow_actions=True,
|
|
578
|
-
)
|
|
579
|
-
+ _get_speaker_names(use_local_speaker_list=use_local_speaker_list)
|
|
578
|
+
) + _get_speaker_names(use_local_speaker_list=use_local_speaker_list)
|
|
580
579
|
]
|
|
581
580
|
+ SHELL_COMMANDS
|
|
582
581
|
+ am.alias_names()
|
|
@@ -609,7 +608,8 @@ This is SoCo-CLI interactive mode. Interactive commands are as follows:
|
|
|
609
608
|
'cd' : Change the working directory of the shell, e.g. 'cd ..'.
|
|
610
609
|
Note that on Windows, backslashes must be doubled, e.g.:
|
|
611
610
|
'cd C:\\'
|
|
612
|
-
'
|
|
611
|
+
'check-for-update'
|
|
612
|
+
: Check whether an update is available
|
|
613
613
|
'docs' : Print a link to the online documentation.
|
|
614
614
|
'exec' : Run a shell command, e.g.: 'exec ls -l'.
|
|
615
615
|
'exit' : Exit the shell.
|
|
@@ -141,7 +141,7 @@ def play_m3u_file(speaker: SoCo, m3u_file: str, options: str = "") -> bool:
|
|
|
141
141
|
directory, _ = path.split(m3u_file)
|
|
142
142
|
if directory != "":
|
|
143
143
|
chdir(directory)
|
|
144
|
-
tracks = [str(Path(track.path).absolute()) for track in track_list] # type:ignore
|
|
144
|
+
tracks = [str(Path(track.path).absolute()) for track in track_list] # type: ignore
|
|
145
145
|
logging.info("Files to to play: {}".format(tracks))
|
|
146
146
|
|
|
147
147
|
play_file_list(speaker, tracks, options)
|
|
@@ -105,11 +105,13 @@ def main():
|
|
|
105
105
|
)
|
|
106
106
|
parser.add_argument(
|
|
107
107
|
"--save_aliases",
|
|
108
|
+
"--save-aliases",
|
|
108
109
|
type=str,
|
|
109
110
|
help="Save the current shell aliases to the supplied filename and exit",
|
|
110
111
|
)
|
|
111
112
|
parser.add_argument(
|
|
112
113
|
"--load_aliases",
|
|
114
|
+
"--load-aliases",
|
|
113
115
|
type=str,
|
|
114
116
|
help=(
|
|
115
117
|
"Load shell aliases from the supplied filename and exit (aliases are"
|
|
@@ -118,6 +120,7 @@ def main():
|
|
|
118
120
|
)
|
|
119
121
|
parser.add_argument(
|
|
120
122
|
"--overwrite_aliases",
|
|
123
|
+
"--overwrite-aliases",
|
|
121
124
|
type=str,
|
|
122
125
|
help=(
|
|
123
126
|
"Overwrite current shell aliases with those from the supplied filename and"
|
|
@@ -658,6 +658,7 @@ def configure_common_args(parser):
|
|
|
658
658
|
)
|
|
659
659
|
parser.add_argument(
|
|
660
660
|
"--min_netmask",
|
|
661
|
+
"--min-netmask",
|
|
661
662
|
"-m",
|
|
662
663
|
type=int,
|
|
663
664
|
default=24,
|
|
@@ -693,6 +694,7 @@ def configure_common_args(parser):
|
|
|
693
694
|
)
|
|
694
695
|
parser.add_argument(
|
|
695
696
|
"--check_for_update",
|
|
697
|
+
"--check-for-update",
|
|
696
698
|
action="store_true",
|
|
697
699
|
default=False,
|
|
698
700
|
help="Check for a more recent version of SoCo-CLI",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: soco-cli
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.82
|
|
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.30.
|
|
15
|
+
Requires-Dist: soco>=0.30.13; 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
|
|
@@ -20,6 +20,7 @@ Requires-Dist: rangehttpserver
|
|
|
20
20
|
Requires-Dist: xmltodict
|
|
21
21
|
Requires-Dist: fastapi; python_version >= "3.7"
|
|
22
22
|
Requires-Dist: uvicorn; python_version >= "3.7"
|
|
23
|
+
Dynamic: license-file
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
# SoCo-CLI: Control Sonos from the Command Line
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|