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
@@ -58,11 +58,32 @@ func (g *igdb) token(ctx context.Context, fresh bool) (string, error) {
|
||||
return c.token, nil
|
||||
}
|
||||
|
||||
const igdbFields = `fields name,first_release_date,cover.image_id,summary,url,involved_companies.developer,involved_companies.publisher,involved_companies.company.name,involved_companies.company.parent.name,involved_companies.company.parent.parent.name,involved_companies.company.parent.parent.parent.name,platforms.abbreviation,platforms.name;`
|
||||
|
||||
func (g *igdb) Search(ctx context.Context, query string) ([]Result, error) {
|
||||
q := strings.NewReplacer(`\`, ``, `"`, `\"`).Replace(query)
|
||||
body := `search "` + q + `";
|
||||
fields name,first_release_date,cover.image_id,summary,url,involved_companies.developer,involved_companies.publisher,involved_companies.company.name,involved_companies.company.parent.name,involved_companies.company.parent.parent.name,involved_companies.company.parent.parent.parent.name,platforms.abbreviation,platforms.name;
|
||||
limit 25;`
|
||||
return g.query(ctx, `search "`+q+`";
|
||||
`+igdbFields+`
|
||||
limit 25;`)
|
||||
}
|
||||
|
||||
// Lookup refreshes one game by its IGDB ID.
|
||||
func (g *igdb) Lookup(ctx context.Context, providerID string) (Result, error) {
|
||||
id, err := strconv.ParseInt(providerID, 10, 64)
|
||||
if err != nil {
|
||||
return Result{}, ErrGone
|
||||
}
|
||||
res, err := g.query(ctx, igdbFields+"\nwhere id = "+strconv.FormatInt(id, 10)+";")
|
||||
if err != nil {
|
||||
return Result{}, err
|
||||
}
|
||||
if len(res) == 0 {
|
||||
return Result{}, ErrGone
|
||||
}
|
||||
return res[0], nil
|
||||
}
|
||||
|
||||
func (g *igdb) query(ctx context.Context, body string) ([]Result, error) {
|
||||
var games []struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
|
||||
Reference in new issue
Block a user