add support for --no-continue

This commit is contained in:
arabcoders 2025-08-20 19:29:39 +03:00
parent a0533a0861
commit 3ebd66fd60
3 changed files with 23 additions and 5 deletions

View file

@ -25,6 +25,7 @@
"brainicism",
"brotlicffi",
"consoletitle",
"continuedl",
"cookiesfrombrowser",
"copyts",
"creationflags",

View file

@ -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):
"""

View file

@ -127,8 +127,8 @@
<span>
<NuxtLink @click="showOptions = true" v-text="'View all options'" />. Not all options are supported
<NuxtLink target="_blank"
to="https://github.com/arabcoders/ytptube/blob/master/app/library/Utils.py#L26">some are
ignored</NuxtLink>. Use with caution.
to="https://github.com/arabcoders/ytptube/blob/master/app/library/Utils.py#L26">some
are ignored</NuxtLink>. Use with caution.
</span>
</span>
</div>
@ -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}`)
}