TheCactusVert / mpv-sponsorblock

MPV plugin that allow you to skip sponsors while watching YouTube videos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

cp ./target/release/libmpv_sponsorblock.so ~/.config/mpv/scripts/sponsorblock.so
Celluloid

Copy the lib generated to your scripts folder:

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 :

  • sponsor: Part of a video promoting a product or service not directly related to the creator.
  • selfpromo: Promoting a product or service that is directly related to the creator themselves.
  • interaction: Explicit reminders to like, subscribe or interact with them on any paid or free platform(s) (e.g. click on a video).
  • poi_highlight: Used to get to the point or highlight of a video.
  • intro: Segments typically found at the start of a video that include an animation, still frame or clip which are also seen in other videos by the same creator.
  • outro: Segments typically near or at the end of the video when the credits pop up and/or endcards are shown.
  • preview: Collection of clips that show what is coming up in in this video or other videos in a series where all information is repeated later in the video.
  • music_offtopic: Non-music Section segments on videos which feature music as the primary content.
  • filler: Filler Tangent/ Jokes is only for tangential scenes added only for filler or humor that are not required to understand the main content of the video.
  • exclusive_access: When the creator showcases a product, service or location that they've received free or subsidised access to in the video that cannot be completely removed by cuts.

Action Types

Here is a summary :

  • skip: The segment will be skipped by the plugin.
  • mute: The segment will be muted by the plugin. These segments are not skipped! See the documentation here.
  • full: The video is marked as a category you requested. The plugin will only show a message at the start of the video. See the documentation here.
  • poi: Allow you to jump to the highlight of the video. Do not forget to add the associated keybinding and the category poi_highlight. See the documentation here.

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

About

MPV plugin that allow you to skip sponsors while watching YouTube videos

License:MIT License


Languages

Language:Rust 100.0%