From b0f100c1937a9157cf3f8914f1358b0903c3bd93 Mon Sep 17 00:00:00 2001 From: ArabCoders Date: Fri, 15 Mar 2024 00:10:02 +0300 Subject: [PATCH 1/4] update packages. --- Pipfile | 16 ++++++++-------- Pipfile.lock | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Pipfile b/Pipfile index d292e3e4..372a888d 100644 --- a/Pipfile +++ b/Pipfile @@ -4,15 +4,15 @@ verify_ssl = true name = "pypi" [packages] -python-socketio = "~=5.0" -aiohttp = "*" +python-socketio = ">=5.11.1" +aiohttp = ">=3.9.3" yt-dlp = "*" -caribou = "*" -coloredlogs = "*" -aiocron = "*" -python-dotenv = "*" -python-magic = "*" -debugpy = "*" +caribou = ">=0.3.0" +coloredlogs = ">=15.0.1" +aiocron = ">=1.8" +python-dotenv = ">=1.0.1" +python-magic = ">=0.4.27" +debugpy = ">=1.8.1" [dev-packages] diff --git a/Pipfile.lock b/Pipfile.lock index b7a8d40c..45b43f32 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "969599ea205de43f64d64331fc3307bb0d9be1dc1830c57b51f93c607d2bbe1f" + "sha256": "6f7d266189a02316b0a7f6d1958351963de5dfa35b6e3860c1da5da875629843" }, "pipfile-spec": 6, "requires": { From 38ec713f153d61812ccd1beff52731f81f71bd97 Mon Sep 17 00:00:00 2001 From: ArabCoders Date: Fri, 15 Mar 2024 01:16:11 +0300 Subject: [PATCH 2/4] fix --- app/DownloadQueue.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/DownloadQueue.py b/app/DownloadQueue.py index a8d32228..a6308a2c 100644 --- a/app/DownloadQueue.py +++ b/app/DownloadQueue.py @@ -134,7 +134,7 @@ class DownloadQueue: output_template=output_template if output_template else self.config.output_template, datetime=formatdate(time.time()), error=error, - is_live=entry.get('is_live', None) or 'is_live' == entry.get('live_status', None) or live_in, + is_live=entry.get('is_live', None) or entry.get('live_status', None) in ['is_live', 'is_upcoming'] or live_in, live_in=live_in, options=options ) From 9560d0f7b6c9e6542a16cb8fddd5eea2da0e5e8e Mon Sep 17 00:00:00 2001 From: ArabCoders Date: Fri, 15 Mar 2024 01:32:33 +0300 Subject: [PATCH 3/4] Fixes is_upcoming in frontend --- app/DownloadQueue.py | 2 +- frontend/src/components/Page-Completed.vue | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/DownloadQueue.py b/app/DownloadQueue.py index a6308a2c..ed5ae079 100644 --- a/app/DownloadQueue.py +++ b/app/DownloadQueue.py @@ -160,7 +160,7 @@ class DownloadQueue: debug=bool(self.config.ytdl_debug) ) - if dlInfo.info.live_in: + if dlInfo.info.live_in or 'is_upcoming' == entry.get('live_status',None): dlInfo.info.status = 'not_live' itemDownload = self.done.put(dlInfo) NotifyEvent = 'completed' diff --git a/frontend/src/components/Page-Completed.vue b/frontend/src/components/Page-Completed.vue index 6c18559f..29ce86bf 100644 --- a/frontend/src/components/Page-Completed.vue +++ b/frontend/src/components/Page-Completed.vue @@ -77,7 +77,7 @@
-
+
- + From b56351cd055425f8eafa4db017841d8a0f5cd1ad Mon Sep 17 00:00:00 2001 From: ArabCoders Date: Sat, 16 Mar 2024 01:22:07 +0300 Subject: [PATCH 4/4] Reduce extract_info calls. --- app/Download.py | 15 ++++++++++++++- app/DownloadQueue.py | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/Download.py b/app/Download.py index 1da4a8fd..6f51b7ec 100644 --- a/app/Download.py +++ b/app/Download.py @@ -9,6 +9,7 @@ import yt_dlp from Utils import Notifier, get_format, get_opts, jsonCookie, mergeConfig from ItemDTO import ItemDTO from Config import Config + import hashlib LOG = logging.getLogger('download') @@ -33,6 +34,8 @@ class Download: notifier: Notifier = None canceled: bool = False is_live: bool = False + info_dict: dict = None + "yt-dlp metadata dict." bad_live_options: list = [ "concurrent_fragment_downloads", @@ -64,6 +67,7 @@ class Download: temp_dir: str, output_template_chapter: str, default_ytdl_opts: dict, + info_dict: dict = None, debug: bool = False ): self.download_dir = download_dir @@ -87,6 +91,7 @@ class Download: self.tempKeep = bool(Config.get_instance().temp_keep) self.is_live = bool(info.is_live) or info.live_in is not None self.is_manifestless = 'is_manifestless' in self.info.options and self.info.options['is_manifestless'] is True + self.info_dict = info_dict def _progress_hook(self, data: dict): dataDict = {k: v for k, v in data.items() if k in self._ytdlp_fields} @@ -163,7 +168,15 @@ class Download: LOG.info(f'Downloading {os.getpid()=} id="{self.info.id}" title="{self.info.title}".') - ret = yt_dlp.YoutubeDL(params=params).download([self.info.url]) + cls = yt_dlp.YoutubeDL(params=params) + + if isinstance(self.info_dict, dict) and len(self.info_dict) > 1: + LOG.debug(f'Downloading using pre-info.') + cls.process_ie_result(self.info_dict, download=True) + ret = cls._download_retcode + else: + LOG.debug(f'Downloading using url: {self.info.url}') + ret = cls.download([self.info.url]) self.status_queue.put({'id': self.id, 'status': 'finished' if ret == 0 else 'error'}) except Exception as exc: diff --git a/app/DownloadQueue.py b/app/DownloadQueue.py index ed5ae079..a6f7c207 100644 --- a/app/DownloadQueue.py +++ b/app/DownloadQueue.py @@ -157,6 +157,7 @@ class DownloadQueue: temp_dir=self.config.temp_path, output_template_chapter=output_chapter, default_ytdl_opts=self.config.ytdl_options, + info_dict=entry, debug=bool(self.config.ytdl_debug) )