mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-07-19 03:31:50 +08:00
feat: optimize scraping for multi-server compatibility
- Add studio, country, runtime tags to NFO generation - Fix Fanart naming: showbackground→fanart (recognized by Jellyfin/Emby) - Add image alias system: backdrop↔fanart, thumb↔landscape - Merge image sources from all modules instead of first-wins - Add CLEARART and LANDSCAPE scraping metadata types - Extend season scraping with backdrop and landscape support Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import asyncio
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import Optional, Tuple, Union
|
||||
|
||||
@@ -549,15 +548,34 @@ class FanartModule(_ModuleBase):
|
||||
_images.sort(key=lambda x: int(x.get("likes", 0)), reverse=True)
|
||||
return _images[0]
|
||||
|
||||
@staticmethod
|
||||
def __name(fanart_name: str) -> str:
|
||||
_FANART_NAME_MAP = {
|
||||
"showbackground": "fanart",
|
||||
"moviebackground": "fanart",
|
||||
"hdtvlogo": "logo",
|
||||
"hdmovielogo": "logo",
|
||||
"movielogo": "logo",
|
||||
"tvposter": "poster",
|
||||
"movieposter": "poster",
|
||||
"tvthumb": "thumb",
|
||||
"moviethumb": "thumb",
|
||||
"tvbanner": "banner",
|
||||
"moviebanner": "banner",
|
||||
"hdclearart": "clearart",
|
||||
"movieart": "clearart",
|
||||
"hdmovieclearart": "clearart",
|
||||
"cdart": "cdart",
|
||||
"moviedisc": "disc",
|
||||
"seasonposter": "seasonposter",
|
||||
"seasonthumb": "seasonthumb",
|
||||
"seasonbanner": "seasonbanner",
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def __name(cls, fanart_name: str) -> str:
|
||||
"""
|
||||
转换Fanart图片的名字
|
||||
转换Fanart图片的名字为媒体服务器兼容名称
|
||||
"""
|
||||
words_to_remove = r"tv|movie|hdmovie|hdtv|show|hd"
|
||||
pattern = re.compile(words_to_remove, re.IGNORECASE)
|
||||
result = re.sub(pattern, "", fanart_name)
|
||||
return result
|
||||
return cls._FANART_NAME_MAP.get(fanart_name.lower(), fanart_name)
|
||||
|
||||
@classmethod
|
||||
@cached(maxsize=settings.CONF.fanart, ttl=settings.CONF.meta, shared_key="get")
|
||||
|
||||
@@ -301,6 +301,17 @@ class TmdbScraper:
|
||||
# 内容分级
|
||||
if content_rating := mediainfo.content_rating:
|
||||
DomUtils.add_node(doc, root, "mpaa", content_rating)
|
||||
# 制作公司
|
||||
for company in mediainfo.production_companies or []:
|
||||
if company.get("name"):
|
||||
DomUtils.add_node(doc, root, "studio", company.get("name"))
|
||||
# 制作国家
|
||||
for country in mediainfo.production_countries or []:
|
||||
if country.get("name"):
|
||||
DomUtils.add_node(doc, root, "country", country.get("name"))
|
||||
# 时长
|
||||
if mediainfo.runtime:
|
||||
DomUtils.add_node(doc, root, "runtime", str(mediainfo.runtime))
|
||||
|
||||
return doc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user