Feed arguments in libary usage mode

This commit is contained in:
Ritiek Malhotra
2020-05-15 00:32:54 +05:30
parent f40f69fdc5
commit e71989a963
6 changed files with 110 additions and 125 deletions

View File

@@ -32,20 +32,8 @@ logger = logging.getLogger(__name__)
class Spotdl:
def __init__(self, arguments):
if "config" in arguments:
# Make sure we set the base configuration from the config file if
# the config file has been passed.
config = spotdl.util.merge(
spotdl.config.DEFAULT_CONFIGURATION["spotify-downloader"],
spotdl.config.get_config(arguments["config"])
)
else:
# If config file has not been passed, set the base configuration
# to the default confguration.
config = spotdl.config.DEFAULT_CONFIGURATION["spotify-downloader"]
self.arguments = spotdl.util.merge(config, arguments)
def __init__(self, argument_handler):
self.arguments = argument_handler.run_errands()
def __enter__(self):
return self
@@ -255,6 +243,8 @@ class Spotdl:
))
os.rename(temp_filename, filename)
return filename
def apply_metadata(self, track, filename, encoding):
logger.info("Applying metadata")
try: