Skip to content

Explo will fail to get the exploration playlist if ListenBrainz timezone is ahead of UTC #18

Closed
@firewalkwithm3

Description

@firewalkwithm3

I have set my timezone to UTC+8 at https://listenbrainz.org/settings/select_timezone
Therefore, ListenBrainz generates my exploration playlist every Monday at 00:00 UTC+8.

However, the API returns the playlist's created time in UTC+0 meaning Explo thinks the playlist was created on Sunday and therefore will never return any playlist.

I made the following change and it works correctly for my case at least:

diff --git a/src/listenbrainz.go b/src/listenbrainz.go
index c4dfb47..b48b74a 100644
--- a/src/listenbrainz.go
+++ b/src/listenbrainz.go
@@ -194,7 +194,7 @@ func getWeeklyExploration(cfg Listenbrainz) (string, error) {
 	for _, playlist := range playlists.Playlist {
 
 		_, currentWeek := time.Now().Local().ISOWeek()
-		_, creationWeek := playlist.Data.Date.ISOWeek()
+		_, creationWeek := playlist.Data.Date.Local().ISOWeek()
 
 		if strings.Contains(playlist.Data.Title, "Weekly Exploration") && currentWeek == creationWeek {
 			id := strings.Split(playlist.Data.Identifier, "/")
@@ -271,4 +271,4 @@ func lbRequest(path string) ([]byte, error) { // Handle ListenBrainz API request
 		return nil, err
 	}
 	return body, nil
-}
\ No newline at end of file
+}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions