Skip to content

Commit

Permalink
fixed mac os ffmpeg download
Browse files Browse the repository at this point in the history
  • Loading branch information
xnetcat authored Dec 8, 2023
1 parent ce15467 commit 9037a96
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions spotdl/utils/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
"darwin": {
"x86_64": "https://github.com/eugeneware/ffmpeg-static/releases/download/b4.4/darwin-x64",
"arm": "https://github.com/eugeneware/ffmpeg-static/releases/download/b4.4/darwin-arm64",
"arm64": "https://github.com/eugeneware/ffmpeg-static/releases/download/b4.4/darwin-arm64",
},
}

Expand Down Expand Up @@ -215,17 +215,27 @@ def download_ffmpeg() -> Path:

os_name = platform.system().lower()
os_arch = platform.machine().lower()
ffmpeg_url: Optional[str] = None

# if platform.system() == "Darwin" and (
# platform.processor() == "arm"
# or subprocess.run(["sysctl", "-n", "sysctl.proc_translated"], check=False)
# ):
# ffmpeg_url = FFMPEG_URLS["darwin"]["arm"]
# else:
# ffmpeg_url = FFMPEG_URLS.get(os_name, {}).get(os_arch)

ffmpeg_url = FFMPEG_URLS.get(os_name, {}).get(os_arch)

if ffmpeg_url is None:
raise FFmpegError("FFmpeg binary is not available for your system.")

ffmpeg_path = Path(
os.path.join(
get_spotdl_path(), "ffmpeg" + (".exe" if os_name == "windows" else "")
)
)

if ffmpeg_url is None:
raise FFmpegError("FFmpeg binary is not available for your system.")

# Download binary and save it to a file in spotdl directory
ffmpeg_binary = requests.get(ffmpeg_url, allow_redirects=True, timeout=10).content
with open(ffmpeg_path, "wb") as ffmpeg_file:
Expand Down

0 comments on commit 9037a96

Please sign in to comment.