|
@@ -1,3 +1,6 @@
|
|
|
|
|
+import os
|
|
|
|
|
+import helper.console as console
|
|
|
|
|
+
|
|
|
class Settings:
|
|
class Settings:
|
|
|
# Directory to permanently save the file (ENV: MD_SAVEDIR)
|
|
# Directory to permanently save the file (ENV: MD_SAVEDIR)
|
|
|
SaveDir = None
|
|
SaveDir = None
|
|
@@ -6,7 +9,41 @@ class Settings:
|
|
|
tmpDir = '/tmp'
|
|
tmpDir = '/tmp'
|
|
|
|
|
|
|
|
# Minimal debug level (ENV: MD_LOGGING)
|
|
# Minimal debug level (ENV: MD_LOGGING)
|
|
|
- Debuglvl = None
|
|
|
|
|
|
|
+ Debuglvl = 0
|
|
|
|
|
|
|
|
# Minimal bitrate to auto download the file (ENV: MD_QUALITY)
|
|
# Minimal bitrate to auto download the file (ENV: MD_QUALITY)
|
|
|
MinQuality = 300
|
|
MinQuality = 300
|
|
|
|
|
+
|
|
|
|
|
+ #Format for downloaded file ID3 comment
|
|
|
|
|
+ CommentFormat = None
|
|
|
|
|
+
|
|
|
|
|
+ @staticmethod
|
|
|
|
|
+ def import_config(config):
|
|
|
|
|
+ namespace = 'music-downloader'
|
|
|
|
|
+ if namespace in config:
|
|
|
|
|
+ if 'saveDir' in config[namespace]:
|
|
|
|
|
+ Settings.SaveDir = config[namespace]['saveDir']
|
|
|
|
|
+ if 'tmpDir' in config[namespace]:
|
|
|
|
|
+ Settings.tmpDir = config[namespace]['tmpDir']
|
|
|
|
|
+ if 'debuglvl' in config[namespace]:
|
|
|
|
|
+ Settings.Debuglvl = config[namespace]['debuglvl']
|
|
|
|
|
+ if 'minQuality' in config[namespace]:
|
|
|
|
|
+ Settings.MinQuality = config[namespace]['minQuality']
|
|
|
|
|
+ if 'commentFormat' in config[namespace]:
|
|
|
|
|
+ Settings.CommentFormat = config[namespace]['commentFormat']
|
|
|
|
|
+
|
|
|
|
|
+ if os.getenv('MD_SAVEDIR') is not None:
|
|
|
|
|
+ console.output('Overrule MD_SAVEDIR', console.DBG_INFO)
|
|
|
|
|
+ Settings.SaveDir = os.getenv('MD_SAVEDIR')
|
|
|
|
|
+ if os.getenv('MD_TMP') is not None:
|
|
|
|
|
+ console.output('Overrule MD_TMP', console.DBG_INFO)
|
|
|
|
|
+ Settings.SaveDir = os.getenv('MD_TMP')
|
|
|
|
|
+ if os.getenv('MD_LOGGING') is not None:
|
|
|
|
|
+ console.output('Overrule MD_LOGGING', console.DBG_INFO)
|
|
|
|
|
+ Settings.SaveDir = os.getenv('MD_LOGGING')
|
|
|
|
|
+ if os.getenv('MD_QUALITY') is not None:
|
|
|
|
|
+ console.output('Overrule MD_QUALITY', console.DBG_INFO)
|
|
|
|
|
+ Settings.SaveDir = os.getenv('MD_QUALITY')
|
|
|
|
|
+
|
|
|
|
|
+ Settings.SaveDir = os.path.expanduser(Settings.SaveDir)
|
|
|
|
|
+ Settings.tmpDir = os.path.expanduser(Settings.tmpDir)
|