odmpy icon indicating copy to clipboard operation
odmpy copied to clipboard

The --selectid option gets only the last ID in the list

Open wtanksleyjr opened this issue 1 year ago • 8 comments

Describe the problem When processing a loan export to get the books I hadn't previously downloaded and moved to their final resting place, I find that the --selectid option only downloads one book, the last ID on the list.

To Reproduce Download your loan file odmpy libby --loans, grab a few IDs from it. Run 'em using the batch mode:

odmpy libby --bookfolderformat './tmp/%(ID)s' --hideprogress --direct --selectid 4790886 4565785

Result:

odmpy Interactive Client for Libby                                                                                                                                                                               ----------------------------------------------------------------------
Non-interactive mode. Downloading loans with IDs 4790886, 4565785...
Opening audiobook "The Lives of Bees"...
Downloading "The Lives of Bees" by "Thomas D. Seeley" in 12 parts...
Error saving ID3: Invalid date string: 2019-05-28T04:00:00+00:00
Saved "tmp/4565785/the-lives-of-bees-part-01.mp3"
Error saving ID3: Invalid date string: 2019-05-28T04:00:00+00:00
Saved "tmp/4565785/the-lives-of-bees-part-02.mp3"
Error saving ID3: Invalid date string: 2019-05-28T04:00:00+00:00
Saved "tmp/4565785/the-lives-of-bees-part-03.mp3"
Error saving ID3: Invalid date string: 2019-05-28T04:00:00+00:00
Saved "tmp/4565785/the-lives-of-bees-part-04.mp3"
Error saving ID3: Invalid date string: 2019-05-28T04:00:00+00:00
Saved "tmp/4565785/the-lives-of-bees-part-05.mp3"
Error saving ID3: Invalid date string: 2019-05-28T04:00:00+00:00
Saved "tmp/4565785/the-lives-of-bees-part-06.mp3"
Error saving ID3: Invalid date string: 2019-05-28T04:00:00+00:00
Saved "tmp/4565785/the-lives-of-bees-part-07.mp3"
Error saving ID3: Invalid date string: 2019-05-28T04:00:00+00:00
Saved "tmp/4565785/the-lives-of-bees-part-08.mp3"
Error saving ID3: Invalid date string: 2019-05-28T04:00:00+00:00
Saved "tmp/4565785/the-lives-of-bees-part-09.mp3"
Error saving ID3: Invalid date string: 2019-05-28T04:00:00+00:00
Saved "tmp/4565785/the-lives-of-bees-part-10.mp3"
Error saving ID3: Invalid date string: 2019-05-28T04:00:00+00:00
Saved "tmp/4565785/the-lives-of-bees-part-11.mp3"
Error saving ID3: Invalid date string: 2019-05-28T04:00:00+00:00
Saved "tmp/4565785/the-lives-of-bees-part-12.mp3"
Downloaded acsm to "tmp/4790886/The Lives of Bees - Thomas D. Seeley.acsm"

No error printed, but it only got the one book. I've tried this with multiple IDs, no success.

Version/Environment odmpy 0.8.1 [Python 3.10.12-linux]

wtanksleyjr avatar Nov 29 '23 21:11 wtanksleyjr

If you use the same two IDs in a list and reverse their position, does it get the opposite book?

collinscochran avatar Dec 28 '23 14:12 collinscochran

No; in fact I'm confused now. It doesn't get either one when I reverse the positions. It's almost like being the first one on the list poisons that ID so it can't be downloaded.

On Thu, Dec 28, 2023 at 6:41 AM collinscochran @.***> wrote:

If you use the same two IDs in a list and reverse their position, does it get the opposite book?

— Reply to this email directly, view it on GitHub https://github.com/ping/odmpy/issues/60#issuecomment-1871236500, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ7H6MKEF4HODJNQNXH733YLWAJLAVCNFSM6AAAAABAAFFUOOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZRGIZTMNJQGA . You are receiving this because you authored the thread.Message ID: @.***>

wtanksleyjr avatar Dec 28 '23 16:12 wtanksleyjr

No; in fact I'm confused now. It doesn't get either one when I reverse the positions. It's almost like being the first one on the list poisons that ID so it can't be downloaded. On Thu, Dec 28, 2023 at 6:41 AM collinscochran @.> wrote: If you use the same two IDs in a list and reverse their position, does it get the opposite book? — Reply to this email directly, view it on GitHub <#60 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ7H6MKEF4HODJNQNXH733YLWAJLAVCNFSM6AAAAABAAFFUOOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZRGIZTMNJQGA . You are receiving this because you authored the thread.Message ID: @.>

Very odd, I'm currently using that same workflow (####### ####### ####### etc) to download specific ID's and it seems to work. These are just values you pulled from the id in the loans?

collinscochran avatar Dec 28 '23 16:12 collinscochran

Yes, the IDs in the json loans dump. I'm trying to make this work as a replacement for a python script that does this all automatically (and got taken down from github, probably for that reason, so let's be careful). So you're saying you run --selectid with multiple IDs it does work? Are you maybe not using direct (maybe I should try without)?

wtanksleyjr avatar Dec 28 '23 17:12 wtanksleyjr

Yes, the IDs in the json loans dump. I'm trying to make this work as a replacement for a python script that does this all automatically (and got taken down from github, probably for that reason, so let's be careful). So you're saying you run --selectid with multiple IDs it does work? Are you maybe not using direct (maybe I should try without)?

Yeah, try it without the direct and see if it works.

The command I'm running now which works is odmpy libby --selectid 1111111 2222222 3333333 -d /mnt/audiobooks -m --mergeformat m4b --nobookfolder -c

That will run through the list and skip any missing/not available, and leave them in my /mnt/audiobooks folder as m4b's with chapters.

collinscochran avatar Dec 28 '23 17:12 collinscochran

CONFIRMED! Thank you, this gives me enough to press forward - the problem must have been in the combination of --direct and --direct, without the latter it works just fine.

wtanksleyjr avatar Dec 28 '23 17:12 wtanksleyjr

Um, yeah, I meant --direct and --selectid. Sorry.

wtanksleyjr avatar Dec 28 '23 17:12 wtanksleyjr

No problem! I'm doing basically the same thing as you... i scrape for loaned books, if the array of ID changes it compares, then automatically downloads the id returned. Works well so far!

collinscochran avatar Dec 28 '23 18:12 collinscochran