Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid date string #58

Open
NolanT opened this issue Nov 25, 2023 · 4 comments
Open

Invalid date string #58

NolanT opened this issue Nov 25, 2023 · 4 comments

Comments

@NolanT
Copy link

NolanT commented Nov 25, 2023

Describe the problem
This week odmpy started failing on processing every audiobook. It successfully downloads all the parts but on the transcode to M4B errors when parsing the date field. I'm going to try debugging more, but submitting this issue in case anyone is already aware of a solution. Traceback logs below.

To Reproduce

odmpy libby \
--direct \
--latest 1 \
--downloaddir=<downloaddir> \
--settings=<settingsdir> \
--keepcover \
--chapters \
--merge \
--mergeformat=m4b \
--mergecodec=aac \
--removefrompaths ":," \
--bookfolderformat "%(Author)s/%(Title)s" \
--bookfileformat "%(Author)s - %(Title)s"

Version/Environment
odmpy 0.8.1 [Python 3.11.6-darwin]

Traceback log

odmpy Interactive Client for Libby
----------------------------------------------------------------------
Non-interactive mode. Downloading latest 1 loan...
Opening audiobook "<book title>"...
Downloading "<book title>" by "<book author>" in 19 parts...
...
Already saved /Users/server/Music/Audiobooks/.....part-19.mp3
Generating "/Users/server/Music/Audiobooks/......"...
size=  457164kB time=16:15:16.88 bitrate=  64.0kbits/s speed=6.29e+03x
An unexpected error has occurred
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.11/site-packages/odmpy/odm.py", line 953, in run
    process_audiobook_loan(
  File "/opt/homebrew/lib/python3.11/site-packages/odmpy/processing/audiobook.py", line 362, in process_audiobook_loan
    write_tags(
  File "/opt/homebrew/lib/python3.11/site-packages/odmpy/processing/shared.py", line 250, in write_tags
    audiofile.tag.release_date = published_date
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/eyed3/id3/tag.py", line 506, in _setReleaseDate
    self._setDate(b"TDRL", date)
  File "/opt/homebrew/lib/python3.11/site-packages/eyed3/id3/tag.py", line 649, in _setDate
    date = core.Date.parse(date)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/eyed3/core.py", line 380, in parse
    pdate, fmt = Date._validateFormat(s)
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/eyed3/core.py", line 368, in _validateFormat
    raise ValueError(f"Invalid date string: {s}")
ValueError: Invalid date string: 2021-02-16T05:00:00+00:00
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/opt/homebrew/lib/python3.11/site-packages/odmpy/__main__.py", line 35, in <module>
    main()
  File "/opt/homebrew/lib/python3.11/site-packages/odmpy/__main__.py", line 27, in main
    run()
  File "/opt/homebrew/lib/python3.11/site-packages/odmpy/odm.py", line 953, in run
    process_audiobook_loan(
  File "/opt/homebrew/lib/python3.11/site-packages/odmpy/processing/audiobook.py", line 362, in process_audiobook_loan
    write_tags(
  File "/opt/homebrew/lib/python3.11/site-packages/odmpy/processing/shared.py", line 250, in write_tags
    audiofile.tag.release_date = published_date
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/eyed3/id3/tag.py", line 506, in _setReleaseDate
    self._setDate(b"TDRL", date)
  File "/opt/homebrew/lib/python3.11/site-packages/eyed3/id3/tag.py", line 649, in _setDate
    date = core.Date.parse(date)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/eyed3/core.py", line 380, in parse
    pdate, fmt = Date._validateFormat(s)
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/eyed3/core.py", line 368, in _validateFormat
    raise ValueError(f"Invalid date string: {s}")
ValueError: Invalid date string: 2021-02-16T05:00:00+00:00
@wtanksleyjr
Copy link

This might be related to the following warning (not error) when saving MP3 files:

odmpy libby --bookfolderformat './tmp/%(ID)s' --hideprogress --direct --selectid 4790886 4565785
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"

@aNullValue
Copy link

I can confirm that this is an issue for me too, though only when using --direct. I removed --direct and it seems to be working properly.

@Epod
Copy link

Epod commented Jan 27, 2024

Same error for me when using --direct only.

Happy to provide any details which might be helpful to troubleshoot.

EDIT: Looks like #59 might have fixed it, which can be used until it is merged

@NolanT
Copy link
Author

NolanT commented Jan 27, 2024

@Epod Yes, I fixed my own issue in PR #59.

@ping, Can you please review my PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants