diff --git a/.gitignore b/.gitignore index 6345828..d84fce7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -'Qobuz Downloads' +Qobuz Downloads *__pycache* +.env \ No newline at end of file diff --git a/README.md b/README.md index 0ddce15..ddfe786 100644 --- a/README.md +++ b/README.md @@ -27,11 +27,21 @@ pip3 install -r requirements.txt --user pip3 install windows-curses pip3 install -r requirements.txt ``` -#### Add your credentials to `config.py` -```python -email = "your@email.com" -password = "your_password" +#### Add your credentials to a `.env` file +```none +QOBUZ_EMAIL=your@email.com +QOBUZ_PW=your_password ``` + +NB: The .env file should be in the root folder, where main.py and config.py are located. + +In addition to your credentials, you can also use the `.env` file to +change other default values by means of the following environment variables: + + - `QOBUZ_FOLDER` (location of the download folder) + - `QOBUZ_LIMIT` (results limit) + - `QOBUZ_QUALITY` (default quality for url input mode) + #### Run qobuz-dl ##### Linux / MAC OS ``` diff --git a/config.py b/config.py index 24a7e47..02cfed8 100644 --- a/config.py +++ b/config.py @@ -1,13 +1,16 @@ +import os +from dotenv import load_dotenv +load_dotenv() # Qobuz credentials (Don't remove the quotes!) -email = "your@email.com" -password = "your_password" +email = os.getenv('QOBUZ_EMAIL') +password = os.getenv('QOBUZ_PW') # Default folder where the releases are downloaded -default_folder = "Qobuz Downloads" +default_folder = os.getenv('QOBUZ_FOLDER', "Qobuz Downloads") # Default per type results limit -default_limit = 10 +default_limit = os.getenv('QOBUZ_LIMIT', 10) # Default quality for url input mode. This will be ignored in interactive mode # (5, 6, 7, 27) [320, LOSSLESS, 24B <96KHZ, 24B >96KHZ] -default_quality = 6 +default_quality = os.getenv('QOBUZ_QUALITY', 6) diff --git a/requirements.txt b/requirements.txt index 2b93501..53bb471 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,4 @@ requests==2.24.0 mutagen==1.45.1 tqdm==4.48.2 pick==0.6.7 +python-dotenv==0.15.0