Peach: Local-first video metadata scraper and media manager.
fix(web): 「官方网站」只用在厂牌页,事务所页照旧写名字
longmeidao8c828078b746
diff --git a/tests/test_web_js.py b/tests/test_web_js.pyindex 734bf596c..efcfafc2d 100644--- a/tests/test_web_js.py+++ b/tests/test_web_js.py@@ -360,24 +360,23 @@ class WebJsBehaviourTests(unittest.TestCase):("core.js", "siteName", ["不是网址"], ""),])- def test_a_company_page_calls_its_own_site_the_official_site(self):- """公司页上指回自家站的链接写「官方网站」,指向别家的保留那家的名字;人物页照旧写短名。"""+ def test_a_studio_page_calls_its_own_site_the_official_site(self):+ """厂牌页上指回自家站的链接写「官方网站」,指向别家的保留那家的名字;事务所页与人物页照旧写名字。"""light = {"url": "https://lightpro.jp/", "label": "LIGHT"}+ nax = {"url": "https://official.nax-pro.com/", "label": "New Actor eXperience"}self.assertJsResults([- ("core.js", "officialLinkText", [light, "agency", ["LIGHT", "RIGHT"]], "官方网站"),("core.js", "officialLinkText",- [{"url": "https://cmore.jp/", "label": "C-more Entertainment"}, "agency",- ["C-more Entertainment"]], "官方网站"),+ [{"url": "https://www.km-produce.com/", "label": "K M Produce"}, "studio",+ ["K M Produce", "KMP"]], "官方网站"),("core.js", "officialLinkText",- [{"url": "https://www.gg1produce.com/", "label": "官方网站"}, "agency", ["GG"]], "官方网站"),+ [{"url": "https://cmore.jp/", "label": "C-more Entertainment"}, "studio",+ ["C-more Entertainment"]], "官方网站"),# 别名也算自家:合并进来的旧名下装的链接。("core.js", "officialLinkText",- [{"url": "https://example.jp/", "label": "Production CLAP"}, "agency",- ["C-more Entertainment", "Production CLAP"]], "官方网站"),+ [{"url": "https://example.jp/", "label": "Studio CLAP"}, "studio",+ ["C-more Entertainment", "Studio CLAP"]], "官方网站"),# 短名是缩写时认 label;label 只是主机名等于没起名。- ("core.js", "officialLinkText",- [{"url": "https://official.nax-pro.com/", "label": "New Actor eXperience"}, "agency",- ["New Actor eXperience"]], "官方网站"),+ ("core.js", "officialLinkText", [nax, "studio", ["New Actor eXperience"]], "官方网站"),("core.js", "officialLinkText",[{"url": "http://www.ran-maru.com", "label": "www.ran-maru.com"}, "studio", ["乱丸"]], "官方网站"),("core.js", "officialLinkText",@@ -389,6 +388,8 @@ class WebJsBehaviourTests(unittest.TestCase):("core.js", "officialLinkText",[{"url": "https://www.prestige-av.com/goods/", "label": "Prestige"}, "studio",["Jackson"]], "Prestige"),+ ("core.js", "officialLinkText", [light, "agency", ["LIGHT", "RIGHT"]], "LIGHT"),+ ("core.js", "officialLinkText", [nax, "agency", ["New Actor eXperience"]], "NAX"),("core.js", "officialLinkText", [light, "performer", ["松本一香"]], "LIGHT"),])diff --git a/web/js/core.js b/web/js/core.jsindex 6a3496b42..bcf1b7452 100644--- a/web/js/core.js+++ b/web/js/core.js@@ -127,17 +127,17 @@ const brandIcon=url=>{return host&&BRAND_ICONS.find(([hosts])=>hosts.some(d=>host===d||host.endsWith('.'+d)))?.[1]||'';};const foldName=s=>String(s??'').normalize('NFKC').trim().toLocaleLowerCase();-/* 官网链接上那行字。人物页写站点短名(`siteName`),表里没有就用账本 label。+/* 官网链接上那行字。写站点短名(`siteName`),表里没有就用账本 label。- 公司页上指回自家站的一律写「官方网站」:页头已经是公司名,链接再写一遍 LIGHT、- C-more 只是重复,同一排里有的写名字、有的写「官方网站」还会看着像两类链接。名字是- 别家的(Jackson 页上链到 Prestige 的名录页)才保留,那说的是另一家。自家的判据是+ 只有厂牌页上指回自家站的写「官方网站」:页头已经是厂牌名,链接再写一遍 S1、+ KMP 只是重复。事务所页和人物页照旧写名字,那里的名字就是要看的信息。名字是+ 别家的(Jackson 页上链到 Prestige 的名录页)也保留,那说的是另一家。自家的判据是短名或 label 与规范名、别名互相包含:`C-more` 之于 `C-more Entertainment`,短名是缩写时看 label(`NAX` 那条的 label 是 `New Actor eXperience`)。label 只是这条链接自己的主机名(`www.ran-maru.com`)等于没起名,也算自家。 */const officialLinkText=(link,kind,names=[])=>{const text=siteName(link.url)||link.label||'';- if(kind!=='studio'&&kind!=='agency')return text;+ if(kind!=='studio')return text;const said=[text,link.label].map(foldName).filter(Boolean);const own=!said.length||said.includes('官方网站')||said.some(shown=>bareHost(shown)===linkHost(link.url)||names.some(name=>{