Skip to content

Commit

Permalink
bugfix: Alignments - correctly update keys for multiple underscores i…
Browse files Browse the repository at this point in the history
…n the filename
  • Loading branch information
torzdf committed Apr 26, 2024
1 parent 0f94779 commit 13dd5b3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/align/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,19 @@ def update(self) -> int:
"""
updated = 0
for key in list(self._alignments.data):
val = self._alignments.data[key]
fname = os.path.splitext(key)[0]
if fname.rsplit("_")[0] != self._video_name:
if fname.rsplit("_", maxsplit=1)[0] != self._video_name:
continue # Key is from a different source

val = self._alignments.data[key]
new_key = f"{fname}{self._extension}"

del self._alignments.data[key]
self._alignments.data[new_key] = val

updated += 1

logger.debug("Updated alignemnt keys for video extension: %s", updated)
logger.debug("Updated alignment keys for video extension: %s", updated)
return updated


Expand Down

0 comments on commit 13dd5b3

Please sign in to comment.