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.
Files changed (39) hide show
  1. {soco-cli-0.4.74/soco_cli.egg-info → soco-cli-0.4.75}/PKG-INFO +1 -1
  2. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/__init__.py +1 -1
  3. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/play_local_file.py +22 -5
  4. {soco-cli-0.4.74 → soco-cli-0.4.75/soco_cli.egg-info}/PKG-INFO +1 -1
  5. {soco-cli-0.4.74 → soco-cli-0.4.75}/LICENSE +0 -0
  6. {soco-cli-0.4.74 → soco-cli-0.4.75}/MANIFEST.in +0 -0
  7. {soco-cli-0.4.74 → soco-cli-0.4.75}/PYPI_README.md +0 -0
  8. {soco-cli-0.4.74 → soco-cli-0.4.75}/README.md +0 -0
  9. {soco-cli-0.4.74 → soco-cli-0.4.75}/pyproject.toml +0 -0
  10. {soco-cli-0.4.74 → soco-cli-0.4.75}/requirements.txt +0 -0
  11. {soco-cli-0.4.74 → soco-cli-0.4.75}/setup.cfg +0 -0
  12. {soco-cli-0.4.74 → soco-cli-0.4.75}/setup.py +0 -0
  13. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/__main__.py +0 -0
  14. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/action_processor.py +0 -0
  15. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/alarms.py +0 -0
  16. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/aliases.py +0 -0
  17. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/api.py +0 -0
  18. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/check_for_update.py +0 -0
  19. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/cmd_parser.py +0 -0
  20. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/http_api.py +0 -0
  21. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/interactive.py +0 -0
  22. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/keystroke_capture.py +0 -0
  23. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/m3u_parser.py +0 -0
  24. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/match_speaker_names.py +0 -0
  25. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/play_local_file_lists.py +0 -0
  26. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/sonos.py +0 -0
  27. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/sonos_discover.py +0 -0
  28. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/speaker_info.py +0 -0
  29. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/speakers.py +0 -0
  30. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/track_follow.py +0 -0
  31. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/utils.py +0 -0
  32. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli/wait_actions.py +0 -0
  33. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli.egg-info/SOURCES.txt +0 -0
  34. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli.egg-info/dependency_links.txt +0 -0
  35. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli.egg-info/entry_points.txt +0 -0
  36. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli.egg-info/requires.txt +0 -0
  37. {soco-cli-0.4.74 → soco-cli-0.4.75}/soco_cli.egg-info/top_level.txt +0 -0
  38. {soco-cli-0.4.74 → soco-cli-0.4.75}/tests/test_cli.py +0 -0
  39. {soco-cli-0.4.74 → soco-cli-0.4.75}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: soco-cli
3
- Version: 0.4.74
3
+ Version: 0.4.75
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
@@ -10,4 +10,4 @@ server, to control Sonos via HTTP requests.
10
10
  For more information, please see: https://github.com/avantrec/soco-cli
11
11
  """
12
12
 
13
- __version__ = "0.4.74"
13
+ __version__ = "0.4.75"
@@ -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 address for Sonos
128
- # on this host by finding an IP that can reach the
129
- # target speaker.
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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: soco-cli
3
- Version: 0.4.74
3
+ Version: 0.4.75
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
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