Skip to content

feat: 添加 BDMV 蓝光原盘支持#133

Merged
AkimioJR merged 5 commits into
AkimioJR:mainfrom
EricCartman9969:feature/bdmv-clean-squashed
Jul 18, 2025
Merged

feat: 添加 BDMV 蓝光原盘支持#133
AkimioJR merged 5 commits into
AkimioJR:mainfrom
EricCartman9969:feature/bdmv-clean-squashed

Conversation

@EricCartman9969
Copy link
Copy Markdown
Contributor

  • 自动识别 BDMV/STREAM 目录结构
  • 智能选择最大的 .m2ts 文件作为主要内容
  • 生成以电影标题命名的 .strm 文件
  • 支持所有现有模式和配置(AlistURL/RawURL/AlistPath)
  • 完全向后兼容,不影响现有功能
  • 添加 fallback 机制确保 URL 生成的可靠性

解决了蓝光原盘用户无法生成有效 .strm 文件的问题

- 自动识别 BDMV/STREAM 目录结构
- 智能选择最大的 .m2ts 文件作为主要内容
- 生成以电影标题命名的 .strm 文件
- 支持所有现有模式和配置(AlistURL/RawURL/AlistPath)
- 完全向后兼容,不影响现有功能
- 添加 fallback 机制确保 URL 生成的可靠性

解决了蓝光原盘用户无法生成有效 .strm 文件的问题
@EricCartman9969
Copy link
Copy Markdown
Contributor Author

@Akimio521 请确认一下

@AkimioJR
Copy link
Copy Markdown
Owner

官方计划移出标准库typing,尽量使用dict、list、tuple替代typing.Dict、typing.List、typing.Tuple

EricCartman9969 and others added 2 commits July 15, 2025 03:16
- 移除 typing.Dict, typing.List, typing.Tuple 导入
- 使用 dict, list, tuple 内置类型替代
- 符合 Python 3.9+ 最佳实践
- 为官方计划移出标准库typing做准备

修改文件:
- app/modules/alist2strm/alist2strm.py: 更新BDMV相关类型注解
@EricCartman9969
Copy link
Copy Markdown
Contributor Author

官方计划移出标准库typing,尽量使用dict、list、tuple替代typing.Dict、typing.List、typing.Tuple

已完成 请确认

@AkimioJR
Copy link
Copy Markdown
Owner

已经提供修改意见

@EricCartman9969
Copy link
Copy Markdown
Contributor Author

是的 已经按照意见修改了 594fc49

@AkimioJR
Copy link
Copy Markdown
Owner

是的 已经按照意见修改了 594fc49

不是这个,我在file change中提供了具体评论

@EricCartman9969
Copy link
Copy Markdown
Contributor Author

是的 已经按照意见修改了 594fc49

不是这个,我在file change中提供了具体评论

你好 我并没有在其中看到任何评论 请确认一下您是否已经发出?

@AkimioJR
Copy link
Copy Markdown
Owner

AkimioJR commented Jul 16, 2025

是的 已经按照意见修改了 594fc49

不是这个,我在file change中提供了具体评论

你好 我并没有在其中看到任何评论 请确认一下您是否已经发出?

不在 Conversation 板块中,在Files Change
image

不过按道理来说 Conversation 板块也能看见
image

@EricCartman9969
Copy link
Copy Markdown
Contributor Author

Conversation/Files changed板块确实都看不到
不过我已经知道需求了
有空的时候会修改的

1. 移除普通文件处理的额外list,直接在迭代中处理文件
2. 将BDMV处理相关变量从__init__移动到run方法中初始化
3. 将import traceback移动到文件开头,避免异常时重复导入

优化点:
- 提高普通文件处理效率,减少内存占用
- 改善变量初始化时机,只在需要时初始化
- 规范import语句位置,符合Python最佳实践
Copy link
Copy Markdown
Owner

@AkimioJR AkimioJR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修改建议测试

Comment thread app/modules/alist2strm/alist2strm.py Outdated
is_detail=is_detail,
filter=filter,
):
files_to_process.append(path)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

普通文件没必要加入一个额外的list,其实感觉可以直接处理

Comment thread app/modules/alist2strm/alist2strm.py Outdated
Comment on lines +94 to +95
self.bdmv_collections: dict[str, list[tuple[AlistPath, int]]] = {} # BDMV目录 -> [(文件路径, 文件大小)]
self.bdmv_largest_files: dict[str, AlistPath] = {} # BDMV目录 -> 最大文件路径
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这两个应该放在run的时候初始化,没必要放在__init__中

Comment thread app/modules/alist2strm/alist2strm.py Outdated
logger.info(f"BDMV 文件处理完成: {largest_file.name}")
except Exception as e:
logger.error(f"处理 BDMV 文件 {largest_file.full_path} 时出错:{e}")
import traceback
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

任何import都应该放在文件的最开始,这样会导致每次Exception都重新import

Comment thread app/modules/alist2strm/alist2strm.py Outdated
local_path = self.__get_local_path(path)
logger.debug(f"__file_processer: 处理文件 {path.full_path}")
logger.debug(f"__file_processer: 本地路径 {local_path}")
logger.debug(f"__file_processer: 模式 {self.mode}")
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果有需要加这些debug提示,应该在同一行,否则并行时不方便排查

@AkimioJR
Copy link
Copy Markdown
Owner

现在看看能看到了吗

@EricCartman9969
Copy link
Copy Markdown
Contributor Author

现在看看能看到了吗

可以看到了

- 将__file_processer方法中的多行debug日志合并为单行
- 提高并行处理时的日志可读性和排查效率
- 保持所有关键信息在同一行显示

根据代码审查建议:否则并行时不方便排查
@EricCartman9969
Copy link
Copy Markdown
Contributor Author

已完成 请查看

现在看看能看到了吗

@AkimioJR AkimioJR merged commit 15a2c83 into AkimioJR:main Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants