mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-12-08 20:39:08 +00:00
Run black formatter on the whole codebase (#460)
This commit is contained in:
@@ -11,7 +11,7 @@ logzero.setup_default_logger(formatter=_formatter, level=_log_level)
|
|||||||
# Options
|
# Options
|
||||||
# Initialize an empty object which can be assigned attributes
|
# Initialize an empty object which can be assigned attributes
|
||||||
# (useful when using spotdl as a library)
|
# (useful when using spotdl as a library)
|
||||||
args = type('', (), {})()
|
args = type("", (), {})()
|
||||||
|
|
||||||
# Apple has specific tags - see mutagen docs -
|
# Apple has specific tags - see mutagen docs -
|
||||||
# http://mutagen.readthedocs.io/en/latest/api/mp4.html
|
# http://mutagen.readthedocs.io/en/latest/api/mp4.html
|
||||||
|
|||||||
@@ -49,7 +49,9 @@ class Converter:
|
|||||||
# FFmpeg/avconv cannot have the same file for both input and output
|
# FFmpeg/avconv cannot have the same file for both input and output
|
||||||
# This would happen when the extensions are same, so rename
|
# This would happen when the extensions are same, so rename
|
||||||
# the input track to append ".temp"
|
# the input track to append ".temp"
|
||||||
log.debug('Input file and output file are going will be same during encoding, will append ".temp" to input file just before starting encoding to avoid conflict')
|
log.debug(
|
||||||
|
'Input file and output file are going will be same during encoding, will append ".temp" to input file just before starting encoding to avoid conflict'
|
||||||
|
)
|
||||||
input_song = output_song + ".temp"
|
input_song = output_song + ".temp"
|
||||||
rename_to_temp = True
|
rename_to_temp = True
|
||||||
delete_original = True
|
delete_original = True
|
||||||
|
|||||||
@@ -178,18 +178,21 @@ class TestFFmpeg:
|
|||||||
assert " ".join(command) == expect_command
|
assert " ".join(command) == expect_command
|
||||||
|
|
||||||
def test_correct_container_for_m4a(self, filename_fixture, monkeypatch):
|
def test_correct_container_for_m4a(self, filename_fixture, monkeypatch):
|
||||||
expect_command = "ffmpeg -y -hide_banner -nostats -v panic -i {0}.m4a.temp -acodec copy -b:a 192k -vn {0}.m4a".format(os.path.join(const.args.folder, filename_fixture))
|
expect_command = "ffmpeg -y -hide_banner -nostats -v panic -i {0}.m4a.temp -acodec copy -b:a 192k -vn {0}.m4a".format(
|
||||||
|
os.path.join(const.args.folder, filename_fixture)
|
||||||
|
)
|
||||||
_, command = convert.song(
|
_, command = convert.song(
|
||||||
filename_fixture + ".m4a", filename_fixture + ".m4a", const.args.folder
|
filename_fixture + ".m4a", filename_fixture + ".m4a", const.args.folder
|
||||||
)
|
)
|
||||||
assert ' '.join(command) == expect_command
|
assert " ".join(command) == expect_command
|
||||||
|
|
||||||
|
|
||||||
class TestAvconv:
|
class TestAvconv:
|
||||||
def test_convert_from_m4a_to_mp3(self, filename_fixture, monkeypatch):
|
def test_convert_from_m4a_to_mp3(self, filename_fixture, monkeypatch):
|
||||||
monkeypatch.setattr("os.remove", lambda x: None)
|
monkeypatch.setattr("os.remove", lambda x: None)
|
||||||
expect_command = "avconv -loglevel 0 -i {0}.m4a -ab 192k {0}.mp3 -y".format(
|
expect_command = "avconv -loglevel 0 -i {0}.m4a -ab 192k {0}.mp3 -y".format(
|
||||||
os.path.join(const.args.folder, filename_fixture))
|
os.path.join(const.args.folder, filename_fixture)
|
||||||
|
)
|
||||||
_, command = convert.song(
|
_, command = convert.song(
|
||||||
filename_fixture + ".m4a",
|
filename_fixture + ".m4a",
|
||||||
filename_fixture + ".mp3",
|
filename_fixture + ".mp3",
|
||||||
|
|||||||
Reference in New Issue
Block a user