mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-07 13:38:15 -08:00
feat: refetch missing images on startup (#160)
* artist image refetching * album image refetching * remove unused var
This commit is contained in:
parent
5e294b839c
commit
1a8099e902
15 changed files with 271 additions and 44 deletions
|
|
@ -211,6 +211,8 @@ func Run(
|
|||
}
|
||||
}()
|
||||
|
||||
l.Info().Msg("Engine: Beginning startup tasks...")
|
||||
|
||||
l.Debug().Msg("Engine: Checking import configuration")
|
||||
if !cfg.SkipImport() {
|
||||
go func() {
|
||||
|
|
@ -218,18 +220,14 @@ func Run(
|
|||
}()
|
||||
}
|
||||
|
||||
// l.Info().Msg("Creating test export file")
|
||||
// go func() {
|
||||
// err := export.ExportData(ctx, "koito", store)
|
||||
// if err != nil {
|
||||
// l.Err(err).Msg("Failed to generate export file")
|
||||
// }
|
||||
// }()
|
||||
|
||||
l.Info().Msg("Engine: Pruning orphaned images")
|
||||
go catalog.PruneOrphanedImages(logger.NewContext(l), store)
|
||||
l.Info().Msg("Engine: Running duration backfill task")
|
||||
go catalog.BackfillTrackDurationsFromMusicBrainz(ctx, store, mbzC)
|
||||
l.Info().Msg("Engine: Attempting to fetch missing artist images")
|
||||
go catalog.FetchMissingArtistImages(ctx, store)
|
||||
l.Info().Msg("Engine: Attempting to fetch missing album images")
|
||||
go catalog.FetchMissingAlbumImages(ctx, store)
|
||||
|
||||
l.Info().Msg("Engine: Initialization finished")
|
||||
quit := make(chan os.Signal, 1)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/gabehf/koito/internal/catalog"
|
||||
"github.com/gabehf/koito/internal/cfg"
|
||||
"github.com/gabehf/koito/internal/db"
|
||||
"github.com/gabehf/koito/internal/images"
|
||||
"github.com/gabehf/koito/internal/logger"
|
||||
"github.com/gabehf/koito/internal/utils"
|
||||
"github.com/google/uuid"
|
||||
|
|
@ -75,7 +76,7 @@ func ReplaceImageHandler(store db.DB) http.HandlerFunc {
|
|||
fileUrl := r.FormValue("image_url")
|
||||
if fileUrl != "" {
|
||||
l.Debug().Msg("ReplaceImageHandler: Image identified as remote file")
|
||||
err = catalog.ValidateImageURL(fileUrl)
|
||||
err = images.ValidateImageURL(fileUrl)
|
||||
if err != nil {
|
||||
l.Debug().AnErr("error", err).Msg("ReplaceImageHandler: Invalid image URL")
|
||||
utils.WriteError(w, "url is invalid or not an image file", http.StatusBadRequest)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue