Add refresh from source for entries and whole lists
- Every provider can look an entry up again by its ID (TMDB, TheTVDB,
IGDB, Deezer, MusicBrainz, Wikipedia); search and lookup share parsing
- POST /api/items/{id}/refresh re-applies title, subtitle, year,
description, link, details and artwork. Kept: the "why" note, rank,
theater production/venue/cast and a theater entry's year, the Deezer
preview match. Empty source fields don't erase existing values
- New items.image_custom column (migration 4; existing uploads marked)
records artwork the owner chose; refresh keeps it unless asked
- Refused for custom lists and hand-added entries; entries the source
dropped are reported, and a refresh whose title shares no words with
the current one is rejected as a likely bad ID
- Editor: refresh button per row (asks about the owner's own artwork),
and "Refresh all" with a confirm step, replace-my-art checkbox,
progress with Stop, and a summary of problems
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4ea7cbc984
commit
33053d1c5f
18 files changed
+852
-148
No files matched your search
@@ -131,6 +131,9 @@ type itemInput struct {
|
||||
Extra map[string]string `json:"extra"`
|
||||
ImageURL string `json:"imageUrl"`
|
||||
ClearImage bool `json:"clearImage"`
|
||||
// CustomArt marks an added entry's image as the owner's own choice
|
||||
// rather than the search result's.
|
||||
CustomArt bool `json:"customArt"`
|
||||
|
||||
// Only used when adding.
|
||||
Provider string `json:"provider"`
|
||||
@@ -196,7 +199,7 @@ func (s *Server) apiAddItem(w http.ResponseWriter, r *http.Request) {
|
||||
if err != nil {
|
||||
warning = "Added without artwork: " + err.Error()
|
||||
} else {
|
||||
it.Image, it.ImageSource = name, res.ImageURL
|
||||
it.Image, it.ImageSource, it.CustomArt = name, res.ImageURL, in.CustomArt
|
||||
}
|
||||
}
|
||||
s.matchDeezer(ctx, list.Category, &it)
|
||||
@@ -273,8 +276,10 @@ func (s *Server) apiUpdateItem(w http.ResponseWriter, r *http.Request) {
|
||||
if in.Extra != nil {
|
||||
it.Extra = in.Extra
|
||||
}
|
||||
// Removing art or swapping it in by hand makes it the owner's choice,
|
||||
// which a refresh leaves alone unless asked.
|
||||
if in.ClearImage {
|
||||
it.Image, it.ImageSource = "", ""
|
||||
it.Image, it.ImageSource, it.CustomArt = "", "", true
|
||||
}
|
||||
if url := strings.TrimSpace(in.ImageURL); url != "" && url != cur.ImageSource {
|
||||
name, err := s.fetchImage(ctx, url)
|
||||
@@ -282,7 +287,7 @@ func (s *Server) apiUpdateItem(w http.ResponseWriter, r *http.Request) {
|
||||
s.writeErr(w, store.ValidationError{Msg: "Couldn't use that image: " + err.Error()})
|
||||
return
|
||||
}
|
||||
it.Image, it.ImageSource = name, url
|
||||
it.Image, it.ImageSource, it.CustomArt = name, url, true
|
||||
}
|
||||
if it.Title != cur.Title || it.Subtitle != cur.Subtitle || it.Extra["deezer"] == "" {
|
||||
if l, err := s.store.ListByID(ctx, it.ListID); err == nil {
|
||||
@@ -335,7 +340,7 @@ func (s *Server) apiUploadItemImage(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
it := cur
|
||||
it.Image, it.ImageSource = name, "upload"
|
||||
it.Image, it.ImageSource, it.CustomArt = name, "upload", true
|
||||
saved, err := s.store.UpdateItem(ctx, it)
|
||||
if err != nil {
|
||||
s.releaseImage(ctx, name)
|
||||
|
||||
Reference in new issue
Block a user