[music] Fix timezones on lastfm imports
This commit is contained in:
@ -50,20 +50,22 @@ class LastFM:
|
||||
enrich=True,
|
||||
)
|
||||
|
||||
timezone = settings.TIME_ZONE
|
||||
if self.vrobbler_user.profile:
|
||||
timezone = self.vrobbler_user.profile.timezone
|
||||
|
||||
timestamp = lfm_scrobble.get("timestamp")
|
||||
timestamp = self.vrobbler_user.profile.get_timestamp_with_tz(
|
||||
lfm_scrobble.get("timestamp")
|
||||
)
|
||||
stop_timestamp = timestamp + timedelta(
|
||||
seconds=track.run_time_seconds
|
||||
)
|
||||
new_scrobble = Scrobble(
|
||||
user=self.vrobbler_user,
|
||||
timestamp=timestamp,
|
||||
stop_timestamp=stop_timestamp,
|
||||
source=source,
|
||||
track=track,
|
||||
timezone=timezone,
|
||||
played_to_completion=True,
|
||||
in_progress=False,
|
||||
media_type=Scrobble.MediaType.TRACK,
|
||||
timezone=timestamp.tzinfo.name,
|
||||
)
|
||||
# Vrobbler scrobbles on finish, LastFM scrobbles on start
|
||||
seconds_eariler = timestamp - timedelta(seconds=20)
|
||||
|
||||
Reference in New Issue
Block a user