Test YTMusicAPI
All checks were successful
release / release-plugins (push) Successful in 27s

This commit is contained in:
mschuepbach
2024-03-28 21:19:32 +01:00
parent 2b07c5cb51
commit d3748de33d

View File

@@ -4,6 +4,11 @@ use strict;
use base qw(Slim::Plugin::OPMLBased); 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::Strings qw(string);
use Slim::Utils::Prefs; use Slim::Utils::Prefs;
use Slim::Utils::Log; use Slim::Utils::Log;
@@ -54,6 +59,10 @@ sub getDisplayName { 'PLUGIN_YOUTUBEMUSIC' }
sub mainMenu { sub mainMenu {
my ( $client, $callback, $args ) = @_; my ( $client, $callback, $args ) = @_;
my $yt = YTMusicAPI::YTMusic->new();
my $song = $yt->get_song("CF1rt_9pdgU");
my $title = $song->{"videoDetails"}->{"title"};
$callback->( $callback->(
[ [
{ {
@@ -62,6 +71,10 @@ sub mainMenu {
url => \&myPlaylistHandler, url => \&myPlaylistHandler,
passthrough => [ { count => 2 } ] passthrough => [ { count => 2 } ]
}, },
{
name => $title,
type => 'text'
}
] ]
); );
} }