mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-06-28 03:02:34 +08:00
fix:修复代码兼容性写法
This commit is contained in:
@@ -133,13 +133,10 @@ def find_metainfo(title: str) -> Tuple[str, dict]:
|
||||
# 查找媒体类型
|
||||
mtype = re.findall(r'(?<=type=)\w+', result)
|
||||
if mtype:
|
||||
match mtype[0]:
|
||||
case "movie":
|
||||
metainfo['type'] = MediaType.MOVIE
|
||||
case "tv":
|
||||
metainfo['type'] = MediaType.TV
|
||||
case _:
|
||||
pass
|
||||
if mtype[0] == "movies":
|
||||
metainfo['type'] = MediaType.MOVIE
|
||||
elif mtype[0] == "tv":
|
||||
metainfo['type'] = MediaType.TV
|
||||
# 查找季信息
|
||||
begin_season = re.findall(r'(?<=s=)\d+', result)
|
||||
if begin_season and begin_season[0].isdigit():
|
||||
|
||||
@@ -150,13 +150,12 @@ class Emby:
|
||||
if hidden and self._sync_libraries and "all" not in self._sync_libraries \
|
||||
and library.get("Id") not in self._sync_libraries:
|
||||
continue
|
||||
match library.get("CollectionType"):
|
||||
case "movies":
|
||||
library_type = MediaType.MOVIE.value
|
||||
case "tvshows":
|
||||
library_type = MediaType.TV.value
|
||||
case _:
|
||||
library_type = MediaType.UNKNOWN.value
|
||||
if library.get("CollectionType") == "movies":
|
||||
library_type = MediaType.MOVIE.value
|
||||
elif library.get("CollectionType") == "tvshows":
|
||||
library_type = MediaType.TV.value
|
||||
else:
|
||||
library_type = MediaType.UNKNOWN.value
|
||||
image = self.__get_local_image_by_id(library.get("Id"))
|
||||
libraries.append(
|
||||
schemas.MediaServerLibrary(
|
||||
@@ -419,7 +418,7 @@ class Emby:
|
||||
return None, {}
|
||||
# 查集的信息
|
||||
if not season:
|
||||
season = ""
|
||||
season = None
|
||||
try:
|
||||
url = f"{self._host}emby/Shows/{item_id}/Episodes"
|
||||
params = {
|
||||
|
||||
@@ -1067,38 +1067,37 @@ class FileManagerModule(_ModuleBase):
|
||||
if not overflag:
|
||||
# 目标文件已存在
|
||||
logger.info(f"目的文件系统中已经存在同名文件 {target_file},当前整理覆盖模式设置为 {overwrite_mode}")
|
||||
match overwrite_mode:
|
||||
case 'always':
|
||||
# 总是覆盖同名文件
|
||||
if overwrite_mode == 'always':
|
||||
# 总是覆盖同名文件
|
||||
overflag = True
|
||||
elif overwrite_mode == 'size':
|
||||
# 存在时大覆盖小
|
||||
if target_item.size < fileitem.size:
|
||||
logger.info(f"目标文件文件大小更小,将覆盖:{new_file}")
|
||||
overflag = True
|
||||
case 'size':
|
||||
# 存在时大覆盖小
|
||||
if target_item.size < fileitem.size:
|
||||
logger.info(f"目标文件文件大小更小,将覆盖:{new_file}")
|
||||
overflag = True
|
||||
else:
|
||||
return TransferInfo(success=False,
|
||||
message=f"媒体库存在同名文件,且质量更好",
|
||||
fileitem=fileitem,
|
||||
target_item=target_item,
|
||||
target_diritem=target_diritem,
|
||||
fail_list=[fileitem.path],
|
||||
transfer_type=transfer_type,
|
||||
need_notify=need_notify)
|
||||
case 'never':
|
||||
# 存在不覆盖
|
||||
else:
|
||||
return TransferInfo(success=False,
|
||||
message=f"媒体库存在同名文件,当前覆盖模式为不覆盖",
|
||||
message=f"媒体库存在同名文件,且质量更好",
|
||||
fileitem=fileitem,
|
||||
target_item=target_item,
|
||||
target_diritem=target_diritem,
|
||||
fail_list=[fileitem.path],
|
||||
transfer_type=transfer_type,
|
||||
need_notify=need_notify)
|
||||
case 'latest':
|
||||
# 仅保留最新版本
|
||||
logger.info(f"当前整理覆盖模式设置为仅保留最新版本,将覆盖:{new_file}")
|
||||
overflag = True
|
||||
elif overwrite_mode == 'never':
|
||||
# 存在不覆盖
|
||||
return TransferInfo(success=False,
|
||||
message=f"媒体库存在同名文件,当前覆盖模式为不覆盖",
|
||||
fileitem=fileitem,
|
||||
target_item=target_item,
|
||||
target_diritem=target_diritem,
|
||||
fail_list=[fileitem.path],
|
||||
transfer_type=transfer_type,
|
||||
need_notify=need_notify)
|
||||
elif overwrite_mode == 'latest':
|
||||
# 仅保留最新版本
|
||||
logger.info(f"当前整理覆盖模式设置为仅保留最新版本,将覆盖:{new_file}")
|
||||
overflag = True
|
||||
else:
|
||||
if overwrite_mode == 'latest':
|
||||
# 文件不存在,但仅保留最新版本
|
||||
|
||||
@@ -147,19 +147,18 @@ class Jellyfin:
|
||||
if hidden and self._sync_libraries and "all" not in self._sync_libraries \
|
||||
and library.get("Id") not in self._sync_libraries:
|
||||
continue
|
||||
match library.get("CollectionType"):
|
||||
case "movies":
|
||||
library_type = MediaType.MOVIE.value
|
||||
link = f"{self._playhost or self._host}web/index.html#!" \
|
||||
f"/movies.html?topParentId={library.get('Id')}"
|
||||
case "tvshows":
|
||||
library_type = MediaType.TV.value
|
||||
link = f"{self._playhost or self._host}web/index.html#!" \
|
||||
f"/tv.html?topParentId={library.get('Id')}"
|
||||
case _:
|
||||
library_type = MediaType.UNKNOWN.value
|
||||
link = f"{self._playhost or self._host}web/index.html#!" \
|
||||
f"/library.html?topParentId={library.get('Id')}"
|
||||
if library.get("CollectionType") == "movies":
|
||||
library_type = MediaType.MOVIE.value
|
||||
link = f"{self._playhost or self._host}web/index.html#!" \
|
||||
f"/movies.html?topParentId={library.get('Id')}"
|
||||
elif library.get("CollectionType") == "tvshows":
|
||||
library_type = MediaType.TV.value
|
||||
link = f"{self._playhost or self._host}web/index.html#!" \
|
||||
f"/tv.html?topParentId={library.get('Id')}"
|
||||
else:
|
||||
library_type = MediaType.UNKNOWN.value
|
||||
link = f"{self._playhost or self._host}web/index.html#!" \
|
||||
f"/library.html?topParentId={library.get('Id')}"
|
||||
image = self.__get_local_image_by_id(library.get("Id"))
|
||||
libraries.append(
|
||||
schemas.MediaServerLibrary(
|
||||
@@ -410,7 +409,7 @@ class Jellyfin:
|
||||
if str(tmdb_id) != str(item_info.tmdbid):
|
||||
return None, {}
|
||||
if not season:
|
||||
season = ""
|
||||
season = None
|
||||
url = f"{self._host}Shows/{item_id}/Episodes"
|
||||
params = {
|
||||
"season": season,
|
||||
|
||||
@@ -138,15 +138,14 @@ class Plex:
|
||||
if hidden and self._sync_libraries and "all" not in self._sync_libraries \
|
||||
and str(library.key) not in self._sync_libraries:
|
||||
continue
|
||||
match library.type:
|
||||
case "movie":
|
||||
library_type = MediaType.MOVIE.value
|
||||
image_list = self.__get_library_images(library.key, 1)
|
||||
case "show":
|
||||
library_type = MediaType.TV.value
|
||||
image_list = self.__get_library_images(library.key, 2)
|
||||
case _:
|
||||
continue
|
||||
if library.type == "movie":
|
||||
library_type = MediaType.MOVIE.value
|
||||
image_list = self.__get_library_images(library.key, 1)
|
||||
elif library.type == "show":
|
||||
library_type = MediaType.TV.value
|
||||
image_list = self.__get_library_images(library.key, 2)
|
||||
else:
|
||||
continue
|
||||
libraries.append(
|
||||
schemas.MediaServerLibrary(
|
||||
id=library.key,
|
||||
|
||||
Reference in New Issue
Block a user