mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-13 00:07:13 +00:00
[2] small fixes
This commit is contained in:
parent
66a92ad8fe
commit
3e8cb33a83
7 changed files with 28 additions and 19 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
1.17.0-develop1
|
1.17.0-develop2
|
||||||
|
|
|
@ -234,6 +234,8 @@ class MyLogger:
|
||||||
msg = msg.replace(secret, "(redacted)")
|
msg = msg.replace(secret, "(redacted)")
|
||||||
if "HTTPConnectionPool" in msg:
|
if "HTTPConnectionPool" in msg:
|
||||||
msg = re.sub("HTTPConnectionPool\\((.*?)\\)", "HTTPConnectionPool(redacted)", msg)
|
msg = re.sub("HTTPConnectionPool\\((.*?)\\)", "HTTPConnectionPool(redacted)", msg)
|
||||||
|
if "HTTPSConnectionPool" in msg:
|
||||||
|
msg = re.sub("HTTPSConnectionPool\\((.*?)\\)", "HTTPSConnectionPool(redacted)", msg)
|
||||||
try:
|
try:
|
||||||
if not _srcfile:
|
if not _srcfile:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
|
@ -44,7 +44,7 @@ def get_dict(attribute, attr_data, check_list=None, make_str=False):
|
||||||
new_name = f'"{str(_name)}"' if make_str or not isinstance(_name, int) else _name
|
new_name = f'"{str(_name)}"' if make_str or not isinstance(_name, int) else _name
|
||||||
logger.warning(f"Config Warning: Skipping duplicate {attribute[:-1] if attribute[-1] == 's' else attribute}: {new_name}")
|
logger.warning(f"Config Warning: Skipping duplicate {attribute[:-1] if attribute[-1] == 's' else attribute}: {new_name}")
|
||||||
elif _data is None:
|
elif _data is None:
|
||||||
logger.warning(f"Config Warning: {attribute[:-1] if attribute[-1] == 's' else attribute}: {_name} has no data")
|
continue
|
||||||
elif not isinstance(_data, dict):
|
elif not isinstance(_data, dict):
|
||||||
logger.warning(f"Config Warning: {attribute[:-1] if attribute[-1] == 's' else attribute}: {_name} must be a dictionary")
|
logger.warning(f"Config Warning: {attribute[:-1] if attribute[-1] == 's' else attribute}: {_name} must be a dictionary")
|
||||||
elif attribute == "templates":
|
elif attribute == "templates":
|
||||||
|
|
|
@ -627,10 +627,13 @@ class Plex(Library):
|
||||||
def playlist_report(self):
|
def playlist_report(self):
|
||||||
playlists = {}
|
playlists = {}
|
||||||
def scan_user(server, username):
|
def scan_user(server, username):
|
||||||
for playlist in server.playlists():
|
try:
|
||||||
if playlist.title not in playlists:
|
for playlist in server.playlists():
|
||||||
playlists[playlist.title] = []
|
if playlist.title not in playlists:
|
||||||
playlists[playlist.title].append(username)
|
playlists[playlist.title] = []
|
||||||
|
playlists[playlist.title].append(username)
|
||||||
|
except requests.exceptions.ConnectionError:
|
||||||
|
pass
|
||||||
scan_user(self.PlexServer, self.PlexServer.myPlexAccount().title)
|
scan_user(self.PlexServer, self.PlexServer.myPlexAccount().title)
|
||||||
for user in self.users:
|
for user in self.users:
|
||||||
scan_user(self.PlexServer.switchUser(user), user)
|
scan_user(self.PlexServer.switchUser(user), user)
|
||||||
|
@ -1313,9 +1316,11 @@ class Plex(Library):
|
||||||
attrs.append(media.videoResolution)
|
attrs.append(media.videoResolution)
|
||||||
for part in media.parts:
|
for part in media.parts:
|
||||||
if filter_attr == "audio_language":
|
if filter_attr == "audio_language":
|
||||||
attrs.extend([a.language for a in part.audioStreams()])
|
for a in part.audioStreams():
|
||||||
|
attrs.extend([a.language, a.tag, a.languageCode])
|
||||||
if filter_attr == "subtitle_language":
|
if filter_attr == "subtitle_language":
|
||||||
attrs.extend([s.language for s in part.subtitleStreams()])
|
for s in part.subtitleStreams():
|
||||||
|
attrs.extend([s.language, s.tag, s.languageCode])
|
||||||
elif filter_attr in ["content_rating", "year", "rating"]:
|
elif filter_attr in ["content_rating", "year", "rating"]:
|
||||||
attrs = [getattr(item, filter_actual)]
|
attrs = [getattr(item, filter_actual)]
|
||||||
elif filter_attr in ["actor", "country", "director", "genre", "label", "producer", "writer",
|
elif filter_attr in ["actor", "country", "director", "genre", "label", "producer", "writer",
|
||||||
|
|
|
@ -214,11 +214,11 @@ class TMDb:
|
||||||
except Failed: raise Failed(f"TMDb Error: No Movie or Collection found for TMDb ID {tmdb_id}")
|
except Failed: raise Failed(f"TMDb Error: No Movie or Collection found for TMDb ID {tmdb_id}")
|
||||||
else: return self.get_show(tmdb_id)
|
else: return self.get_show(tmdb_id)
|
||||||
|
|
||||||
def get_movie(self, tmdb_id):
|
def get_movie(self, tmdb_id, ignore_cache=False):
|
||||||
return TMDbMovie(self, tmdb_id)
|
return TMDbMovie(self, tmdb_id, ignore_cache=ignore_cache)
|
||||||
|
|
||||||
def get_show(self, tmdb_id):
|
def get_show(self, tmdb_id, ignore_cache=False):
|
||||||
return TMDbShow(self, tmdb_id)
|
return TMDbShow(self, tmdb_id, ignore_cache=ignore_cache)
|
||||||
|
|
||||||
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_failed)
|
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_failed)
|
||||||
def get_season(self, tmdb_id, season_number, partial=None):
|
def get_season(self, tmdb_id, season_number, partial=None):
|
||||||
|
|
|
@ -302,7 +302,7 @@ class Trakt:
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def sync_list(self, slug, ids):
|
def sync_list(self, slug, ids):
|
||||||
current_ids = self._list(slug, urlparse=False)
|
current_ids = self._list(slug, urlparse=False, fail=False)
|
||||||
|
|
||||||
def read_result(data, obj_type, result_type, result_str=None):
|
def read_result(data, obj_type, result_type, result_str=None):
|
||||||
result_str = result_str if result_str else result_type.capitalize()
|
result_str = result_str if result_str else result_type.capitalize()
|
||||||
|
@ -365,14 +365,17 @@ class Trakt:
|
||||||
def build_user_url(self, user, name):
|
def build_user_url(self, user, name):
|
||||||
return f"{base_url.replace('api.', '')}/users/{user}/lists/{name}"
|
return f"{base_url.replace('api.', '')}/users/{user}/lists/{name}"
|
||||||
|
|
||||||
def _list(self, data, urlparse=True, trakt_ids=False):
|
def _list(self, data, urlparse=True, trakt_ids=False, fail=True):
|
||||||
try:
|
try:
|
||||||
url = requests.utils.urlparse(data).path if urlparse else f"/users/me/lists/{data}"
|
url = requests.utils.urlparse(data).path if urlparse else f"/users/me/lists/{data}"
|
||||||
items = self._request(f"{url}/items")
|
items = self._request(f"{url}/items")
|
||||||
except Failed:
|
except Failed:
|
||||||
raise Failed(f"Trakt Error: List {data} not found")
|
raise Failed(f"Trakt Error: List {data} not found")
|
||||||
if len(items) == 0:
|
if len(items) == 0:
|
||||||
raise Failed(f"Trakt Error: List {data} is empty")
|
if fail:
|
||||||
|
raise Failed(f"Trakt Error: List {data} is empty")
|
||||||
|
else:
|
||||||
|
return []
|
||||||
return self._parse(items, trakt_ids=trakt_ids)
|
return self._parse(items, trakt_ids=trakt_ids)
|
||||||
|
|
||||||
def _userlist(self, list_type, user, is_movie, sort_by=None):
|
def _userlist(self, list_type, user, is_movie, sort_by=None):
|
||||||
|
|
|
@ -203,7 +203,7 @@ def start(attrs):
|
||||||
logger.debug("")
|
logger.debug("")
|
||||||
logger.separator(f"Starting {start_type}Run")
|
logger.separator(f"Starting {start_type}Run")
|
||||||
config = None
|
config = None
|
||||||
stats = {"created": 0, "modified": 0, "deleted": 0, "added": 0, "unchanged": 0, "removed": 0, "radarr": 0, "sonarr": 0}
|
stats = {"created": 0, "modified": 0, "deleted": 0, "added": 0, "unchanged": 0, "removed": 0, "radarr": 0, "sonarr": 0, "names": []}
|
||||||
try:
|
try:
|
||||||
config = ConfigFile(default_dir, attrs)
|
config = ConfigFile(default_dir, attrs)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -211,7 +211,7 @@ def start(attrs):
|
||||||
logger.critical(e)
|
logger.critical(e)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
stats = run_config(config)
|
stats = run_config(config, stats)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
config.notify(e)
|
config.notify(e)
|
||||||
logger.stacktrace()
|
logger.stacktrace()
|
||||||
|
@ -231,7 +231,7 @@ def start(attrs):
|
||||||
logger.separator(f"Finished {start_type}Run\n{version_line}\nFinished: {end_time.strftime('%H:%M:%S %Y-%m-%d')} Run Time: {run_time}")
|
logger.separator(f"Finished {start_type}Run\n{version_line}\nFinished: {end_time.strftime('%H:%M:%S %Y-%m-%d')} Run Time: {run_time}")
|
||||||
logger.remove_main_handler()
|
logger.remove_main_handler()
|
||||||
|
|
||||||
def run_config(config):
|
def run_config(config, stats):
|
||||||
library_status = run_libraries(config)
|
library_status = run_libraries(config)
|
||||||
|
|
||||||
playlist_status = {}
|
playlist_status = {}
|
||||||
|
@ -354,7 +354,6 @@ def run_config(config):
|
||||||
logger.info("")
|
logger.info("")
|
||||||
print_status(playlist_status)
|
print_status(playlist_status)
|
||||||
|
|
||||||
stats = {"created": 0, "modified": 0, "deleted": 0, "added": 0, "unchanged": 0, "removed": 0, "radarr": 0, "sonarr": 0, "names": []}
|
|
||||||
stats["added"] += amount_added
|
stats["added"] += amount_added
|
||||||
for library in config.libraries:
|
for library in config.libraries:
|
||||||
stats["created"] += library.stats["created"]
|
stats["created"] += library.stats["created"]
|
||||||
|
|
Loading…
Reference in a new issue