mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 18:00:15 +00:00
Add conversion test
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
def song(input_song, output_song, avconv, verbose):
|
||||
def song(input_song, output_song, avconv=False, verbose=False):
|
||||
if not input_song == output_song:
|
||||
input_song = input_song.encode('utf-8')
|
||||
output_song = output_song.encode('utf-8')
|
||||
@@ -11,7 +11,8 @@ def song(input_song, output_song, avconv, verbose):
|
||||
else:
|
||||
convert_with_FFmpeg(input_song, output_song, verbose)
|
||||
os.remove('Music/' + input_song)
|
||||
return True
|
||||
return True
|
||||
return False
|
||||
|
||||
def convert_with_avconv(input_song, output_song, verbose):
|
||||
# different path for windows
|
||||
|
||||
@@ -33,3 +33,13 @@ def test_download():
|
||||
content = spotdl.go_pafy(raw_song)
|
||||
download = spotdl.download_song(content)
|
||||
assert download == expect_download
|
||||
|
||||
def test_convert():
|
||||
expect_convert = True
|
||||
content = spotdl.go_pafy(raw_song)
|
||||
music_file = spotdl.misc.generate_filename(content.title)
|
||||
music_file = spotdl.misc.fix_decoding(music_file)
|
||||
input_song = music_file + spotdl.args.input_ext
|
||||
output_song = music_file + spotdl.args.output_ext
|
||||
convert = spotdl.convert.song(input_song, output_song)
|
||||
assert convert == expect_convert
|
||||
|
||||
Reference in New Issue
Block a user