change string value for default/no library from empty string to "Default"

This commit is contained in:
maxDorninger
2025-07-16 14:24:42 +02:00
parent e0a7e115e4
commit b18b11c682
7 changed files with 8 additions and 8 deletions

View File

@@ -23,11 +23,11 @@ def upgrade() -> None:
"""Upgrade schema."""
op.add_column(
"movie",
sa.Column("library", sa.String(), nullable=False, server_default=sa.text("''")),
sa.Column("library", sa.String(), nullable=False, server_default=sa.text("'Default'")),
)
op.add_column(
"show",
sa.Column("library", sa.String(), nullable=False, server_default=sa.text("''")),
sa.Column("library", sa.String(), nullable=False, server_default=sa.text("'Default'")),
)

View File

@@ -279,7 +279,7 @@ def get_movie_files_by_movie_id(movie_service: movie_service_dep, movie_id: Movi
def set_library(
movie_id: MovieId,
movie_service: movie_service_dep,
library: Literal[*[x.name for x in AllEncompassingConfig().misc.movie_libraries]],
library: Literal[*[x.name for x in AllEncompassingConfig().misc.movie_libraries], "Default"],
) -> None:
"""
Sets the library of a movie.

View File

@@ -22,7 +22,7 @@ class Movie(BaseModel):
external_id: int
metadata_provider: str
library: str = ""
library: str = "Default"
class MovieFile(BaseModel):

View File

@@ -472,7 +472,7 @@ class MovieService:
misc_config.movie_directory
/ f"{movie.name} ({movie.year}) [{movie.metadata_provider}id-{movie.external_id}]"
)
if movie.library != "":
if movie.library != "Default":
for library in misc_config.movie_libraries:
if library.name == movie.library:
log.debug(f"Using library {library.name} for movie {movie.name}")

View File

@@ -176,7 +176,7 @@ def get_a_shows_torrents(show: show_dep, tv_service: tv_service_dep):
def set_library(
show: show_dep,
tv_service: tv_service_dep,
library: Literal[*[x.name for x in AllEncompassingConfig().misc.tv_libraries]],
library: Literal[*[x.name for x in AllEncompassingConfig().misc.tv_libraries], "Default"],
) -> None:
"""
Sets the library of a Show.

View File

@@ -54,7 +54,7 @@ class Show(BaseModel):
metadata_provider: str
continuous_download: bool = False
library: str = ""
library: str = "Default"
seasons: list[Season]

View File

@@ -511,7 +511,7 @@ class TvService:
misc_config.tv_directory
/ f"{show.name} ({show.year}) [{show.metadata_provider}id-{show.external_id}]"
)
if show.library != "":
if show.library != "Default":
for library in misc_config.tv_libraries:
if library.name == show.library:
log.info(