soco-cli 0.4.74__tar.gz → 0.4.75__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.74/soco_cli.egg-info → soco-cli-0.4.75}/PKG-INFO +1 -1
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/__init__.py +1 -1
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/play_local_file.py +22 -5
- {soco-cli-0.4.74 → soco-cli-0.4.75/soco_cli.egg-info}/PKG-INFO +1 -1
- {soco-cli-0.4.74 → soco-cli-0.4.75}/LICENSE +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/MANIFEST.in +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/PYPI_README.md +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/README.md +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/pyproject.toml +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/requirements.txt +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/setup.cfg +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/setup.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/__main__.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/action_processor.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/alarms.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/aliases.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/api.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/check_for_update.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/cmd_parser.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/http_api.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/interactive.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/keystroke_capture.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/m3u_parser.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/match_speaker_names.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/play_local_file_lists.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/sonos.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/sonos_discover.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/speaker_info.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/speakers.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/track_follow.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/utils.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/wait_actions.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli.egg-info/SOURCES.txt +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli.egg-info/dependency_links.txt +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli.egg-info/entry_points.txt +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli.egg-info/requires.txt +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli.egg-info/top_level.txt +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/tests/test_cli.py +0 -0
- {soco-cli-0.4.74 → soco-cli-0.4.75}/tests/test_utils.py +0 -0
|
@@ -124,16 +124,33 @@ def http_server(
|
|
|
124
124
|
|
|
125
125
|
|
|
126
126
|
def get_server_ip(speaker: SoCo) -> Optional[str]:
|
|
127
|
-
# Get the IP address to use as a server
|
|
128
|
-
# on this host
|
|
129
|
-
|
|
127
|
+
# Get the host IP address to use as a server IP for Sonos
|
|
128
|
+
# on this host.
|
|
129
|
+
|
|
130
130
|
adapters = ifaddr.get_adapters()
|
|
131
|
+
|
|
132
|
+
# First, try to find a host IP address in the same network as the speaker
|
|
133
|
+
for adapter in adapters:
|
|
134
|
+
for ip in adapter.ips:
|
|
135
|
+
if ip.is_IPv4 and ip.ip != "127.0.0.1":
|
|
136
|
+
logging.info(
|
|
137
|
+
"Checking if IP address '{}' is in target speaker's network".format(
|
|
138
|
+
ip.ip
|
|
139
|
+
)
|
|
140
|
+
)
|
|
141
|
+
network = IPv4Network(
|
|
142
|
+
ip.ip + "/" + str(ip.network_prefix), strict=False
|
|
143
|
+
)
|
|
144
|
+
if IPv4Address(speaker.ip_address) in network:
|
|
145
|
+
return ip.ip
|
|
146
|
+
|
|
147
|
+
# If that fails, try to find a host IP address that can reach the target speaker
|
|
131
148
|
for adapter in adapters:
|
|
132
149
|
for ip in adapter.ips:
|
|
133
150
|
if ip.is_IPv4 and ip.ip != "127.0.0.1":
|
|
134
151
|
try:
|
|
135
152
|
logging.info(
|
|
136
|
-
"Checking target speaker reachability from IP address '{}'"
|
|
153
|
+
"Checking target speaker's reachability from IP address '{}'"
|
|
137
154
|
.format(ip.ip)
|
|
138
155
|
)
|
|
139
156
|
http_connection = http.client.HTTPConnection(
|
|
@@ -147,6 +164,7 @@ def get_server_ip(speaker: SoCo) -> Optional[str]:
|
|
|
147
164
|
return ip.ip
|
|
148
165
|
except:
|
|
149
166
|
continue
|
|
167
|
+
|
|
150
168
|
return None
|
|
151
169
|
|
|
152
170
|
|
|
@@ -199,7 +217,6 @@ def is_supported_type(filename: str) -> bool:
|
|
|
199
217
|
file_upper = filename.upper()
|
|
200
218
|
for file_type in SUPPORTED_TYPES:
|
|
201
219
|
if file_upper.endswith("." + file_type):
|
|
202
|
-
# Supported file type
|
|
203
220
|
return True
|
|
204
221
|
return False
|
|
205
222
|
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|