Skip to content

Commit

Permalink
pot 第零季; mpv autoload.lua 冲突。
Browse files Browse the repository at this point in the history
  • Loading branch information
kjtsune committed Dec 7, 2023
1 parent 1e16493 commit a1db326
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 12 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@

### FAQ

**如果排版有问题,请到 GitHub 查看。**
**FAQ 建议到 GitHub 查看。**
https://github.com/kjtsune/embyToLocalPlayer#faq

<details>
Expand Down Expand Up @@ -498,4 +498,18 @@ https://github.com/kjtsune/embyToLocalPlayer#faq
</details>
<details>
<summary>Pot 漏播第零季选集</summary>
* 修复情景:Pot 读盘模式播放动漫第一季,会漏播 Emby 穿插的 S0 集数。
* 前提条件:Pot 选项 > 基本 > 相似文件打开策略 > 仅打开选定的文件。(由脚本添加播放列表)
* 填写位置:`.ini` > playlist
```
# 解决 Pot 读盘模式漏播第零季选集,播放列表加载会变慢,每秒1集。
mix_s0 = yes
```
* 播放的第一个文件是 S0 的话,会连续播 S0。(通用 Bug,换 mpv 也会这样)
</details>
</details>
2 changes: 1 addition & 1 deletion embyToLocalPlayer_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ subtitle_priority = Chinese Simplified, Chinese, 中文, ASS, SRT, Und

# 同一集有不同版本时生效,下一集保持播放相同版本。
# 写下不同版本间,文件名之间的差异字段,用|隔开。(实际是正则,不分大小写)
version_filter = 720|1080|2160|4k|remux|hevc|265|264|sdr|hdr|dv|vision|baha|cr|global|house|vcb
version_filter = 720|1080|2160|4k|remux|hevc|265|264|sdr|hdr|dv|vision|baha|cr|global|house|vcb|mkv|mp4|简.|.语|内.|..字幕|....组|..@..

# 条目数量限制,需要大于0,-1 为采用预设值。
item_limit = -1
Expand Down
22 changes: 14 additions & 8 deletions user_script/embyToLocalPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
// @name:zh-CN embyToLocalPlayer
// @name:en embyToLocalPlayer
// @namespace https://github.com/kjtsune/embyToLocalPlayer
// @version 1.1.10.1
// @version 1.1.11
// @description 需要 Python。Emby/Jellyfin 调用外部本地播放器,并回传播放记录。适配 Plex。
// @description:zh-CN 需要 Python。Emby/Jellyfin 调用外部本地播放器,并回传播放记录。适配 Plex。
// @description:en Require Python. Play in an external player. Update watch history to Emby/Jellyfin server. Support Plex.
// @author Kjtsune
// @match *://*/web/index.html*
// @match *://*/*/web/index.html*
// @include /:\/\/[\w.]*\/web\/$/
// @icon https://www.google.com/s2/favicons?sz=64&domain=emby.media
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
Expand All @@ -22,6 +21,19 @@
// ==/UserScript==
'use strict';
/*
2023-12-07:
1. mpv 播放列表避免与官方 autoload.lua 冲突。
2. pot 修复读盘模式播放列表漏播第零季选集。(详见 FAQ 隐藏功能)
* 版本间累积更新:
* 追更 TG 通知。(详见 FAQ 隐藏功能)
* 适配 Emby beta 版本 api 变动。
* bgm.tv: 适配上游搜索结果变动。
* bgm.tv: 增加旧版搜索 api 备选。
* trakt: 适配上游新剧缺失单集 imdb/tvdb。
* .bat 强制使用 utf-8 编码。
* 默认启用日志文件。
* pot 播放列表 未加载完成时可退出。
* 网络流:外挂 sup 支持(限 Emby v4.8.0.55 | mpv)。升级 Emby 记得备份,无法回退。
2023-10-04:
1. pot 和 vlc(Linux/macOS) 网络外挂字幕时,使用连播代替播放列表。`.ini` > playlist
2. 高版本 macOS 自启方案。@Eatsolx
Expand All @@ -36,12 +48,6 @@
* 减少回传次数。**油猴脚本也需要更新**
* 播放网络流时:pot 播放列表:降低添加条目速度,减少异常。
* 播放网络流时:mpc 切换进度时 api 无响应,导致提前回传。
2023-09-04:
1. Trakt 播放记录单向同步。(详见 FAQ)
2. 剧集多版本:下一集匹配失败则禁用播放列表。
* 版本间累积更新:
* 自动选择视频版本(限emby,配置文件有新增条目 [dev])
* 油猴:非管理员可显示文件名。
*/

let config = {
Expand Down
8 changes: 6 additions & 2 deletions utils/players.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ def mpv_player_start(cmd, start_sec=None, sub_file=None, media_title=None, get_s
if is_darwin:
cmd.append('--focus-on-open')
cmd.append(fr'--input-ipc-server={cmd_pipe}')
cmd.append('--script-opts=autoload-disabled=yes')
if configs.fullscreen:
cmd.append('--fullscreen=yes')
if configs.disable_audio:
Expand Down Expand Up @@ -583,6 +584,7 @@ def pot_player_start(cmd: list, start_sec=None, sub_file=None, media_title=None,


def playlist_add_pot(pid, player_path, data, eps_data=None, limit=5, **_):
mix_s0 = configs.raw.getboolean('playlist', 'mix_s0', fallback=False)
from utils.windows_tool import process_is_running_by_pid
playlist_data = {}
if not player_path:
Expand All @@ -591,6 +593,7 @@ def playlist_add_pot(pid, player_path, data, eps_data=None, limit=5, **_):
episodes = eps_data or list_episodes(data)
append = False
mount_disk_mode = data['mount_disk_mode']
limit = 12 if limit == 5 and mount_disk_mode and mix_s0 else limit
is_http_sub = bool(data.get('sub_file'))
if not mount_disk_mode:
while True:
Expand All @@ -606,19 +609,20 @@ def playlist_add_pot(pid, player_path, data, eps_data=None, limit=5, **_):
if basename == data['basename']:
append = True
continue
if not append or mount_disk_mode or limit <= 0 or is_http_sub:
if not append or (mount_disk_mode and not mix_s0) or limit <= 0 or is_http_sub:
continue
limit -= 1
# f'/sub={ep["sub_file"]}' pot 下一集会丢失字幕
# /add /title 不能复用,会丢失 /title
pot_cmds.append([player_path, '/add', ep['media_path'], f'/title={basename}'])
if pot_cmds:
def add_thread():
sleep_sec = 1 if mount_disk_mode else 5
for cmd in pot_cmds:
if not process_is_running_by_pid(pid):
break
subprocess.run(cmd)
time.sleep(5)
time.sleep(sleep_sec)

threading.Thread(target=add_thread, daemon=True).start()
return playlist_data
Expand Down

2 comments on commit a1db326

@schrader545
Copy link

Choose a reason for hiding this comment

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

Could you please help me install this on my windows PC, it took me hours to get it working but I had to reinstall potplayer and its never worked ever since and I have tried everything I could think of and followed all the FAQ. Your help would be super super apreciated

@kjtsune
Copy link
Owner Author

@kjtsune kjtsune commented on a1db326 Dec 8, 2023

Choose a reason for hiding this comment

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

Could you please help me install this on my windows PC, it took me hours to get it working but I had to reinstall potplayer and its never worked ever since and I have tried everything I could think of and followed all the FAQ. Your help would be super super apreciated

https://t.me/+S2AnRMTtzAZkMDYx

Please sign in to comment.