mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-08-28 11:37:23 +08:00
feat: 强化集数定位模板智能自动生成 (#5801)
This commit is contained in:
+10
-2
@@ -1823,14 +1823,22 @@ class TransferChain(ChainBase, ConfigReloadMixin, metaclass=Singleton):
|
||||
self, directory: FileItem
|
||||
) -> List[FileItem]:
|
||||
"""
|
||||
获取目录下可参与模板推荐的媒体文件
|
||||
获取目录下可参与模板推荐的样本文件。
|
||||
|
||||
推荐结果最终会在手动整理链路中作为 `episode_format`
|
||||
交由 `FormatParser` 过滤主视频、字幕和外挂音频,因此这里需要把
|
||||
同目录下的主视频、字幕和外挂音频一起纳入推荐流程。
|
||||
"""
|
||||
file_items = StorageChain().list_files(directory, recursion=False) or []
|
||||
sample_files: List[FileItem] = []
|
||||
for item in file_items:
|
||||
if not item or item.type != "file":
|
||||
continue
|
||||
if not self.__is_media_file(item):
|
||||
if not (
|
||||
self.__is_media_file(item)
|
||||
or self.__is_subtitle_file(item)
|
||||
or self.__is_audio_file(item)
|
||||
):
|
||||
continue
|
||||
if self.__is_hidden_or_recycle_path(item.path):
|
||||
continue
|
||||
|
||||
+969
-22
File diff suppressed because it is too large
Load Diff
@@ -126,7 +126,10 @@ class FormatParser(object):
|
||||
if not ret or not ret.__contains__(self._key):
|
||||
return None, None
|
||||
episodes = ret.__getitem__(self._key)
|
||||
if not re.compile(r"^(EP)?(\d{1,4})(-(EP)?(\d{1,4}))?$", re.IGNORECASE).match(episodes):
|
||||
if not re.compile(
|
||||
r"^([Ee][Pp]?)?(\d{1,4})(-([Ee][Pp]?)?(\d{1,4}))?$",
|
||||
re.IGNORECASE,
|
||||
).match(episodes):
|
||||
return None, None
|
||||
episode_splits = list(filter(lambda x: re.compile(r'[a-zA-Z]*\d{1,4}', re.IGNORECASE).match(x),
|
||||
re.split(r'%s' % self._split_chars, episodes)))
|
||||
|
||||
Reference in New Issue
Block a user