diff --git a/vrobbler/apps/scrobbles/importers/lastfm.py b/vrobbler/apps/scrobbles/importers/lastfm.py index f74e398..23a8d36 100644 --- a/vrobbler/apps/scrobbles/importers/lastfm.py +++ b/vrobbler/apps/scrobbles/importers/lastfm.py @@ -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)