]> git.parisson.com Git - telecaster-server.git/commitdiff
add remux_only mode
authorGuillaume Pellerin <guillaume.pellerin@free.fr>
Tue, 30 Apr 2024 09:55:35 +0000 (11:55 +0200)
committerGuillaume Pellerin <guillaume.pellerin@free.fr>
Tue, 30 Apr 2024 09:55:35 +0000 (11:55 +0200)
bin/mastering/mastering.py

index 25ba49d7cdf6c53ba179352e8e149e1fb0c6f662..738e2fe06310ad757e1327dd1cf31b6f65888c0f 100755 (executable)
@@ -27,6 +27,7 @@ class Logger:
 class TeleCasterMastering(object):
     """docstring for TelemetaTranscode"""
 
+    raw_source_formats = ['webm',]
     source_formats = ['webm', 'mp4']
     dest_formats = {
                    'mp3' : {'in': '', 'out': '-vn -acodec libmp3lame -aq 6'},
@@ -61,9 +62,10 @@ class TeleCasterMastering(object):
                 self.dest_formats[f] = self.vaapi_formats[f]
 
         self.auto_offset_mode = args.auto_offset
-        self.dry_run = args.dry_run
+        self.dry_run_mode = args.dry_run
         self.force_mode = args.force
         self.verbose_mode = args.verbose
+        self.remux_only_mode = args.remux_only
 
         if args.input_formats:
             self.input_formats = args.input_formats
@@ -154,7 +156,7 @@ class TeleCasterMastering(object):
 
                 self.logger.logger.info(command)
 
-                if not self.dry_run:
+                if not self.dry_run_mode:
                     os.system(command)
 
 
@@ -167,7 +169,7 @@ class TeleCasterMastering(object):
                 source_files = []
                 for file in dir_files:
                     filename, ext = os.path.splitext(path + os.sep + file)
-                    if ext[1:] in self.source_formats:
+                    if ext[1:] in self.raw_source_formats:
                         source_files.append(path + os.sep + file)
 
                 if self.verbose_mode:
@@ -188,11 +190,12 @@ class TeleCasterMastering(object):
                         if ext in self.source_formats and date_dir >= self.date_limit:
                             if ext == "webm":
                                 self.remux(file)
-                            offset = None
-                            if offsets:
-                                if not file in offsets:
-                                    offset = offsets[1]['offsets'][file]
-                            self.transcode(file, offset=offset)
+                            if not self.remux_only_mode:
+                                offset = None
+                                if offsets:
+                                    if not file in offsets:
+                                        offset = offsets[1]['offsets'][file]
+                                self.transcode(file, offset=offset)
 
 
 def main():
@@ -205,6 +208,7 @@ def main():
     parser.add_argument('-dr', '--dry_run', help='dry run', 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")
     parser.add_argument('-i','--input_formats', nargs='+', help='Required input formats', required=True)
     parser.add_argument('-o','--output_formats', nargs='+', help='Required output formats', required=True)