PlayMedia() won't handle album XSP
#1
I'm trying to assign a keyboard shortcut to a smart playlist that plays random albums. The playlist works when I choose it from the library, but not when assigned to a key. I think it's a bug in PlayMedia() function.

XBMC 10.1. Built on Mar 8 2011 (Git:e9e9099, compiler 1500). Windows 7.
Smart playlist:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="albums">
    <name>Random albums</name>
    <match>all</match>
    <rule field="none" operator="contains"></rule>
    <limit>10</limit>
    <order direction="ascending">random</order>
</smartplaylist>

Nice and simple. In my keyboard.xml I have the F2 key assigned to the command:
XBMC.PlayMedia(special://profile/playlists/music/Random-albums.xsp)

When I press the F2 key, nothing happens. Here's what I get in the log file:
Code:
21:10:59 T:85484 M:1099210752   DEBUG: CApplication::OnKey: 61553 pressed, action is XBMC.PlayMedia(special://profile/playlists/music/Random-albums.xsp)
21:10:59 T:85484 M:1099198464   DEBUG: CMusicDatabase::GetAlbumsByWhere query: select * from albumview WHERE ('1')ORDER BY RANDOM() LIMIT 10
21:10:59 T:85484 M:1099149312   DEBUG: CApplication::ProcessAndStartPlaylist(Random albums, 0)
21:10:59 T:85484 M:1099141120   DEBUG: CPlayerCoreFactory::GetPlayers(musicdb://3/375/)
[snip]
21:10:59 T:85484 M:1099108352   ERROR: CAudioDecoder: Unable to Init Codec while loading file musicdb://3/375/

On the other hand, if I select the playlist in the library and press P, it works fine. Here's what I get then:
Code:
21:11:03 T:85484 M:1099345920   DEBUG: CApplication::OnKey: 61520 pressed, action is Play
21:11:03 T:85484 M:1099341824   DEBUG: CGUIMediaWindow::GetDirectory (special://profile/playlists/music/Random-albums.xsp)
21:11:03 T:85484 M:1099341824   DEBUG:   ParentPath = [special://musicplaylists/]
21:11:03 T:85484 M:1099337728   DEBUG: CMusicDatabase::GetAlbumsByWhere query: select * from albumview WHERE ('1')ORDER BY RANDOM() LIMIT 10
21:11:03 T:14056 M:1099304960   DEBUG: thread start, auto delete: 0
21:11:03 T:14056 M:1099268096   DEBUG: Thread 14056 terminating
21:11:03 T:85484 M:1099280384   DEBUG: CGUIMediaWindow::GetDirectory (musicdb://3/209/)
21:11:03 T:85484 M:1099280384   DEBUG:   ParentPath = [special://musicplaylists/]
21:11:03 T:83964 M:1099276288   DEBUG: CMusicDatabase::GetSongsByWhere query = select * from songview where (idAlbum=209)
21:11:03 T:83964 M:1099104256   DEBUG: CMusicDatabase::GetSongsByWhere(where (idAlbum=209) ) - took 28 ms
[snip]
21:11:04 T:85484 M:1098772480   DEBUG: CPlayerCoreFactory::GetPlayers(musicdb://3/209/1355.mp3)

My analysis is that when pressing play, the smart playlist returns an album which is then opened via GetDirectory and the first file sent to the player. However, when using PlayMedia(), the smart playlist returns an album which is sent directly to the player, which then fails because it can only play files, not albums.

Is this a bug in PlayMedia() or should I be using a different function? I've checked the documentation and forums extensively but didn't find a solution. So I'm reporting it here Smile
Reply
#2
Does PlayMedia() allow you to play a directory rather than a smartplaylist? If so, then I suggest we just remove the special-casing for the smartplaylist (which is just a directory as far as XBMC is concerned).
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
Yes, if the second argument is 'isdir' then it should treat it as a directory. However it makes no difference in my case:
Code:
07:55:48 T:57224 M:1411076096   DEBUG: CApplication::OnKey: 61553 pressed, action is XBMC.PlayMedia(special://profile/playlists/music/Random-albums.xsp,isdir)
07:55:48 T:57224 M:1410998272   DEBUG: CMusicDatabase::GetAlbumsByWhere query: select * from albumview WHERE ('1')ORDER BY RANDOM() LIMIT 10
07:55:48 T:57224 M:1410899968   DEBUG: CApplication::ProcessAndStartPlaylist(Random albums, 0)
07:55:48 T:57224 M:1410895872   DEBUG: CPlayerCoreFactory::GetPlayers(musicdb://3/371/)
As before, it's sending the album directly to the player, instead of a file.
From looking at Builtins.cpp around line 533, it seems like the directory-handling code only applies to video playlists. Perhaps that's the problem?
Reply
#4
*bump*
I tried routing around the problem by creating a smartplaylist that encapsulates this one and returns tracks instead of albums.
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="songs">
    <name>Test</name>
    <match>all</match>
    <rule field="playlist" operator="is">Random-albums.xsp</rule>
    <limit>100</limit>
</smartplaylist>
I was hoping that it would call the random-albums playlist which would return 10 random albums, and then generate a list of the tracks inside those albums. But instead, it generates a list of all tracks, sorted alphabetically. If I don't limit it to 100, it returns my entire library. So no luck there.
Reply
#5
Add a ticket on trac. Attach the playlist. cc me and maybe vdrfan.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#6
No problem. Ticket #11830: PlayMedia() can't handle album smartplaylists
Reply
#7
And it's fixed! With the latest nightly I can press F2 and get a bunch of random albums queued up. If I don't feel like listening to an album, I can skip it by pressing F2 again and getting a new one. I've seen others on this forum asking for this ability, and now we have it Smile
Thanks guys! This is why I returned to XBMC from Boxee.
Reply

Logout Mark Read Team Forum Stats Members Help
PlayMedia() won't handle album XSP0