fix 豆瓣来源订阅
This commit is contained in:
parent
1ecbc2f0be
commit
30c9c66087
@ -6,6 +6,7 @@ from typing import Dict, List, Optional, Union, Tuple
|
|||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from app.chain import ChainBase
|
from app.chain import ChainBase
|
||||||
|
from app.chain.douban import DoubanChain
|
||||||
from app.chain.download import DownloadChain
|
from app.chain.download import DownloadChain
|
||||||
from app.chain.search import SearchChain
|
from app.chain.search import SearchChain
|
||||||
from app.chain.torrents import TorrentsChain
|
from app.chain.torrents import TorrentsChain
|
||||||
@ -50,18 +51,28 @@ class SubscribeChain(ChainBase):
|
|||||||
识别媒体信息并添加订阅
|
识别媒体信息并添加订阅
|
||||||
"""
|
"""
|
||||||
logger.info(f'开始添加订阅,标题:{title} ...')
|
logger.info(f'开始添加订阅,标题:{title} ...')
|
||||||
# 识别元数据
|
metainfo = None
|
||||||
metainfo = MetaInfo(title)
|
mediainfo = None
|
||||||
if year:
|
if not tmdbid and doubanid:
|
||||||
metainfo.year = year
|
# 将豆瓣信息转换为TMDB信息
|
||||||
if mtype:
|
context = DoubanChain().recognize_by_doubanid(doubanid)
|
||||||
metainfo.type = mtype
|
if context:
|
||||||
if season:
|
metainfo = context.meta_info
|
||||||
metainfo.type = MediaType.TV
|
mediainfo = context.media_info
|
||||||
metainfo.begin_season = season
|
else:
|
||||||
# 识别媒体信息
|
# 识别元数据
|
||||||
mediainfo: MediaInfo = self.recognize_media(meta=metainfo, mtype=mtype, tmdbid=tmdbid)
|
metainfo = MetaInfo(title)
|
||||||
if not mediainfo:
|
if year:
|
||||||
|
metainfo.year = year
|
||||||
|
if mtype:
|
||||||
|
metainfo.type = mtype
|
||||||
|
if season:
|
||||||
|
metainfo.type = MediaType.TV
|
||||||
|
metainfo.begin_season = season
|
||||||
|
# 识别媒体信息
|
||||||
|
mediainfo = self.recognize_media(meta=metainfo, mtype=mtype, tmdbid=tmdbid)
|
||||||
|
# 识别失败
|
||||||
|
if not mediainfo or not metainfo or not mediainfo.tmdb_id:
|
||||||
logger.warn(f'未识别到媒体信息,标题:{title},tmdbid:{tmdbid}')
|
logger.warn(f'未识别到媒体信息,标题:{title},tmdbid:{tmdbid}')
|
||||||
return None, "未识别到媒体信息"
|
return None, "未识别到媒体信息"
|
||||||
# 更新媒体图片
|
# 更新媒体图片
|
||||||
@ -74,8 +85,8 @@ class SubscribeChain(ChainBase):
|
|||||||
if not kwargs.get('total_episode'):
|
if not kwargs.get('total_episode'):
|
||||||
if not mediainfo.seasons:
|
if not mediainfo.seasons:
|
||||||
# 补充媒体信息
|
# 补充媒体信息
|
||||||
mediainfo: MediaInfo = self.recognize_media(mtype=mediainfo.type,
|
mediainfo = self.recognize_media(mtype=mediainfo.type,
|
||||||
tmdbid=mediainfo.tmdb_id)
|
tmdbid=mediainfo.tmdb_id)
|
||||||
if not mediainfo:
|
if not mediainfo:
|
||||||
logger.error(f"媒体信息识别失败!")
|
logger.error(f"媒体信息识别失败!")
|
||||||
return None, "媒体信息识别失败"
|
return None, "媒体信息识别失败"
|
||||||
@ -85,7 +96,7 @@ class SubscribeChain(ChainBase):
|
|||||||
total_episode = len(mediainfo.seasons.get(season) or [])
|
total_episode = len(mediainfo.seasons.get(season) or [])
|
||||||
if not total_episode:
|
if not total_episode:
|
||||||
logger.error(f'未获取到总集数,标题:{title},tmdbid:{tmdbid}')
|
logger.error(f'未获取到总集数,标题:{title},tmdbid:{tmdbid}')
|
||||||
return None, "未获取到总集数"
|
return None, f"未获取到第 {season} 季的总集数"
|
||||||
kwargs.update({
|
kwargs.update({
|
||||||
'total_episode': total_episode
|
'total_episode': total_episode
|
||||||
})
|
})
|
||||||
|
@ -61,8 +61,7 @@ class WordsMatcher(metaclass=Singleton):
|
|||||||
|
|
||||||
if state:
|
if state:
|
||||||
appley_words.append(word)
|
appley_words.append(word)
|
||||||
else:
|
|
||||||
logger.debug(f"自定义识别词替换失败:{message}")
|
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print(str(err))
|
print(str(err))
|
||||||
|
|
||||||
|
@ -283,6 +283,8 @@ class TheMovieDbModule(_ModuleBase):
|
|||||||
:param mediainfo: 识别的媒体信息
|
:param mediainfo: 识别的媒体信息
|
||||||
:return: 更新后的媒体信息
|
:return: 更新后的媒体信息
|
||||||
"""
|
"""
|
||||||
|
if not mediainfo.tmdb_id:
|
||||||
|
return mediainfo
|
||||||
if mediainfo.logo_path \
|
if mediainfo.logo_path \
|
||||||
and mediainfo.poster_path \
|
and mediainfo.poster_path \
|
||||||
and mediainfo.backdrop_path:
|
and mediainfo.backdrop_path:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user