mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-12-08 20:39:08 +00:00
Save file names using a custom format specifiers (#205)
* Use custom formats to generate file name * Do not mess up search term * Fix tests * Fix conflicting names * Fix subprocess call on file paths with spaces * Create directories and keep spaces as defaults * Fix config merge * Remove underscores from default file format * Remove debug info * Show possible formats in usage help
This commit is contained in:
@@ -69,7 +69,8 @@ def generate_youtube_url(raw_song, meta_tags, tries_remaining=5):
|
||||
song = raw_song
|
||||
query['q'] = song
|
||||
else:
|
||||
song = internals.generate_songname(meta_tags)
|
||||
song = '{0} - {1}'.format(meta_tags['artists'][0]['name'],
|
||||
meta_tags['name'])
|
||||
query['q'] = song
|
||||
log.debug('query: {0}'.format(query))
|
||||
|
||||
@@ -123,7 +124,7 @@ def generate_youtube_url(raw_song, meta_tags, tries_remaining=5):
|
||||
the duration_tolerance has reached the max_duration_tolerance
|
||||
'''
|
||||
while len(possible_videos_by_duration) == 0:
|
||||
possible_videos_by_duration = list(filter(lambda x: abs(x['seconds'] - (int(meta_tags['duration_ms'])/1000)) <= duration_tolerance, videos))
|
||||
possible_videos_by_duration = list(filter(lambda x: abs(x['seconds'] - meta_tags['duration']) <= duration_tolerance, videos))
|
||||
duration_tolerance += 1
|
||||
if duration_tolerance > max_duration_tolerance:
|
||||
log.error("{0} by {1} was not found.\n".format(meta_tags['name'], meta_tags['artists'][0]['name']))
|
||||
|
||||
Reference in New Issue
Block a user