I use a headless Fedora Core 3 box to run bittorrent downloads on. I'm using 'btlaunchmany' running as a background process so I can just drop .torrent files into a folder and it starts downloading automatically.
I'd like, however, to automate the process further. Specifically, I'd like to have a script I can run as a cron job that will scan the log file and delete the .torrent file for downloads that have finished.
A line of output in the log file for a finished torrent looks like this:
"/mnt/storage/Current Downloads/example.torrent": "seeding" (100.0%) - 33P0s7.000D u13.6K/s-d0.0K/s u498400K-d2346300K ""
I want the script to look for the word 'seeding' on a line in the log file and delete the file /mnt/storage/Current\ Downloads/example.torrent. However I'm not sure exactly how to go about this. Any hints to point me in the right direction would be appreciated.
Also appreciated would be tips on how to implement a download queue. Say for example I want no more than 4 downloads running at one time, but I have several .torrent files queued in another folder. If one download completes and is removed by the removal script, the queue script would detect that there are less than 4 downloads and move the oldest
.torrent file from the queue directory to the download directory (the one monitored by btlaunchmany) where it would then be downloaded. Again, I'm not sure how I might go about this, but it would be cool to have, yes?