From 1b3390d349f9b100b30a4a0cc39fa6681a0fc537 Mon Sep 17 00:00:00 2001 From: Fabrice Quenneville Date: Sat, 21 Nov 2020 16:47:32 -0500 Subject: [PATCH] Working on broken filter --- mediacurator/curator.py | 29 ++++++++++++++++++++++++---- mediacurator/library/medialibrary.py | 2 +- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/mediacurator/curator.py b/mediacurator/curator.py index 0975a4c..6d8cdc9 100755 --- a/mediacurator/curator.py +++ b/mediacurator/curator.py @@ -91,10 +91,30 @@ def main(): # if marked for deletion delete and unwatch the video if "-del" in sys.argv: - medialibrary.unwatch(filepath, delete = True) + #medialibrary.unwatch(filepath, delete = True) + pass elif sys.argv[1] == "test": - print(medialibrary) - exit() + + # Pulling list of marked videos / original keys for the medialibrary.videos dictionary + keylist = [filepath for filepath in medialibrary.videos if medialibrary.videos[filepath].useful] + keylist.sort() + + for filepath in keylist: + if medialibrary.videos[filepath].useful: + if "formated" in printop or "verbose" in printop: + if medialibrary.videos[filepath].error: + print(f"{BColors.FAIL}{medialibrary.videos[filepath].fprint()}{BColors.ENDC}") + else: + print(medialibrary.videos[filepath].fprint()) + else: + if medialibrary.videos[filepath].error: + print(f"{BColors.FAIL}{medialibrary.videos[filepath]}{BColors.ENDC}") + else: + print(medialibrary.videos[filepath]) + + # if marked for deletion delete and unwatch the video + if "-del" in sys.argv: + medialibrary.unwatch(filepath, delete = True) elif sys.argv[1] == "convert": counter = 0 @@ -148,7 +168,8 @@ def main(): # if marked for deletion delete and unwatch the video if "-del" in sys.argv: - medialibrary.unwatch(filepath, delete = True) + #medialibrary.unwatch(filepath, delete = True) + pass diff --git a/mediacurator/library/medialibrary.py b/mediacurator/library/medialibrary.py index 021849f..030552b 100644 --- a/mediacurator/library/medialibrary.py +++ b/mediacurator/library/medialibrary.py @@ -117,7 +117,7 @@ class MediaLibrary(): self.videos[filepath].useful = useful # keep video if useful and user wants to also filter by selected resolutions - if self.videos[filepath].useful and len([filtr for filtr in self.filters if filtr in ["lowres", "subsd", "hd", "sd", "720p", "1080p", "uhd"]]) > 0: + if self.videos[filepath].useful and len([filtr for filtr in self.filters if filtr in ["lowres", "hd", "subsd", "sd", "720p", "1080p", "uhd"]]) > 0: useful = False if "subsd" in self.filters and self.videos[filepath].definition in ["subsd"]: