TheCactusVert / mpv-sponsorblock

MPV plugin that allow you to skip sponsors while watching YouTube videos
MIT License
49 stars 3 forks source link
mpv mpv-script rust sponsorblock youtube

SponsorBlock plugin for MPV

A port of SponsorBlock for MPV (or Celluloid) written in Rust.

Questions

Can I write my own plugin in Rust ?

Yes! Just follow the example here and you will be ready.

Build

Build the plugin:

cargo build --release --locked

Installation

Linux

MPV Copy the lib generated to your `scripts` folder: ```bash cp ./target/release/libmpv_sponsorblock.so ~/.config/mpv/scripts/sponsorblock.so ```
Celluloid Copy the lib generated to your `scripts` folder: ```bash cp ./target/release/libmpv_sponsorblock.so ~/.config/celluloid/scripts/sponsorblock.so ```

Windows

Installation for Windows is available : https://mpv.io/manual/stable/#c-plugins. I don't use Windows. Feel free to make a pull request.

Configuration

Copy the exemple configuration file sponsorblock.toml into your MPV (not Celluloid) folder:

cp ./sponsorblock.toml ~/.config/mpv/sponsorblock.toml

If no configuration file is found, only the sponsors segments will be skipped as specified by the API.

A segment is the combination of a category and an action type.

Categories

Official SponsorBlock documentation on categories can be found here.

Here is a summary :

Action Types

Here is a summary :

Keybindings

All the keybinds are for exemple, you can change the shortcut.

Toggle

You can toggle on and off the plugin by adding this line to input.conf:

alt+t script-binding "sponsorblock/toggle"

Highlight

You can add a binding to jump to the highlight of the video by adding this line to input.conf:

alt+p script-binding "sponsorblock/poi"

You also need to add these values to their associated keys in your sponsorblock.toml:

categories = ["poi_highlight"]
action_types = ["poi"]

Usage

Play a YouTube video and segments you chose in the configuration file will be skipped or muted.

If the video is entirely labeled as a category it will be shown at startup : celluloid