#!/bin/sh pwd=`echo "$0" | sed -e "s/[^\/]*$//"` if [ `cat $pwd/urls | wc -l` -gt 0 ] && [ ! -e /tmp/dlEnCours ]; then transmission-remote -asu 10 -as touch /tmp/dlEnCours lign=`sed '2,$d' $pwd/urls | tr -d '\n'` if [ -z "$lign" ]; then sed -i '1d' $pwd/urls lign=`sed '2,$d' $pwd/urls | tr -d '\n'` fi while [ -n "$lign" ] && [ `cat $pwd/urls | wc -l` -gt 0 ] do echo "Action: $lign" if [ "$lign" = "clear" ]; then sed -i '1d' $pwd/urls mkdir $pwd/content/`date +%Y%m%d%H%M%S` mv $pwd/content/*.mp3 $pwd/content/`date +%Y%m%d%H%M%S` transmission-remote -AS else $pwd/youtube-dl -e $lign > $pwd/dlEc sed -i '1d' $pwd/urls $pwd/youtube-dl --no-progress -c -k -o "$pwd/content/%(title)s.%(ext)s" --extract-audio --audio-format=mp3 "$lign" echo "" > $pwd/dlEc fi lign=`sed '2,$d' $pwd/urls | tr -d '\n'` done rm /tmp/dlEnCours fi