This can't be done just with arguments as it says here: Set download-archive path with args
I want to make two similar scripts. One that downloads the videos and archive file in the uploader's folder for each video. And another script that also downloads the metadata.
I want to check the archive before downloading.
I want to be able to use the function multiple times in parallel putting them on the background.
The only way I can think of getting the uploader is to download the metadata with the output %(uploader)s
.
Then create a folder with the uploader's name, remove the file, and download again the files with the correct name from the created folder.
I have a few functions defined already that may help with this.
This is what I've tried but it isn't working
# Video Playlist saving archive file to uploader's folder
ytp() {
# Dl opts=(
${opts[@]}
--skownload metadata
--skip-download
--write-info-json
)
# Get ten random characters
local rand=$( cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 1 )
LOG_NAME=$( get_log_name "$(${paste[@]})" )
$yt_dl ${opts[@]} --output "%(uploader|Anon-%(id)s)s.%(ext)s" "$(${paste[@]})" >> "/tmp/$LOG_NAME" 2>&1
for f in *.info.json; do
local name="${f%.*}"
if [[ $name == Anon* ]]; then
name="Anon"
fi
mkdir -p "$name"
rm "$f"
cd "$name" || exit
# Download media
ytv
cd .. || exit
done
}