Skip to content

Commit

Permalink
Merge pull request #71 from michaelherger/philippe
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelherger authored Apr 3, 2024
2 parents 04bbc94 + 136a294 commit 7dd217e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion InfoMenu.pm
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ sub menuBrowse {
} elsif ( $type eq 'playlist' ) {

Plugins::TIDAL::Plugin::getAPIHandler($client)->playlist(sub {
my $feed = Plugins::TIDAL::Plugin::_renderItem( $client, $_[0] ) if $_[0];
my $feed = [ map { Plugins::TIDAL::Plugin::_renderItem( $client, $_) } @{$_[0]} ] if $_[0];
# we don't need to memorize the feed as we won't redescend into it
$cb->($feed);
}, $id );
Expand Down
24 changes: 21 additions & 3 deletions Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,8 @@ sub _renderPlaylist {
line1 => $item->{title},
line2 => join(', ', map { $_->{name} } @{$item->{promotedArtists} || []}),
favorites_url => 'tidal://playlist:' . $item->{uuid},
play => 'tidal://playlist:' . $item->{uuid},
# see note on album
# play => 'tidal://playlist:' . $item->{uuid},
type => 'playlist',
url => \&getPlaylist,
image => Plugins::TIDAL::API->getImageUrl($item),
Expand All @@ -834,6 +835,9 @@ sub _renderPlaylist {
id => $item->{uuid},
},
},
play => _makeAction('play', 'playlist', $item->{uuid}),
add => _makeAction('add', 'playlist', $item->{uuid}),
insert => _makeAction('insert', 'playlist', $item->{uuid}),
},
};
}
Expand Down Expand Up @@ -863,8 +867,8 @@ sub _renderAlbum {
url => \&getAlbum,
image => Plugins::TIDAL::API->getImageUrl($item, 'usePlaceholder'),
passthrough => [{ id => $item->{id} }],
# we need a 'play' for M(ore) to appear
play => 'tidal://album:' . $item->{id},
# we need a 'play' for M(ore) to appear or set play, add and insert actions
# play => 'tidal://album:' . $item->{id},
itemActions => {
info => {
command => ['tidal_info', 'items'],
Expand All @@ -873,6 +877,9 @@ sub _renderAlbum {
id => $item->{id},
},
},
play => _makeAction('play', 'album', $item->{id}),
add => _makeAction('add', 'album', $item->{id}),
insert => _makeAction('insert', 'album', $item->{id}),
},
};
}
Expand Down Expand Up @@ -1058,6 +1065,17 @@ sub _renderCategory {
};
}

sub _makeAction {
my ($action, $type, $id) = @_;
return {
command => ['tidal_browse', 'playlist', $action],
fixedParams => {
type => $type,
id => $id,
},
};
}

sub getAPIHandler {
my ($client) = @_;

Expand Down

0 comments on commit 7dd217e

Please sign in to comment.