Use JSON for configuration
This commit is contained in:
parent
931b8f2db8
commit
8fdd1ef3d0
30
convert-psp
30
convert-psp
@ -9,23 +9,29 @@ help(){
|
||||
exit 1
|
||||
}
|
||||
|
||||
[[ -z "$1" || "$1" == "-h" || "$1" == "--help" ]] && help
|
||||
[[ "$1" == "-h" || "$1" == "--help" ]] && help
|
||||
|
||||
saveifs=$IFS
|
||||
IFS=$'\n'
|
||||
directory=$1
|
||||
iterations=$(jq -r ".subscriptions | length" < subscriptions.json)
|
||||
|
||||
[ ! -d "$directory" ] && mkdir -p "$directory"
|
||||
[ ! -d "PSP/$directory" ] && mkdir -p "PSP/$directory"
|
||||
|
||||
youtube-dl "$2" -f 18 -o "$directory/%(title)s.%(ext)s"
|
||||
|
||||
files=($(ls "$directory"))
|
||||
|
||||
for file in ${files[*]}
|
||||
for (( iteration=0; iteration<$iterations; iteration++ ))
|
||||
do
|
||||
[ ! -f "PSP/$directory/$file" ] && \
|
||||
f_convert-psp "$directory"/"$file"
|
||||
directory=$(jq -r ".subscriptions[$iteration].name" < subscriptions.json)
|
||||
channelURL=$(jq -r ".subscriptions[$iteration].link" < subscriptions.json)
|
||||
|
||||
[ ! -d "$directory" ] && mkdir -p "$directory"
|
||||
[ ! -d "PSP/$directory" ] && mkdir -p "PSP/$directory"
|
||||
|
||||
youtube-dl "$channelURL" -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
|
||||
done
|
||||
|
||||
IFS=$saveifs
|
||||
|
Loading…
x
Reference in New Issue
Block a user