mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-18 11:46:34 -07:00
feat: time-gated imports via cfg
This commit is contained in:
parent
6d000d87e4
commit
c14df8c2fb
6 changed files with 59 additions and 4 deletions
|
|
@ -65,14 +65,18 @@ func ImportMalojaFile(ctx context.Context, store db.DB, filename string) error {
|
|||
l.Debug().Msg("Skipping invalid maloja import item")
|
||||
continue
|
||||
}
|
||||
ts := time.Unix(item.Time, 0).UTC()
|
||||
ts := time.Unix(item.Time, 0)
|
||||
if !inImportTimeWindow(ts) {
|
||||
l.Debug().Msgf("Skipping import due to import time rules")
|
||||
continue
|
||||
}
|
||||
opts := catalog.SubmitListenOpts{
|
||||
MbzCaller: &mbz.MusicBrainzClient{},
|
||||
Artist: item.Track.Artists[0],
|
||||
ArtistNames: artists,
|
||||
TrackTitle: item.Track.Title,
|
||||
ReleaseTitle: item.Track.Album.Title,
|
||||
Time: ts,
|
||||
Time: ts.Local(),
|
||||
UserID: 1,
|
||||
}
|
||||
err = catalog.SubmitListen(ctx, store, opts)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue