summaryrefslogtreecommitdiff
path: root/src/wikiarticle.go
diff options
context:
space:
mode:
authordev2026-06-26 18:36:46 +0200
committerdev2026-06-26 18:36:46 +0200
commit2d72767874f6972726ef09082373e6ac01da169a (patch)
tree133dcc651e20c3137e158f6a78e938df6cb44fc1 /src/wikiarticle.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/wikiarticle.go')
-rw-r--r--src/wikiarticle.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/wikiarticle.go b/src/wikiarticle.go
index 09c2da8..19f612c 100644
--- a/src/wikiarticle.go
+++ b/src/wikiarticle.go
@@ -26,6 +26,7 @@ type wikiArticleEntry struct {
PosterURL string
Synopsis string
License string
+ LicenseShort string
LicenseURL string
NumAccolades int
People []wikiPerson
@@ -100,8 +101,12 @@ func (a *App) queryWikiArticle(name string) (wikiArticleEntry, int, error) {
// license
if licList, ok := article["license"]; ok {
if arr, ok := licList.([]interface{}); ok && len(arr) > 0 {
+ if len(arr) > 1 {
+ logWarn("license array has %d entries, using first (article %s)", len(arr), name)
+ }
if lic, ok := arr[0].(map[string]interface{}); ok {
entry.License = fmt.Sprintf("%v", lic["name"])
+ entry.LicenseShort = fmt.Sprintf("%v", lic["identifier"])
entry.LicenseURL = fmt.Sprintf("%v", lic["url"])
}
}