Custom YouTube search string (#261)

* Custom YouTube search string

* Fix sorting issues on < Python 3.6
This commit is contained in:
Ritiek Malhotra
2018-04-08 15:56:44 +05:30
committed by GitHub
parent 4d18224bb7
commit fc226442fe
7 changed files with 60 additions and 34 deletions

View File

@@ -66,7 +66,7 @@ def is_youtube(raw_song):
return status
def generate_songname(file_format, tags):
def format_string(string_format, tags):
""" Generate a string of the format '[artist] - [song]' for the given spotify song. """
format_tags = dict(formats)
format_tags[0] = tags['name']
@@ -83,13 +83,13 @@ def generate_songname(file_format, tags):
format_tags[11] = tags['external_ids']['isrc']
for x in formats:
file_format = file_format.replace('{' + formats[x] + '}',
string_format = string_format.replace('{' + formats[x] + '}',
str(format_tags[x]))
if const.args.no_spaces:
file_format = file_format.replace(' ', '_')
string_format = string_format.replace(' ', '_')
return file_format
return string_format
def sanitize_title(title):