diff --git a/app/library/DownloadQueue.py b/app/library/DownloadQueue.py index df84ba68..07e92b22 100644 --- a/app/library/DownloadQueue.py +++ b/app/library/DownloadQueue.py @@ -184,8 +184,8 @@ class DownloadQueue(metaclass=Singleton): """ if item.has_extras(): for key in item.extras.copy(): - if not str(key).startswith("playlist"): - item.extras.pop(key, None) + if not self.keep_extra_key(key): + item.extras.pop(key) if not entry: return {"status": "error", "msg": "Invalid/empty data was given."} @@ -395,6 +395,10 @@ class DownloadQueue(metaclass=Singleton): .get_all(), } + if yt_conf.get("external_downloader"): + LOG.warning(f"Using external downloader '{yt_conf.get('external_downloader')}' for '{item.url}'.") + item.extras.update({"external_downloader": True}) + downloaded, id_dict = self._is_downloaded(file=yt_conf.get("download_archive", None), url=item.url) if downloaded is True and id_dict: message = f"This url with ID '{id_dict.get('id')}' has been downloaded already and recorded in archive." @@ -715,3 +719,17 @@ class DownloadQueue(metaclass=Singleton): return False, None return is_downloaded(file, url) + + def keep_extra_key(self, key: str) -> bool: + """ + Check if the extra key should be kept. + + Args: + key (str): The extra key to check. + + Returns: + bool: True if the extra key should be kept, False otherwise. + + """ + keys = ("playlist", "external_downloader") + return any(key == k or key.startswith(k) for k in keys) diff --git a/ui/components/Queue.vue b/ui/components/Queue.vue index 03f7cd1c..066c477a 100644 --- a/ui/components/Queue.vue +++ b/ui/components/Queue.vue @@ -301,6 +301,10 @@ const setStatus = item => { return 'Live Streaming'; } + if ('preparing' === item.status) { + return ag(item, 'extras.external_downloader') ? 'External DL' : 'Preparing..'; + } + if (!item.status) { return 'Unknown..'; } @@ -372,7 +376,7 @@ const updateProgress = (item) => { } if ('preparing' === item.status) { - return 'Preparing'; + return ag(item, 'extras.external_downloader') ? 'External downloader.' : 'Preparing'; } if (null != item.status) {