There is also a .wget-nameloop-single.sh The difference: one uses single quotes for the filenames, the other double quotes.
Single quotes are more robust, but will fail when the $namebase contains single quotes as well.
Like nameext="I've gotten yadda yadda " will work, when
Code: Select all
I've gotten yadda yadda
nameext='I've gotten yadda yadda ' will fail.
Code: Select all
#!/bin/bash
#V0.3 - added || notify-send -i error * $sourceurl
namebase="TITLE "
nameext=".mp4"
filename=wget.sh
sourceurl=
declare -i n=12
declare -i i
echo '#!/bin/bash' >> $filename
echo '# '$sourceurl >> $filename
echo -n "processing # "
for ((i = 1; i <= ${n}; i++)); do {
if [ $i -lt 10 ]; then
number=0${i}
else
number=${i}
fi
echo '#wget -c '\'\'' -O "'$namebase$number$nameext'" && notify-send -i info -t 0 "Downloading '$number'" "finished" || notify-send -i error -t 0 "Downloading '$number'" "failed"' >> $filename
echo -n $number" "
} done
echo "echo press enter
read" >> $filename
chmod u+x $filename
Set the sourceurl= if you want, you can keep it blank as well.
As example, using "TEST " as $namebase and declare -i n=2 and sourceurl=http://example.net/TEST the script produces this wget.sh script and makes it executable:
Code: Select all
#!/bin/bash
# http://example.net/TEST
#wget -c '' -O "TEST 01.mp4" && notify-send -i info -t 0 "Downloading 01" "finished" || notify-send -i error -t 0 "Downloading 01" "failed"
#wget -c '' -O "TEST 02.mp4" && notify-send -i info -t 0 "Downloading 02" "finished" || notify-send -i error -t 0 "Downloading 02" "failed"
echo press enter
read
Why are the
Code: Select all
#wget -c
Because it is meant for you to manually hunt down the URLs for each episode first.
When you have one URL, uncomment the line and insert it at the correct place.
E.g. like so:
Code: Select all
#!/bin/bash
# http://example.net/TEST
wget -c 'http://example.net/random1/TEST01.mp4' -O "TEST 01.mp4" && notify-send -i info -t 0 "Downloading 01" "finished" || notify-send -i error -t 0 "Downloading 01" "failed"
wget -c 'http://example.net/random2/TEST02.mp4' -O "TEST 02.mp4" && notify-send -i info -t 0 "Downloading 02" "finished" || notify-send -i error -t 0 "Downloading 02" "failed"
echo press enter
read
Code: Select all
http://example.net/TEST01.mp4
http://example.net/TEST02.mp4
[…]
http://example.net/TEST24.mp4
Have a screenshot from yesterday as example where I hunted down more URLs while wget.sh already ran and re-started the script more than once:

