lorenzodifuccia / safaribooks

Download and generate EPUB of your favorite books from O'Reilly Learning (aka Safari Books Online) library.
Do What The F*ck You Want To Public License
4.65k stars 691 forks source link

[Feature Request] Add an option to set folder to where media will be downloaded #297

Open mhogomchungu opened 3 years ago

mhogomchungu commented 3 years ago

Right now, destination path is hard coded to the folder where the executable is located and the option will make it possible for the executable in folder A and downloaded media to be in folder B.

The argument should be named "--destination".

johnlane commented 2 years ago

I was looking for this also.

Some background.... I have the script in a Docker container that I run from Gitlab CI. The Dockerfile installs it to /usr/bin so it's on the path and removes the need for a user and home directory. Because there is no option to set the download directory, the Dockerfile uses sed to modify the output location to /tmp (otherwise it'd try writing to /usr/bin), however it still creates Books/BookName - I would have preferred to be able to use the current directory (because Gitlab provides this when runing the container) and I would prefer if it did not add Books/BookName to the path. I've had to copy the files from /tmp/Books/BookName to the current directory in my CI Job.

So, my slant on this feature request would be to allow the destination to be where the data is written (not to the root of a "library"). Perhaps both are needed to satisfy more use-cases... What about...

The options would be mutually exclusive and the default behaviour if neither is given would to to work as it does now.

Also, while talking about options, a --no-create-epub option to skip creating the epub file after downloading would be nice (I commit the downloaded files to Git and have a separate job that creates a zip with a deterministic hash - but that's a whole other story!)