mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 18:00:15 +00:00
Use appdirs to figure out user config directory
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import appdirs
|
||||||
from core import internals, const
|
from core import internals, const
|
||||||
|
|
||||||
log = const.log
|
log = const.log
|
||||||
@@ -79,7 +80,9 @@ def get_arguments(raw_args=None, to_group=True, to_merge=True):
|
|||||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||||
|
|
||||||
if to_merge:
|
if to_merge:
|
||||||
config_file = os.path.join(sys.path[0], 'config.yml')
|
config_dir = os.path.join(appdirs.user_config_dir(), 'spotdl')
|
||||||
|
os.makedirs(config_dir, exist_ok=True)
|
||||||
|
config_file = os.path.join(config_dir, 'config.yml')
|
||||||
config = merge(default_conf['spotify-downloader'], get_config(config_file))
|
config = merge(default_conf['spotify-downloader'], get_config(config_file))
|
||||||
else:
|
else:
|
||||||
config = default_conf['spotify-downloader']
|
config = default_conf['spotify-downloader']
|
||||||
@@ -175,8 +178,7 @@ def get_arguments(raw_args=None, to_group=True, to_merge=True):
|
|||||||
help=argparse.SUPPRESS)
|
help=argparse.SUPPRESS)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-c', '--config', default=None,
|
'-c', '--config', default=None,
|
||||||
help='path to config.yml file (otherwise load it from same '
|
help='path to custom config.yml file')
|
||||||
'directory as spotdl.py)')
|
|
||||||
|
|
||||||
parsed = parser.parse_args(raw_args)
|
parsed = parser.parse_args(raw_args)
|
||||||
|
|
||||||
|
|||||||
@@ -9,3 +9,4 @@ titlecase >= 0.10.0
|
|||||||
logzero >= 1.3.1
|
logzero >= 1.3.1
|
||||||
lyricwikia >= 0.1.8
|
lyricwikia >= 0.1.8
|
||||||
PyYAML >= 3.12
|
PyYAML >= 3.12
|
||||||
|
appdirs >= 1.4.3
|
||||||
|
|||||||
3
setup.py
3
setup.py
@@ -35,7 +35,8 @@ setup(
|
|||||||
'titlecase >= 0.10.0',
|
'titlecase >= 0.10.0',
|
||||||
'logzero >= 1.3.1',
|
'logzero >= 1.3.1',
|
||||||
'lyricwikia >= 0.1.8',
|
'lyricwikia >= 0.1.8',
|
||||||
'PyYAML >= 3.12'
|
'PyYAML >= 3.12',
|
||||||
|
'appdirs >= 1.4.3'
|
||||||
],
|
],
|
||||||
description='Download songs from YouTube using Spotify song URLs or playlists with albumart and meta-tags.',
|
description='Download songs from YouTube using Spotify song URLs or playlists with albumart and meta-tags.',
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
|
|||||||
Reference in New Issue
Block a user