Skip to content

viztea/track-encoder-plugin

Repository files navigation

Track Encoder

A lavalink plugin for encoding lavaplayer tracks that are usually returned by /v4/loadtracks (or /v4/decodetrack).

API

This plugin offers two endpoints: /v4/encodetrack and /v4/encodetracks, the latter is available for encoding multiple track objects at once.

Track Model

The basic track structure should look something like

{
    "info": {
        "identifier": "3w3y8KPTfNeOKPiqUTakBh",
        "author": "Bruno Mars",
        "length": 233478,
        "isStream": false,
        "title": "Locked out of Heaven",
        "uri": "https://open.spotify.com/track/3w3y8KPTfNeOKPiqUTakBh",
        "sourceName": "spotify",
        "position": 0,
        "artworkUrl": "https://i.scdn.co/image/ab67616d0000b273926f43e7cce571e62720fd46",
        "isrc": "USAT21203287"
    }
}

In case you need to encode source-specific information, you may either provide a "plugin" preset or a list of source info fields to encode.

Note

Currently, the only available presets are lavasrc. However, you may provide custom presets in your application.yml file.

Custom plugin presets

config in your application.yml

plugins:
  trackEncoder:
    presets:
      - name: http
        fields:
          - name: probeInfo
            type: TEXT

request body for /encodetrack(s)

{
    "plugin": "http",
    "pluginInfo": {
        "probeInfo": "mp3"
    }
}
{
    "plugin": "lavasrc",
    "pluginInfo": {
        "albumName": "...",
        "albumUrl": "...",
        "artistUrl": "...",
        "artistArtworkUrl": "...",
        "previewUrl": "...",
        "isPreview": false
    },
    // or
    "sourceInfo": [
        {
            "type": "TEXT",
            "value": "..."
        }
    ]
}

Note

Supported field types: NULLABLE_TEXT, BOOL, LONG, FLOAT, DOUBLE, or TEXT

Usage

Go to the releases page and download the plugin jar or place this in your application.yml and replace X.Y.Z with the current version displayed in the badge.

lavalink:
  plugins:
    - dependency: "com.github.viztea:track-encoder-plugin:X.Y.Z"
      repository: "https://jitpack.io"

POST /v4/encodetrack

Request

{
    // track object
}

Response:

{
    "value": "encoded track"
}

POST /v4/encodetracks

Request

[
    {
        // track object
    }
]
{
    "value": [
        "<encoded track>"
    ]
}

About

A lavalink plugin for creating encoded tracks

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published

Languages