2014-06-05, 14:59
I'm new to Python and need some help. I don't know if this is right place to post. I will move this thread if necessary.
Ever since I discovered smart playlists I've wanted the option to play two or more smart playlists were one button press. First I tried it by combining smart playlists, but adding random to the playlist messes things up. Then I tried using a .strm file to cqall the playlists, but of course the file extension .xsp is not recognized as a playable file. Then I found that I could launch a smart playlist with python. I thought that would be the solution, but I cann't seem to get it to work, at least not like I'd like.
Using I can launch one playlist. That's cool. The problems come when I try to launch another. I tried:
And ran into problems right away. Of course, XBMC tries to launch each playlist right away (that's what I told it to do. I'm new to python, not programming). Checking the log, I figured out what went wrong, searched the forums, and came up with (borrowed) a partial solution:
That plays the first playlist, puts the entries in the log and then there's a problem. It will not play the second item.
I've spent more than 2 weeks search for an answer. Everything I've tried brings up the same problem. After playing the first smart playlist, XBMC can not open the second. In the log I see:
Error loading Smart playlist special://videoplaylists/playlist2.xsp (failed to read file)
every time it goes to load the second list. I even accidentally wrote a script that started a loop where XBMC tried opening the playlist many times, failing each time.
What am I doing wrong? Since a smart playlist is not an actual playlist, I don't think clearing the playlist will help. Is there some way to reset the player to it's original state, before the first playlist played?
I don't want to developed a long program to do such a simple set of tasks, but I will if I must. Just means lots of homework.
Any help would be appreciated. Thank You.
Ever since I discovered smart playlists I've wanted the option to play two or more smart playlists were one button press. First I tried it by combining smart playlists, but adding random to the playlist messes things up. Then I tried using a .strm file to cqall the playlists, but of course the file extension .xsp is not recognized as a playable file. Then I found that I could launch a smart playlist with python. I thought that would be the solution, but I cann't seem to get it to work, at least not like I'd like.
Using
Code:
xbmc.executebuiltin("PlayMedia(special://videoplaylists/playlist1.xsp)")
Code:
import xbmc
xbmc.executebuiltin("PlayMedia(special://videoplaylists/playlist1.xsp)")
xbmc.executebuiltin("PlayMedia(special://videoplaylists/playlist2.xsp)")
xbmc.executebuiltin("PlayMedia(special://videoplaylists/playlist3.xsp)")
xbmc.executebuiltin("PlayMedia(special://videoplaylists/playlist4.xsp)")
xbmc.executebuiltin("PlayMedia(special://videoplaylists/playlist5.xsp)")
xbmc.executebuiltin("PlayMedia(special://videoplaylists/playlist6.xsp)")
And ran into problems right away. Of course, XBMC tries to launch each playlist right away (that's what I told it to do. I'm new to python, not programming). Checking the log, I figured out what went wrong, searched the forums, and came up with (borrowed) a partial solution:
Code:
import xbmc
xbmc.executebuiltin("PlayMedia(special://videoplaylists/playlist1.xsp)")
class MyPlayer(xbmc.Player) :
def __init__ (self):
xbmc.Player.__init__(self)
def onPlayBackStarted(self):
xbmc.log('********************************************************* CALLBACK: PLAY Item 2')
def onPlayBackEnded(self):
xbmc.sleep(1000)
xbmc.log('********************************************************* CALLBACK: END Item 1')
def onPlayBackStopped(self):
xbmc.log('********************************************************* CALLBACK: STOP Item 1')
xbmc.log('********************************************************* CALLBACK: PLAY Item 2')
xbmc.executebuiltin("PlayMedia(special://videoplaylists/playlist2.xsp)")
player=MyPlayer()
while(1):
xbmc.sleep(500)
That plays the first playlist, puts the entries in the log and then there's a problem. It will not play the second item.
I've spent more than 2 weeks search for an answer. Everything I've tried brings up the same problem. After playing the first smart playlist, XBMC can not open the second. In the log I see:
Error loading Smart playlist special://videoplaylists/playlist2.xsp (failed to read file)
every time it goes to load the second list. I even accidentally wrote a script that started a loop where XBMC tried opening the playlist many times, failing each time.
What am I doing wrong? Since a smart playlist is not an actual playlist, I don't think clearing the playlist will help. Is there some way to reset the player to it's original state, before the first playlist played?
I don't want to developed a long program to do such a simple set of tasks, but I will if I must. Just means lots of homework.
Any help would be appreciated. Thank You.