diff --git a/app/library/Download.py b/app/library/Download.py index e0622233..29474493 100644 --- a/app/library/Download.py +++ b/app/library/Download.py @@ -281,9 +281,15 @@ class Download: ret = cls.download(url_list=[self.info.url]) self.status_queue.put({"id": self.id, "status": "finished" if ret == 0 else "error"}) + except yt_dlp.utils.ExistingVideoReached as exc: + self.logger.error(exc) + self.status_queue.put({"id": self.id, "status": "skip", "msg": "Item has already been downloaded."}) except Exception as exc: self.logger.exception(exc) + self.logger.error(exc) self.status_queue.put({"id": self.id, "status": "error", "msg": str(exc), "error": str(exc)}) + finally: + self.status_queue.put(Terminator()) self.logger.info(f'Task id="{self.info.id}" PID="{os.getpid()}" title="{self.info.title}" completed.') diff --git a/app/library/DownloadQueue.py b/app/library/DownloadQueue.py index cf355311..2f62cd59 100644 --- a/app/library/DownloadQueue.py +++ b/app/library/DownloadQueue.py @@ -493,9 +493,8 @@ class DownloadQueue(metaclass=Singleton): 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." - LOG.info(message) - await self._notify.emit(Events.LOG_WARNING, data=event_warning(message)) + message = f"'{id_dict.get('id')}': The URL '{item.url}' is already downloaded and recorded in archive." + LOG.error(message) return {"status": "error", "msg": message} started: float = time.perf_counter() @@ -528,6 +527,7 @@ class DownloadQueue(metaclass=Singleton): ) if not entry: + LOG.error(f"Unable to extract info for '{item.url}'. Logs: {logs}") return {"status": "error", "msg": "Unable to extract info." + "\n".join(logs)} if not item.requeued and (condition := Conditions.get_instance().match(info=entry)): @@ -759,7 +759,7 @@ class DownloadQueue(metaclass=Singleton): self._active[entry.info._id] = entry await entry.start() - if "finished" != entry.info.status: + if entry.info.status not in ("finished", "skip"): entry.info.status = "error" finally: if entry.info._id in self._active: diff --git a/ui/components/History.vue b/ui/components/History.vue index 5c1d6cc1..df558a1c 100644 --- a/ui/components/History.vue +++ b/ui/components/History.vue @@ -666,6 +666,10 @@ const setIcon = item => { return item.extras?.is_premiere ? 'fa-solid fa-star' : 'fa-solid fa-headset' } + if ('skip' === item.status) { + return 'fa-solid fa-ban' + } + return 'fa-solid fa-circle' } @@ -681,7 +685,7 @@ const setIconColor = item => { return 'has-text-info' } - if ('cancelled' === item.status) { + if ('cancelled' === item.status || "skipped" === item.status) { return 'has-text-warning' } @@ -690,10 +694,6 @@ const setIconColor = item => { const setStatus = item => { if ('finished' === item.status) { - if (!item.filename) { - return 'Skipped?' - } - if (item.extras?.is_premiere) { return 'Premiered' } @@ -716,6 +716,10 @@ const setStatus = item => { return display_style.value === 'cards' ? 'Stream' : 'Live' } + if ('skip' === item.status) { + return 'Skipped' + } + return item.status }