From 00103ef68c2bf47d16e2f4355e523f3107909c4f Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Tue, 20 Sep 2022 01:21:56 -0400 Subject: [PATCH] [32] add mass_original_title_update library operation --- VERSION | 2 +- docs/conf.py | 2 +- docs/config/operations.md | 1 + modules/config.py | 7 ++++++- modules/library.py | 1 + modules/operations.py | 21 ++++++++++++++++++++- 6 files changed, 30 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index aca4b2e6..c12f2bcf 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.3-develop31 +1.17.3-develop32 diff --git a/docs/conf.py b/docs/conf.py index 1663ae5a..88bc3e5b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -184,7 +184,7 @@ html_theme_options = { ("Editing TV Metadata", "metadata/metadata/show"), ("Editing Music Metadata", "metadata/metadata/music"), ]), - ("_menu", "Metadata Builders", [ + ("_menu", "Builders", [ ("Plex Builders", "metadata/builders/plex"), ("Smart Builders", "metadata/builders/smart"), ("TMDb Builders", "metadata/builders/tmdb"), diff --git a/docs/config/operations.md b/docs/config/operations.md index df1d82f0..6aacf9fd 100644 --- a/docs/config/operations.md +++ b/docs/config/operations.md @@ -23,6 +23,7 @@ The available attributes for the operations attribute are as follows | `delete_unmanaged_collections` | Deletes every unmanaged collection
**Values:** `true` or `false` | | `mass_genre_update` | Updates every item's genres in the library to the chosen site's genres
**Values:**
`tmdb`Use TMDb for Genres
`tvdb`Use TVDb for Genres
`imdb`Use IMDb for Genres
`omdb`Use IMDb through OMDb for Genres
`anidb`Use AniDB Tags for Genres
| | `mass_content_rating_update` | Updates every item's content rating in the library to the chosen site's content rating
**Values:**
`mdb`Use MdbList for Content Ratings
`mdb_commonsense`Use Commonsense Rating through MDbList for Content Ratings
`omdb`Use IMDb through OMDb for Content Ratings
| +| `mass_original_title_update` | Updates every item's original title in the library to the chosen site's content rating
**Values:**
`anidb`Use AniDB Main Title for Original Titles
`anidb_official`Use AniDB Official Title based on the language attribute in the config file for Original Titles
| | `mass_originally_available_update` | Updates every item's originally available date in the library to the chosen site's date
**Values:**
`tmdb`Use TMDb Release Date
`tvdb`Use TVDb Release Date
`omdb`Use IMDb Release Date through OMDb
`mdb`Use MdbList Release Date
`anidb`Use AniDB Release Date
| | `mass_audience_rating_update`/
`mass_critic_rating_update`/
`mass_user_rating_update` | Updates every item's audience/critic/user rating in the library to the chosen site's rating
**Values:**
`tmdb`Use TMDb Rating
`imdb`Use IMDb Rating
`trakt_user`Use Trakt User's Personal Rating
`omdb`Use IMDbRating through OMDb
`mdb`Use MdbList Score
`mdb_imdb`Use IMDb Rating through MDbList
`mdb_metacritic`Use Metacritic Rating through MDbList
`mdb_metacriticuser`Use Metacritic User Rating through MDbList
`mdb_trakt`Use Trakt Rating through MDbList
`mdb_tomatoes`Use Rotten Tomatoes Rating through MDbList
`mdb_tomatoesaudience`Use Rotten Tomatoes Audience Rating through MDbList
`mdb_tmdb`Use TMDb Rating through MDbList
`mdb_letterboxd`Use Letterboxd Rating through MDbList
`mdb_myanimelist`Use MyAnimeList Rating through MDbList
`anidb_rating`Use AniDB Rating
`anidb_average`Use AniDB Average
| | `mass_episode_audience_rating_update`/
`mass_episode_critic_rating_update`/
`mass_episode_user_rating_update` | Updates every item's episode's audience/critic/user rating in the library to the chosen site's rating
**Values:**
`tmdb`Use TMDb Rating
`imdb`Use IMDb Rating
| diff --git a/modules/config.py b/modules/config.py index ada19014..278074c4 100644 --- a/modules/config.py +++ b/modules/config.py @@ -35,6 +35,7 @@ logger = util.logger sync_modes = {"append": "Only Add Items to the Collection or Playlist", "sync": "Add & Remove Items from the Collection or Playlist"} mass_genre_options = {"tmdb": "Use TMDb Metadata", "imdb": "Use IMDb Rating", "omdb": "Use IMDb Metadata through OMDb", "tvdb": "Use TVDb Metadata", "anidb": "Use AniDB Tag Metadata"} mass_content_options = {"omdb": "Use IMDb Metadata through OMDb", "mdb": "Use MdbList Metadata", "mdb_commonsense": "Use Commonsense Rating through MDbList"} +mass_original_title_options = {"anidb": "Use AniDB Main Title", "anidb_official": "Use AniDB Official Title based on the language attribute in the config file"} mass_available_options = {"tmdb": "Use TMDb Metadata", "omdb": "Use IMDb Metadata through OMDb", "mdb": "Use MdbList Metadata", "tvdb": "Use TVDb Metadata", "anidb": "Use AniDB Metadata"} imdb_label_options = {"with_none": "Add IMDb Parental Labels including None", "without_none": "Add IMDb Parental Labels including None"} mass_episode_rating_options = {"tmdb": "Use TMDb Rating", "imdb": "Use IMDb Rating"} @@ -54,7 +55,8 @@ mass_rating_options = { "mdb_letterboxd": "Use Letterboxd Rating through MDbList", "mdb_myanimelist": "Use MyAnimeList Rating through MDbList", "anidb_rating": "Use AniDB Rating", - "anidb_average": "Use AniDB Average" + "anidb_average": "Use AniDB Average", + "anidb_score": "Use AniDB Review Dcore" } reset_overlay_options = {"tmdb": "Reset to TMDb poster", "plex": "Reset to Plex Poster"} @@ -592,6 +594,7 @@ class ConfigFile: "metadata_backup": None, "update_blank_track_titles": None, "mass_content_rating_update": None, + "mass_original_title_update": None, "mass_originally_available_update": None, "mass_imdb_parental_labels": None, "remove_title_parentheses": None, @@ -677,6 +680,8 @@ class ConfigFile: params["mass_episode_user_rating_update"] = check_for_attribute(lib["operations"], "mass_episode_user_rating_update", test_list=mass_episode_rating_options, default_is_none=True, save=False) if "mass_content_rating_update" in lib["operations"]: params["mass_content_rating_update"] = check_for_attribute(lib["operations"], "mass_content_rating_update", test_list=mass_content_options, default_is_none=True, save=False) + if "mass_original_title_update" in lib["operations"]: + params["mass_original_title_update"] = check_for_attribute(lib["operations"], "mass_original_title_update", test_list=mass_original_title_options, default_is_none=True, save=False) if "mass_originally_available_update" in lib["operations"]: params["mass_originally_available_update"] = check_for_attribute(lib["operations"], "mass_originally_available_update", test_list=mass_available_options, default_is_none=True, save=False) if "mass_imdb_parental_labels" in lib["operations"]: diff --git a/modules/library.py b/modules/library.py index fa690799..de42785f 100644 --- a/modules/library.py +++ b/modules/library.py @@ -83,6 +83,7 @@ class Library(ABC): self.mass_episode_critic_rating_update = params["mass_episode_critic_rating_update"] self.mass_episode_user_rating_update = params["mass_episode_user_rating_update"] self.mass_content_rating_update = params["mass_content_rating_update"] + self.mass_original_title_update = params["mass_original_title_update"] self.mass_originally_available_update = params["mass_originally_available_update"] self.mass_imdb_parental_labels = params["mass_imdb_parental_labels"] self.radarr_add_all_existing = params["radarr_add_all_existing"] diff --git a/modules/operations.py b/modules/operations.py index e37ad12f..267250a4 100644 --- a/modules/operations.py +++ b/modules/operations.py @@ -236,6 +236,8 @@ class Operations: found_rating = anidb_item.rating elif anidb_item and attribute == "anidb_average": found_rating = anidb_item.average + elif anidb_item and attribute == "anidb_score": + found_rating = anidb_item.score else: found_rating = None if found_rating is None: @@ -255,7 +257,7 @@ class Operations: elif tvdb_item and self.library.mass_genre_update == "tvdb": new_genres = tvdb_item.genres elif anidb_item and self.library.mass_genre_update == "anidb": - new_genres = anidb_item.tags + new_genres = [str(t).title() for t in anidb_item.tags] else: raise Failed if not new_genres: @@ -328,6 +330,23 @@ class Operations: batch_display += f"\nContent Rating | {new_rating}" except Failed: pass + + if self.library.mass_original_title_update: + try: + if anidb_item and self.library.mass_original_title_update == "anidb": + new_original_title = anidb_item.main_title + elif anidb_item and self.library.mass_original_title_update == "anidb_official": + new_original_title = anidb_item.official_title + else: + raise Failed + if not new_original_title: + logger.info(f"No Original Title Found") + elif str(item.originalTitle) != str(new_original_title): + item.editOriginalTitle(new_original_title) + batch_display += f"\nOriginal Title | {new_original_title}" + except Failed: + pass + if self.library.mass_originally_available_update: try: if omdb_item and self.library.mass_originally_available_update == "omdb":