mirror of
https://github.com/gabehf/Koito.git
synced 2026-04-22 12:01:52 -07:00
Merge 0104374859 into 0ec7b458cc
This commit is contained in:
commit
4da5c4baf6
2 changed files with 4 additions and 4 deletions
|
|
@ -274,7 +274,7 @@ func RunImporter(l *zerolog.Logger, store db.DB, mbzc mbz.MusicBrainzCaller) {
|
||||||
}
|
}
|
||||||
if strings.Contains(file.Name(), "Streaming_History_Audio") {
|
if strings.Contains(file.Name(), "Streaming_History_Audio") {
|
||||||
l.Info().Msgf("Importer: Import file %s detecting as being Spotify export", file.Name())
|
l.Info().Msgf("Importer: Import file %s detecting as being Spotify export", file.Name())
|
||||||
err := importer.ImportSpotifyFile(logger.NewContext(l), store, file.Name())
|
err := importer.ImportSpotifyFile(logger.NewContext(l), store, mbzc, file.Name())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.Err(err).Msgf("Importer: Failed to import file: %s", file.Name())
|
l.Err(err).Msgf("Importer: Failed to import file: %s", file.Name())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import (
|
||||||
"github.com/gabehf/koito/internal/cfg"
|
"github.com/gabehf/koito/internal/cfg"
|
||||||
"github.com/gabehf/koito/internal/db"
|
"github.com/gabehf/koito/internal/db"
|
||||||
"github.com/gabehf/koito/internal/logger"
|
"github.com/gabehf/koito/internal/logger"
|
||||||
"github.com/gabehf/koito/internal/mbz"
|
mbz "github.com/gabehf/koito/internal/mbz"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SpotifyExportItem struct {
|
type SpotifyExportItem struct {
|
||||||
|
|
@ -24,7 +24,7 @@ type SpotifyExportItem struct {
|
||||||
MsPlayed int32 `json:"ms_played"`
|
MsPlayed int32 `json:"ms_played"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func ImportSpotifyFile(ctx context.Context, store db.DB, filename string) error {
|
func ImportSpotifyFile(ctx context.Context, store db.DB, mbzc mbz.MusicBrainzCaller, filename string) error {
|
||||||
l := logger.FromContext(ctx)
|
l := logger.FromContext(ctx)
|
||||||
l.Info().Msgf("Beginning spotify import on file: %s", filename)
|
l.Info().Msgf("Beginning spotify import on file: %s", filename)
|
||||||
file, err := os.Open(path.Join(cfg.ConfigDir(), "import", filename))
|
file, err := os.Open(path.Join(cfg.ConfigDir(), "import", filename))
|
||||||
|
|
@ -59,7 +59,7 @@ func ImportSpotifyFile(ctx context.Context, store db.DB, filename string) error
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
opts := catalog.SubmitListenOpts{
|
opts := catalog.SubmitListenOpts{
|
||||||
MbzCaller: &mbz.MusicBrainzClient{},
|
MbzCaller: mbzc,
|
||||||
Artist: item.ArtistName,
|
Artist: item.ArtistName,
|
||||||
TrackTitle: item.TrackName,
|
TrackTitle: item.TrackName,
|
||||||
ReleaseTitle: item.AlbumName,
|
ReleaseTitle: item.AlbumName,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue