Compare commits
3 Commits
0ed904319d
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
9f0e7b422f
|
|||
|
a300158d53
|
|||
|
fd9d7859b8
|
@@ -1,3 +1,6 @@
|
|||||||
|
**/.git
|
||||||
|
.manager/*
|
||||||
|
!.manager/.gitkeep
|
||||||
cache/
|
cache/
|
||||||
|
|
||||||
files/*.log
|
files/*.log
|
||||||
|
|||||||
@@ -16,3 +16,18 @@
|
|||||||
| ---------- | ------------------------------------- | ---------------------------------------------- |
|
| ---------- | ------------------------------------- | ---------------------------------------------- |
|
||||||
| alass | 字幕自动同步(autosubsync 脚本) | `paru -S alass` |
|
| alass | 字幕自动同步(autosubsync 脚本) | `paru -S alass` |
|
||||||
| ffsubsync | 字幕自动同步(alass 的替代) | `pip install ffsubsync` |
|
| ffsubsync | 字幕自动同步(alass 的替代) | `pip install ffsubsync` |
|
||||||
|
|
||||||
|
## 字体
|
||||||
|
|
||||||
|
弹幕中可能出现 emoji, 因此需要使用支持的字体, 例如将 Symbola 加到 Noto Sans CJK SC 的末尾:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<match target="pattern">
|
||||||
|
<test name="family">
|
||||||
|
<string>Noto Sans CJK SC</string>
|
||||||
|
</test>
|
||||||
|
<edit mode="append" name="family">
|
||||||
|
<string>Symbola</string>
|
||||||
|
</edit>
|
||||||
|
</match>
|
||||||
|
```
|
||||||
|
|||||||
@@ -60,10 +60,21 @@ icc/ # ICC 色彩配置文件
|
|||||||
|
|
||||||
## 更新流程
|
## 更新流程
|
||||||
|
|
||||||
1. 在 mpv 中按 `M` 触发 manager.lua,观察控制台输出,确认无 `FAILED` 条目
|
1. 在 mpv 中按 `M` 触发 manager.lua,观察控制台输出,确认无 `FAILED` 条目。可能会有其他报错如 `[manager] Fehler: externes Repository manager existiert bereits.`,这是正常的。只需要确保不出现全大写的 `FAILED` 即可。
|
||||||
2. 更新完成后删除 manager 在子目录留下的嵌套 `.git`(否则 `git add` 会失败):
|
2. 将 manager.lua 在 dest 目录产生的嵌套 `.git` 目录迁移到仓库内的 `.manager/`(避免根仓库误判为 submodule,幂等可重复执行):
|
||||||
```bash
|
```bash
|
||||||
find ~/.config/mpv -mindepth 2 -name .git -type d | sort -r | xargs rm -rvf
|
REPO=$(git -C ~/.config/mpv rev-parse --show-toplevel)
|
||||||
|
GITSTORE="$REPO/.manager"
|
||||||
|
mkdir -p "$GITSTORE"
|
||||||
|
find -L ~/.config/mpv -mindepth 2 -name .git -type d | while read gitdir; do
|
||||||
|
dest="${gitdir%/.git}"
|
||||||
|
rel="${dest#$REPO/}"
|
||||||
|
name=$(echo "$rel" | tr '/' '-')
|
||||||
|
mv "$gitdir" "$GITSTORE/$name"
|
||||||
|
depth=$(echo "$rel" | tr -cd '/' | wc -c)
|
||||||
|
ups=$(printf '../%.0s' $(seq 1 $((depth + 1))))
|
||||||
|
echo "gitdir: ${ups}.manager/$name" > "$dest/.git"
|
||||||
|
done
|
||||||
```
|
```
|
||||||
3. 重启 mpv,检查控制台有无 `unknown key` 或脚本加载失败的警告
|
3. 重启 mpv,检查控制台有无 `unknown key` 或脚本加载失败的警告
|
||||||
4. 若有 `unknown key` 警告,说明对应脚本的配置项发生变化,找 `script-opts/` 下同名 `.conf` 对照脚本源码更新
|
4. 若有 `unknown key` 警告,说明对应脚本的配置项发生变化,找 `script-opts/` 下同名 `.conf` 对照脚本源码更新
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+7
-1
@@ -1,4 +1,10 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"git": "https://github.com/po5/mpv_manager",
|
||||||
|
"branch": "master",
|
||||||
|
"whitelist": "manager%.lua$",
|
||||||
|
"dest": "~~/scripts"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"git": "https://github.com/po5/evafast",
|
"git": "https://github.com/po5/evafast",
|
||||||
"branch": "rewrite",
|
"branch": "rewrite",
|
||||||
@@ -60,7 +66,7 @@
|
|||||||
{
|
{
|
||||||
"git": "https://github.com/Tony15246/uosc_danmaku",
|
"git": "https://github.com/Tony15246/uosc_danmaku",
|
||||||
"branch": "main",
|
"branch": "main",
|
||||||
"blacklist": "^%.",
|
"blacklist": "^%.|^\"",
|
||||||
"dest": "~~/scripts/uosc_danmaku"
|
"dest": "~~/scripts/uosc_danmaku"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,5 @@
|
|||||||
|
-- https://github.com/Seme4eg/mpv-scripts/blob/master/script-modules/extended-menu.lua
|
||||||
|
|
||||||
local mp = require 'mp'
|
local mp = require 'mp'
|
||||||
local utils = require 'mp.utils'
|
local utils = require 'mp.utils'
|
||||||
local assdraw = require 'mp.assdraw'
|
local assdraw = require 'mp.assdraw'
|
||||||
@@ -449,7 +451,7 @@ end
|
|||||||
I was too lazy to list all modifications i've done to the script, but if u
|
I was too lazy to list all modifications i've done to the script, but if u
|
||||||
rly need to see those - do diff with the original code
|
rly need to see those - do diff with the original code
|
||||||
]]
|
]]
|
||||||
--
|
--
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
-- START ORIGINAL MPV CODE --
|
-- START ORIGINAL MPV CODE --
|
||||||
@@ -868,8 +870,8 @@ function em:get_bindings()
|
|||||||
{ 'home', function() self:go_home() end },
|
{ 'home', function() self:go_home() end },
|
||||||
{ 'ctrl+e', function() self:go_end() end },
|
{ 'ctrl+e', function() self:go_end() end },
|
||||||
{ 'end', function() self:go_end() end },
|
{ 'end', function() self:go_end() end },
|
||||||
{ 'ctrl+shift+f',function() self:handle_pgdown() end },
|
{ 'ctrl+shift+f', function() self:handle_pgdown() end },
|
||||||
{ 'ctrl+shift+b',function() self:handle_pgup() end },
|
{ 'ctrl+shift+b', function() self:handle_pgup() end },
|
||||||
{ 'pgdwn', function() self:handle_pgdown() end },
|
{ 'pgdwn', function() self:handle_pgdown() end },
|
||||||
{ 'pgup', function() self:handle_pgup() end },
|
{ 'pgup', function() self:handle_pgup() end },
|
||||||
{ 'ctrl+c', function() self:clear() end },
|
{ 'ctrl+c', function() self:clear() end },
|
||||||
|
|||||||
+10
-55
@@ -1,4 +1,3 @@
|
|||||||
local msg = require "mp.msg"
|
|
||||||
local utils = require "mp.utils"
|
local utils = require "mp.utils"
|
||||||
local legacy = mp.command_native_async == nil
|
local legacy = mp.command_native_async == nil
|
||||||
local config = {}
|
local config = {}
|
||||||
@@ -45,55 +44,22 @@ function apply_defaults(info)
|
|||||||
return info
|
return info
|
||||||
end
|
end
|
||||||
|
|
||||||
local function build_directory_string(dir, repo)
|
|
||||||
local str = ""
|
|
||||||
local contents = utils.readdir(dir)
|
|
||||||
if not contents then return msg.error("could not access local repo:", repo) end
|
|
||||||
for _, item in ipairs(contents) do
|
|
||||||
local path = dir..'/'..item
|
|
||||||
if utils.file_info(path).is_dir then
|
|
||||||
if item ~= ".git" then str = str..'/'..build_directory_string(path, repo)..'\n' end
|
|
||||||
else
|
|
||||||
str = str..(path:sub(repo:len()+2))..'\n'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return str
|
|
||||||
end
|
|
||||||
|
|
||||||
local function get_file_list(info)
|
|
||||||
if not info.local_repo then
|
|
||||||
return run({"git", "-C", info.edist, "ls-tree", "-r", "--name-only", "remotes/manager/"..info.branch}).stdout
|
|
||||||
else
|
|
||||||
return build_directory_string(info.local_repo, info.local_repo)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function update(info)
|
function update(info)
|
||||||
info = apply_defaults(info)
|
info = apply_defaults(info)
|
||||||
if not info then return false end
|
if not info then return false end
|
||||||
|
|
||||||
local base = nil
|
local base = nil
|
||||||
|
|
||||||
info.edist = string.match(mp.command_native({"expand-path", info.dest}), "(.-)[/\\]?$")
|
local e_dest = string.match(mp.command_native({"expand-path", info.dest}), "(.-)[/\\]?$")
|
||||||
mkdir(info.edist)
|
mkdir(e_dest)
|
||||||
|
|
||||||
local files = {}
|
local files = {}
|
||||||
|
|
||||||
if info.local_repo then
|
run({"git", "-C", e_dest, "remote", "add", "manager", info.git})
|
||||||
info.local_repo = mp.command_native({"expand-path", info.local_repo})
|
run({"git", "-C", e_dest, "remote", "set-url", "manager", info.git})
|
||||||
if not utils.file_info(info.local_repo) then
|
run({"git", "-C", e_dest, "fetch", "manager", info.branch})
|
||||||
info.local_repo = false
|
|
||||||
msg.warn("local repo not found - falling back to git")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if not info.local_repo then
|
for file in string.gmatch(run({"git", "-C", e_dest, "ls-tree", "-r", "--name-only", "remotes/manager/"..info.branch}).stdout, "[^\r\n]+") do
|
||||||
run({"git", "-C", info.edist, "remote", "add", "manager", info.git})
|
|
||||||
run({"git", "-C", info.edist, "remote", "set-url", "manager", info.git})
|
|
||||||
run({"git", "-C", info.edist, "fetch", "manager", info.branch})
|
|
||||||
end
|
|
||||||
|
|
||||||
for file in string.gmatch(get_file_list(info), "[^\r\n]+") do
|
|
||||||
local l_file = string.lower(file)
|
local l_file = string.lower(file)
|
||||||
if info.whitelist == "" or match(l_file, info.whitelist) then
|
if info.whitelist == "" or match(l_file, info.whitelist) then
|
||||||
if info.blacklist == "" or not match(l_file, info.blacklist) then
|
if info.blacklist == "" or not match(l_file, info.blacklist) then
|
||||||
@@ -118,18 +84,9 @@ function update(info)
|
|||||||
for _, file in ipairs(files) do
|
for _, file in ipairs(files) do
|
||||||
local based = string.sub(file, string.len(base)+1)
|
local based = string.sub(file, string.len(base)+1)
|
||||||
local p_based = parent(based)
|
local p_based = parent(based)
|
||||||
if p_based and not info.flatten_folders then mkdir(info.edist.."/"..p_based) end
|
if p_based and not info.flatten_folders then mkdir(e_dest.."/"..p_based) end
|
||||||
|
local c = string.match(run({"git", "-C", e_dest, "--no-pager", "show", "remotes/manager/"..info.branch..":"..file}).stdout, "(.-)[\r\n]?$")
|
||||||
local c = ""
|
local f = io.open(e_dest.."/"..(info.flatten_folders and file:match("[^/]+$") or based), "w")
|
||||||
if info.local_repo then
|
|
||||||
local source = io.open(info.local_repo..'/'..file)
|
|
||||||
c = source:read("*a")
|
|
||||||
source:close()
|
|
||||||
else
|
|
||||||
c = string.match(run({"git", "-C", info.edist, "--no-pager", "show", "remotes/manager/"..info.branch..":"..file}).stdout, "(.-)[\r\n]?$")
|
|
||||||
end
|
|
||||||
|
|
||||||
local f = io.open(info.edist.."/"..(info.flatten_folders and file:match("[^/]+$") or based), "w")
|
|
||||||
f:write(c)
|
f:write(c)
|
||||||
f:close()
|
f:close()
|
||||||
end
|
end
|
||||||
@@ -150,10 +107,8 @@ function update_all()
|
|||||||
end
|
end
|
||||||
|
|
||||||
for i, info in ipairs(config) do
|
for i, info in ipairs(config) do
|
||||||
print("updating", (info.git:match("([^/]+)%.git$") or info.git).."...")
|
print("update"..i, update(info))
|
||||||
if not update(info) then msg.error("FAILED") end
|
|
||||||
end
|
end
|
||||||
print("all files updated")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
mp.add_key_binding(nil, "manager-update-all", update_all)
|
mp.add_key_binding(nil, "manager-update-all", update_all)
|
||||||
@@ -754,7 +754,7 @@ fallback_server
|
|||||||
想要使用此选项,请在mpv配置文件夹下的 `script-opts`中创建 `uosc_danmaku.conf`文件并自定义如下内容:
|
想要使用此选项,请在mpv配置文件夹下的 `script-opts`中创建 `uosc_danmaku.conf`文件并自定义如下内容:
|
||||||
|
|
||||||
```
|
```
|
||||||
fallback_server= https://api.danmu.icu
|
fallback_server=https://api.danmu.icu
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|||||||
Reference in New Issue
Block a user