diff --git a/convert-psp b/convert-psp index 87ac5b9..5fbaa16 100644 --- a/convert-psp +++ b/convert-psp @@ -1,18 +1,32 @@ #!/bin/bash -saveifs=$IFS -IFS=$'\n' -directory=$1 -files=($(ls "$1")) - f_convert-psp(){ ffmpeg -y -i "$1" -flags +bitexact -vcodec libx264 -profile:v baseline -level 3.0 -s 480x272 -r 29.97 -b:v 384k -acodec aac -b:a 96k -ar 48000 -f psp -strict -2 "PSP/$1" } +help(){ + printf "Usage: $0 \"directory\" \"URL\"\n" + exit 1 +} + +[ -z "$1" ] && help +[ "$1" == "-h" ] && help +[ "$1" == "--help" ] && help + +saveifs=$IFS +IFS=$'\n' +directory=$1 + +[ ! -d "$directory" ] && mkdir -p "$directory" [ ! -d "PSP/$directory" ] && mkdir -p "PSP/$directory" -for file in ${files[@]} +youtube-dl "$2" -f 18 -o "$directory/%(title)s.%(ext)s" + +files=($(ls "$directory")) + +for file in ${files[*]} do + [ ! -f "PSP/$directory/$file" ] && \ f_convert-psp "$directory"/"$file" done