Implement download functions

This commit is contained in:
Michael De Roover 2023-04-12 22:46:00 +02:00
parent fb44d22190
commit 5bb0271e31
Signed by: vim
GPG Key ID: 075496E232CE04CB

View File

@ -1,18 +1,32 @@
#!/bin/bash #!/bin/bash
saveifs=$IFS
IFS=$'\n'
directory=$1
files=($(ls "$1"))
f_convert-psp(){ 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" 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" [ ! -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 do
[ ! -f "PSP/$directory/$file" ] && \
f_convert-psp "$directory"/"$file" f_convert-psp "$directory"/"$file"
done done