diff --git a/media_manager/movies/repository.py b/media_manager/movies/repository.py index 38e9ff4..3ddd7d5 100644 --- a/media_manager/movies/repository.py +++ b/media_manager/movies/repository.py @@ -435,10 +435,12 @@ class MovieRepository: name: str | None = None, overview: str | None = None, year: int | None = None, + imdb_id: str | None = None, ) -> MovieSchema: """ Update attributes of an existing movie. + :param imdb_id: The new IMDb ID for the movie. :param movie_id: The ID of the movie to update. :param name: The new name for the movie. :param overview: The new overview for the movie. @@ -459,6 +461,9 @@ class MovieRepository: if year is not None and db_movie.year != year: db_movie.year = year updated = True + if imdb_id is not None and db_movie.imdb_id != imdb_id: + db_movie.imdb_id = imdb_id + updated = True if updated: self.db.commit() diff --git a/media_manager/movies/service.py b/media_manager/movies/service.py index 84559dc..ee05a0c 100644 --- a/media_manager/movies/service.py +++ b/media_manager/movies/service.py @@ -719,6 +719,7 @@ class MovieService: name=fresh_movie_data.name, overview=fresh_movie_data.overview, year=fresh_movie_data.year, + imdb_id=fresh_movie_data.imdb_id, ) updated_movie = self.movie_repository.get_movie_by_id(movie_id=db_movie.id) diff --git a/media_manager/tv/repository.py b/media_manager/tv/repository.py index bce49a5..5e12ec5 100644 --- a/media_manager/tv/repository.py +++ b/media_manager/tv/repository.py @@ -643,10 +643,13 @@ class TvRepository: year: int | None = None, ended: bool | None = None, continuous_download: bool | None = None, + imdb_id: str | None = None, ) -> ShowSchema: # Removed poster_url from params """ Update attributes of an existing show. + :param imdb_id: The new IMDb ID for the show. + :param continuous_download: The new continuous download status for the show. :param show_id: The ID of the show to update. :param name: The new name for the show. :param overview: The new overview for the show. @@ -677,6 +680,9 @@ class TvRepository: ): db_show.continuous_download = continuous_download updated = True + if imdb_id is not None and db_show.imdb_id != imdb_id: + db_show.imdb_id = imdb_id + updated = True if updated: self.db.commit() self.db.refresh(db_show) diff --git a/media_manager/tv/service.py b/media_manager/tv/service.py index f479bcf..22e2661 100644 --- a/media_manager/tv/service.py +++ b/media_manager/tv/service.py @@ -780,6 +780,7 @@ class TvService: overview=fresh_show_data.overview, year=fresh_show_data.year, ended=fresh_show_data.ended, + imdb_id=fresh_show_data.imdb_id, continuous_download=db_show.continuous_download if fresh_show_data.ended is False else False,