Fix not properly sending playback ticks
This commit is contained in:
@ -33,6 +33,7 @@ class WebhooksFrontend(pykka.ThreadingActor, CoreListener):
|
|||||||
album_name = ""
|
album_name = ""
|
||||||
if track.album:
|
if track.album:
|
||||||
album_name = getattr(track.album, "name")
|
album_name = getattr(track.album, "name")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"name": track.name,
|
"name": track.name,
|
||||||
"artist": artists,
|
"artist": artists,
|
||||||
@ -71,7 +72,7 @@ class WebhooksFrontend(pykka.ThreadingActor, CoreListener):
|
|||||||
artists = ", ".join(sorted([a.name for a in track.artists]))
|
artists = ", ".join(sorted([a.name for a in track.artists]))
|
||||||
self.last_start_time = int(time.time())
|
self.last_start_time = int(time.time())
|
||||||
logger.debug(f"Now playing track: {artists} - {track.name}")
|
logger.debug(f"Now playing track: {artists} - {track.name}")
|
||||||
post_data = self._build_post_data(tl_track.track)
|
post_data = self._build_post_data(tl_track.track, time_position=0)
|
||||||
|
|
||||||
# Build post data to send to urls
|
# Build post data to send to urls
|
||||||
if not self.webhook_urls:
|
if not self.webhook_urls:
|
||||||
@ -84,11 +85,11 @@ class WebhooksFrontend(pykka.ThreadingActor, CoreListener):
|
|||||||
track = tl_track.track
|
track = tl_track.track
|
||||||
artists = ", ".join(sorted([a.name for a in track.artists]))
|
artists = ", ".join(sorted([a.name for a in track.artists]))
|
||||||
duration = track.length and track.length // 1000 or 0
|
duration = track.length and track.length // 1000 or 0
|
||||||
time_position = time_position // 1000
|
time_position_sec = time_position // 1000
|
||||||
|
|
||||||
post_data = self._build_post_data(tl_track.track, time_position=time_position)
|
post_data = self._build_post_data(tl_track.track, time_position=time_position)
|
||||||
|
|
||||||
if time_position < duration // 2 and time_position < 240:
|
if time_position_sec < duration // 2 and time_position_sec < 240:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Track not played long enough to scrobble. (50% or 240s)"
|
"Track not played long enough to scrobble. (50% or 240s)"
|
||||||
)
|
)
|
||||||
@ -106,11 +107,11 @@ class WebhooksFrontend(pykka.ThreadingActor, CoreListener):
|
|||||||
track = tl_track.track
|
track = tl_track.track
|
||||||
artists = ", ".join(sorted([a.name for a in track.artists]))
|
artists = ", ".join(sorted([a.name for a in track.artists]))
|
||||||
duration = track.length and track.length // 1000 or 0
|
duration = track.length and track.length // 1000 or 0
|
||||||
time_position = time_position // 1000
|
time_position_sec = time_position // 1000
|
||||||
|
|
||||||
post_data = self._build_post_data(tl_track.track, time_position=time_position)
|
post_data = self._build_post_data(tl_track.track, time_position=time_position)
|
||||||
|
|
||||||
if time_position < duration // 2 and time_position < 240:
|
if time_position_sec < duration // 2 and time_position_sec < 240:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Track not played long enough to scrobble. (50% or 240s)"
|
"Track not played long enough to scrobble. (50% or 240s)"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user