FoxxMD / multi-scrobbler

Scrobble plays from multiple sources to multiple clients
https://foxxmd.github.io/multi-scrobbler
MIT License
422 stars 17 forks source link

Environment variable or config setting to set Time Zone? #43

Closed lylebrown closed 2 years ago

lylebrown commented 2 years ago

I'm wondering if there's a way to set the time zone of scrobbles before sending them over to Maloja. (If this is actually something that needs to be adjusted in Maloja, let me know.)

In my personal use case, I would just need the ability to set the time zone system-wide, but I would imagine others may want to adjust it per client in a multi-user scenario, so it may be worth building it into the config file structure instead of system-wide.

FoxxMD commented 2 years ago

MS determines the time for a scrobble by following these rules in order:

1. Time from Source

If the Source data contains a "played at" datetime then this is used. Sources like Spotify, Last.fm, and Deezer always include this data and AFAIK use either unix epoch or datetime with timezone included so an accurate timestamp is preserved.

2. Time of Ingestion

If the Source data does not contain a "played at" datetime (like plex/subsonic) then MS assumes the play time is when it received the play data.

Both Last.fm and Maloja accept unix epoch timestamps as scrobble timestamp which means the time information they receive for a scrobble is timezone agnostic.

So far MS does not support any sources that return historical plays that do not include timezone-aware information so implementing per client TZ info isn't necessary at this point. If that does happen in the future I'd support the needed TZ info.


The timestamps displayed in the MS web dashboard are based on system timezone. You can optionally configure this for the docker container by passing a tz database name as the environmental variable TZ. Otherwise UTC is used. EX

// configure MS to use EST as timezone
docker run -e "TZ=America/New_York" ... foxxmd/multi-scrobbler
lylebrown commented 2 years ago

Thank you for this information! I added the timezone environment variable and am seeing that reflected in the dashboard.

For Maloja, I needed to adjust the "UTC Offset" setting and restart the service. Hopefully this information helps someone else in the future.