audible-cli
audible-cli copied to clipboard
downloads of books with the same title skip/overwrite
Describe the bug:
If your library contains 2 or more titles with the same name (eg the same books with a different ASIN/narrator), downloads of aaxc,json,jpg will skip due to existing files. voucher file will get overwritten.
I believe a potential workaround is already proposed in this PR:
https://github.com/mkb79/audible-cli/pull/23
i.e. we would use the following new option to prefix titles with their asin:
--filename-mode asin_ascii
It would be nice to have an option to try and migrate existing downloads between filename modes (eg from "ascii" to "asin_ascii") so you don't have to pull the entire library again, but that is probably asking for too much cream on the cake :). The most important thing is to be able to consistently update your library using something like "audible download --all --filename-mode asin_ascii"
To Reproduce:
Use two books with the same title and different ASIN, eg:
audible download --asin 0008433844 --aaxc --cover --cover-size 1215 --chapter audible download --asin B0030EJV3U --aaxc --cover --cover-size 1215 --chapter
I applied "issue-49" branch/PR changes against the current master and ran a test by re-downloading my entire library of several hundred books. I didn't encounter any issues, and all my "duplicate" titles with a different narrator are now downloaded without skips/overwrites using:
audible download --all --filename-mode asin_ascii --aaxc --cover --cover-size 1215 --chapter
I also re-ran all my normal post-processing (unrelated to audible-cli) on the aaxc files and didn't encounter any errors. I use the "narrator" metadata in the directory name to tell the difference between different versions when I'm playing or otherwise re-organizing my audio book files.
Hopefully you find this feedback useful in your considerations to commit "issue-49". I will keep testing and let you know if any problems turn up.
Thanks again for a great tool.
Good to hear that. I'm on vacation. Will work on this next week.
@xaeiougit adding the option to the cli command is a good solution. But I'm thinking on add a default setting to the config yml file. So a user can change name convention globally without entering the option every time. What do you think about this?
Edit: As an addition to the cli command option
@mkb79 I think a global config option that can be overridden on the command line as you suggest is a great idea!
I'm trying to think how to nudge people towards this config option if needed. A note in the documentation will work of course, but a warning if duplicate titles are encountered when using the "-all" download option would be nice if it can be efficiently coded (ie you keep enough state to do that). Otherwise, no big deal, people can read the caveat in the documentation :)
Besides books with different narrator, I've noticed Audible also sometimes re-issue the exact same book/narrator with a different ASIN. Possibly this is to fix production errors? You would think Audible would let us get the re-issue for free, but that's not the case, it needs to be purchased again! Anyway, I only mention this for completeness - since a different ASIN is used, the same workaround applies.
@xaeiougit If created the new PR #39. These PR contains setting the filename_mode in config. I will take a look on the duplicate thing.
The re-issue behave must be changed by Audible in my opinion. Maybe they think, you buy the book where it is. But if there are errors in the book, which are corrected, they must give all Users the new book.
@mkb79 I installed and tried PR #39 using both CLI and config file methods and works great. Thanks very much.
Edit: I agree Audible are being very stingy not allowing us to update to the latest reissue of a book. I won't buy the book a second time that's for sure :)
@xaeiougit Sounds great. Next step is to rewrite the doc. My english is not so good but I will give my best! After that I can merge the PR.
Next is to add more settings to config to make life easier. Some wishes?
@mkb79 - I just noticed in the config file the option is "filename_mode" and in the CLI it's "filename-mode. Difference using "-" for CLI vs "_" for config file. Is this normal? Sorry I've not used the config file before, this is my first time so better check.
EDIT - I just checked some other commands, and it seems this is indeed the standard "_" for config file and "-" for CLI.
@xaeiougit As far as I know the hyphen is the convention when using options in bash or Windows Terminal. So I use always the hyphen there. The Python convention is the underscore, so I use it in the config file. I doesn't think about this in the past. But you are right. This is confusing. Have to add this info to the doc.
@mkb79 - lots of different methods, but fortunately there is already a pre-built ~/.audible/config.toml we can study for reference.
I've noticed many programs do different things. Some popular programs e.g. youtube-dl uses a CLI style "--variable-name" in the config file, whereas mpv uses just "variable-name" in the config file. I think you using the python style is good, as long as it's consistent for all variables that's the only important thing :).
You asked about other wishes for the config file, for me this would be a standard config.toml:
` title = "Audible Config File"
[APP] primary_profile = "audible"
[profile.audible] #aaxc #cover #cover_size = "1215" #chapter filename_mode = "asin_ascii" auth_file = "audible.json" country_code = "us" `
Okay, I can implement this easily. But not in these release.
I have released v0.0.4 to PyPi now.
Hello again
After playing around some more, I think it would good if "audible library list" also knows about the ASIN.
Using the original example I gave to reproduce this issue, what you currently will get from the "audible library list" command is duplicate titles.
$ audible library list | grep -i hobbit J. R. R. Tolkien: The Lord of the Rings: The Hobbit J. R. R. Tolkien: The Lord of the Rings: The Hobbit
Maybe this command could be modified to prefix with the asin if filename_mode = "asin_ascii" is configured. Or perhaps an additional command line option, eg "audible library list asin_ascii" .
This would allow us to write a personal script that loops over the output of "audible library list" to perform some further action on every title in our library (eg output a report on missing titles).