iheanyi / bandcamp-dl

Simple python script to download Bandcamp albums

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Default download directory woes

Evolution0 opened this issue · comments

Is your feature request related to a problem? Please describe.
os.getcwd() as default for the location to store albums is pretty bad, this usually leads to users downloading albums into their system32 folder (Yikes)

Describe the solution you'd like
Default to the user directory as was originally intended when this issue first came up. Via os.path.expanduser('~')

Describe alternatives you've considered
The Music directory, though that isn't cross-platform safe, it could be if I create the directory on run if its missing.

If anyone come up with better ideas and/or can possibly post the general directory layout on Mac I'm all ears, because if a music folder of some sort exists on Mac as well I would rather just use that across systems and create it for unix/linux if missing.

For now this change has been made in 0.0.11, as for creating the Music directory.. I had some misgivings about doing so. On Windows/Mac it exists by default in the same exact place (~/Music) but on unix/linux its hit or miss, many user friendly distros do indeed include some default directories (Ubuntu) while others it could be in any number of places and use XDG_MUSIC_DIR to set its location or simply not exist.

So this will have to do for the moment, I have tested it and at least it keeps files contained to the User/Home directory rather than dumping everything in whatever the working folder is when run.

This behavior is surprising. I don't understand why the working directory would be an issue for a command line tool. Anyway, bandcamp-dl should at least tell where the files were created. It is not told in the README, or in the help message, or the command output.

This behavior is surprising. I don't understand why the working directory would be an issue for a command line tool. Anyway, bandcamp-dl should at least tell where the files were created. It is not told in the README, or in the help message, or the command output.

It shouldn't have been considering most people familiar with command line tools know that whatever directory you are in is your working directory; thing is though many people use bandcamp-dl that aren't very familiar with working from the command line so they crack open CMD (Or their terminal of choice) and don't bother to CD to a different dir.

Its not an issue anymore as the base dir is set to ~ now and if a user is specifying their own with the arg then its moot.

README is getting a rewrite in 0.0.13 and will mention that the default directory is the User/Home directory.

--base-dir should be pwd

🪙

--base-dir should be pwd

🪙

https://docs.python.org/3/library/os.path.html#os.path.expanduser

Its was changed to os.path.expanduser('~') shortly before I closed this which is much better:

On Unix and Windows, return the argument with an initial component of ~ or ~user replaced by that user’s home directory.

On Unix, an initial ~ is replaced by the environment variable HOME if it is set; otherwise the current user’s home directory is looked up in the password directory through the built-in module pwd. An initial ~user is looked up directly in the password directory.

On Windows, USERPROFILE will be used if set, otherwise a combination of HOMEPATH and HOMEDRIVE will be used. An initial ~user is handled by checking that the last directory component of the current user’s home directory matches USERNAME, and replacing it if so.