From d3748de33d19ef143bb5bbd817501d3860bac31e Mon Sep 17 00:00:00 2001 From: mschuepbach Date: Thu, 28 Mar 2024 21:19:32 +0100 Subject: [PATCH] Test YTMusicAPI --- YouTubeMusic/Plugin.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/YouTubeMusic/Plugin.pm b/YouTubeMusic/Plugin.pm index e57f69f..60f84ed 100644 --- a/YouTubeMusic/Plugin.pm +++ b/YouTubeMusic/Plugin.pm @@ -4,6 +4,11 @@ use strict; use base qw(Slim::Plugin::OPMLBased); +use File::Spec::Functions qw(catdir); +use FindBin qw($Bin); +use lib catdir($Bin, 'Plugins', 'YouTubeMusic', 'lib'); +use YTMusicAPI qw(YTMusic); + use Slim::Utils::Strings qw(string); use Slim::Utils::Prefs; use Slim::Utils::Log; @@ -54,6 +59,10 @@ sub getDisplayName { 'PLUGIN_YOUTUBEMUSIC' } sub mainMenu { my ( $client, $callback, $args ) = @_; + my $yt = YTMusicAPI::YTMusic->new(); + my $song = $yt->get_song("CF1rt_9pdgU"); + my $title = $song->{"videoDetails"}->{"title"}; + $callback->( [ { @@ -62,6 +71,10 @@ sub mainMenu { url => \&myPlaylistHandler, passthrough => [ { count => 2 } ] }, + { + name => $title, + type => 'text' + } ] ); }