mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-15 18:35:55 -07:00
feat: add last fm importer
This commit is contained in:
parent
ceaba6f1a3
commit
d2277aea32
7 changed files with 186 additions and 30 deletions
|
|
@ -67,17 +67,5 @@ func ImportSpotifyFile(ctx context.Context, store db.DB, filename string) error
|
|||
}
|
||||
throttleFunc()
|
||||
}
|
||||
_, err = os.Stat(path.Join(cfg.ConfigDir(), "import_complete"))
|
||||
if err != nil {
|
||||
err = os.Mkdir(path.Join(cfg.ConfigDir(), "import_complete"), 0744)
|
||||
if err != nil {
|
||||
l.Err(err).Msg("Failed to create import_complete dir! Import files must be removed from the import directory manually, or else the importer will run on every app start")
|
||||
}
|
||||
}
|
||||
err = os.Rename(path.Join(cfg.ConfigDir(), "import", filename), path.Join(cfg.ConfigDir(), "import_complete", filename))
|
||||
if err != nil {
|
||||
l.Err(err).Msg("Failed to move file to import_complete dir! Import files must be removed from the import directory manually, or else the importer will run on every app start")
|
||||
}
|
||||
l.Info().Msgf("Finished importing %s; imported %d items", filename, len(export))
|
||||
return nil
|
||||
return finishImport(ctx, filename, len(export))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue