justfoolingaround / animdl

A highly efficient, fast, powerful and light-weight anime downloader and streamer for your favorite anime.
GNU General Public License v3.0
1.33k stars 109 forks source link

Upon failing to load an episode, animdl should exit with non-zero exit code #66

Closed codingCoffee closed 3 years ago

codingCoffee commented 3 years ago

The use case for the problem is for automation. If a better strategy can be suggested, that would also work. Currently there is no way to know if animdl exited because an episode was not found or if exited after playing an episode.

justfoolingaround commented 3 years ago

Actually yes! Thank you for suggesting this!

While animdl was intended for automation and me even optimising the code for it to seamlessly run in a remote server, I never thought this through.

There aren't many cases where animdl needs to abruptly stop except for when the streaming configuration has mismatched or when the content doesn't get found. Due to this, I didn't really mention about it in the documentations.

So, now animdl has 4 possible exit codes:

0: For returning a successful completion of the program.
1: For returning a exception in the program. (Handled by click)
2:  For returning no content found during search, or 404
3: For returning failed streamer configurations

I have tried my best to keep it even with the standard approach of returncodes. Thank you again, for suggesting this!

Note: This isn't added in the codebase, but in the cli portion of it because of obvious reasons.