diff --git a/plugins/youtube-plugin-1.12.0.jar b/plugins/youtube-plugin-c9e52a450ac8fc47aee537f62ff293642d17cff5.jar similarity index 93% rename from plugins/youtube-plugin-1.12.0.jar rename to plugins/youtube-plugin-c9e52a450ac8fc47aee537f62ff293642d17cff5.jar index 1a6a09b..72472ea 100644 Binary files a/plugins/youtube-plugin-1.12.0.jar and b/plugins/youtube-plugin-c9e52a450ac8fc47aee537f62ff293642d17cff5.jar differ diff --git a/update-plugin.sh b/update-plugin.sh new file mode 100755 index 0000000..2999c7d --- /dev/null +++ b/update-plugin.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# Exit immediately if a command exits with a non-zero status. +set -e + +# Define variables +PLUGIN_DIR="./plugins" +REPO_URL="https://maven.lavalink.dev/snapshots/dev/lavalink/youtube/youtube-plugin" +METADATA_URL="${REPO_URL}/maven-metadata.xml" +ARTIFACT_ID="youtube-plugin" + +echo "Fetching latest snapshot version..." + +# Fetch metadata and extract the latest snapshot version using grep and sed +# Use curl with -sS for silent operation but show errors +# Use grep to find the tag, then sed to extract the content +LATEST_VERSION=$(curl -sS "$METADATA_URL" | grep '' | sed -e 's/.*\(.*\)<\/latest>.*/\1/') + +if [ -z "$LATEST_VERSION" ]; then + echo "Error: Could not determine the latest snapshot version." + exit 1 +fi + +echo "Latest snapshot version: $LATEST_VERSION" + +# Construct the JAR filename and download URL +JAR_FILENAME="${ARTIFACT_ID}-${LATEST_VERSION}.jar" +DOWNLOAD_URL="${REPO_URL}/${LATEST_VERSION}/${JAR_FILENAME}" + +# Create the plugins directory if it doesn't exist +mkdir -p "$PLUGIN_DIR" + +# Remove any existing youtube-plugin JARs to avoid conflicts +echo "Removing old plugin versions from $PLUGIN_DIR..." +rm -f "$PLUGIN_DIR"/youtube-plugin-*.jar + +# Download the latest snapshot JAR +echo "Downloading $JAR_FILENAME from $DOWNLOAD_URL..." +curl -L -o "$PLUGIN_DIR/$JAR_FILENAME" "$DOWNLOAD_URL" + +# Verify download +if [ ! -f "$PLUGIN_DIR/$JAR_FILENAME" ]; then + echo "Error: Failed to download the plugin JAR." + exit 1 +fi + +echo "Successfully downloaded $JAR_FILENAME to $PLUGIN_DIR" +echo "Make sure to restart your Lavalink container for the changes to take effect." + +exit 0