borg1622/packtpub-mass-downloader

Exit when invalid filenames created when book title contains invalid windows file characters.

Opened this issue · 3 comments

Hi, nice script.
I made a small change to it that might help others.
In the downloadBook function I add this line:
filename.replace( /[<>:"\/\\|?*]+/g, '-' );
in order to get rid of some characters that make the script exit when it tries to save a file with an invalid filename.

thanks for your contribution. :-)
Please let me know if you encounter any further issues.

Sure thing... already updated to 1.2, looked at the code and testing now.
If anything pops up I'll let you know.

PS: An idea for an improvement for non tech savvy users would be to add a percentage indicator to the [downloading] label something like [downloading 17%]... maybe count the number of books and recalculate when the script moves on to the next book, or count the number of downloads and increment when it moves to download the next file.
(I just use the JS Console in Firefox to know how the download is going, but other might not be comfortable with that or now know about it.) Do you mind if I start a pull request and implement this? I might have a little time to do this either this weekend or next.

I'd appreciate it if you implement a status bar - I've copied that idea into a new issue #2.
Feel free to start a pull request. :-)