exts.append(ext)
return extension in exts
- def get_offset(self, within_file, find_file, window=10):
+ def get_offset(self, within_file, find_file, window=10):
y_within, sr_within = librosa.load(within_file, sr=None, duration=60.0)
y_find, _ = librosa.load(find_file, sr=sr_within, duration=60.0)
c = signal.correlate(y_within, y_find[:sr_within*window], mode='valid', method='fft')
if not self.dry_run_mode:
os.system(command)
+ def is_processed(self, source_files):
+ processed = False
+ for file in source_files:
+ filename, ext = os.path.splitext(file)
+ if ext[1:] == "log":
+ processed = True
+ return processed
+
def run(self):
for root, dirs, files in os.walk(self.root_dir):
if not dirs:
if source_files:
offsets = {}
- if len(source_files) > 1 and self.auto_offset_mode:
+ is_processed = self.is_processed(source_files)
+
+ if len(source_files) > 1 and self.auto_offset_mode and (not is_processed or self.force_mode):
date_file = datetime.datetime.fromtimestamp(os.path.getmtime(source_files[0]))
if date_file >= self.date_limit and self.date_filter:
offsets = self.find_best_offset(source_files)
path = os.path.abspath(file)
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 and self.date_filter):
+ date_dir = datetime.datetime.fromtimestamp(os.path.getmtime(file))²
+ if ext in self.source_formats and \
+ (date_dir >= self.date_limit and self.date_filter) and \
+ (not is_processed or self.force_mode):
if ext == "webm":
self.remux(file)
if not self.remux_only_mode: