DRSchlaubi / Sponsorblock-Plugin

Lavalink SponsorBlock Plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SponsorBlock-Plugin

A Lavalink plugin to skip SponsorBlock segments in YouTube videos and provide information about chapters

Installation

Warning This plugin requires Lavalink v4 or higher

To install this plugin either download the latest release and place it into your plugins folder or add the following into your application.yml

lavalink:
  plugins:
    - dependency: "com.github.topi314.sponsorblock:sponsorblock-plugin:x.x.x" # replace x.x.x with the latest release tag!
      repository: "https://maven.topi.wtf/releases"

Snapshot builds are available in https://maven.topi.wtf/snapshots with the short commit hash as the version

Usage

Get Categories

GET /v4/sessions/{sessionId}/players/{guildId}/sponsorblock/categories

Response:

[
  "sponsor",
  "selfpromo"
]

Put Categories

PUT /v4/sessions/{sessionId}/players/{guildId}/sponsorblock/categories

Request:

[
  "sponsor",
  "selfpromo"
]

Delete Categories

DELETE /v4/sessions/{sessionId}/players/{guildId}/sponsorblock/categories

  • sponsor
  • selfpromo
  • interaction
  • intro
  • outro
  • preview
  • music_offtopic
  • filler

There are also two new events:

SegmentsLoaded

which is fired when the segments for a track are loaded

{
  "op": "event",
  "type": "SegmentsLoaded",
  "guildId": "...",
  "segments": [
    {
      "category": "...",
      "start": 0, // in milliseconds
      "end": 3000 // in milliseconds
    }
  ]
}

SegmentSkipped

which is fired when a segment is skipped

{
  "op": "event",
  "type": "SegmentSkipped",
  "guildId": "...",
  "segment": {
    "category": "...",
    "start": 0, // in milliseconds
    "end": 3000 // in milliseconds
  }
}

ChaptersLoaded

which is fired when the chapters for a track are loaded

{
  "op": "event",
  "type": "ChaptersLoaded",
  "guildId": "...",
  "chapters": [
    {
      "name": "Prelude",
      "start": 0, // in milliseconds
      "end": 0, // in milliseconds
      "duration": "0" // in milliseconds
    }
  ]}

ChapterStarted

which is fired when a new Chapter starts

{
  "op": "event",
  "type": "ChapterStarted",
  "guildId": "...",
  "chapter": {
    "name": "Prelude",
    "start": 0, // in milliseconds
    "end": 0,// in milliseconds
    "duration": "0" // in milliseconds
  }
}

Example

An example implementation in Go can be found here

About

Lavalink SponsorBlock Plugin

License:Apache License 2.0


Languages

Language:Kotlin 50.5%Language:Java 49.5%