diff --git a/.vscode/settings.json b/.vscode/settings.json index ad57e7c4..b375b46a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -25,6 +25,7 @@ "brainicism", "brotlicffi", "consoletitle", + "continuedl", "cookiesfrombrowser", "copyts", "creationflags", diff --git a/app/library/Download.py b/app/library/Download.py index c81e15ef..f7b3b8f9 100644 --- a/app/library/Download.py +++ b/app/library/Download.py @@ -276,6 +276,9 @@ class Download: params["logger"] = NestedLogger(self.logger) + if "continuedl" in params and params["continuedl"] is False: + self.delete_temp(by_pass=True) + cls = YTDLP(params=params) self.started_time = int(time.time()) @@ -435,11 +438,16 @@ class Download: return False - def delete_temp(self): + def delete_temp(self, by_pass: bool = False): if self.temp_disabled or self.temp_keep is True or not self.temp_path: return - if "finished" != self.info.status and self.info.downloaded_bytes and self.info.downloaded_bytes > 0: + if ( + not by_pass + and "finished" != self.info.status + and self.info.downloaded_bytes + and self.info.downloaded_bytes > 0 + ): self.logger.warning( f"Keeping temp folder '{self.temp_path}', as the reported status is not finished '{self.info.status}'." ) @@ -457,7 +465,11 @@ class Download: return status = delete_dir(tmp_dir) - self.logger.info(f"Temp folder '{self.temp_path}' deletion is {'success' if status else 'failed'}.") + if by_pass: + tmp_dir.mkdir(parents=True, exist_ok=True) + self.logger.info(f"Temp folder '{self.temp_path}' emptied.") + else: + self.logger.info(f"Temp folder '{self.temp_path}' deletion is {'success' if status else 'failed'}.") async def progress_update(self): """ diff --git a/ui/app/components/NewDownload.vue b/ui/app/components/NewDownload.vue index 55c3603c..4521ef55 100644 --- a/ui/app/components/NewDownload.vue +++ b/ui/app/components/NewDownload.vue @@ -127,8 +127,8 @@ . Not all options are supported some are - ignored. Use with caution. + to="https://github.com/arabcoders/ytptube/blob/master/app/library/Utils.py#L26">some + are ignored. Use with caution. @@ -313,6 +313,11 @@ const addDownload = async () => { continue } + const keyRegex = new RegExp(`(^|\s)${key}(\s|$)`); + if (form_cli && keyRegex.test(form_cli)) { + continue; + } + joined.push(true === value ? `${key}` : `${key} ${value}`) }