From c24f218670073455b008c88d90880818f3f7ab05 Mon Sep 17 00:00:00 2001 From: ArabCoders Date: Thu, 11 Jan 2024 19:08:01 +0300 Subject: [PATCH] Use different icon to differentiate Live vs normal download. --- .vscode/launch.json | 3 +-- app/Download.py | 4 +++- app/DownloadQueue.py | 2 +- frontend/src/components/Page-Completed.vue | 4 ++++ frontend/src/main.js | 4 ++-- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index cc9939a7..00142ba4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -26,8 +26,7 @@ "type": "python", "request": "launch", "program": "app/main.py", - "console": "integratedTerminal", - "justMyCode": true, + "console": "internalConsole", "env": { "YTP_CONFIG_PATH": "${workspaceFolder}/var/config", "YTP_DOWNLOAD_PATH": "${workspaceFolder}/var/downloads", diff --git a/app/Download.py b/app/Download.py index 9d2fd40a..5f427ad2 100644 --- a/app/Download.py +++ b/app/Download.py @@ -29,6 +29,7 @@ class Download: tempPath: str = None notifier: Notifier = None canceled: bool = False + is_live: bool = False _ytdlp_fields: tuple = ( 'tmpfilename', @@ -73,6 +74,7 @@ class Download: config = Config.get_instance() self.max_workers = int(config.max_workers) self.tempKeep = bool(config.temp_keep) + self.is_live = bool(info.is_live) or info.live_in is not None def _progress_hook(self, data: dict): dicto = {k: v for k, v in data.items() if k in self._ytdlp_fields} @@ -209,7 +211,7 @@ class Download: if self.tempKeep is True or not self.tempPath: return - if self.info.status != 'finished' and (self.info.live_in or self.info.is_live): + if self.info.status != 'finished' and self.is_live: log.warning( f'Keeping live temp directory: {self.tempPath}, as the reported status is not finished [{self.info.status}].') return diff --git a/app/DownloadQueue.py b/app/DownloadQueue.py index 6a65bc8f..9d0b795c 100644 --- a/app/DownloadQueue.py +++ b/app/DownloadQueue.py @@ -130,7 +130,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), + is_live=entry.get('is_live', None) or live_in is not None, live_in=live_in, ) diff --git a/frontend/src/components/Page-Completed.vue b/frontend/src/components/Page-Completed.vue index 4d48b54e..b90e5cf7 100644 --- a/frontend/src/components/Page-Completed.vue +++ b/frontend/src/components/Page-Completed.vue @@ -328,6 +328,10 @@ const clearFailed = () => { emits('deleteItem', 'completed', keys); } const setIcon = (item) => { + if (item.status === 'finished' && item.is_live) { + return 'fa-solid fa-globe'; + } + if (item.status === 'finished') { return 'fa-solid fa-circle-check'; } diff --git a/frontend/src/main.js b/frontend/src/main.js index 1388bc1a..9156da27 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -6,7 +6,7 @@ import { library } from '@fortawesome/fontawesome-svg-core' import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' import { faCog, faTrash, faLink, faPlus, faTrashCan, faCircleXmark, faCircleCheck, faRotateRight, faDownload, faUpRightFromSquare, - faSpinner, faArrowUp, faArrowDown, faTasks, faCalendar, faArrowUpAZ, faArrowDownAZ, faEject + faSpinner, faArrowUp, faArrowDown, faTasks, faCalendar, faArrowUpAZ, faArrowDownAZ, faEject, faGlobe } from '@fortawesome/free-solid-svg-icons' import { faSquare, faSquareCheck } from '@fortawesome/free-regular-svg-icons' @@ -18,7 +18,7 @@ import './assets/css/style.css' import 'floating-vue/dist/style.css' library.add(faCog, faTrash, faLink, faPlus, faTrashCan, faCircleXmark, faCircleCheck, faRotateRight, faDownload, faUpRightFromSquare, - faSquare, faSquareCheck, faSpinner, faArrowUp, faArrowDown, faTasks, faCalendar, faArrowUpAZ, faArrowDownAZ, faEject) + faSquare, faSquareCheck, faSpinner, faArrowUp, faArrowDown, faTasks, faCalendar, faArrowUpAZ, faArrowDownAZ, faEject, faGlobe) const app = createApp(App); app.config.globalProperties.capitalize = s => s && s[0].toUpperCase() + s.slice(1);