|
|
@ -584,18 +584,33 @@ def library_operations(config, library):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
raise Failed
|
|
|
|
raise Failed
|
|
|
|
|
|
|
|
|
|
|
|
if library.mass_genre_update:
|
|
|
|
if library.mass_genre_update or library.genre_mapper:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if tmdb_item and library.mass_genre_update == "tmdb":
|
|
|
|
new_genres = []
|
|
|
|
new_genres = tmdb_item.genres
|
|
|
|
if library.mass_genre_update:
|
|
|
|
elif omdb_item and library.mass_genre_update == "omdb":
|
|
|
|
if tmdb_item and library.mass_genre_update == "tmdb":
|
|
|
|
new_genres = omdb_item.genres
|
|
|
|
new_genres = tmdb_item.genres
|
|
|
|
elif tvdb_item and library.mass_genre_update == "tvdb":
|
|
|
|
elif omdb_item and library.mass_genre_update == "omdb":
|
|
|
|
new_genres = tvdb_item.genres
|
|
|
|
new_genres = omdb_item.genres
|
|
|
|
elif anidb_item and library.mass_genre_update == "anidb":
|
|
|
|
elif tvdb_item and library.mass_genre_update == "tvdb":
|
|
|
|
new_genres = anidb_item.genres
|
|
|
|
new_genres = tvdb_item.genres
|
|
|
|
else:
|
|
|
|
elif anidb_item and library.mass_genre_update == "anidb":
|
|
|
|
raise Failed
|
|
|
|
new_genres = anidb_item.genres
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
raise Failed
|
|
|
|
|
|
|
|
if not new_genres:
|
|
|
|
|
|
|
|
logger.info(f"{item.title[:25]:<25} | No Genres Found")
|
|
|
|
|
|
|
|
if library.genre_mapper:
|
|
|
|
|
|
|
|
if not new_genres:
|
|
|
|
|
|
|
|
new_genres = [g.tag for g in item.genres]
|
|
|
|
|
|
|
|
mapped_genres = []
|
|
|
|
|
|
|
|
for genre in new_genres:
|
|
|
|
|
|
|
|
if genre in library.genre_mapper:
|
|
|
|
|
|
|
|
if library.genre_mapper[genre]:
|
|
|
|
|
|
|
|
mapped_genres.append(library.genre_mapper[genre])
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
mapped_genres.append(genre)
|
|
|
|
|
|
|
|
new_genres = mapped_genres
|
|
|
|
library.edit_tags("genre", item, sync_tags=new_genres)
|
|
|
|
library.edit_tags("genre", item, sync_tags=new_genres)
|
|
|
|
except Failed:
|
|
|
|
except Failed:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
@ -619,19 +634,26 @@ def library_operations(config, library):
|
|
|
|
logger.info(f"{item.title[:25]:<25} | Critic Rating | {new_rating}")
|
|
|
|
logger.info(f"{item.title[:25]:<25} | Critic Rating | {new_rating}")
|
|
|
|
except Failed:
|
|
|
|
except Failed:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
if library.mass_content_rating_update:
|
|
|
|
if library.mass_content_rating_update or library.content_rating_mapper:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if omdb_item and library.mass_content_rating_update == "omdb":
|
|
|
|
new_rating = None
|
|
|
|
new_rating = omdb_item.content_rating
|
|
|
|
if library.mass_content_rating_update:
|
|
|
|
elif mdb_item and library.mass_content_rating_update == "mdb":
|
|
|
|
if omdb_item and library.mass_content_rating_update == "omdb":
|
|
|
|
new_rating = mdb_item.certification if mdb_item.certification else None
|
|
|
|
new_rating = omdb_item.content_rating
|
|
|
|
elif mdb_item and library.mass_content_rating_update == "mdb_commonsense":
|
|
|
|
elif mdb_item and library.mass_content_rating_update == "mdb":
|
|
|
|
new_rating = mdb_item.commonsense if mdb_item.commonsense else None
|
|
|
|
new_rating = mdb_item.certification if mdb_item.certification else None
|
|
|
|
else:
|
|
|
|
elif mdb_item and library.mass_content_rating_update == "mdb_commonsense":
|
|
|
|
raise Failed
|
|
|
|
new_rating = mdb_item.commonsense if mdb_item.commonsense else None
|
|
|
|
if new_rating is None:
|
|
|
|
else:
|
|
|
|
logger.info(f"{item.title[:25]:<25} | No Content Rating Found")
|
|
|
|
raise Failed
|
|
|
|
elif str(item.rating) != str(new_rating):
|
|
|
|
if new_rating is None:
|
|
|
|
|
|
|
|
logger.info(f"{item.title[:25]:<25} | No Content Rating Found")
|
|
|
|
|
|
|
|
if library.content_rating_mapper:
|
|
|
|
|
|
|
|
if new_rating is None:
|
|
|
|
|
|
|
|
new_rating = item.contentRating
|
|
|
|
|
|
|
|
if new_rating in library.content_rating_mapper:
|
|
|
|
|
|
|
|
new_rating = library.content_rating_mapper[new_rating]
|
|
|
|
|
|
|
|
if str(item.contentRating) != str(new_rating):
|
|
|
|
library.edit_query(item, {"contentRating.value": new_rating, "contentRating.locked": 1})
|
|
|
|
library.edit_query(item, {"contentRating.value": new_rating, "contentRating.locked": 1})
|
|
|
|
logger.info(f"{item.title[:25]:<25} | Content Rating | {new_rating}")
|
|
|
|
logger.info(f"{item.title[:25]:<25} | Content Rating | {new_rating}")
|
|
|
|
except Failed:
|
|
|
|
except Failed:
|
|
|
@ -658,25 +680,6 @@ def library_operations(config, library):
|
|
|
|
except Failed:
|
|
|
|
except Failed:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
if library.genre_mapper or library.content_rating_mapper:
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
library.reload(item)
|
|
|
|
|
|
|
|
if library.genre_mapper:
|
|
|
|
|
|
|
|
adds = []
|
|
|
|
|
|
|
|
deletes = []
|
|
|
|
|
|
|
|
for genre in item.genres:
|
|
|
|
|
|
|
|
if genre.tag in library.genre_mapper:
|
|
|
|
|
|
|
|
deletes.append(genre.tag)
|
|
|
|
|
|
|
|
if library.genre_mapper[genre.tag]:
|
|
|
|
|
|
|
|
adds.append(library.genre_mapper[genre.tag])
|
|
|
|
|
|
|
|
library.edit_tags("genre", item, add_tags=adds, remove_tags=deletes)
|
|
|
|
|
|
|
|
if library.content_rating_mapper:
|
|
|
|
|
|
|
|
if item.contentRating in library.content_rating_mapper:
|
|
|
|
|
|
|
|
library.edit_query(item, {"contentRating.value": library.content_rating_mapper[item.contentRating], "contentRating.locked": 1})
|
|
|
|
|
|
|
|
logger.info(f"{item.title[:25]:<25} | Content Rating | {library.content_rating_mapper[item.contentRating]}")
|
|
|
|
|
|
|
|
except Failed:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if library.Radarr and library.radarr_add_all_existing:
|
|
|
|
if library.Radarr and library.radarr_add_all_existing:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
library.Radarr.add_tmdb(radarr_adds)
|
|
|
|
library.Radarr.add_tmdb(radarr_adds)
|
|
|
|