]> git.parisson.com Git - telecaster-server.git/commitdiff
add date_filter arg to exclude older files
authorGuillaume Pellerin <guillaume.pellerin@parisson.com>
Tue, 24 Dec 2024 10:45:38 +0000 (11:45 +0100)
committerGuillaume Pellerin <guillaume.pellerin@parisson.com>
Tue, 24 Dec 2024 10:45:38 +0000 (11:45 +0100)
bin/mastering/mastering.py

index b6fedba47c5e38ef75f12bc21d03ec47e01fba1a..6cfe861b93d1b11b84662e3914a83b5e766cc010 100755 (executable)
@@ -66,6 +66,7 @@ class TeleCasterMastering(object):
         self.force_mode = args.force
         self.verbose_mode = args.verbose
         self.remux_only_mode = args.remux_only
+        self.date_filter = args.date_filter
 
         if args.input_formats:
             self.input_formats = args.input_formats
@@ -180,7 +181,7 @@ class TeleCasterMastering(object):
                     offsets = {}
                     if len(source_files) > 1 and self.auto_offset_mode:
                         date_file = datetime.datetime.fromtimestamp(os.path.getmtime(source_files[0]))
-                        if date_file >= self.date_limit:
+                        if date_file >= self.date_limit and self.date_filter:
                             offsets = self.find_best_offset(source_files)
 
                     for file in source_files:
@@ -188,7 +189,7 @@ class TeleCasterMastering(object):
                         filename, ext = os.path.splitext(file)
                         ext = ext[1:]
                         date_dir = datetime.datetime.fromtimestamp(os.path.getmtime(file))
-                        if ext in self.source_formats and date_dir >= self.date_limit:
+                        if ext in self.source_formats and (date_dir >= self.date_limit and self.date_filter):
                             if ext == "webm":
                                 self.remux(file)
                             if not self.remux_only_mode:
@@ -207,6 +208,7 @@ def main():
     parser.add_argument('-va', '--vaapi', help='use VAAPI encoder', action="store_true")
     parser.add_argument('-ao', '--auto_offset', help='add auto offset based on audio correlation', action="store_true")
     parser.add_argument('-dr', '--dry_run', help='dry run', action="store_true")
+    parser.add_argument('-df', '--date_filter', help='filter by specific date', action="store_true")
     parser.add_argument('-f', '--force', help='force mode', action="store_true")
     parser.add_argument('-v', '--verbose', help='verbose mode', action="store_true")
     parser.add_argument('-r', '--remux_only', help='remux only mode', action="store_true")