finalizing removed features

This commit is contained in:
arabcoders 2025-08-30 01:50:42 +03:00
parent db57d6de11
commit ed4bb1e440
8 changed files with 16 additions and 44 deletions

23
FAQ.md
View file

@ -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_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_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_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_HOST | Which IP address to bind to | `0.0.0.0` |
| YTP_PORT | Which port to bind to | `8081` | | YTP_PORT | Which port to bind to | `8081` |
| YTP_LOG_LEVEL | Log level | `info` | | 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_ACCESS_LOG | Whether to log access to the web server | `true` |
| YTP_DEBUG | Whether to turn on debug mode | `false` | | YTP_DEBUG | Whether to turn on debug mode | `false` |
| YTP_DEBUGPY_PORT | The port to use for the debugpy debugger | `5678` | | 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_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_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` | | 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. 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. 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 # Troubleshooting and submitting issues
Before asking a question or submitting an issue for YTPTube, please remember that YTPTube is only a thin wrapper for Before asking a question or submitting an issue for YTPTube, please remember that YTPTube is only a thin wrapper for

View file

@ -180,7 +180,6 @@ class Download:
try: try:
params: dict = ( params: dict = (
self.info.get_ytdlp_opts() self.info.get_ytdlp_opts()
.add({"break_on_existing": True})
.add( .add(
config={ config={
"color": "no_color", "color": "no_color",

View file

@ -413,7 +413,7 @@ class DownloadQueue(metaclass=Singleton):
try: try:
_item: Download = self.done.get(key=entry.get("id"), url=entry.get("webpage_url") or entry.get("url")) _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) LOG.warning(err_msg)
await self.clear([_item.info._id], remove_file=False) await self.clear([_item.info._id], remove_file=False)
except KeyError: except KeyError:
@ -423,7 +423,7 @@ class DownloadQueue(metaclass=Singleton):
_item: Download = self.queue.get( _item: Download = self.queue.get(
key=str(entry.get("id")), url=str(entry.get("webpage_url") or entry.get("url")) 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) LOG.info(err_msg)
return {"status": "error", "msg": err_msg} return {"status": "error", "msg": err_msg}
except KeyError: except KeyError:
@ -977,7 +977,7 @@ class DownloadQueue(metaclass=Singleton):
if entry.info.status not in ("finished", "skip", "cancelled"): if entry.info.status not in ("finished", "skip", "cancelled"):
if not entry.info.error: 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" entry.info.status = "error"
except Exception as e: except Exception as e:
entry.info.status = "error" entry.info.status = "error"
@ -1005,9 +1005,11 @@ class DownloadQueue(metaclass=Singleton):
if entry.info.status == "finished" and entry.info.filename: if entry.info.status == "finished" and entry.info.filename:
nTitle = "Download Completed" nTitle = "Download Completed"
nMessage = f"Completed '{entry.info.title}' download." 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)) _tasks.append(self._notify.emit(Events.ITEM_COMPLETED, data=entry.info, title=nTitle, message=nMessage))
await asyncio.sleep(0.5)
self.done.put(entry) self.done.put(entry)
_tasks.append( _tasks.append(
self._notify.emit( self._notify.emit(
@ -1115,7 +1117,6 @@ class DownloadQueue(metaclass=Singleton):
) )
) )
except Exception as e: except Exception as e:
item.info.archive_status()
self.done.put(item) self.done.put(item)
LOG.exception(e) LOG.exception(e)
LOG.error(f"Failed to retry item '{item_ref}'. {e!s}") LOG.error(f"Failed to retry item '{item_ref}'. {e!s}")

View file

@ -63,7 +63,7 @@ REMOVE_KEYS: list = [
YTDLP_INFO_CLS: YTDLP = None 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 = [ FILES_TYPE: list = [
{"rx": re.compile(r"\.(avi|ts|mkv|mp4|mp3|mpv|ogm|m4v|webm|m4b)$", re.IGNORECASE), "type": "video"}, {"rx": re.compile(r"\.(avi|ts|mkv|mp4|mp3|mpv|ogm|m4v|webm|m4b)$", re.IGNORECASE), "type": "video"},

View file

@ -386,23 +386,18 @@ class Config:
opts_file: Path = Path(self.config_path) / "ytdlp.cli" opts_file: Path = Path(self.config_path) / "ytdlp.cli"
if opts_file.exists() and opts_file.stat().st_size > 2: 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: with open(opts_file) as f:
self.ytdlp_cli = f.read().strip() self.ytdlp_cli = f.read().strip()
if self.ytdlp_cli: if self.ytdlp_cli:
self._ytdlp_cli_mutable = self.ytdlp_cli self._ytdlp_cli_mutable = self.ytdlp_cli
try: try:
removed_options: list = [] arg_converter(args=self.ytdlp_cli, level=True)
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
)
except Exception as e: except Exception as e:
msg = f"Failed to parse yt-dlp cli options from '{opts_file}'. '{e!s}'." msg = f"Failed to parse yt-dlp cli options from '{opts_file}'. '{e!s}'."
raise ValueError(msg) from e 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}" self._ytdlp_cli_mutable += f"\n--socket-timeout {self.socket_timeout}"
@ -513,8 +508,8 @@ class Config:
Returns: Returns:
dict: The yt-dlp command line options. dict: The yt-dlp command line options.
Todo: Deprecated:
Rename to get_ytdlp_opts() to match the system. Usage of global ytdlp.cli file is deprecated, please use presets instead.
""" """
try: try:

View file

@ -5,8 +5,6 @@ from pathlib import Path
from yt_dlp.networking.impersonate import ImpersonateTarget from yt_dlp.networking.impersonate import ImpersonateTarget
from yt_dlp.utils import DateRange from yt_dlp.utils import DateRange
from .ItemDTO import ItemDTO
class Encoder(json.JSONEncoder): class Encoder(json.JSONEncoder):
""" """
@ -16,6 +14,8 @@ class Encoder(json.JSONEncoder):
""" """
def default(self, o): def default(self, o):
from .ItemDTO import ItemDTO
if isinstance(o, Path): if isinstance(o, Path):
return str(o) return str(o)

View file

@ -126,7 +126,6 @@ class YoutubeHandler:
has_items = True has_items = True
if archive_id in YoutubeHandler.queued: if archive_id in YoutubeHandler.queued:
LOG.debug(f"Item '{vid}' is already queued for download. Skipping.")
continue continue
items.append({"id": vid, "url": url, "title": title, "published": published, "archive_id": archive_id}) items.append({"id": vid, "url": url, "title": title, "published": published, "archive_id": archive_id})

View file

@ -85,6 +85,7 @@
The <strong>Basic mode</strong> (which limited the interface to the new download form) is being removed. The <strong>Basic mode</strong> (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. Everything except what is available behind configurable flag will become part of the standard interface.
</li> </li>
<li>The <strong>archive.manual.log</strong> feature has been removed.</li>
</ul> </ul>
<p> <p>
These changes help reduce confusion from multiple sources of truth. Going forward, <strong>presets</strong> These changes help reduce confusion from multiple sources of truth. Going forward, <strong>presets</strong>