diff --git a/plugin/API.pm b/plugin/API.pm
index 06aa2e2..3f2e411 100644
--- a/plugin/API.pm
+++ b/plugin/API.pm
@@ -57,14 +57,33 @@ sub getCategories {
sub getVideoDetails {
my ( $class, $cb, $ids ) = @_;
+ # topicDetails for genre
_call('videos', {
- part => 'snippet,contentDetails',
+ part => 'snippet,contentDetails,topicDetails',
id => $ids,
# cache video details a bit longer
_cache_ttl => 7 * 86400,
}, $cb);
}
+# single-shot fetch of the first N items of a playlist, no paging. used by
+# the music-playlist filter where we just want a small sample to classify.
+# pass extra (eg. access_token + _noKey) to read private playlists.
+sub getPlaylistSample {
+ my ( $class, $cb, $playlistId, $max, $extra ) = @_;
+
+ my %args = (
+ part => 'snippet',
+ playlistId => $playlistId,
+ maxResults => $max || 5,
+ _noRegion => 1,
+ _cache_ttl => 86400,
+ %{ $extra || {} },
+ );
+
+ _call('playlistItems', \%args, $cb);
+}
+
sub _pagedCall {
my ( $method, $args, $cb ) = @_;
my $wantedItems = $args->{_quantity} || $prefs->get('max_items');
diff --git a/plugin/HTML/EN/plugins/YouTube/settings/basic.html b/plugin/HTML/EN/plugins/YouTube/settings/basic.html
index 61638d1..15c0380 100644
--- a/plugin/HTML/EN/plugins/YouTube/settings/basic.html
+++ b/plugin/HTML/EN/plugins/YouTube/settings/basic.html
@@ -159,6 +159,14 @@
[% END %]
+ [% WRAPPER setting title="PLUGIN_YOUTUBE_MUSICONLY" desc="PLUGIN_YOUTUBE_MUSICONLY_DESC" %]
+
+ [% END %]
+
+ [% WRAPPER setting title="PLUGIN_YOUTUBE_RICHMETA" desc="PLUGIN_YOUTUBE_RICHMETA_DESC" %]
+
+ [% END %]
+
[% WRAPPER setting title="PLUGIN_YOUTUBE_MAXITEMS" desc="PLUGIN_YOUTUBE_MAXITEMS_DESC" %]
[% END %]
diff --git a/plugin/Metadata.pm b/plugin/Metadata.pm
new file mode 100644
index 0000000..52f2c7e
--- /dev/null
+++ b/plugin/Metadata.pm
@@ -0,0 +1,153 @@
+package Plugins::YouTube::Metadata;
+
+# helpers for v3 video items. v3 has no album/year/artist fields,
+# we dig artist/album/year out of the description block when YT
+# Music auto-generated it.
+
+use strict;
+use warnings;
+
+use Slim::Utils::Log;
+
+my $log = logger('plugin.youtube');
+
+use constant CATEGORY_MUSIC => 10;
+
+# "Artist - Title" split. returns (artist, title, fulltitle) or
+# (undef, $title, undef).
+sub parseDashTitle {
+ my ($title) = @_;
+ return (undef, $title, undef) unless defined $title;
+
+ if ($title =~ /^(.+?)\s+-\s+(.+)$/) {
+ return ($1, $2, $title);
+ }
+ return (undef, $title, undef);
+}
+
+# the auto-generated YT Music "Provided to YouTube by..." block.
+# shape:
+# Provided to YouTube by
+# . .
+#
+# . YYYY