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": "" }