diff --git a/FAQ.md b/FAQ.md index 27e03ffc..a5bbf97f 100644 --- a/FAQ.md +++ b/FAQ.md @@ -18,7 +18,6 @@ or the `environment:` section in `compose.yaml` file. | YTP_CONFIG_PATH | Path to where the config files will be stored. | `/config` | | YTP_TEMP_PATH | Path to where tmp files are stored. | `/tmp` | | YTP_TEMP_KEEP | Whether to keep the Individual video temp directory or remove it | `false` | -| YTP_KEEP_ARCHIVE | Keep history of downloaded videos | `true` | | YTP_HOST | Which IP address to bind to | `0.0.0.0` | | YTP_PORT | Which port to bind to | `8081` | | YTP_LOG_LEVEL | Log level | `info` | @@ -27,7 +26,6 @@ or the `environment:` section in `compose.yaml` file. | YTP_ACCESS_LOG | Whether to log access to the web server | `true` | | YTP_DEBUG | Whether to turn on debug mode | `false` | | YTP_DEBUGPY_PORT | The port to use for the debugpy debugger | `5678` | -| YTP_SOCKET_TIMEOUT | The timeout for the yt-dlp socket connection variable | `30` | | YTP_EXTRACT_INFO_TIMEOUT | The timeout for extracting video information | `70` | | YTP_DB_FILE | The path to the SQLite database file | `{config_path}/ytptube.db` | | YTP_UI_UPDATE_TITLE | Whether to update the title of the page with the current stats | `true` | @@ -196,27 +194,6 @@ you and also enable the fallback by using the follow extractor args Use this alternative extractor args in case the extractor fails to get the pot tokens from the bgutil provider server. For more information please visit [bgutil-ytdlp-pot-provider](https://github.com/Brainicism/bgutil-ytdlp-pot-provider) project. -# How to set global settings for yt-dlp? - -You can create a file named `ytdlp.cli` in the `/config` folder, and add your desired global settings there. - -> [!IMPORTANT] -> We strongly recommend to use presets instead of global settings, as presets are more convenient. - -The `ytdlp.cli` file usage is deprecated and likely will be removed in `v1.0.0` release. - -# Updating yt-dlp - -The engine which powers the actual video downloads in YTPTube is [yt-dlp](https://github.com/yt-dlp/yt-dlp). Since video -sites regularly updated, frequent updates of yt-dlp are required to keep up. - -We have added the `YTP_YTDLP_AUTO_UPDATE` environment variable, which is enabled by default. This feature allows the -container to automatically update `yt-dlp` to the latest version whenever the container starts. If a new version is -available, it will be downloaded and applied automatically. To disable this automatic update, set the -`YTP_YTDLP_AUTO_UPDATE` environment variable to `false`. - -We will no longer release new versions of YTPTube for every new version of yt-dlp. - # Troubleshooting and submitting issues Before asking a question or submitting an issue for YTPTube, please remember that YTPTube is only a thin wrapper for diff --git a/app/library/Download.py b/app/library/Download.py index 4e015e63..b42a4dca 100644 --- a/app/library/Download.py +++ b/app/library/Download.py @@ -180,7 +180,6 @@ class Download: try: params: dict = ( self.info.get_ytdlp_opts() - .add({"break_on_existing": True}) .add( config={ "color": "no_color", diff --git a/app/library/DownloadQueue.py b/app/library/DownloadQueue.py index efb8e2b9..67148ea3 100644 --- a/app/library/DownloadQueue.py +++ b/app/library/DownloadQueue.py @@ -413,7 +413,7 @@ class DownloadQueue(metaclass=Singleton): try: _item: Download = self.done.get(key=entry.get("id"), url=entry.get("webpage_url") or entry.get("url")) - err_msg: str = f"Item '{_item.info.id}' - '{_item.info.title}' already exists. Removing from history." + err_msg: str = f"Removing {_item.info.name()} from history list." LOG.warning(err_msg) await self.clear([_item.info._id], remove_file=False) except KeyError: @@ -423,7 +423,7 @@ class DownloadQueue(metaclass=Singleton): _item: Download = self.queue.get( key=str(entry.get("id")), url=str(entry.get("webpage_url") or entry.get("url")) ) - err_msg: str = f"Item ID '{_item.info.id}' - '{_item.info.title}' already in download queue." + err_msg: str = f"Item {_item.info.name()} is already in download queue." LOG.info(err_msg) return {"status": "error", "msg": err_msg} except KeyError: @@ -977,7 +977,7 @@ class DownloadQueue(metaclass=Singleton): if entry.info.status not in ("finished", "skip", "cancelled"): if not entry.info.error: - entry.info.error = f"Download failed with status '{entry.info.status}'." + entry.info.error = f"Download ended with unexpected status '{entry.info.status}'." entry.info.status = "error" except Exception as e: entry.info.status = "error" @@ -1005,9 +1005,11 @@ class DownloadQueue(metaclass=Singleton): if entry.info.status == "finished" and entry.info.filename: nTitle = "Download Completed" nMessage = f"Completed '{entry.info.title}' download." + if entry.info.is_archivable and not entry.info.is_archived: + entry.info.is_archived = True + _tasks.append(self._notify.emit(Events.ITEM_COMPLETED, data=entry.info, title=nTitle, message=nMessage)) - await asyncio.sleep(0.5) self.done.put(entry) _tasks.append( self._notify.emit( @@ -1115,7 +1117,6 @@ class DownloadQueue(metaclass=Singleton): ) ) except Exception as e: - item.info.archive_status() self.done.put(item) LOG.exception(e) LOG.error(f"Failed to retry item '{item_ref}'. {e!s}") diff --git a/app/library/Utils.py b/app/library/Utils.py index 418f747e..b01a6cac 100644 --- a/app/library/Utils.py +++ b/app/library/Utils.py @@ -63,7 +63,7 @@ REMOVE_KEYS: list = [ YTDLP_INFO_CLS: YTDLP = None -ALLOWED_SUBS_EXTENSIONS: tuple[str, str, str] = (".srt", ".vtt", ".ass") +ALLOWED_SUBS_EXTENSIONS: set[str] = {".srt", ".vtt", ".ass"} FILES_TYPE: list = [ {"rx": re.compile(r"\.(avi|ts|mkv|mp4|mp3|mpv|ogm|m4v|webm|m4b)$", re.IGNORECASE), "type": "video"}, diff --git a/app/library/config.py b/app/library/config.py index cb803331..dc3d68b0 100644 --- a/app/library/config.py +++ b/app/library/config.py @@ -386,23 +386,18 @@ class Config: opts_file: Path = Path(self.config_path) / "ytdlp.cli" if opts_file.exists() and opts_file.stat().st_size > 2: - LOG.error("The global config file 'ytdlp.cli' file is deprecated and will be removed in future releases.") + LOG.warning( + "Usage of 'ytdlp.cli' global config file is deprecated and will be removed in future releases. please migrate to presets." + ) with open(opts_file) as f: self.ytdlp_cli = f.read().strip() if self.ytdlp_cli: self._ytdlp_cli_mutable = self.ytdlp_cli try: - removed_options: list = [] - arg_converter(args=self.ytdlp_cli, level=True, removed_options=removed_options) - if len(removed_options) > 0: - LOG.warning( - "Removed the following options: '%s' from '%s'", ", ".join(removed_options), opts_file - ) + arg_converter(args=self.ytdlp_cli, level=True) except Exception as e: msg = f"Failed to parse yt-dlp cli options from '{opts_file}'. '{e!s}'." raise ValueError(msg) from e - else: - LOG.warning(f"Empty yt-dlp custom options file '{opts_file}'.") self._ytdlp_cli_mutable += f"\n--socket-timeout {self.socket_timeout}" @@ -513,8 +508,8 @@ class Config: Returns: dict: The yt-dlp command line options. - Todo: - Rename to get_ytdlp_opts() to match the system. + Deprecated: + Usage of global ytdlp.cli file is deprecated, please use presets instead. """ try: diff --git a/app/library/encoder.py b/app/library/encoder.py index 5f292d64..d16aaf12 100644 --- a/app/library/encoder.py +++ b/app/library/encoder.py @@ -5,8 +5,6 @@ from pathlib import Path from yt_dlp.networking.impersonate import ImpersonateTarget from yt_dlp.utils import DateRange -from .ItemDTO import ItemDTO - class Encoder(json.JSONEncoder): """ @@ -16,6 +14,8 @@ class Encoder(json.JSONEncoder): """ def default(self, o): + from .ItemDTO import ItemDTO + if isinstance(o, Path): return str(o) diff --git a/app/library/task_handlers/youtube.py b/app/library/task_handlers/youtube.py index 86dea377..eae2b340 100644 --- a/app/library/task_handlers/youtube.py +++ b/app/library/task_handlers/youtube.py @@ -126,7 +126,6 @@ class YoutubeHandler: has_items = True if archive_id in YoutubeHandler.queued: - LOG.debug(f"Item '{vid}' is already queued for download. Skipping.") continue items.append({"id": vid, "url": url, "title": title, "published": published, "archive_id": archive_id}) diff --git a/ui/app/pages/index.vue b/ui/app/pages/index.vue index cdfb5eec..27c065ba 100644 --- a/ui/app/pages/index.vue +++ b/ui/app/pages/index.vue @@ -85,6 +85,7 @@ The Basic mode (which limited the interface to the new download form) is being removed. Everything except what is available behind configurable flag will become part of the standard interface. +
These changes help reduce confusion from multiple sources of truth. Going forward, presets