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

[Feature Request] Path length detection +chapter title or lecture title truncation if needed #50

Open
tinfever opened this issue Aug 29, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@tinfever
Copy link

First of all, thank you for this program. It works extremely well for backing up the Udemy courses I've purchased.

I ran into an issue with one of my courses that has very long chapter title and lecture titles which caused the path length to exceed the Windows 255 character limit. This caused lots of weird errors about "cannot write to file" or "file not found" during the download process.

Example (256 characters long): Z:\Udemy\out_dir\crash-course-electronics-and-pcb-design\08 - Graduating to Design Engineer_ CircuitMaker Fundamentals and Real-World Projects/004 CircuitMaker Fundamentals_ Magic Wand 555 Timer Design & Parts Selection Process.encrypted.m4a.part.frag.urls

I worked around the issue by putting the udemy-downloader folder in the root folder of my drive, renaming the udemy-downloader folder to just "Udemy", and finally I had to add a line to the main.py to truncate any chapter title greater than 51 characters:

for chapter in _udemy.get("chapters"):
        chapter_title = chapter.get("chapter_title")
        chapter_title = chapter_title[:51]                                           <<<
        chapter_index = chapter.get("chapter_index")
        chapter_dir = os.path.join(course_dir, chapter_title)
        if not os.path.exists(chapter_dir):
            os.mkdir(chapter_dir)

This all worked fine for me but it might be worth adding a mechanism to detect if the program is going to try to access a path longer than 256 characters, and if so either just arbitrarily truncate the chapter titles and lecture titles if necessary, or give the user an option to select what to truncate and how much. Or even just print an error and quit rather than have the user receive lots of weird errors. For me, I figured the information in the long lecture titles was more useful so I opted to truncate the chapter titles. Although, I did add a txt file with the full chapter titles "just in case".

Just some thoughts I thought I'd share. Thanks again!

@Puyodead1 Puyodead1 changed the title Feature suggestion: Path length detection +chapter title or lecture title truncation if needed [Feature Request] Path length detection +chapter title or lecture title truncation if needed Sep 26, 2021
@Puyodead1 Puyodead1 added the enhancement New feature or request label Sep 26, 2021
@Leftifield
Copy link

nice thank you - I was having trouble as udemy-downloader-id-as-course-name which was released to address this issue was having a problem parsing something through to a library as INT and failed.

@Puyodead1
Copy link
Owner

First of all, thank you for this program. It works extremely well for backing up the Udemy courses I've purchased.

I ran into an issue with one of my courses that has very long chapter title and lecture titles which caused the path length to exceed the Windows 255 character limit. This caused lots of weird errors about "cannot write to file" or "file not found" during the download process.

Example (256 characters long): Z:\Udemy\out_dir\crash-course-electronics-and-pcb-design\08 - Graduating to Design Engineer_ CircuitMaker Fundamentals and Real-World Projects/004 CircuitMaker Fundamentals_ Magic Wand 555 Timer Design & Parts Selection Process.encrypted.m4a.part.frag.urls

I worked around the issue by putting the udemy-downloader folder in the root folder of my drive, renaming the udemy-downloader folder to just "Udemy", and finally I had to add a line to the main.py to truncate any chapter title greater than 51 characters:

for chapter in _udemy.get("chapters"):
        chapter_title = chapter.get("chapter_title")
        chapter_title = chapter_title[:51]                                           <<<
        chapter_index = chapter.get("chapter_index")
        chapter_dir = os.path.join(course_dir, chapter_title)
        if not os.path.exists(chapter_dir):
            os.mkdir(chapter_dir)

This all worked fine for me but it might be worth adding a mechanism to detect if the program is going to try to access a path longer than 256 characters, and if so either just arbitrarily truncate the chapter titles and lecture titles if necessary, or give the user an option to select what to truncate and how much. Or even just print an error and quit rather than have the user receive lots of weird errors. For me, I figured the information in the long lecture titles was more useful so I opted to truncate the chapter titles. Although, I did add a txt file with the full chapter titles "just in case".

Just some thoughts I thought I'd share. Thanks again!

Yikes, this got buried 👀

The path length issue has been a real pain in the ass, i have suggested to people that encounter this issue to move the tool as close to the root of the drive as possible, I even made a new branch id-as-course-name to help shorten the path which now that i think if it could be merged right into the main branch as an option. truncating is also a good idea, not sure why i didnt think of that.

@Puyodead1
Copy link
Owner

nice thank you - I was having trouble as udemy-downloader-id-as-course-name which was released to address this issue was having a problem parsing something through to a library as INT and failed.

what was the error?

@Leftifield
Copy link

Leftifield commented Dec 12, 2021

nice thank you - I was having trouble as udemy-downloader-id-as-course-name which was released to address this issue was having a problem parsing something through to a library as INT and failed.

what was the error?

I logged it as 81 with traceback added.
#81

Repository owner deleted a comment from sivaparvathigoli5 Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants