2011-08-08, 21:56
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:
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:
On the other hand, if I select the playlist in the library and press P, it works fine. Here's what I get then:
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
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