From 0c760a08e528650ade9c2698bb1b7c4e44108d82 Mon Sep 17 00:00:00 2001 From: jenz Date: Thu, 30 Apr 2026 23:05:41 +0200 Subject: [PATCH] added proxy config for ffmpeg --- .../Torchlight/FFmpegAudioPlayer.py | 20 +++++++++++++------ .../torchlight3/config.json | 3 ++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/torchlight_changes_unloze/torchlight3/Torchlight/FFmpegAudioPlayer.py b/torchlight_changes_unloze/torchlight3/Torchlight/FFmpegAudioPlayer.py index 064a789..661dcfc 100755 --- a/torchlight_changes_unloze/torchlight3/Torchlight/FFmpegAudioPlayer.py +++ b/torchlight_changes_unloze/torchlight3/Torchlight/FFmpegAudioPlayer.py @@ -63,13 +63,21 @@ class FFmpegAudioPlayer(): if self.Playing: self.Stop() - if position: - PosStr = str(datetime.timedelta(seconds = position)) - #Command = ["/usr/bin/ffmpeg", "-ss", PosStr, "-i", uri, "-acodec", "pcm_s16le", "-ac", "1", "-ar", str(int(self.SampleRate)), "-f", "s16le", "-vn", *args] - Command = ["/usr/bin/ffmpeg", "-ss", PosStr, "-i", uri, "-acodec", "pcm_s16le", "-ac", str(self.Channels), "-ar", str(int(self.SampleRate)), "-f", "s16le", "-vn"] + proxy_url = "" + if uri.startswith("http://") or uri.startswith("https://"): + proxy_url = self.Torchlight().Config["Proxy"] + + if position: + PosStr = str(datetime.timedelta(seconds=position)) + Command = ["/usr/bin/ffmpeg"] + if proxy_url: + Command += ["-http_proxy", proxy_url] + Command += ["-ss", PosStr, "-i", uri, "-acodec", "pcm_s16le", "-ac", str(self.Channels), "-ar", str(int(self.SampleRate)), "-f", "s16le", "-vn"] else: - #Command = ["/usr/bin/ffmpeg", "-i", uri, "-acodec", "pcm_s16le", "-ac", "1", "-ar", str(int(self.SampleRate)), "-f", "s16le", "-vn", *args] - Command = ["/usr/bin/ffmpeg", "-i", uri, "-acodec", "pcm_s16le", "-ac", str(self.Channels), "-ar", str(int(self.SampleRate)), "-f", "s16le", "-vn"] + Command = ["/usr/bin/ffmpeg"] + if proxy_url: + Command += ["-http_proxy", proxy_url] + Command += ["-i", uri, "-acodec", "pcm_s16le", "-ac", str(self.Channels), "-ar", str(int(self.SampleRate)), "-f", "s16le", "-vn"] if args: Command += list(args) diff --git a/torchlight_changes_unloze/torchlight3/config.json b/torchlight_changes_unloze/torchlight3/config.json index f9c703a..1e78854 100755 --- a/torchlight_changes_unloze/torchlight3/config.json +++ b/torchlight_changes_unloze/torchlight3/config.json @@ -58,5 +58,6 @@ }, "WolframAPIKey": "", - "OpenWeatherAPIKey": "" + "OpenWeatherAPIKey": "", + "Proxy": "" }