mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-14 01:46:09 -07:00
fix: ensure importers are using UTC
This commit is contained in:
parent
330f0061f0
commit
e1fcc5d5f4
3 changed files with 2 additions and 8 deletions
|
|
@ -88,7 +88,7 @@ func ImportLastFMFile(ctx context.Context, store db.DB, mbzc mbz.MusicBrainzCall
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ts, err = time.Parse("02 Jan 2006, 15:04", track.Date.Text)
|
ts, err = time.Parse("02 Jan 2006, 15:04", track.Date.Text)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ts = time.Now()
|
ts = time.Now().UTC()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ts = time.Unix(unix, 0).UTC()
|
ts = time.Unix(unix, 0).UTC()
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,6 @@ import (
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
// first, unzip zip file with name "listenbrainz_username_unix.zip"
|
|
||||||
// then, enter the listens folder
|
|
||||||
// then, recursively traverse all files in folder
|
|
||||||
// then, import all .jsonl files found in folders
|
|
||||||
// then, cleanup folder recursively
|
|
||||||
// finally, move zip to complete dir
|
|
||||||
func ImportListenBrainzExport(ctx context.Context, store db.DB, mbzc mbz.MusicBrainzCaller, filename string) error {
|
func ImportListenBrainzExport(ctx context.Context, store db.DB, mbzc mbz.MusicBrainzCaller, filename string) error {
|
||||||
l := logger.FromContext(ctx)
|
l := logger.FromContext(ctx)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ func ImportSpotifyFile(ctx context.Context, store db.DB, filename string) error
|
||||||
TrackTitle: item.TrackName,
|
TrackTitle: item.TrackName,
|
||||||
ReleaseTitle: item.AlbumName,
|
ReleaseTitle: item.AlbumName,
|
||||||
Duration: dur / 1000,
|
Duration: dur / 1000,
|
||||||
Time: item.Timestamp,
|
Time: item.Timestamp.UTC(),
|
||||||
UserID: 1,
|
UserID: 1,
|
||||||
}
|
}
|
||||||
err = catalog.SubmitListen(ctx, store, opts)
|
err = catalog.SubmitListen(ctx, store, opts)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue