Do not scrobble if duration is <30s
This commit is contained in:
parent
448aa47923
commit
1ed711fb85
@ -105,12 +105,14 @@ class LastfmFrontendProcess(BaseProcess):
|
|||||||
logger.error(u'Last.fm now playing error: %s', e)
|
logger.error(u'Last.fm now playing error: %s', e)
|
||||||
|
|
||||||
def scrobble(self, track):
|
def scrobble(self, track):
|
||||||
|
duration = track.length // 1000
|
||||||
artists = ', '.join([a.name for a in track.artists])
|
artists = ', '.join([a.name for a in track.artists])
|
||||||
|
if duration < 30:
|
||||||
|
logger.debug(u'Track too short to scrobble.')
|
||||||
|
return
|
||||||
logger.debug(u'Scrobbling track: %s - %s', artists, track.name)
|
logger.debug(u'Scrobbling track: %s - %s', artists, track.name)
|
||||||
# TODO Scrobble if >50% or >240s of a track has been played
|
# TODO Scrobble if >50% or >240s of a track has been played
|
||||||
# TODO Do not scrobble if duration <30s
|
|
||||||
# FIXME Get actual time when track started playing
|
# FIXME Get actual time when track started playing
|
||||||
duration = track.length // 1000
|
|
||||||
time_started = int(time.time()) - duration
|
time_started = int(time.time()) - duration
|
||||||
try:
|
try:
|
||||||
self.scrobbler.scrobble(
|
self.scrobbler.scrobble(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user