Skip to content

Instantly share code, notes, and snippets.

@ddimick
Last active August 12, 2020 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ddimick/d165c090e458b035e0f0eb89f775c073 to your computer and use it in GitHub Desktop.
Save ddimick/d165c090e458b035e0f0eb89f775c073 to your computer and use it in GitHub Desktop.
One-liner to run ffsubsync against all media files in directory.
# assumes .mkv media format and existing subtitles end in .en.srt
for f in ./*.mkv; do media=$(basename -s .mkv ${f}); $(ffs ${media}.mkv -i ${media}.en.srt --overwrite-input); done
# improved version that handles directory recursion
find . -type f -name '*.mkv' -print0 | while IFS= read -r -d '' file; do episode=$(echo -en ${file} | sed 's/\.[^.]*$//'); echo -en ${episode}; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment