Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # DESCRIPTION:
- # Very simple script to read the contents of the working
- # directory and encode all .avi files to .m4v for adding to
- # iTunes, copies to iTunes watched folder, then then deletes
- # the input file and the original output file.
- #
- # USES:
- # * HandBrakeCLI to encode the files
- # * Rsync to copy encoded files to their final destination
- # so that progress can be tracked.
- #
- # TODO:
- # * Find a way to make HandBrakeCLI run silently
- #
- output_destination="PATH/TO/SHARE"
- for input in *.avi; do
- output=$(echo $input|sed "s/.avi/.m4v/g")
- HandBrakeCLI -i "$input" -o "$output" --preset="AppleTV 2"
- if $? = 0
- then
- rsync -az --progress "$output" "$output_destination"
- rm "$input"
- rm "$output"
- echo "[$(date +"%D %H:%M:%S")]
- Source File: $input
- Output file: $output
- Encode successful
- " >> ~/Dropbox/Logs/logfile.txt
- else
- echo "[$(date +"%D %H:%M:%S")]
- Source File: $input
- Output file: $output
- Encode failed
- " >> ~/Dropbox/Logs/logfile.txt
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement