Skip to content

Commit

Permalink
Merge pull request #627 from philippe44/8.2-misc
Browse files Browse the repository at this point in the history
allow explodePlaylist to return an OPML object
  • Loading branch information
mherger committed Jun 30, 2021
2 parents 7b89951 + 681d320 commit 3d5fa12
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Slim/Control/Commands.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1424,6 +1424,12 @@ sub playlistXitemCommand {
if ( $handler && $handler->can('explodePlaylist') ) {
$handler->explodePlaylist($client, $path, sub {
my $tracks = shift;
# transform opml list into url array if needed
if (ref $tracks eq 'HASH') {
$tracks = [ map {
$_->{play} || $_->{url}
} @{$tracks->{items}} ];
}
$client->execute(['playlist', $cmd . 'tracks' , 'listRef', $tracks, $fadeIn]);
$request->setStatusDone();
});
Expand Down
4 changes: 4 additions & 0 deletions Slim/Formats/XML.pm
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ sub getFeedAsync {
$handler->explodePlaylist($params->{client}, $url, sub {
my ($tracks) = @_;

# explode playlist might return a full opml list
return $cb->($tracks, $params) if ref $tracks eq 'HASH';

# if not, this is just an array of url
return $cb->({
'type' => 'opml',
'title' => '',
Expand Down

0 comments on commit 3d5fa12

Please sign in to comment.