Fix errors introduced with previous code cleanup

This commit is contained in:
Linus
2017-06-28 16:21:24 +02:00
parent 0f384bb5ee
commit e20be5d97e
2 changed files with 3 additions and 3 deletions

View File

@@ -77,7 +77,7 @@ def convert_with_ffmpeg(input_song, output_song, verbose):
elif output_ext == 'm4a': elif output_ext == 'm4a':
ffmpeg_params = '-cutoff 20000 -c:a libfdk_aac -b:a 192k -vn ' ffmpeg_params = '-cutoff 20000 -c:a libfdk_aac -b:a 192k -vn '
command = '{0}-i Music/{1} {2}Music/{4}'.format( command = '{0}-i Music/{1} {2}Music/{3}'.format(
ffmpeg_pre, input_song, ffmpeg_params, output_song).split(' ') ffmpeg_pre, input_song, ffmpeg_params, output_song).split(' ')
return subprocess.call(command) return subprocess.call(command)

View File

@@ -75,7 +75,7 @@ def generate_youtube_url(raw_song):
# fetch all video links on first page on YouTube # fetch all video links on first page on YouTube
for x in items_parse.find_all('h3', {'class': 'yt-lockup-title'}): for x in items_parse.find_all('h3', {'class': 'yt-lockup-title'}):
# confirm the video result is not an advertisement # confirm the video result is not an advertisement
if not x.find('channel') == -1 or not x.find('googleads') == -1: if x.find('channel') > -1 or x.find('googleads') > -1:
print('{0}. {1}'.format(check, x.get_text())) print('{0}. {1}'.format(check, x.get_text()))
links.append(x.find('a')['href']) links.append(x.find('a')['href'])
check += 1 check += 1
@@ -91,7 +91,7 @@ def generate_youtube_url(raw_song):
# confirm the video result is not an advertisement # confirm the video result is not an advertisement
# otherwise keep iterating until it is not # otherwise keep iterating until it is not
while result.find('channel') < 0 or result.find('googleads') < 0: while result.find('channel') > -1 or result.find('googleads') > -1:
result = items_parse.find_all( result = items_parse.find_all(
attrs={'class': 'yt-uix-tile-link'})[check]['href'] attrs={'class': 'yt-uix-tile-link'})[check]['href']
check += 1 check += 1