catch no object response on count (for obscure items?)
This commit is contained in:
parent
94075b14a8
commit
b35b4c2b8c
@ -100,7 +100,11 @@ class Counter:
|
|||||||
fmtrack = self.fmnet.get_track(name=track.name,
|
fmtrack = self.fmnet.get_track(name=track.name,
|
||||||
artist=track.artists[0].name,
|
artist=track.artists[0].name,
|
||||||
username=username or self.fmnet.username)
|
username=username or self.fmnet.username)
|
||||||
|
if fmtrack is not None:
|
||||||
return fmtrack.user_scrobbles
|
return fmtrack.user_scrobbles
|
||||||
|
else:
|
||||||
|
logger.error(f'no track returned for {track}')
|
||||||
|
return 0
|
||||||
except LastFMNetworkException as e:
|
except LastFMNetworkException as e:
|
||||||
logger.error(f'error occured during track retrieval - {e}')
|
logger.error(f'error occured during track retrieval - {e}')
|
||||||
return 0
|
return 0
|
||||||
@ -123,7 +127,11 @@ class Counter:
|
|||||||
fmalbum = self.fmnet.get_album(name=album.name,
|
fmalbum = self.fmnet.get_album(name=album.name,
|
||||||
artist=album.artists[0].name,
|
artist=album.artists[0].name,
|
||||||
username=username or self.fmnet.username)
|
username=username or self.fmnet.username)
|
||||||
|
if fmalbum is not None:
|
||||||
return fmalbum.user_scrobbles
|
return fmalbum.user_scrobbles
|
||||||
|
else:
|
||||||
|
logger.error(f'no track returned for {album}')
|
||||||
|
return 0
|
||||||
except LastFMNetworkException as e:
|
except LastFMNetworkException as e:
|
||||||
logger.error(f'error occured during album retrieval - {e}')
|
logger.error(f'error occured during album retrieval - {e}')
|
||||||
return 0
|
return 0
|
||||||
@ -144,7 +152,11 @@ class Counter:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
fmartist = self.fmnet.get_artist(name=artist.name, username=username or self.fmnet.username)
|
fmartist = self.fmnet.get_artist(name=artist.name, username=username or self.fmnet.username)
|
||||||
|
if fmartist is not None:
|
||||||
return fmartist.user_scrobbles
|
return fmartist.user_scrobbles
|
||||||
|
else:
|
||||||
|
logger.error(f'no track returned for {artist}')
|
||||||
|
return 0
|
||||||
except LastFMNetworkException as e:
|
except LastFMNetworkException as e:
|
||||||
logger.error(f'error occured during artist retrieval - {e}')
|
logger.error(f'error occured during artist retrieval - {e}')
|
||||||
return 0
|
return 0
|
||||||
|
Loading…
Reference in New Issue
Block a user