#!/bin/bash/ finalDest=/path/of/sovigall/videos/ tempDest=/path/of/sovigall/tmp/ pageCache=/path/of/sovigall/pagecache/ threads=3 # nb cpu core - 1 cd $tempDest nbProcessLauch=$(ps -ef | grep -v grep | grep youtube-dl | wc -l) if [ $nbProcessLauch != 0 ] then exit fi for file in $tempDest*.hash do if [ -f $file ]; then while read ddl urlHash url destination do if [ ddl != 0 ] then /usr/local/bin/youtube-dl -R 0 -c --write-thumbnail --write-info-json --no-check-certificate -f 45/46/37/45/22/44/35/34/5 -o "$urlHash.%(ext)s" "$url" convert "$urlHash.jpg" -resize 260 "$urlHash.thumb.jpg" sleep 2 avconv -i $urlHash\.mp4 -codec:v libvpx -cpu-used 0 -b:v 500k -qmin 20 -qmax 42 -maxrate 500k -bufsize 1000k -threads $threads -codec:a libvorbis -b:a 128k $urlHash\.webm sleep 2 else wget -O urlHash url fi if [ ! -f $urlHash.*.part ] then rm $file sleep 2 mv $urlHash* $destination fi done < $file fi rm $pageCache*.html 2> /dev/null done