Add --overwrite option (#182)

* Add overwrite option

* Fix tests

* address changes requested
This commit is contained in:
Victor Yap
2017-12-31 01:13:34 -06:00
committed by Ritiek Malhotra
parent 64548b6894
commit 01bb783724
5 changed files with 23 additions and 17 deletions

View File

@@ -13,6 +13,7 @@ class TestArgs:
output_ext = '.mp3'
folder = 'test'
log_level = logger.logging.DEBUG
overwrite = 'skip'
test_args = TestArgs()
setattr(spotdl, "args", test_args)
@@ -39,7 +40,7 @@ def test_check_exists():
expect_check = False
# prerequisites for determining filename
file_name = spotdl.internals.sanitize_title(title)
check = spotdl.check_exists(file_name, raw_song, meta_tags=None, islist=True)
check = spotdl.check_exists(file_name, raw_song, meta_tags=None)
assert check == expect_check
@@ -79,6 +80,6 @@ def test_check_exists2():
# prerequisites for determining filename
file_name = spotdl.internals.sanitize_title(title)
os.remove(os.path.join(spotdl.args.folder, input_song))
check = spotdl.check_exists(file_name, raw_song, meta_tags=None, islist=True)
check = spotdl.check_exists(file_name, raw_song, meta_tags=None)
os.remove(os.path.join(spotdl.args.folder, output_song))
assert check == expect_check

View File

@@ -13,6 +13,7 @@ class TestArgs:
output_ext = '.mp3'
folder = 'test'
log_level = 'DEBUG'
overwrite = 'skip'
test_args = TestArgs()
setattr(spotdl, "args", test_args)
@@ -49,7 +50,7 @@ def test_check_exists():
songname = spotdl.generate_songname(meta_tags)
global file_name
file_name = spotdl.internals.sanitize_title(songname)
check = spotdl.check_exists(file_name, raw_song, meta_tags, islist=True)
check = spotdl.check_exists(file_name, raw_song, meta_tags)
assert check == expect_check
@@ -85,6 +86,6 @@ def test_check_exists2():
expect_check = True
# prerequisites for determining filename
os.remove(os.path.join(spotdl.args.folder, input_song))
check = spotdl.check_exists(file_name, raw_song, meta_tags, islist=True)
check = spotdl.check_exists(file_name, raw_song, meta_tags)
os.remove(os.path.join(spotdl.args.folder, output_song))
assert check == expect_check