mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-25 22:10:22 +00:00
[65] #738 Even more expanded summary
This commit is contained in:
parent
07471b06a8
commit
54c7581bf8
4 changed files with 40 additions and 12 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.16.5-develop64
|
||||
1.16.5-develop65
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import os, re
|
||||
from datetime import datetime
|
||||
from modules import plex, util
|
||||
from modules.util import Failed
|
||||
from plexapi.audio import Artist
|
||||
|
@ -13,6 +14,7 @@ class Operations:
|
|||
self.library = library
|
||||
|
||||
def run_operations(self):
|
||||
operation_start = datetime.now()
|
||||
logger.info("")
|
||||
logger.separator(f"{self.library.name} Library Operations")
|
||||
logger.info("")
|
||||
|
@ -499,3 +501,8 @@ class Operations:
|
|||
logger.info(f"{len(meta['metadata'])} {self.library.type.capitalize()}{'s' if len(meta['metadata']) > 1 else ''} Backed Up")
|
||||
except yaml.scanner.ScannerError as e:
|
||||
logger.error(f"YAML Error: {util.tab_new_lines(e)}")
|
||||
|
||||
operation_run_time = str(datetime.now() - operation_start).split('.')[0]
|
||||
logger.info("")
|
||||
logger.separator(f"Finished {self.library.name} Library Operations\nOperations Run Time: {operation_run_time}")
|
||||
return operation_run_time
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import os, re, time
|
||||
from datetime import datetime
|
||||
from modules import util
|
||||
from modules.builder import CollectionBuilder
|
||||
from modules.util import Failed
|
||||
|
@ -16,6 +17,7 @@ class Overlays:
|
|||
self.overlays = []
|
||||
|
||||
def run_overlays(self):
|
||||
overlay_start = datetime.now()
|
||||
logger.info("")
|
||||
logger.separator(f"{self.library.name} Library Overlays")
|
||||
logger.info("")
|
||||
|
@ -169,6 +171,10 @@ class Overlays:
|
|||
except Failed as e:
|
||||
logger.error(e)
|
||||
logger.exorcise()
|
||||
overlay_run_time = str(datetime.now() - overlay_start).split('.')[0]
|
||||
logger.info("")
|
||||
logger.separator(f"Finished {self.library.name} Library Overlays\nOverlays Run Time: {overlay_run_time}")
|
||||
return overlay_run_time
|
||||
|
||||
def get_item_sort_title(self, item_to_sort, atr="titleSort"):
|
||||
if isinstance(item_to_sort, Album):
|
||||
|
|
|
@ -226,11 +226,13 @@ def start(attrs):
|
|||
logger.remove_main_handler()
|
||||
|
||||
def update_libraries(config):
|
||||
library_status = {}
|
||||
for library in config.libraries:
|
||||
if library.skip_library:
|
||||
logger.info("")
|
||||
logger.separator(f"Skipping {library.name} Library")
|
||||
continue
|
||||
library_status[library.name] = {}
|
||||
try:
|
||||
logger.add_library_handler(library.mapping_name)
|
||||
plexapi.server.TIMEOUT = library.timeout
|
||||
|
@ -264,27 +266,32 @@ def update_libraries(config):
|
|||
logger.debug(f"Timeout: {library.timeout}")
|
||||
|
||||
if config.delete_collections:
|
||||
time_start = datetime.now()
|
||||
logger.info("")
|
||||
logger.separator(f"Deleting all Collections from the {library.name} Library", space=False, border=False)
|
||||
logger.info("")
|
||||
for collection in library.get_all_collections():
|
||||
logger.info(f"Collection {collection.title} Deleted")
|
||||
library.query(collection.delete)
|
||||
library_status[library.name]["All Collections Deleted"] = str(datetime.now() - time_start).split('.')[0]
|
||||
|
||||
temp_items = library.cache_items()
|
||||
if not library.is_other and not library.is_music:
|
||||
time_start = datetime.now()
|
||||
logger.info("")
|
||||
logger.separator(f"Mapping {library.name} Library", space=False, border=False)
|
||||
logger.info("")
|
||||
library.map_guids(temp_items)
|
||||
library_status[library.name]["Library Loading and Mapping"] = str(datetime.now() - time_start).split('.')[0]
|
||||
|
||||
if config.library_first and not config.test_mode and not collection_only:
|
||||
if not overlays_only and library.library_operation:
|
||||
library.Operations.run_operations()
|
||||
library_status[library.name]["Library Operations"] = library.Operations.run_operations()
|
||||
if not operations_only and (library.overlay_files or library.remove_overlays):
|
||||
library.Overlays.run_overlays()
|
||||
library_status[library.name]["Library Overlays"] = library.Overlays.run_overlays()
|
||||
|
||||
if not operations_only and not overlays_only:
|
||||
time_start = datetime.now()
|
||||
for metadata in library.metadata_files:
|
||||
metadata_name = metadata.get_file_name()
|
||||
if config.requested_metadata_files and metadata_name not in config.requested_metadata_files:
|
||||
|
@ -310,12 +317,13 @@ def update_libraries(config):
|
|||
logger.remove_library_handler(library.mapping_name)
|
||||
run_collection(config, library, metadata, collections_to_run)
|
||||
logger.re_add_library_handler(library.mapping_name)
|
||||
library_status[library.name]["Library Metadata Files"] = str(datetime.now() - time_start).split('.')[0]
|
||||
|
||||
if not config.library_first and not config.test_mode and not collection_only:
|
||||
if not overlays_only and library.library_operation:
|
||||
library.Operations.run_operations()
|
||||
library_status[library.name]["Library Operations"] = library.Operations.run_operations()
|
||||
if not operations_only and (library.overlay_files or library.remove_overlays):
|
||||
library.Overlays.run_overlays()
|
||||
library_status[library.name]["Library Overlays"] = library.Overlays.run_overlays()
|
||||
|
||||
logger.remove_library_handler(library.mapping_name)
|
||||
except Exception as e:
|
||||
|
@ -392,10 +400,7 @@ def update_libraries(config):
|
|||
if len(title) > longest:
|
||||
longest = len(title)
|
||||
|
||||
def print_status(section, status):
|
||||
logger.info("")
|
||||
logger.separator(f"{section} Summary", space=False, border=False)
|
||||
logger.info("")
|
||||
def print_status( status):
|
||||
logger.info(f"{'Title':^{longest}} | + | = | - | Run Time | {'Status'}")
|
||||
breaker = f"{logger.separating_character * longest}|{logger.separating_character * 5}|{logger.separating_character * 5}|{logger.separating_character * 5}|"
|
||||
logger.separator(breaker, space=False, border=False, side_space=False, left=True)
|
||||
|
@ -408,9 +413,19 @@ def update_libraries(config):
|
|||
|
||||
logger.separator("Summary")
|
||||
for library in config.libraries:
|
||||
print_status(library.name, library.status)
|
||||
logger.info("")
|
||||
logger.separator(f"{library.name} Summary", space=False, border=False)
|
||||
logger.info("")
|
||||
logger.info(f"{'Title':<27} | Run Time")
|
||||
for text, value in library_status[library.name].items():
|
||||
logger.info(f"{text:<27} | {value:>8}")
|
||||
logger.info("")
|
||||
print_status(library.status)
|
||||
if playlist_status:
|
||||
print_status("Playlists", playlist_status)
|
||||
logger.info("")
|
||||
logger.separator(f"Playlists Summary", space=False, border=False)
|
||||
logger.info("")
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue