Skip to content

Instantly share code, notes, and snippets.

@Hunsu
Created June 14, 2015 15:39
Show Gist options
  • Save Hunsu/f1fbb5527156d10bb0cf to your computer and use it in GitHub Desktop.
Save Hunsu/f1fbb5527156d10bb0cf to your computer and use it in GitHub Desktop.
#!/bin/bash
# subsrec: Script to execute after a torrent completes within Deluge.
# 1. Install pip
# Ubuntu: sudo apt-get install python-pip
# Fedora: sudo yum install python-pip
# 2. Install subliminal
# sudo pip install subliminal
# 3. Use the execute plugin in Deluge
# http://dev.deluge-torrent.org/wiki/Plugins/Execute
# create a "Torrent Complete" script execution with the current script.
shopt -s nocasematch
torrentid=$1
torrentname=$2
torrentpath=$3
file=()
while read -r -d $'\0'; do
files+=("$REPLY")
done < <(find "$3" -type f -name '*.avi' -o -name '*.mp4' -print0)
for i in "${files[@]}"
do
if [[ $i == *sample* ]]; then
continue
fi
echo "$i"
subliminal -l en -s -f "$i"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment