chbrown / overdrive

Bash script to download mp3s from the OverDrive audiobook service
452 stars 66 forks source link

Add 'quicknclean' command #31

Closed johngarner closed 3 years ago

johngarner commented 3 years ago

Addition of 'quicknclean' command which combines the download and return commands as well as deletes book.odm.metadata, book.odm.license, and book.odm. Also change of of cover image filename to "cover" from "folder".

chbrown commented 3 years ago

Hi! Thanks for the suggestion, but I won't be merging this. I think this sort of composition is better implemented at the user level; e.g., a function in your ~/.bashrc or whatever.

For instance, I have a conceptually similar sequence of commands I run through whenever I check out a new audiobook: cd to a specific directory, download, then archive (not rm) the *.odm* files, which I recall with a simple reverse-search into my bash history. I expect we're not alone, but everyone's going to have a slightly different pipeline.

That said, I am sympathetic to two aspects of these changes:

  1. Customizing the name of the cover image. It uses folder.jpg because that's what #5 used, which I figured must mean something in rok1024's environment... Windows? In my environment, macOS, it doesn't mean anything special to Finder or iTunes, but at least it's available in some form as of #5. I'd be open to a PR that lets you override the default folder.jpg via an environment variable called something like OVERDRIVE_COVER_FILENAME.
  2. Cleaning up the temporary files the script creates; namely, *.odm.metadata and *.odm.license. I'm against doing anything to the original *.odm input file — which seems like non-idiomatic command line behavior to me. *.odm.metadata can be trivially recreated from the original *.odm anytime. *.odm.license is a little trickier, since the Overdrive servers won't let you acquire a license twice, but if #4 had a good solution, and there was another subsequent check that all files had been successfully downloaded, I could see adding a --cleanup flag to delete these files.

FWIW, you can already accomplish part of what you're trying to do by just supplying multiple commands at once: overdrive download return book.odm — which is equivalent to overdrive download book.odm && overdrive return book.odm but you only have to specify the filename once.