mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-12-08 20:39:08 +00:00
Increase coverage (#218)
* Monkeypatch fetch user and use pytest.tempdir * Cover spotify_tools.grab_album() * Cover avconv conversion * Cover grab_single() * Reduce code repetition * Move grab_playlist() to spotify_tools.py * Move Spotify specific functions to spotify_tools.py * Refactoring * Return track list from write_tracks() * Fix tests * Cover more cases in generate_youtube_url() * Test for unavailable audio streams * Test for filename without spaces * handle.py 100% coverage * Improve config tests * Speed up tests * Install avconv and libfdk-aac * Some cleaning * FFmpeg with libfdk-aac, libopus * Some refactoring * Convert tmpdir to string * Cover YouTube title when downloading from list * Explicitly cover some internals.py functions
This commit is contained in:
@@ -48,6 +48,7 @@ def trim_song(text_file):
|
||||
data = file_in.read().splitlines(True)
|
||||
with open(text_file, 'w') as file_out:
|
||||
file_out.writelines(data[1:])
|
||||
return data[0]
|
||||
|
||||
|
||||
def is_spotify(raw_song):
|
||||
@@ -117,3 +118,13 @@ def videotime_from_seconds(time):
|
||||
return '{0}:{1:02}'.format(time//60, time % 60)
|
||||
|
||||
return '{0}:{1:02}:{2:02}'.format((time//60)//60, (time//60) % 60, time % 60)
|
||||
|
||||
|
||||
def get_splits(url):
|
||||
if '/' in url:
|
||||
if url.endswith('/'):
|
||||
url = url[:-1]
|
||||
splits = url.split('/')
|
||||
else:
|
||||
splits = url.split(':')
|
||||
return splits
|
||||
Reference in New Issue
Block a user