Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.88 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # This script attempts to merge a srt file into the
  4. # mkv container on track 0 and mark it as English.
  5. #
  6. # deegan @ IRCnet
  7. # hakan@monkii.net
  8. #
  9.  
  10. if [ ! $1 ]; then
  11.     echo "Usage: $0 <dir>"
  12.     exit 0;
  13. fi
  14.  
  15. cd $1
  16.  
  17. echo "----------------------------------------------------------------------------------"
  18. pwd
  19. echo "CWD: $1"
  20.  
  21. SRT=$(ls *.srt)
  22. MKV=$(ls *.mkv)
  23.  
  24. if [ -f $SRT ]; then
  25.     echo "MKV: $MKV"
  26.     echo "SRT: $SRT"
  27.     mv $MKV tmp.mkv
  28.     mkvmerge -o $MKV --default-track 0 --language 0:eng $SRT tmp.mkv
  29.     if [ $? -eq 0 ]; then
  30.         echo "Removing tmp.mkv and $SRT .."
  31.         rm tmp.mkv
  32.         rm $SRT
  33.     else
  34.         echo "there was a problem with $MKV, aborting.."
  35.         mv tmp.mkv $MKV
  36.     fi
  37. else
  38.     echo "No srt found.."
  39. fi
  40.  
  41. cd ..
  42.  
  43. echo "----------------------------------------------------------------------------------"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement