Skip to content

Commit

Permalink
Merge pull request #10 from kanjieater/video
Browse files Browse the repository at this point in the history
adding video syncing
  • Loading branch information
kanjieater authored May 20, 2024
2 parents 8354b3c + 34b88c4 commit 0515ff7
Show file tree
Hide file tree
Showing 11 changed files with 374 additions and 85 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.env
__pycache__/
build/
.ruff_cache/
.vscode/
*.egg-info

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.env
__pycache__/
.ruff_cache/
.vscode/
build/
*.egg-info
Expand Down
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@
// "/mnt/d/sync/変な家/変な家.epub",
],
},
{
"name": "Video file",
"type": "debugpy",
"request": "launch",
"module": "subplz",
"args": [
"sync",
"-d",
"/mnt/v/test",
"--no-overwrite",
// "--audio",
// "/mnt/d/sync/変な家/変な家.m4b",
// "--text",
// "/mnt/d/sync/変な家/変な家.epub",
],
},

{
"name": "Python: align vtt",
Expand Down
7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ RUN apt-get update \
libportaudio2 \
&& rm -rf /var/lib/apt/lists/*

#remove when we get abts updated w/ a pyproject.toml
COPY /home/ke/code/AudiobookTextSync /tmp/AudiobookTextSync

COPY pyproject.toml /tmp/
RUN pip install --no-cache-dir /tmp/

Expand All @@ -36,5 +33,5 @@ WORKDIR /app
HEALTHCHECK --interval=30s --timeout=10s CMD nc -z localhost 10300 || exit 1

# Start the application
# ENTRYPOINT ["python", "./src/main.py"]
# CMD ["--help"]
ENTRYPOINT ["python", "-m", "subplz"]
CMD ["--help"]
2 changes: 1 addition & 1 deletion compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- TZ=Etc/UTC
- WHISPER_MODEL=tiny-int8
- WHISPER_BEAM=1 #optional
- WHISPER_LANG=en #optional
- WHISPER_LANG=ja #optional
volumes:
- ./:/app
- /mnt/d/sync:/sync
Expand Down
8 changes: 8 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ Currently supports Docker (preferred), Windows, and unix based OS's like Ubuntu
- This can be GPU intense, RAM intense, and CPU intense script part. `subplz sync -d "<full folder path>"` eg `subplz sync -d "/mnt/d/Editing/Audiobooks/かがみの孤城/"`. This runs each file to get a character level transcript. It then creates a sub format that can be matched to the `script.txt`. Each character level subtitle is merged into a phrase level, and your result should be a `<name>.srt` file. The video or audio file then can be watched with `MPV`, playing audio in time with the subtitle.
- 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 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" --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.


# Split m4b by chapter
`./split.sh "/mnt/d/Editing/Audiobooks/かがみの孤城/"`
Expand Down
2 changes: 1 addition & 1 deletion subplz/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def setup_advanced_cli(parser):
# Behaviors
optional_group.add_argument(
"--overwrite",
default=False,
default=True,
help="Overwrite any destination files",
action=argparse.BooleanOptionalAction,
)
Expand Down
Loading

0 comments on commit 0515ff7

Please sign in to comment.