I have a new stuff showing in my conky:
It’s a status of downloads.
The script, autoytdl.sh, retrieve the new videos feed via YouTube API and check if there are new entries.
I use cron to run it every hour:
0 * * * * autodlyt.sh livibetter /home/livibetter/Videos/ 1> /dev/null
The first argument is the account name, second is where to store data and videos. In my case, the downloaded videos go to ~/Videos/livibetter/videos.
If you run it for first time, it will download all videos listed in the feed. It’s better to run it and interrupt it, then clean USERNAME/queue, that directory record what videos should be downloaded. It uses youtube-dl to download, one video at a time. So, the downloading process may take very long. If your cron run the script again when previous job isn’t finished1, well, same video could be downloaded twice.
This script could be very buggy.
(Normally, I wouldn’t put such script into public. But YouTube homepage’s Subscription section sometimes showed me videos I had watched through same section again, and YouTube often put be into 360p, or 480p if it thought my Internet speed is fast enough or I was just lucky. 720p, I always have to manually select.)
Hey!
ReplyDeleteRegarding cron: from my experience, cron does not care whether previously started job is finished or not. I usually include a "ps aux ¦ grep scriptname" filter in the script if I want it to run only one instance at a time. Works quite well.
Have a nice day,
Martin
`pgrep` might be a better choice. But I was thinking, if I would want to fix that, I would use `flock` on corresponding lockfile to queue files. So queuing files would not be downloaded twice. And it has a benefit, or side-effect, two or more autodlyt would download videos at same time when cron invokes more instances.
ReplyDeleteHmmm, pgrep, thanks for the tip!
ReplyDeleteI'm not sure if anyone will see this, but worth a shot. Has any progress been made on this script? It still works fine for me but I'd like a solution for when the script is still running and the cron comes around ... instead of it running multiple instances downloading the same video... Fingers crossed. Cheers
ReplyDeleteNo further progress has been made. In fact, I don't use this script anymore myself, because many videos the script downloads from my subscriptions I actually don't watch.
ReplyDeleteI did notice the multiple instances issue when I was using the script, but didn't bother to fix it. To avoid multiple instance, just check and touch a lock file to make sure only one process is running. It's not to hard to code for that.