Skip to content

Commit

Permalink
Cleanup binaries (#1014)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt authored Jan 21, 2024
1 parent bf21200 commit 0982c30
Show file tree
Hide file tree
Showing 33 changed files with 17 additions and 85 deletions.
49 changes: 9 additions & 40 deletions music_assistant/server/providers/airplay/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,52 +330,21 @@ async def check_bridge_binary(bridge_binary_path: str) -> str | None:
):
self._bridge_bin = bridge_binary_path
return bridge_binary_path
except OSError:
except OSError as err:
self.logger.exception(err)
return None

base_path = os.path.join(os.path.dirname(__file__), "bin")
if platform.system() == "Windows" and (
bridge_binary := await check_bridge_binary(
os.path.join(base_path, "squeeze2raop-static.exe")
)

system = platform.system().lower()
architecture = platform.machine().lower()

if bridge_binary := await check_bridge_binary(
os.path.join(base_path, f"squeeze2raop-{system}-{architecture}-static")
):
return bridge_binary
if platform.system() == "Darwin":
# macos binary is autoselect x86_64/arm64
if bridge_binary := await check_bridge_binary(
os.path.join(base_path, "squeeze2raop-macos-static")
):
return bridge_binary

if platform.system() == "FreeBSD":
# FreeBSD binary is x86_64 intel
if bridge_binary := await check_bridge_binary(
os.path.join(base_path, "squeeze2raop-freebsd-x86_64-static")
):
return bridge_binary

if platform.system() == "Linux":
architecture = platform.machine()
if architecture in ["AMD64", "x86_64"]:
# generic linux x86_64 binary
if bridge_binary := await check_bridge_binary(
os.path.join(
base_path,
"squeeze2raop-linux-x86_64-static",
)
):
return bridge_binary

# other linux architecture... try all options one by one...
for arch in ["aarch64", "arm", "armv6", "mips", "sparc64", "x86"]:
if bridge_binary := await check_bridge_binary(
os.path.join(base_path, f"squeeze2raop-linux-{arch}-static")
):
return bridge_binary

raise RuntimeError(
f"Unable to locate RaopBridge for {platform.system()} ({platform.machine()})"
)
raise RuntimeError(f"Unable to locate RaopBridge for {system}/{architecture}")

async def _bridge_process_runner(self, slimproto_prov: SlimprotoProvider) -> None:
"""Run the bridge binary in the background."""
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
48 changes: 8 additions & 40 deletions music_assistant/server/providers/spotify/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,45 +797,13 @@ async def check_librespot(librespot_path: str) -> str | None:
except OSError:
return None

base_path = os.path.join(os.path.dirname(__file__), "librespot")
if platform.system() == "Windows" and (
librespot := await check_librespot(os.path.join(base_path, "windows", "librespot.exe"))
base_path = os.path.join(os.path.dirname(__file__), "bin")
system = platform.system().lower()
architecture = platform.machine().lower()

if bridge_binary := await check_librespot(
os.path.join(base_path, f"librespot-{system}-{architecture}")
):
return librespot
if platform.system() == "Darwin":
# macos binary is x86_64 intel
if librespot := await check_librespot(os.path.join(base_path, "osx", "librespot")):
return librespot

if platform.system() == "FreeBSD":
# FreeBSD binary is x86_64 intel
if librespot := await check_librespot(os.path.join(base_path, "freebsd", "librespot")):
return librespot

if platform.system() == "Linux":
architecture = platform.machine()
if architecture in ["AMD64", "x86_64"]:
# generic linux x86_64 binary
if librespot := await check_librespot(
os.path.join(
base_path,
"linux",
"librespot-x86_64",
)
):
return librespot

# arm architecture... try all options one by one...
for arch in ["aarch64", "armv7", "armhf", "arm"]:
if librespot := await check_librespot(
os.path.join(
base_path,
"linux",
f"librespot-{arch}",
)
):
return librespot
return bridge_binary

raise RuntimeError(
f"Unable to locate Libespot for {platform.system()} ({platform.machine()})"
)
raise RuntimeError(f"Unable to locate Librespot for {system}/{architecture}")
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

0 comments on commit 0982c30

Please sign in to comment.