[73] add collection/playlist names to end hook

pull/737/head
meisnate12 3 years ago
parent e3007b4461
commit a78b0737f5

@ -1 +1 @@
1.15.1-develop72 1.15.1-develop73

@ -89,7 +89,7 @@ class Library(ABC):
self.clean_bundles = params["plex"]["clean_bundles"] # TODO: Here or just in Plex? self.clean_bundles = params["plex"]["clean_bundles"] # TODO: Here or just in Plex?
self.empty_trash = params["plex"]["empty_trash"] # TODO: Here or just in Plex? self.empty_trash = params["plex"]["empty_trash"] # TODO: Here or just in Plex?
self.optimize = params["plex"]["optimize"] # TODO: Here or just in Plex? self.optimize = params["plex"]["optimize"] # TODO: Here or just in Plex?
self.stats = {"created": 0, "modified": 0, "deleted": 0, "added": 0, "unchanged": 0, "removed": 0, "radarr": 0, "sonarr": 0} self.stats = {"created": 0, "modified": 0, "deleted": 0, "added": 0, "unchanged": 0, "removed": 0, "radarr": 0, "sonarr": 0, "names": []}
self.status = {} self.status = {}
self.items_library_operation = True if self.assets_for_all or self.mass_genre_update or self.mass_audience_rating_update \ self.items_library_operation = True if self.assets_for_all or self.mass_genre_update or self.mass_audience_rating_update \

@ -58,7 +58,6 @@ class MyLogger:
def _get_handler(self, log_file, count=3): def _get_handler(self, log_file, count=3):
_handler = RotatingFileHandler(log_file, delay=True, mode="w", backupCount=count, encoding="utf-8") _handler = RotatingFileHandler(log_file, delay=True, mode="w", backupCount=count, encoding="utf-8")
self._formatter(_handler) self._formatter(_handler)
_handler.addFilter(fmt_filter)
if os.path.isfile(log_file): if os.path.isfile(log_file):
_handler.doRollover() _handler.doRollover()
return _handler return _handler
@ -71,6 +70,7 @@ class MyLogger:
def add_main_handler(self): def add_main_handler(self):
self.main_handler = self._get_handler(self.main_log, count=10) self.main_handler = self._get_handler(self.main_log, count=10)
self.main_handler.addFilter(fmt_filter)
self._logger.addHandler(self.main_handler) self._logger.addHandler(self.main_handler)
def remove_main_handler(self): def remove_main_handler(self):

@ -61,6 +61,7 @@ class Webhooks:
"items_removed": stats["removed"], "items_removed": stats["removed"],
"added_to_radarr": stats["radarr"], "added_to_radarr": stats["radarr"],
"added_to_sonarr": stats["sonarr"], "added_to_sonarr": stats["sonarr"],
"names": stats["names"]
}) })
def error_hooks(self, text, server=None, library=None, collection=None, playlist=None, critical=True): def error_hooks(self, text, server=None, library=None, collection=None, playlist=None, critical=True):

@ -372,7 +372,7 @@ def update_libraries(config):
if playlist_status: if playlist_status:
print_status("Playlists", playlist_status) print_status("Playlists", playlist_status)
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": []}
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"]
@ -383,6 +383,7 @@ def update_libraries(config):
stats["removed"] += library.stats["removed"] stats["removed"] += library.stats["removed"]
stats["radarr"] += library.stats["radarr"] stats["radarr"] += library.stats["radarr"]
stats["sonarr"] += library.stats["sonarr"] stats["sonarr"] += library.stats["sonarr"]
stats["names"].extend([{"name": n, "library": library.name} for n in library.stats["names"]])
if playlist_stats: if playlist_stats:
stats["created"] += playlist_stats["created"] stats["created"] += playlist_stats["created"]
stats["modified"] += playlist_stats["modified"] stats["modified"] += playlist_stats["modified"]
@ -392,7 +393,7 @@ def update_libraries(config):
stats["removed"] += playlist_stats["removed"] stats["removed"] += playlist_stats["removed"]
stats["radarr"] += playlist_stats["radarr"] stats["radarr"] += playlist_stats["radarr"]
stats["sonarr"] += playlist_stats["sonarr"] stats["sonarr"] += playlist_stats["sonarr"]
stats["names"].extend([{"name": n, "library": "PLAYLIST"} for n in playlist_stats["names"]])
return stats return stats
def library_operations(config, library): def library_operations(config, library):
@ -807,6 +808,7 @@ def run_collection(config, library, metadata, requested_collections):
logger.separator(f"Validating {mapping_name} Attributes", space=False, border=False) logger.separator(f"Validating {mapping_name} Attributes", space=False, border=False)
builder = CollectionBuilder(config, metadata, mapping_name, no_missing, collection_attrs, library=library) builder = CollectionBuilder(config, metadata, mapping_name, no_missing, collection_attrs, library=library)
library.stats["names"].append(builder.name)
logger.info("") logger.info("")
logger.separator(f"Running {mapping_name} Collection", space=False, border=False) logger.separator(f"Running {mapping_name} Collection", space=False, border=False)
@ -938,7 +940,7 @@ def run_collection(config, library, metadata, requested_collections):
logger.remove_collection_handler(library.mapping_name, collection_log_name) logger.remove_collection_handler(library.mapping_name, collection_log_name)
def run_playlists(config): def run_playlists(config):
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": []}
status = {} status = {}
logger.info("") logger.info("")
logger.separator("Playlists") logger.separator("Playlists")
@ -979,6 +981,7 @@ def run_playlists(config):
logger.separator(f"Validating {mapping_name} Attributes", space=False, border=False) logger.separator(f"Validating {mapping_name} Attributes", space=False, border=False)
builder = CollectionBuilder(config, playlist_file, mapping_name, no_missing, playlist_attrs) builder = CollectionBuilder(config, playlist_file, mapping_name, no_missing, playlist_attrs)
stats["names"].append(builder.name)
logger.info("") logger.info("")
logger.separator(f"Running {mapping_name} Playlist", space=False, border=False) logger.separator(f"Running {mapping_name} Playlist", space=False, border=False)

Loading…
Cancel
Save