kemono-dl icon indicating copy to clipboard operation
kemono-dl copied to clipboard

Reintroduce signal interrupt

Open bea831333 opened this issue 2 years ago • 4 comments

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.

bea831333 avatar May 14 '22 16:05 bea831333

Alternative is to instead catch specific exceptions and nix the generic catch-all, open to doing this instead

bea831333 avatar May 14 '22 16:05 bea831333

could you please explain in longer sentences, im new to programming

afterdelight avatar May 15 '22 20:05 afterdelight

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.

bea831333 avatar May 16 '22 11:05 bea831333

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

afterdelight avatar May 17 '22 23:05 afterdelight