MCPcopy Index your code
hub / github.com/akiirui/mpv-handler

github.com/akiirui/mpv-handler @v0.4.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.4.2 ↗ · + Follow
35 symbols 71 edges 6 files 19 documented · 54%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

English | 簡體中文 | 繁體中文

mpv handler

一個 mpv 的協議處理程序,使用 Rust 編寫。

使用 mpvyt-dlp 播放網站上的視頻與音樂。

請配合用戶腳本使用:

play-with-mpv

重大變更

v0.4.0

爲了避免與 mpv 所提供的 mpv:// 協議衝突。

mpv://...

mpv protocol. This is used for starting mpv from URL handler. The protocol is stripped and the rest is passed to the player as a normal open argument. Only safe network protocols are allowed to be opened this way.

協議 mpv://mpv-debug:// 已棄用, 請使用 mpv-handler://mpv-handler-debug://.

需要手動干預

Windows

運行 handler-uninstall.bat 卸載已棄用的協議, 然後運行 handler-install.bat 安裝新的協議.

Linux

如果你是手動安裝的,請重新執行一遍手動安裝流程。

協議

協議名

  • mpv-handler: 在沒有命令行窗口的情況下運行 mpv-handler
  • mpv-handler-debug: 在有命令行窗口的情況下運行 mpv-handler 以便於查看輸出和錯誤

插件 / Plugins

  • play: 使用 mpv 播放視頻

編碼數據 / Encoded Data

使用 URL 安全的 base64 編碼網址或標題。

替換 /_, +- 並且刪除填充的 =

示例 (JavaScript):

let data = btoa("https://www.youtube.com/watch?v=Ggkn2f5e-IU");
let safe = data.replace(/\//g, "_").replace(/\+/g, "-").replace(/\=/g, "");

參數 / Parameters (可選)

cookies  = [ www.domain.com.txt ]
profile  = [ default, low-latency, etc... ]
quality  = [ 2160p, 1440p, 1080p, 720p, 480p, 360p ]
v_codec  = [ av01, vp9, h265, h264 ]
v_title  = [ Encoded Title ]
subfile  = [ Encoded URL ]
startat  = [ Seconds (float) ]
referrer = [ Encoded URL ]

安裝

Linux

Arch Linux

mpv-handler mpv-handler-git

手動安裝

  1. 下載 最新的 Linux 壓縮包
  2. 解壓縮壓縮包
  3. 複製 mpv-handler$HOME/.local/bin
  4. 複製 mpv-handler.desktop$HOME/.local/share/applications/
  5. 複製 mpv-handler-debug.desktop$HOME/.local/share/applications/
  6. 爲二進制文件設置可執行權限

  7. $ chmod +x $HOME/.local/bin/mpv-handler

  8. 註冊 xdg-mime(感謝 linuxuprising 的提醒)

  9. $ xdg-mime default mpv-handler.desktop x-scheme-handler/mpv-handler $ xdg-mime default mpv-handler-debug.desktop x-scheme-handler/mpv-handler-debug

  10. 添加 $HOME/.local/bin 到環境變量 PATH

  11. 可選: 複製 config.toml$HOME/.config/mpv-handler/config.toml 並配置

Windows

Windows 用戶目前只能手動安裝。

手動安裝

  1. 下載 最新的 Windows 壓縮包
  2. 解壓縮檔案到你想要的位置
  3. 運行 handler-install.bat 註冊協議處理程序
  4. 編輯 config.toml 設置 mpvytdl 的路徑

配置

mpv = "/usr/bin/mpv"
# 可選,類型:字符串
# mpv 可執行文件的路徑
# 默認值:
# - Linux: mpv
# - Windows: mpv.com

ytdl = "/usr/bin/yt-dlp"
# 可選,類型:字符串
# yt-dlp 可執行文件的路徑

proxy = "http://example.com:8080"
# 可選,類型:字符串
# HTTP(S) 代理服務器的地址

# 對於 Windows 用戶:
#   - 路徑格式可以是 "C:\\folder\\some.exe",也可以是 "C:/folder/some.exe"
#   - 路徑的目標是可執行二進制文件,而不是目錄

Core symbols most depended-on inside this repo

realpath
called by 4
src/config.rs
formats
called by 4
src/plugins/play.rs
get_config_dir
called by 3
src/config.rs
decode_txt
called by 3
src/protocol.rs
decode_url
called by 3
src/protocol.rs
profile
called by 2
src/plugins/play.rs
v_title
called by 2
src/plugins/play.rs
subfile
called by 2
src/plugins/play.rs

Shape

Function 28
Enum 3
Class 2
Method 2

Languages

Rust100%

Modules by API surface

src/plugins/play.rs16 symbols
src/config.rs7 symbols
src/protocol.rs6 symbols
src/main.rs4 symbols
src/plugins/mod.rs1 symbols
src/error.rs1 symbols

For agents

$ claude mcp add mpv-handler \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page