Show that a external dl is being used if we are stuck in preparing stage as yt-dlp doesn't trigger progress_hook
This commit is contained in:
parent
4a21592e12
commit
17dd007ff0
2 changed files with 25 additions and 3 deletions
|
|
@ -184,8 +184,8 @@ class DownloadQueue(metaclass=Singleton):
|
||||||
"""
|
"""
|
||||||
if item.has_extras():
|
if item.has_extras():
|
||||||
for key in item.extras.copy():
|
for key in item.extras.copy():
|
||||||
if not str(key).startswith("playlist"):
|
if not self.keep_extra_key(key):
|
||||||
item.extras.pop(key, None)
|
item.extras.pop(key)
|
||||||
|
|
||||||
if not entry:
|
if not entry:
|
||||||
return {"status": "error", "msg": "Invalid/empty data was given."}
|
return {"status": "error", "msg": "Invalid/empty data was given."}
|
||||||
|
|
@ -395,6 +395,10 @@ class DownloadQueue(metaclass=Singleton):
|
||||||
.get_all(),
|
.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)
|
downloaded, id_dict = self._is_downloaded(file=yt_conf.get("download_archive", None), url=item.url)
|
||||||
if downloaded is True and id_dict:
|
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."
|
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 False, None
|
||||||
|
|
||||||
return is_downloaded(file, url)
|
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)
|
||||||
|
|
|
||||||
|
|
@ -301,6 +301,10 @@ const setStatus = item => {
|
||||||
return 'Live Streaming';
|
return 'Live Streaming';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('preparing' === item.status) {
|
||||||
|
return ag(item, 'extras.external_downloader') ? 'External DL' : 'Preparing..';
|
||||||
|
}
|
||||||
|
|
||||||
if (!item.status) {
|
if (!item.status) {
|
||||||
return 'Unknown..';
|
return 'Unknown..';
|
||||||
}
|
}
|
||||||
|
|
@ -372,7 +376,7 @@ const updateProgress = (item) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('preparing' === item.status) {
|
if ('preparing' === item.status) {
|
||||||
return 'Preparing';
|
return ag(item, 'extras.external_downloader') ? 'External downloader.' : 'Preparing';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null != item.status) {
|
if (null != item.status) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue