Skip to content

Instantly share code, notes, and snippets.

@kyawkyawsoezhu
Last active February 12, 2018 09:36
Show Gist options
  • Save kyawkyawsoezhu/89aabbbe17f38368ee19a0990380a450 to your computer and use it in GitHub Desktop.
Save kyawkyawsoezhu/89aabbbe17f38368ee19a0990380a450 to your computer and use it in GitHub Desktop.
an example of soft code subtitle and rename video using `mkvmerge` and `filebot`
#!/bin/bash
outputPath="/home/kyawkyawsoezhu/Desktop/Outputs"
basePath="/home/kyawkyawsoezhu/Desktop/Downloads"
videoPath=(${basePath}/*/*.mkv)
mmSubtitlePath=(${basePath}/*/mmsub/*.srt)
engSubtitlePath=(${basePath}/*/engsub/*.srt)
index=0
for episode in ${videoPath[*]}
do
destination="${outputPath}/${episode##*/}"
mmsub=${mmSubtitlePath[${index}]}
engsub=${engSubtitlePath[${index}]}
mkvmerge -o "$destination" "$episode" --language 0:eng "$engsub" --language 0:bur "$mmsub"
let index=${index}+1
done
format="{n}/{'Season '+s}/{n} - {s00e00} - {t}"
query="Game Of Thrones"
filebot -rename ${outputPath[*]} --q "$query" --format "$format" --db TheTVDB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment