Skip to content

Commit

Permalink
Renaming files shouldn't overlap now
Browse files Browse the repository at this point in the history
  • Loading branch information
kanjieater committed May 20, 2024
1 parent 2901fe3 commit 34b88c4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"sync",
"-d",
"/mnt/v/test",
"--no-overwrite",
// "--audio",
// "/mnt/d/sync/変な家/変な家.m4b",
// "--text",
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ Currently supports Docker (preferred), Windows, and unix based OS's like Ubuntu
- Users with a modern CPU with lots of threads won't notice much of a difference between using CUDA/GPU & CPU

# Overwrite
By default the tool will write an srt named after the audio file's name. If you don't want it to do this you must explicitly tell it not to.
By default the tool will overwrite any existing srt named after the audio file's name. If you don't want it to do this you must explicitly tell it not to.

`subplz sync -d "/mnt/v/somefolder" --overwrite=False`
`subplz sync -d "/mnt/v/somefolder" --no-overwrite`

# Only Running for the Files It Needs
SubPlz writes a file in the same folder to the audio with the `<audiofile>.subplz` extension. It starts with a `.` so you may need to enable hidden files if you want to see it. This ensures that subplz runs once and only once per directory for your content. If you want to rerun the SubPlz syncing, delete the file.
Expand Down
10 changes: 5 additions & 5 deletions subplz/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def get_sources(input):
valid_sources.append(source)

for source in valid_sources:
print(f"🎧 {pformat(source.audio)}' ⟹ 📖 {pformat(source.text)}...")
print(f"🎧 {pformat(source.audio)}' ⟹ 📖 {pformat(source.text)}...")
cleanup(invalid_sources)
return valid_sources

Expand Down Expand Up @@ -420,11 +420,11 @@ def write_sub_cache(source: sourceData):


def rename_old_subs(source: sourceData):
remaining_subs = []
subs = []
for sub in source.text:
sub_ext= Path(sub)
if sub_ext in SUBTITLE_FORMATS and sub_ext != source.output_format:
remaining_subs.append(sub)
if Path(sub).suffix[1:] in SUBTITLE_FORMATS:
subs.append(sub)
remaining_subs = set(subs) - set(source.output_full_paths)

for sub in remaining_subs:
sub_path = Path(sub)
Expand Down

0 comments on commit 34b88c4

Please sign in to comment.