improvement(downloads): no-embed builtin presets + 1080p default
Embedding (thumbnail/chapters) rewrote the whole file — a 10 GB video spent minutes making a 10 GB temp copy — while the Plex .nfo + poster sidecars already carry that metadata. So: - builtin presets no longer embed (migration 0040 re-seeds them; formats._DEFAULTS embed off); only the tiny FFmpegThumbnailsConvertor (for poster.jpg) remains, so downloads go video -> audio -> merge -> done with no full-file rewrite - default preset is now 1080p (Best stays available, second in the list) so a long video doesn't silently pull ~10 GB and blow the quota Users who want self-contained files can enable embedding in a custom profile.
This commit is contained in:
parent
fc69656d12
commit
d7fe3c34e8
2 changed files with 77 additions and 2 deletions
72
backend/alembic/versions/0040_reset_builtin_profiles.py
Normal file
72
backend/alembic/versions/0040_reset_builtin_profiles.py
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
"""reset builtin download profiles: no embedding, 1080p default
|
||||
|
||||
Revision ID: 0040_reset_profiles
|
||||
Revises: 0039_title_normalize
|
||||
Create Date: 2026-07-03
|
||||
|
||||
Redefines the shipped presets: embedding (thumbnail/chapters/subs) is OFF (it rewrites the whole
|
||||
file — expensive on large videos — and the Plex .nfo/poster sidecars already carry the metadata),
|
||||
and the default is now 1080p (Best stays available but no longer first). Re-seeds the builtin
|
||||
rows so both fresh installs (0037 then this) and existing DBs converge on the same set. Existing
|
||||
jobs are unaffected (they snapshot their spec; profile_id just SET NULLs if it pointed at a
|
||||
replaced row).
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision: str = "0040_reset_profiles"
|
||||
down_revision: Union[str, None] = "0039_title_normalize"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def _spec(mode, height=None, container=None, audio_format=None):
|
||||
return {
|
||||
"mode": mode,
|
||||
"max_height": height,
|
||||
"container": container,
|
||||
"audio_format": audio_format,
|
||||
"vcodec": None,
|
||||
"embed_subs": False,
|
||||
"embed_chapters": False,
|
||||
"embed_thumbnail": False,
|
||||
"sponsorblock": False,
|
||||
}
|
||||
|
||||
|
||||
# Default first (1080p), then Best, then the rest.
|
||||
_BUILTINS = [
|
||||
("1080p (MP4)", _spec("av", 1080, "mp4"), 10),
|
||||
("Best (MP4)", _spec("av", None, "mp4"), 20),
|
||||
("720p (MP4)", _spec("av", 720, "mp4"), 30),
|
||||
("Audio (M4A)", _spec("a", None, None, "m4a"), 40),
|
||||
("Audio (MP3)", _spec("a", None, None, "mp3"), 50),
|
||||
("Video only (MP4)", _spec("v", None, "mp4"), 60),
|
||||
]
|
||||
|
||||
_profiles = sa.table(
|
||||
"download_profiles",
|
||||
sa.column("user_id", sa.Integer),
|
||||
sa.column("name", sa.String),
|
||||
sa.column("spec", sa.JSON),
|
||||
sa.column("is_builtin", sa.Boolean),
|
||||
sa.column("sort_order", sa.Integer),
|
||||
)
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute("DELETE FROM download_profiles WHERE is_builtin = true")
|
||||
op.bulk_insert(
|
||||
_profiles,
|
||||
[
|
||||
{"user_id": None, "name": n, "spec": s, "is_builtin": True, "sort_order": o}
|
||||
for n, s, o in _BUILTINS
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# No-op: the previous builtin set was seeded by 0037; not worth reconstructing.
|
||||
pass
|
||||
|
|
@ -35,9 +35,12 @@ _DEFAULTS = {
|
|||
"container": "mp4",
|
||||
"audio_format": "m4a",
|
||||
"vcodec": None,
|
||||
# Embedding is OFF by default: it rewrites the whole file (doubles I/O — a 10 GB video
|
||||
# gets a 10 GB temp copy), and the Plex `.nfo` + poster sidecars already carry the
|
||||
# metadata/thumbnail. Users who want self-contained files opt in via a custom profile.
|
||||
"embed_subs": False,
|
||||
"embed_chapters": True,
|
||||
"embed_thumbnail": True,
|
||||
"embed_chapters": False,
|
||||
"embed_thumbnail": False,
|
||||
"sponsorblock": False,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue