From 3c25c3a1d8035d91a902c4a9f5d06caf3b6ad710 Mon Sep 17 00:00:00 2001 From: Daniel Kucera Date: Fri, 29 Mar 2024 14:58:46 +0100 Subject: [PATCH] use uri2addon for yt video parsing --- .../org/xbmc/kore/utils/PluginUrlUtils.java | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/org/xbmc/kore/utils/PluginUrlUtils.java b/app/src/main/java/org/xbmc/kore/utils/PluginUrlUtils.java index 002abda59..35c69142a 100644 --- a/app/src/main/java/org/xbmc/kore/utils/PluginUrlUtils.java +++ b/app/src/main/java/org/xbmc/kore/utils/PluginUrlUtils.java @@ -41,29 +41,13 @@ public class PluginUrlUtils { public static String toDefaultYouTubePluginUrl(Uri playUri) { String host = playUri.getHost(); - if (host.endsWith("youtube.com")) { - String videoId = playUri.getQueryParameter("v"); - String playlistId = playUri.getQueryParameter("list"); + if (host.endsWith("youtube.com") || host.endsWith("youtu.be")) { Uri.Builder pluginUri = new Uri.Builder() .scheme("plugin") .authority("plugin.video.youtube") - .path("play/"); - boolean valid = false; - if (videoId != null) { - valid = true; - pluginUri.appendQueryParameter("video_id", videoId); - } - if (playlistId != null) { - valid = true; - pluginUri.appendQueryParameter("playlist_id", playlistId) - .appendQueryParameter("order", "default"); - } - if (valid) { - return pluginUri.build().toString(); - } - } else if (host.endsWith("youtu.be")) { - return "plugin://plugin.video.youtube/play/?video_id=" - + playUri.getLastPathSegment(); + .path("uri2addon/"). + appendQueryParameter("uri", playUri.toString()); + return pluginUri.toString(); } return null;