Skip to content

Instantly share code, notes, and snippets.

@caarlos0
Forked from k3rn/series.sh
Created December 30, 2011 21:51
Show Gist options
  • Save caarlos0/1541635 to your computer and use it in GitHub Desktop.
Save caarlos0/1541635 to your computer and use it in GitHub Desktop.
#!/bin/bash
###
feedurl='' #url do feed do teu tracker
series=("American.Horror.Story" "The.X.Factor") #aqui uma array com as series
dir='' #diretorio onde o teu cliente de torrent esta escutando
##
mkdir -p /tmp/torresmos/
cd /tmp/torresmos
wget $feedurl -O feed.xml -o /dev/null;
grep \<link\> feed.xml > tmp.xml
mv tmp.xml feed.xml
sed -i '1,2d' feed.xml;sed -i 's/<link>//g' feed.xml;sed -i 's/<\/link>//g' feed.xml;
for i in $series
do
grep $series[$i] feed.xml > tmp.xml
done
mv tmp.xml feed.xml
for i in $(cat feed.xml)
do
eos=${#i}-46
outputfile=${i:0:$eos}
#here will be gambiarras, unica maneira que achei de resolver
echo $outputfile > name.tmp
sed -i 's/://g' name.tmp
sed -i 's/\///g' name.tmp
file=$(cat name.tmp)
wget $i -O $dir$file -o /dev/null
done
rm -rf /tmp/torresmos/
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment