neatc0der / zdf-auto-dl

ZDF Mediathek Auto Downloader
MIT License
1 stars 0 forks source link

Add Registry to avoid redownloading files #3

Open pfmephisto opened 7 years ago

pfmephisto commented 7 years ago

Hey @tgrosch, I was wondering if there was an easy way to implement having the downloads go to another directory before being assembled. I have another program running that is checking the download directory and then is formatting and sorting the files. What I have noticed is that it is initiating when the first part of a show is downloaded and then ignores the rest, instead of waiting for all the parts to be loaded and assembled. I think having the download go to one directory and then just moving the assembled file should solve that problem.

I have seen that there is the option for a script to be executed when a download has finished I'm just not sure how to implement what I'm looking for.

Possible problems I see are shows being downloaded multiple times if the download is moved out of the download directory and double the disk space being taken up, if using the copy command (although a hard link could be an option).

neatc0der commented 7 years ago

Hi @pfmephisto,

I get the issue. Whenever working with a file structure independent of the one the downloader is expecting, you've got the issue of redownloading bloody everything. On the other hand I'd like to keep this processing as is, since it fits my use case.

Thus I've added a registry for downloaded files. So far there is only a single one called SimpleRegister. You can find it in zdf_auto_dl/config/register.py. It's quite simple, really. Just add your register here (something like FileRegister) and handle check() and add() (i.e. check if downloaded file path was logged in a file and add a downloaded file path as log in this file). Then add your registry to RegisterFactory.get_register(). Here you need to decide when to use your registry or mine. I suggest you add something like this to the config and access the data through config_parser:

register=file
register_file=/home/pfmephisto/zdf-download-register.txt

Catch my drift? This should be straight forward. Please drop me a line when you're finished with this or send a pull request. I'd like to add your solution to the repository.

Cheers!

neatc0der commented 7 years ago

Hey @pfmephisto,

I just saw your fork of the project. Please be aware of two bugs (typo in RegisterFactory, API Auth for video master request) that were fixed a few days ago. You should merge the corresponding three commits.

Cheers!