kjtsune / embyToLocalPlayer

etlp - Emby/Jellyfin 调用外部本地播放器,并回传播放记录。适配 Plex。
595 stars 38 forks source link

播放列表从后面的集数切回第一集时字幕有问题 #26

Closed verygoodlee closed 9 months ago

verygoodlee commented 9 months ago

启动时第一集选择了字幕,播放列表的subtitle_priority参数也填写了,字幕都能成功加载,\ 从第一集往后切没啥问题,但是从后面切回第一集字幕没了。 原因是第一集的字幕加载方式用的JSON IPC,不是以启动参数加载的 https://github.com/kjtsune/embyToLocalPlayer/blob/5c5a99c5056ce03faff103221e338cce16fdb8b9/utils/players.py#L231-L233 启动参数--sub-file影响后面的集数是可以解决的,sub-files是一个List Options,利用-toggle操作的特性:不存在则添加,存在则删除。启动参数改为cmd.append(f'--sub-files-toggle={sub_file}') https://github.com/kjtsune/embyToLocalPlayer/blob/5c5a99c5056ce03faff103221e338cce16fdb8b9/utils/players.py#L195-L200 播放列表的字幕参数部分改为

        # 启动时选择的第一集的字幕,先给它加上,启动参数sub-files-toggle会把它删掉
        first_ep_sub_file = data['sub_file'] or ''
        sub_file_cmd = f',sub-files-remove={first_ep_sub_file},sub-files-append={first_ep_sub_file}' if first_ep_sub_file else ''
        sub_file = ep['sub_file'] or ''
        sub_file_cmd = sub_file_cmd + (f',sub-files-append={sub_file}' if sub_file else '')

https://github.com/kjtsune/embyToLocalPlayer/blob/5c5a99c5056ce03faff103221e338cce16fdb8b9/utils/players.py#L260-L261

kjtsune commented 9 months ago

已更新,辛苦了

verygoodlee commented 9 months ago

有个尴尬的问题是mpv.net好像不支持List Options操作,#22 应该也在影响范围内,\ 作者也发现这个问题了,可能未来会修复。 mpv-player/mpv/issues/13132

kjtsune commented 9 months ago

修了,先把mpv.net排除了。

22 问题不大,不会报错,FAQ也有写让用户手动关闭加载相似文件。