jo1gi / audiobook-dl

Audiobook CLI downloader
GNU General Public License v3.0
225 stars 38 forks source link

Everend bulk download aborts on unavailable books #105

Closed iuliiakr closed 4 months ago

iuliiakr commented 4 months ago

Installation method: Github repo

Version: Python 3.11.8 audiobook-dl 0.7.3

Describe the bug

I am using audiobook-dl for bulk download from Everend. There are thousands of items on my list, but some of the books are not available for my region. So the audiobook-dl aborts download every time when 1) an exception is raised (in my case the most often is DataNotPresent) 2) I answer "no" for the question if an existing folder should be re-written. It slows the scraping significantly, while amount of those unavailable books is insignificant compared to the number of available books. So we can skip them, no problem. But I guess an -ignore-errors (or -skip-unavailable) flag is not implemented yet.

Suggestion It would be nice to have a kind of skip-unavailable flag.

Meanwhile, I changed my local version of audiobookdl/main.py

def main() -> None:
    # Parsing arguments
    options = args.parse_arguments()
    config = load_config(options.config_location)
    options.output_template = options.output_template or config.output_template
    # Applying arguments as global constants
    logging.debug_mode = options.debug
    logging.quiet_mode = options.quiet
    logging.ffmpeg_output = options.ffmpeg_output or options.debug
    logging.debug(f"audiobook-dl {__version__}", remove_styling=True)
    logging.debug(f"python {sys.version}", remove_styling=True)
    urls = args.get_urls(options)
    if not urls:
        logging.simple_help()
        exit()

#    try:
#        for url in urls:
#            process_url(url, options, config)
#    except AudiobookDLException as e:
#        e.print()
#        if logging.debug_mode:
#            logging.print_traceback()
#        exit(1)

# Here is the part that I changed
    for url in urls:
        try:
            process_url(url, options, config)
        except AudiobookDLException as e:
            e.print()
            if logging.debug_mode:
                logging.print_traceback()
# End of changed part

Maybe, you can suggest a better solution to this issue. Would be great to see what you think about it.

Another option was to filter out unavailable books on the stage of collecting book links. But somehow I haven't figured this out yet on Everend.

jo1gi commented 4 months ago

I think it is a great suggestion and have added it in bbc2e53.