mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-22 08:53:59 +01:00
Merge pull request #1783 from multikatt/lyrics
Actually check if lyrics are found
This commit is contained in:
@@ -848,11 +848,11 @@ def embedLyrics(downloaded_track_list):
|
|||||||
# TODO: If adding lyrics for flac & lossy, only fetch the lyrics once
|
# TODO: If adding lyrics for flac & lossy, only fetch the lyrics once
|
||||||
# and apply it to both files
|
# and apply it to both files
|
||||||
for downloaded_track in downloaded_track_list:
|
for downloaded_track in downloaded_track_list:
|
||||||
|
track_title = downloaded_track.decode(headphones.SYS_ENCODING, 'replace')
|
||||||
try:
|
try:
|
||||||
f = MediaFile(downloaded_track)
|
f = MediaFile(downloaded_track)
|
||||||
except:
|
except:
|
||||||
logger.error('Could not read %s. Not checking lyrics', downloaded_track.decode(headphones.SYS_ENCODING, 'replace'))
|
logger.error('Could not read %s. Not checking lyrics', track_title)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if f.albumartist and f.title:
|
if f.albumartist and f.title:
|
||||||
@@ -860,17 +860,20 @@ def embedLyrics(downloaded_track_list):
|
|||||||
elif f.artist and f.title:
|
elif f.artist and f.title:
|
||||||
metalyrics = lyrics.getLyrics(f.artist, f.title)
|
metalyrics = lyrics.getLyrics(f.artist, f.title)
|
||||||
else:
|
else:
|
||||||
logger.info('No artist/track metadata found for track: %s. Not fetching lyrics', downloaded_track.decode(headphones.SYS_ENCODING, 'replace'))
|
logger.info('No artist/track metadata found for track: %s. Not fetching lyrics', track_title)
|
||||||
metalyrics = None
|
metalyrics = None
|
||||||
|
|
||||||
if lyrics:
|
if metalyrics:
|
||||||
logger.debug('Adding lyrics to: %s', downloaded_track.decode(headphones.SYS_ENCODING, 'replace'))
|
logger.debug('Adding lyrics to: %s', track_title)
|
||||||
f.lyrics = metalyrics
|
f.lyrics = metalyrics
|
||||||
try:
|
try:
|
||||||
f.save()
|
f.save()
|
||||||
except:
|
except:
|
||||||
logger.error('Cannot save lyrics to: %s. Skipping', downloaded_track.decode(headphones.SYS_ENCODING, 'replace'))
|
logger.error('Cannot save lyrics to: %s. Skipping', track_title)
|
||||||
continue
|
continue
|
||||||
|
else:
|
||||||
|
logger.debug('No lyrics found for track: %s', track_title)
|
||||||
|
|
||||||
|
|
||||||
def renameFiles(albumpath, downloaded_track_list, release):
|
def renameFiles(albumpath, downloaded_track_list, release):
|
||||||
logger.info('Renaming files')
|
logger.info('Renaming files')
|
||||||
|
|||||||
Reference in New Issue
Block a user