This commit is contained in:
meisnate12 2021-05-16 18:06:51 -04:00
parent 6f59e860c4
commit 9668c2f316
6 changed files with 32 additions and 10 deletions

View file

@ -1,5 +1,5 @@
# Plex Meta Manager # Plex Meta Manager
#### Version 1.8.0 #### Version 1.9.0
The original concept for Plex Meta Manager is [Plex Auto Collections](https://github.com/mza921/Plex-Auto-Collections), but this is rewritten from the ground up to be able to include a scheduler, metadata edits, multiple libraries, and logging. Plex Meta Manager is a Python 3 script that can be continuously run using YAML configuration files to update on a schedule the metadata of the movies, shows, and collections in your libraries as well as automatically build collections based on various methods all detailed in the wiki. Some collection examples that the script can automatically build and update daily include Plex Based Searches like actor, genre, or studio collections or Collections based on TMDb, IMDb, Trakt, TVDb, AniDB, or MyAnimeList lists and various other services. The original concept for Plex Meta Manager is [Plex Auto Collections](https://github.com/mza921/Plex-Auto-Collections), but this is rewritten from the ground up to be able to include a scheduler, metadata edits, multiple libraries, and logging. Plex Meta Manager is a Python 3 script that can be continuously run using YAML configuration files to update on a schedule the metadata of the movies, shows, and collections in your libraries as well as automatically build collections based on various methods all detailed in the wiki. Some collection examples that the script can automatically build and update daily include Plex Based Searches like actor, genre, or studio collections or Collections based on TMDb, IMDb, Trakt, TVDb, AniDB, or MyAnimeList lists and various other services.

View file

@ -2,8 +2,21 @@
libraries: # Library mappings must have a colon (:) placed after them libraries: # Library mappings must have a colon (:) placed after them
Movies: Movies:
metadata_path:
- file: config/Movies.yml # You have to create this file the other are online
- git: meisnate12/MovieCharts
- git: meisnate12/Studios
- git: meisnate12/IMDBGenres
- git: meisnate12/People
TV Shows: TV Shows:
metadata_path:
- file: config/TV Shows.yml # You have to create this file the other are online
- git: meisnate12/ShowCharts
- git: meisnate12/Networks
Anime: Anime:
metadata_path:
- file: config/Anime.yml # You have to create this file the other are online
- git: meisnate12/AnimeCharts
settings: # Can be individually specified per library as well settings: # Can be individually specified per library as well
cache: true cache: true
cache_expiration: 60 cache_expiration: 60

View file

@ -1519,7 +1519,10 @@ class CollectionBuilder:
if not self.obj and self.smart_url: if not self.obj and self.smart_url:
self.library.create_smart_collection(self.name, self.smart_type_key, self.smart_url) self.library.create_smart_collection(self.name, self.smart_type_key, self.smart_url)
elif not self.obj and self.smart_label_collection: elif not self.obj and self.smart_label_collection:
self.library.create_smart_labels(self.name, sort=self.smart_sort) try:
self.library.create_smart_labels(self.name, sort=self.smart_sort)
except Failed:
raise Failed(f"Collection Error: Label: {self.name} was not added to any items in the Library")
self.obj = self.library.get_collection(self.name) self.obj = self.library.get_collection(self.name)
if self.smart_url and self.smart_url != self.library.smart_filter(self.obj): if self.smart_url and self.smart_url != self.library.smart_filter(self.obj):

View file

@ -407,6 +407,11 @@ class Config:
logger.error("Config Error: metadata_path git is blank") logger.error("Config Error: metadata_path git is blank")
else: else:
params["metadata_path"].append(("Git", path['git'])) params["metadata_path"].append(("Git", path['git']))
if "file" in path:
if path["file"] is None:
logger.error("Config Error: metadata_path file is blank")
else:
params["metadata_path"].append(("File", path['file']))
else: else:
params["metadata_path"].append(("File", path)) params["metadata_path"].append(("File", path))
else: else:

View file

@ -211,7 +211,7 @@ class TMDbAPI:
movie_ids.append(credit.id) movie_ids.append(credit.id)
elif credit.media_type == "tv": elif credit.media_type == "tv":
try: try:
show_ids.append(self.config.Convert.tmdb_to_tvdb(credit.id)) show_ids.append(self.config.Convert.tmdb_to_tvdb(credit.id, fail=True))
except Failed as e: except Failed as e:
logger.warning(e) logger.warning(e)
for credit in actor_credits.crew: for credit in actor_credits.crew:
@ -223,7 +223,7 @@ class TMDbAPI:
movie_ids.append(credit.id) movie_ids.append(credit.id)
elif credit.media_type == "tv": elif credit.media_type == "tv":
try: try:
show_ids.append(self.config.Convert.tmdb_to_tvdb(credit.id)) show_ids.append(self.config.Convert.tmdb_to_tvdb(credit.id, fail=True))
except Failed as e: except Failed as e:
logger.warning(e) logger.warning(e)
return movie_ids, show_ids return movie_ids, show_ids
@ -240,9 +240,10 @@ class TMDbAPI:
else: raise Failed(f"TMDb Error: {method} method not supported") else: raise Failed(f"TMDb Error: {method} method not supported")
for tmdb_item in tmdb_items: for tmdb_item in tmdb_items:
try: try:
ids.append(tmdb_item.id if is_movie else self.config.Convert.tmdb_to_tvdb(tmdb_item.id)) ids.append(tmdb_item.id if is_movie else self.config.Convert.tmdb_to_tvdb(tmdb_item.id, fail=True))
count += 1 count += 1
except Failed: except Failed as e:
logger.error(e)
pass pass
if count == amount: break if count == amount: break
if count == amount: break if count == amount: break
@ -263,7 +264,7 @@ class TMDbAPI:
tmdb_items = self.Discover.discover_movies(attrs) if is_movie else self.Discover.discover_tv_shows(attrs) tmdb_items = self.Discover.discover_movies(attrs) if is_movie else self.Discover.discover_tv_shows(attrs)
for tmdb_item in tmdb_items: for tmdb_item in tmdb_items:
try: try:
ids.append(tmdb_item.id if is_movie else self.config.Convert.tmdb_to_tvdb(tmdb_item.id)) ids.append(tmdb_item.id if is_movie else self.config.Convert.tmdb_to_tvdb(tmdb_item.id, fail=True))
count += 1 count += 1
except Failed as e: except Failed as e:
logger.error(e) logger.error(e)
@ -336,7 +337,7 @@ class TMDbAPI:
if tmdb_item.media_type == "movie": if tmdb_item.media_type == "movie":
movie_ids.append(tmdb_item.id) movie_ids.append(tmdb_item.id)
elif tmdb_item.media_type == "tv": elif tmdb_item.media_type == "tv":
try: show_ids.append(self.config.Convert.tmdb_to_tvdb(tmdb_item.id)) try: show_ids.append(self.config.Convert.tmdb_to_tvdb(tmdb_item.id, fail=True))
except Failed: pass except Failed: pass
elif method == "tmdb_movie": elif method == "tmdb_movie":
tmdb_name = str(self.get_movie(tmdb_id).title) tmdb_name = str(self.get_movie(tmdb_id).title)
@ -348,7 +349,7 @@ class TMDbAPI:
movie_ids.append(tmdb_item["id"]) movie_ids.append(tmdb_item["id"])
elif method == "tmdb_show": elif method == "tmdb_show":
tmdb_name = str(self.get_show(tmdb_id).name) tmdb_name = str(self.get_show(tmdb_id).name)
show_ids.append(self.config.Convert.tmdb_to_tvdb(tmdb_id)) show_ids.append(self.config.Convert.tmdb_to_tvdb(tmdb_id, fail=True))
else: else:
tmdb_name = str(self.get_person(tmdb_id).name) tmdb_name = str(self.get_person(tmdb_id).name)
if method == "tmdb_actor": movie_ids, show_ids = self._credits(tmdb_id, actor=True) if method == "tmdb_actor": movie_ids, show_ids = self._credits(tmdb_id, actor=True)

View file

@ -92,7 +92,7 @@ util.centered("| |_) | |/ _ \\ \\/ / | |\\/| |/ _ \\ __/ _` | | |\\/| |/ _` | '_
util.centered("| __/| | __/> < | | | | __/ || (_| | | | | | (_| | | | | (_| | (_| | __/ | ") util.centered("| __/| | __/> < | | | | __/ || (_| | | | | | (_| | | | | (_| | (_| | __/ | ")
util.centered("|_| |_|\\___/_/\\_\\ |_| |_|\\___|\\__\\__,_| |_| |_|\\__,_|_| |_|\\__,_|\\__, |\\___|_| ") util.centered("|_| |_|\\___/_/\\_\\ |_| |_|\\___|\\__\\__,_| |_| |_|\\__,_|_| |_|\\__,_|\\__, |\\___|_| ")
util.centered(" |___/ ") util.centered(" |___/ ")
util.centered(" Version: 1.9.0-beta5 ") util.centered(" Version: 1.9.0 ")
util.separator() util.separator()
def start(config_path, is_test, daily, requested_collections, requested_libraries, resume_from): def start(config_path, is_test, daily, requested_collections, requested_libraries, resume_from):