Jaffa / amazon-music

Provide programmatic access to Amazon Music/Prime Music's streaming service
Apache License 2.0
336 stars 67 forks source link

Windows has no HOME environment variable #10

Closed danieldaeschle closed 6 years ago

danieldaeschle commented 6 years ago

i would suggest to use a local file indead of home as fallback.

https://github.com/Jaffa/amazon-music/blob/ca0f6d6796e2fd7a17f271bcc6c13dee2aaf9155/amazonmusic.py#L68

would look like this:

local = os.path.dirname(os.path.realpath(__file__))
cookie_path = cookies or '{}/.amazonmusic-cookies.dat'.format(os.environ.get('HOME',  local))
Jaffa commented 6 years ago

That's a sensible ultimate fallback, but on non-Cygwin/non-WSL Windows, an intermediate would be LOCALAPPDATA, that seems to default to (on my machine):

LOCALAPPDATA=C:\Users\andrew\AppData\Local
danieldaeschle commented 6 years ago

Yes, but the code at the moment causes a crash which should be fixed.

Jaffa commented 6 years ago

Yep.