summaryrefslogtreecommitdiff
path: root/src/wikidata.go
diff options
context:
space:
mode:
authordev2026-06-26 18:36:46 +0200
committerdev2026-06-26 18:36:46 +0200
commit2d72767874f6972726ef09082373e6ac01da169a (patch)
tree133dcc651e20c3137e158f6a78e938df6cb44fc1 /src/wikidata.go
parentb8255840d99c1d0bd81db1a40afc74ab13bf8501 (diff)
downloadhnimdbbot-2d72767874f6972726ef09082373e6ac01da169a.tar.gz
feat: add license_short from Wikipedia license identifiermain
- Extract license.identifier (e.g. CC-BY-SA-4.0) into new license_short column - Warn if a license array has more than 1 entry (none seen yet) - Include license_short IS NULL in getExistingWikiArticles query
Diffstat (limited to 'src/wikidata.go')
-rw-r--r--src/wikidata.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wikidata.go b/src/wikidata.go
index 3101673..5175d52 100644
--- a/src/wikidata.go
+++ b/src/wikidata.go
@@ -125,7 +125,7 @@ func (a *App) getExistingWikiArticles() ([]existingWikiArticle, error) {
WHERE wiki_article IS NOT NULL
AND wiki_status_code != 404
AND (synopsis IS NULL OR description IS NULL OR year IS NULL
- OR poster_url IS NULL OR license IS NULL OR license_url IS NULL OR num_accolades IS NULL OR has_people = 0)
+ OR poster_url IS NULL OR license IS NULL OR license_short IS NULL OR license_url IS NULL OR num_accolades IS NULL OR has_people = 0)
`)
if err != nil {
return nil, fmt.Errorf("query existing wiki articles: %w", err)
@@ -254,10 +254,10 @@ func (a *App) wikiDataConsumer(artCh <-chan wikiArticleFetch, done chan<- struct
if statusCode == 200 {
a.DB.Exec(`
UPDATE imdb SET synopsis = ?, description = ?, year = ?, poster_url = ?,
- license = ?, license_url = ?, num_accolades = ?
+ license = ?, license_short = ?, license_url = ?, num_accolades = ?
WHERE imdb_id = ?`,
entry.Synopsis, entry.Description, entry.Year, entry.PosterURL,
- entry.License, entry.LicenseURL, entry.NumAccolades, art.imdbID)
+ entry.License, entry.LicenseShort, entry.LicenseURL, entry.NumAccolades, art.imdbID)
updated++
}