Skip to content

Commit

Permalink
脚本更新
Browse files Browse the repository at this point in the history
Former-commit-id: a63339e
  • Loading branch information
dyphire committed Aug 12, 2022
1 parent 408096f commit 52bc14c
Show file tree
Hide file tree
Showing 5 changed files with 233 additions and 205 deletions.
22 changes: 11 additions & 11 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
| --- | --- |
| adevice-list.lua* | OSD交互式音频设备菜单 |
| autoload.lua* | 自动加载同级目录的文件(配置文件 [autoload.conf](../script-opts/autoload.conf)|
| autodeint.lua | 自动检测去交错(默认禁用,需快捷键启用) |
| auto-save-state.lua* | 每隔 1 分钟自动保存进度(而不是退出时),播放完毕时自动删除进度 |
| autodeint.lua | 自动检测并切换去交错(默认禁用,需快捷键启用) |
| auto-save-state.lua* | 每隔 1 分钟自动保存播放进度(而不是退出时),播放完毕时自动删除进度 |
| blacklist-extensions.lua | mpv 直接拖放目录时的文件加载类型的黑/白名单 |
| change-refresh.lua | 更改刷新率(依赖[nircmd](https://www.nirsoft.net/utils/nircmd.html) ,配置文件 [changerefresh.conf](../script-opts/changerefresh.conf)|
| chapter_make_read.lua* | 标记/制作/自动读取加载外部章节文件(配置文件 [chapter_make_read.conf](../script-opts/chapter_make_read.conf) |
| change-refresh.lua | 更改显示器刷新率(依赖[nircmd](https://www.nirsoft.net/utils/nircmd.html) ,配置文件 [changerefresh.conf](../script-opts/changerefresh.conf)|
| chapter_make_read.lua* | 标记/制作/自动读取并加载外部章节文件(配置文件 [chapter_make_read.conf](../script-opts/chapter_make_read.conf)|
| chapter-list.lua* | OSD交互式章节菜单(依赖 [scroll-list.lua](../script-modules/scroll-list.lua)|
| chapterskip.lua* | 跳过指定章节(配置文件 [chapterskip.conf](../script-opts/chapterskip.conf)|
| copy_subortime.lua* | 复制当前字幕内容或播放时间 |
Expand All @@ -20,7 +20,7 @@
| drcbox.lua* | 使用并调整dynaudnorm过滤器混音的可视化脚本(配置文件 [drcbox.conf](../script-opts/drcboxp.conf)|
| dynamic-crop.lua | 自动检测黑边并裁切([autocrop.lua](https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/autocrop.lua) 改进版;配置文件 [dynamic_crop.conf](../script-opts/dynamic_crop.conf)|
| editions-notification-menu.lua* | OSD交互式edition菜单(如果检测到播放文件存在多个edition则在OSD上提示; 配置文件 [editions_notification_menu.conf](../script-opts/editions_notification_menu.conf)|
| file-browser.lua | 内置文件浏览器(依赖 [user-input.lua](../scripts/user-input.lua); [user-input-module.lua](../script-modules/user-input-module.lua) ;配置文件 [file_browser.conf](../script-opts/file_browser.conf)|
| file-browser.lua | OSD交互式文件浏览器(依赖 [user-input.lua](../scripts/user-input.lua); [user-input-module.lua](../script-modules/user-input-module.lua) ;配置文件 [file_browser.conf](../script-opts/file_browser.conf)|
| fix-avsync.lua* | 修复存在af过滤器时切换音轨和调整播放速度带来的视频冻结 |
| fuzzydir.lua* | 外挂音轨/字幕路径检测增强(配置文件 [fuzzydir.conf](../script-opts/fuzzydir.conf)|
| history-bookmark.lua* | 记录并恢复视频目录播放记录(可确认是否恢复该目录上次播放进度; 配置文件 [history_bookmark.conf](../script-opts/history_bookmark.conf)|
Expand All @@ -29,10 +29,10 @@
| mpv-webp.lua* | 剪切指定片段为 webp 动图(依赖 ffmpeg;配置文件 [webp.conf](../script-opts/webp.conf)|
| open_dialog.lua* | 快捷键载入文件/网址/其他字幕或音轨/高级次字幕 |
| ordered-chapters-playlist.lua | 有序章节播放列表 |
| pause-indicator.lua | 在 mpv 暂停时在屏幕中间显示暂停图标 |
| persist_properties.lua | 保存预设值(如音量)(配置文件 [persist_properties.conf](../script-opts/persist_properties.conf)|
| pause-indicator.lua | 在 mpv 暂停时在屏幕右上角显示暂停图标 |
| persist_properties.lua | 监视并保存预设参数的全局变化值(如音量)(配置文件 [persist_properties.conf](../script-opts/persist_properties.conf)|
| playlistmanager.lua | OSD交互式播放列表(配置文件 [playlistmanager.conf](../script-opts/playlistmanager.conf)|
| quality-menu.lua* | ytdl 选择视频/音频质量的菜单脚本(依赖 yt-dlp/youtube-dl; 配置文件 [quality-menu.conf](../script-opts/quality-menu.conf)|
| quality-menu.lua* | 选择ytdl视频/音频质量的OSD交互式菜单(依赖 yt-dlp/youtube-dl; 配置文件 [quality-menu.conf](../script-opts/quality-menu.conf)|
| segment-linking.lua | 实现对 matroska [硬段链接](https://www.ietf.org/archive/id/draft-ietf-cellar-matroska-06.html#name-hard-linking) 的支持(依赖 [read-file.lua](../script-modules/read-file.lua);配置文件 [segment_linking.conf](../script-opts/segment_linking.conf)|
| slicing_copy.lua* | 剪切视频片段(依赖 ffmpeg;配置文件 [slicing_copy.conf](../script-opts/slicing_copy.conf)|
| skiptosilence.lua | 跳至播放文件的下一个静音位置(另类地实现跳 op/ed 的方法;配置文件 [skiptosilence.conf](../script-opts/skiptosilence.conf)|
Expand All @@ -47,13 +47,13 @@
| track-menu.lua* | OSD交互式轨道菜单(配置文件 [track_menu.conf](../script-opts/track_menu.conf)|
| trackselect.lua* | 指定音频轨道优先级/黑白名单(配置文件 [trackselect.conf](../script-opts/trackselect.conf)|
| undoredo.lua | 智能跳跃记录操作 |
| ytdl_hook_plus.lua* | 修改版 ytdl_hook 脚本,修复 http 请求头缺失(依赖yt-dlp/youtube-dl; 配置文件 [ytdl_hook_plus.conf](../script-opts/ytdl_hook_plus.conf)|
| youtube-download.lua* | ytdl 下载视频/音频/字幕/片段的脚本(依赖 yt-dlp/youtube-dl和ffmpeg; 配置文件 [youtube-download.conf](../script-opts/youtube-download.conf)|
| ytdl_hook_plus.lua* | 增强版 ytdl_hook 脚本,整合了部分相关的pr代码(依赖yt-dlp/youtube-dl; 配置文件 [ytdl_hook_plus.conf](../script-opts/ytdl_hook_plus.conf)|
| youtube-download.lua* | 下载 ytdl 视频/音频/字幕/片段(依赖 yt-dlp/youtube-dl和ffmpeg; 配置文件 [youtube-download.conf](../script-opts/youtube-download.conf)|
| autosubsync(组)* | 字幕同步菜单(依赖 ffmpeg, [ffsubsync](https://github.com/smacke/ffsubsync) or [alass](https://github.com/dyphire/alass) or both; 配置文件 [autosubsync.conf](../script-opts/autosubsync.conf)|
| contextmenu_gui(组)* | 图形化右键菜单(依赖 tclkit,上游说明:https://github.com/hooke007/MPV_lazy/discussions/60; 配置文件 [contextmenu_gui.conf](../script-opts/contextmenu_gui.conf)|
1. 标记`*`号的部分脚本为**个人修改版或自建脚本**
2. 所有脚本预绑定的`mp.add_key_binding`静态键位已被 [mpv.conf](../mpv.conf) 中的`input-default-bindings=no`参数屏蔽,可查看 [input.conf](../input.conf) 的"LUA 脚本"部分示例参考绑定所需键位
- 本配置绑定的快捷键及功能请参考 [快捷键说明.md](../快捷键说明.md) 文件
3. 部分脚本存在动态绑定键位,可查看对应脚本及配置文件相关部分(或[快捷键.md](../快捷键.md)中相关说明)
3. 部分脚本存在动态绑定键位,可查看对应脚本及配置文件相关部分(或 [快捷键说明.md](../快捷键说明.md) 中相关说明)
4. **MPV已知问题**:当 scripts 文件夹内脚本绑定的`mp.add_key_binding`总数超过一定阈值时,会导致 osc.lua 交互功能失效。本配置已针对该问题进行脚本优化

7 changes: 2 additions & 5 deletions scripts/delete-current-file.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ function delete_file(path)

if is_windows then
local ps_code = [[& {
Start-Sleep -Seconds 1
Add-Type -AssemblyName Microsoft.VisualBasic
[Microsoft.VisualBasic.FileIO.FileSystem]::DeleteFile('__path__', 'OnlyErrorDialogs', 'SendToRecycleBin')
}]]
Expand Down Expand Up @@ -69,17 +68,15 @@ function remove_current_file()
new_pos = pos + 1
end

if new_pos > -1 then
mp.set_property_number("playlist-pos", new_pos)
end

mp.set_property_number("playlist-pos", new_pos)
mp.command("playlist-remove " .. pos)
end

function handle_confirm_key()
local path = mp.get_property("path")

if file_to_delete == path then
mp.commandv("show-text", "")
remove_current_file()
delete_file(file_to_delete)
remove_bindings()
Expand Down
9 changes: 4 additions & 5 deletions scripts/pause-indicator.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
--[[
Prints a pause icon in the middle of the screen when mpv is paused
available at: https://github.com/CogentRedTester/mpv-scripts
]]--

local mp = require 'mp'
local mp = require "mp"

local ov = mp.create_osd_overlay('ass-events')
ov.data = [[{\an5\p1\alpha&H79\1c&H0000&\3a&Hff}]] ..
[[m30 15 b37 8 112 8 117 15 b125 22 125 75 118 82 b112 89 38 89 30 82 b23 75 23 22 30 15 m76 108]] ..
[[{\alpha&H10\1c&Hffffff&\3a&Hff} m-45 -25 l 2 2 l -45 28{\p0}]]

ov.data = "{\\a7\\fs26}⏸"

mp.observe_property('pause', 'bool', function(_, paused)
idle = mp.get_property_native("idle-active")
Expand Down
7 changes: 5 additions & 2 deletions scripts/segment-linking.lua
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,11 @@ local function main()
end

--we'll use the mpv edl specification to merge the files into one seamless timeline
local separator = ",title="..SEGMENT_CHAPTER..";"
local edl_path = "edl://"..table.concat(list, separator)..separator
local edl_path = "edl://"
for _, filepath in ipairs(list) do
-- the filepath should start with `%[#-chars-in-path]%` to handle any special characters
edl_path = edl_path..("%%%d%%%s,title=%s;"):format(filepath:len(), filepath, SEGMENT_CHAPTER)
end

mp.set_property("stream-open-filename", edl_path)
FLAG_CHAPTER_FIX = true
Expand Down
Loading

0 comments on commit 52bc14c

Please sign in to comment.