From f5fd58ad43a0bcd465460124a9011cd9b66ee415 Mon Sep 17 00:00:00 2001 From: Devoxin Date: Wed, 14 Aug 2024 23:04:12 +0100 Subject: [PATCH] Fix advanced options example, add more debug logs --- README.md | 17 +++++++++-------- .../lavalink/youtube/clients/ClientOptions.java | 6 ++++++ .../lavalink/youtube/plugin/ClientProvider.java | 7 ++++++- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 166244b..79b4ed2 100644 --- a/README.md +++ b/README.md @@ -163,14 +163,15 @@ plugins: # WARNING!: UNDERSTANDING WHAT IT DOES. MISCONFIGURATION WILL HINDER YOUTUBE-SOURCE'S ABILITY TO WORK PROPERLY. # Write the names of clients as they are specified under the heading "Available Clients". - WEB: - # Example: Disabling a client's playback capabilities. - playback: false - videoLoading: false # Disables loading of videos for this client. A client may still be used for playback even if this is set to 'false'. - TVHTML5EMBEDDED: - # Example: Configuring a client to exclusively be used for video loading and playback. - playlistLoading: false # Disables loading of playlists and mixes. - searching: false # Disables the ability to search for videos. + clientOptions: + WEB: + # Example: Disabling a client's playback capabilities. + playback: false + videoLoading: false # Disables loading of videos for this client. A client may still be used for playback even if this is set to 'false'. + TVHTML5EMBEDDED: + # Example: Configuring a client to exclusively be used for video loading and playback. + playlistLoading: false # Disables loading of playlists and mixes. + searching: false # Disables the ability to search for videos. ``` ## Available Clients diff --git a/common/src/main/java/dev/lavalink/youtube/clients/ClientOptions.java b/common/src/main/java/dev/lavalink/youtube/clients/ClientOptions.java index 612751d..1f96fa7 100644 --- a/common/src/main/java/dev/lavalink/youtube/clients/ClientOptions.java +++ b/common/src/main/java/dev/lavalink/youtube/clients/ClientOptions.java @@ -48,4 +48,10 @@ public ClientOptions copy() { options.setSearching(this.searching); return options; } + + @Override + public String toString() { + return String.format("ClientOptions{playback=%s, playlistLoading=%s, videoLoading=%s, searching=%s}", + playback, playlistLoading, videoLoading, searching); + } } diff --git a/plugin/src/main/java/dev/lavalink/youtube/plugin/ClientProvider.java b/plugin/src/main/java/dev/lavalink/youtube/plugin/ClientProvider.java index 198eebc..c9b67f1 100644 --- a/plugin/src/main/java/dev/lavalink/youtube/plugin/ClientProvider.java +++ b/plugin/src/main/java/dev/lavalink/youtube/plugin/ClientProvider.java @@ -46,7 +46,12 @@ static Client getClientByName(ClientReference[] enumValues, return Arrays.stream(enumValues) .filter(it -> it.getName().equals(name)) .findFirst() - .map(ref -> ref.getClient(provider.getOptionsForClient(name))) + .map(ref -> { + ClientOptions options = provider.getOptionsForClient(name); + + log.debug("Initialising client {} with options {}", ref.getName(), options); + return ref.getClient(options); + }) .orElse(null); }