mirror of
https://github.com/gabehf/Koito.git
synced 2026-04-22 03:51:51 -07:00
fix: nil pointer panic
This commit is contained in:
parent
0ec7b458cc
commit
13566e58a2
2 changed files with 3 additions and 3 deletions
|
|
@ -274,7 +274,7 @@ func RunImporter(l *zerolog.Logger, store db.DB, mbzc mbz.MusicBrainzCaller) {
|
|||
}
|
||||
if strings.Contains(file.Name(), "Streaming_History_Audio") {
|
||||
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 {
|
||||
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/db"
|
||||
"github.com/gabehf/koito/internal/logger"
|
||||
"github.com/gabehf/koito/internal/mbz"
|
||||
mbz "github.com/gabehf/koito/internal/mbz"
|
||||
)
|
||||
|
||||
type SpotifyExportItem struct {
|
||||
|
|
@ -24,7 +24,7 @@ type SpotifyExportItem struct {
|
|||
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.Info().Msgf("Beginning spotify import on file: %s", filename)
|
||||
file, err := os.Open(path.Join(cfg.ConfigDir(), "import", filename))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue