kemono-dl
kemono-dl copied to clipboard
Reintroduce signal interrupt
Restores previous functionality where SIGINT would allow the user to exit the program.
Works by throwing KeyboardInterrupt exceptions during generic try catch blocks, rather than allowing it to be swallowed by a generic catch.
Alternative is to instead catch specific exceptions and nix the generic catch-all, open to doing this instead
could you please explain in longer sentences, im new to programming
Sure. Currently if there are any exception such as HTTP exceptions (404s, 429s, the like), they are caught by the generic try: ... except: ... structure. If there are any errors inside the try block instead of crashing your program, it executes the except block.
If a user wants to stop Kemono DL from running, they can use ctrl+C, what this does is that it sends an interrupt known as a KeyboardInterrupt. However, since these try-except blocks catch every single exception, the code treats it like the download fails and tries again.
Ideally, the try-except blocks should specify what type of exceptions they should catch. In lieu of that, we can catch KeyboardInterrupts and specifically throw those exceptions so we "crash" our program as we expect it to.
I see, but i prefer the current solution which when pressing ctrl+C cancel the current download and go to the next download. therefore I can skip some big files which take a long time to download. The program also dont have try except to catch connection timeout. should have tried to reconnect when its time out. you may want to make that enhancement