Closed aeunson closed 10 years ago
Look at the -mppl
argument.
it appears that the -mppl feature doesn't work
referencing the code below if a MPPL is specified, it gets overwritten on windows.
I tried -mppl 40 to keep a course running to long and it gets ignored.
for windows, logic should check to see if a value is specified in args, if not default to 90 if a value is specfied in windows, used the value specified in args
#should we be trimming paths?
# TODO: this is a simple hack, something more elaborate needed
mppl = None
if args.mppl:
if platform.system() == "Windows":
mppl = 90
print_("Maximum length of a path component set to %s" % mppl)
else:
# linux max path length is typically around 4060 so assume thats ok
pass
maybe something like this?
# should we be trimming paths?
# TODO: this is a simple hack, something more elaborate needed
mppl = None
if args.mppl:
if platform.system() == "Windows":
if args.mppl > 0 :
mppl = args.mppl
else:
mppl = 90
print_("Maximum length of a path component set to %s" % mppl)
else:
# linux max path length is typically around 4060 so assume thats ok
pass
Yeah, I think so. The original code didn't handle the user defined length under windows.
发自我的 iPhone
在 2013年11月24日,12:47,aeunson notifications@github.com 写道:
maybe something like this?
should we be trimming paths?
TODO: this is a simple hack, something more elaborate needed
mppl = None if args.mppl: if platform.system() == "Windows": if args.mppl > 0 : mppl = args.mppl else: mppl = 90 print_("Maximum length of a path component set to %s" % mppl) else:
linux max path length is typically around 4060 so assume thats ok
pass
— Reply to this email directly or view it on GitHub.
this feels like it might be what's intended
a. always use the MPPL value if its supplied by the user b. only set a default if on windows and mppl isn't provided
# should we be trimming paths?
mppl = None
if args.mppl:
if args.mppl > 0 :
mppl = args.mppl
elif platform.system() == "Windows":
mppl = 90
print_("Maximum length of a path component set to %s" % mppl)
Im a bit all over the place at the moment so cant look at it in depth right now. Will do so asap. However, if you submit a pull request I will merge.
On Sun, Nov 24, 2013 at 1:05 PM, aeunson notifications@github.com wrote:
this feels like it might be what's intended
- if MPPL is set, use it (regardless of platform)
- if MMPL is not set, and the user is on windows, default to 90
- if MMPL is not set, and the user is not on windows, leave MPPL null as there are checks to ignore MMPL if its not set elsewhere
should we be trimming paths?
mppl = None if args.mppl:
if args.mppl > 0 : mppl = args.mppl else if platform.system() == "Windows": mppl = 90
print_("Maximum length of a path component set to %s" % mppl)
—
Reply to this email directly or view it on GitHubhttps://github.com/dgorissen/coursera-dl/issues/112#issuecomment-29154936 .
it appears the script is having trouble with the ... in the trim_path_part function where ... is appended to the end of the truncated name.
I played with a bunch of stuff including truncating the week name and file name but used __ (2 underscores) and that appears to be working.
i think i have to find a way to preserve the file extension when doing a rename as things renamed come through as "file"
Quick fix per your previous comment. Reopen if other issues remain.
In windows the max path allowed is 260 characters.
Truncate or abbreviate files to stay within the limit.
thank you