Oshan96 / monkey-dl

Bulk download your favourite anime episodes from your favourite anime websites
MIT License
819 stars 71 forks source link

CLI support for websites #28

Open nichwall opened 4 years ago

nichwall commented 4 years ago

Attempting to download a show from animefreak using the CLI causes errors, but seems to work with the GUI. This appears to be because Anime_Downloader.py only imports scrapers.nineanime and does not check which scaper to use for different links inside of the main function.

Oshan96 commented 4 years ago

First of all, sorry for the very late reply. And yes, CLI only supports 9anime download. The thing is though it is quite easy for me to add support for all the websites through CLI as well, almost everyone using monkey-dl uses the GUI. So I didn't want to maintain another CLI version for all the websites. However, I have kept the ability to use it or 9anime for the users who were using it.

If somehow it is required by more people, I will add functionality for CLI as well.

nichwall commented 4 years ago

Ah, no worries. I did end up using the GUI, so it worked out. If that's the case, it would be handy if the documentation mentioned that the CLI only supports 9anime, and to use the GUI for other sites. The README makes it sound like you can use either for any of the supported sites.

Is there a reason you didn't write it as a CLI and then the GUI just being a wrapper? I'd be interested in helping with that, but depends on how much would need to be rewritten.

Oshan96 commented 4 years ago

Yes, I have edited the readme already in the dev branch just not in the current master :D

This is originally a CLI and yes, it has then GUI been wrapped around it. However as I added more website support (after GUI) I quite didn't add the same website support for CLI. However, if it's needed to add all the website supported using CLI, it will be easy (you just have to add another parameter to the CLI commands list to input the website (and other new functionalities added)). Almost same as GUI work since I have used the same format for both.

Have a look at it! :D Another dev will really help in maintaining this since I have been busy. Also, you don't have to actually rewrite many things, just add some more parameters and call the relevant scraper as for that :D

nichwall commented 4 years ago

Cool, sounds like fun.

Is the dev branch in a state where I can make a branch from there and then make a PR, or do you have local changes that have not been pushed?

Oshan96 commented 4 years ago

Nope, you can use the dev branch to start working on it. I will only be working on the update files and scrapers :D

Edit: If you're to implement any new features, open an issue first so we can keep track of them :)

nichwall commented 4 years ago

The entire CLI functionality was removed in https://github.com/Oshan96/monkey-dl/commit/4ee3c33466c93449695eae3eeaf8bcbb55398211. It also looks like you're putting everything into one file (gui/GUI.py), which will lead to a lot of code duplication to include the CLI.

To clean up the code a bit, I think it would be worth it to move the download function found in gui/GUI.py to the Downloader class. You could then pass the entire values dictionary to the Downloader class to simplify parsing and make it easy to keep the CLI and GUI with the same functionality, because you could just pass the same flags with CLI as the value fields in the GUI.

I am attempting this change and will let you know how it works out.