From dbebb4c988beb85a10f836d83df7fe351834945b Mon Sep 17 00:00:00 2001 From: Mirko Ceroni Date: Mon, 1 Jul 2024 21:17:49 +0200 Subject: [PATCH 1/5] Update audio.py pass to yt-dlp --- mkchromecast/audio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkchromecast/audio.py b/mkchromecast/audio.py index 06a76fa9..bbb4c905 100644 --- a/mkchromecast/audio.py +++ b/mkchromecast/audio.py @@ -61,7 +61,7 @@ query = urllib.parse.parse_qs(url_data.query) video = query["v"][0] print(colors.options("Playing video:") + " " + video) - command = ["youtube-dl", "-o", "-", _mkcc.youtube_url] + command = ["yt-dlp", "-o", "-", _mkcc.youtube_url] media_type = "audio/mp4" else: backend.name = _mkcc.backend From 5f5bae0e8bda3cf53c2db2e024a829c08726c915 Mon Sep 17 00:00:00 2001 From: Mirko Ceroni Date: Mon, 1 Jul 2024 21:20:13 +0200 Subject: [PATCH 2/5] Update pipeline_builder.py pass to yt-dlp --- mkchromecast/pipeline_builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkchromecast/pipeline_builder.py b/mkchromecast/pipeline_builder.py index 3b71bc2f..ac0d8126 100644 --- a/mkchromecast/pipeline_builder.py +++ b/mkchromecast/pipeline_builder.py @@ -239,7 +239,7 @@ def __init__(self, video_settings: VideoSettings): @property def command(self) -> SubprocessCommand: if self._settings.operation == OpMode.YOUTUBE: - return ["youtube-dl", "-o", "-", self._settings.youtube_url] + return ["yt-dlp", "-o", "-", self._settings.youtube_url] if self._settings.operation == OpMode.SCREENCAST: return self._screencast_command() From e3f72316d75cdec66a3be1e4369bf13f6e51209d Mon Sep 17 00:00:00 2001 From: Mirko Ceroni Date: Mon, 1 Jul 2024 21:22:21 +0200 Subject: [PATCH 3/5] Update __init__.py pass to yt-dlp --- mkchromecast/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mkchromecast/__init__.py b/mkchromecast/__init__.py index 705e62ff..8d35717a 100644 --- a/mkchromecast/__init__.py +++ b/mkchromecast/__init__.py @@ -157,7 +157,7 @@ def __init__(self, args = None): self.codec = args.codec # TODO(xsdg): Add support for yt-dlp - command_choices = ["ffmpeg", "youtube-dl"] + command_choices = ["ffmpeg", "yt-dlp"] self.command: Optional[str] if not args.command: self.command = None @@ -230,13 +230,13 @@ def __init__(self, args = None): else: if not check_url(args.youtube): youtube_error = """ - You need to provide a URL that is supported by youtube-dl. + You need to provide a URL that is supported by yt-dlp. """ # TODO(xsdg): Switch to yt-dlp. message = """ For a list of supported sources please visit: - https://rg3.github.io/youtube-dl/supportedsites.html + https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md?plain=1 Note that the URLs have to start with https. """ From fd7e7a3abca26ccc2b79bb38d78d9d9a330108de Mon Sep 17 00:00:00 2001 From: Mirko Ceroni Date: Mon, 1 Jul 2024 21:32:12 +0200 Subject: [PATCH 4/5] Update audio.py corrected bug --- mkchromecast/audio.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/mkchromecast/audio.py b/mkchromecast/audio.py index bbb4c905..8d287470 100644 --- a/mkchromecast/audio.py +++ b/mkchromecast/audio.py @@ -37,6 +37,15 @@ frame_size = 32 * _mkcc.chunk_size buffer_size = 2 * _mkcc.chunk_size**2 +encode_settings = pipeline_builder.EncodeSettings( + codec=_mkcc.codec, + adevice=_mkcc.adevice, + bitrate=_mkcc.bitrate, + frame_size=frame_size, + samplerate=str(_mkcc.samplerate), + segment_time=_mkcc.segment_time + ) + debug = _mkcc.debug if debug is True: @@ -65,15 +74,7 @@ media_type = "audio/mp4" else: backend.name = _mkcc.backend - backend.path = backend.name - encode_settings = pipeline_builder.EncodeSettings( - codec=_mkcc.codec, - adevice=_mkcc.adevice, - bitrate=_mkcc.bitrate, - frame_size=frame_size, - samplerate=str(_mkcc.samplerate), - segment_time=_mkcc.segment_time - ) + backend.path = backend.name # TODO(xsdg): Why is this only run in tray mode??? if _mkcc.operation == OpMode.TRAY and backend.name in {"ffmpeg", "parec"}: From fc9abfcb3359ac31af1bcfa265bb2b2db9960745 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 1 Jul 2024 21:44:07 +0200 Subject: [PATCH 5/5] substituted youtube-dl with yt-dlp --- mkchromecast/_arg_parsing.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mkchromecast/_arg_parsing.py b/mkchromecast/_arg_parsing.py index 05564368..129d0c2c 100644 --- a/mkchromecast/_arg_parsing.py +++ b/mkchromecast/_arg_parsing.py @@ -558,12 +558,12 @@ def raise_arg_type_error(): type=str, default=None, help=""" - Stream from sources supported by youtube-dl. This option needs - the youtube-dl package, and it also gives you access to all its + Stream from sources supported by yt-dlp. This option needs + the yt-dlp package, and it also gives you access to all its supported websites such as Dailymotion, LiveLeak, and Vimeo. For a comprehensive list, check: - http://rg3.github.io/youtube-dl/supportedsites.html. + http://rg3.github.io/yt-dlp/supportedsites.html. Example: python mkchromecast.py -y https://www.youtube.com/watch?v=NVvAJhZVBTc