Giter Club home page Giter Club logo

Comments (4)

Diegus83 avatar Diegus83 commented on June 5, 2024 1

I'm still getting an error related to the long filename but the error code is 63 so the exception is not being caught.

'python3 -m odmpy -v dl -c -k -f -j OrsonScottCardsIntergalacticMedicineS9781482999198.odm'

  File "/Users/diego/Downloads/odmpy-master/odmpy/odm.py", line 282, in run
    os.makedirs(book_folder)
  File "/usr/local/Cellar/[email protected]/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/os.py", line 223, in makedirs
    mkdir(name, mode)
OSError: [Errno 63] File name too long: "./Orson Scott Card's Intergalactic Medicine Show - Orson Scott Card, Edmund R. Schubert, Wayne Wightman, Stefan Rudnicki, Gabrielle De Cuir, Roxanne Hernandez, Arthur Morey, Emily Janice Card, Paul Boehmer, Various Narrators, Claire Bloom, Susan Hanfield, Mary Robinette Kowal, Eric James Stone, Aliette de Bodard, Others"

Seems like the error codes are not standard in different OSs Popular Errno Codes by Platform

I changed the OSError value to 63

odmpy/odmpy/odm.py

Lines 283 to 286 in 69ba511

except OSError as exc:
if exc.errno != 36:
raise # re-raise previously caught exception

The error gets caught and the execution continues but the directory isn't created.

  File "/Users/diego/Downloads/odmpy-master/odmpy/odm.py", line 299, in run
    with open(cover_filename, 'wb') as outfile:
FileNotFoundError: [Errno 2] No such file or directory: "./Orson Scott Card's Intergalactic Medicine Show/cover.jpg"

I added a new line to create the directory after the error gets caught like this

           book_folder = os.path.join(
                args.download_dir, u'{}'.format(title.replace(os.sep, '-')))
            os.makedirs(book_folder)

And the download progresses as expected.

Saved "./Orson Scott Card's Intergalactic Medicine Show/orson-scott-cards-intergalactic-medicine-show-part-12.mp3"

It fails to create the merged mp3 file since it is trying to use the full name for the output file.

./Orson Scott Card's Intergalactic Medicine Show/Orson Scott Card's Intergalactic Medicine Show - Orson Scott Card, Edmund R. Schubert, Wayne Wightman, Stefan Rudnicki, Gabrielle De Cuir, Roxanne Hernandez, Arthur Morey, Emily Janice Card, Paul Boehmer, Various Narrators, Claire Bloom, Susan Hanfield, Mary Robinette Kowal, Eric James Stone, Aliette de Bodard, Others.mp3: File name too long
ffmpeg exited with the code: 1

from odmpy.

Diegus83 avatar Diegus83 commented on June 5, 2024

This is an OS error because the filename is too long (over 300 characters in this case) so the OS can't create the directory.

I checked this particular odm file and since the book is a compilation there is not author tag, they are all attributed as Contributor, Narrators and one Editor.

It should be easy to handle this error but I'm not sure what the proper way to name the folder and file would be in this case.

One option would be to arbitrarily cut the directory name to a safe value.

A better one would be to use the Editor's name in the cases where the Author tag is missing. I checked several compilations in the library catalog and they seem to prefer to use the Editor's name where the author would usually be listed. For example John Joseph Adams is the editor of several sci fi collections and his name appears under the title in the search results.

I personally prefer the following convention "Author Name - Book Name.ext" or "Editor Name - Book Name.ext" in the case of compilations.

from odmpy.

ping avatar ping commented on June 5, 2024

I've chosen to drop all authors from the book folder name when OS error 36 occurs. It's probably not the most ideal solution but hopefully a reasonable enough fix for an edge case like this.

In the reported case, the book folder will now just be audiobooks/Orson Scott Card's Intergalactic Medicine Show/.

from odmpy.

ping avatar ping commented on June 5, 2024

@Diegus83 Thanks for the catch. Added a couple more fixes to address the issues you raised.

from odmpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.