def playCommand(cmd): try: cmd = favourite.tidy(cmd) #if a 'Super Favourite' favourite just do it if ADDONID in cmd: return xbmc.executebuiltin(cmd) if cmd.startswith('RunScript'): #workaround bug in Frodo that can cause lock-up #when running a script favourite if FRODO: xbmc.executebuiltin('ActivateWindow(Home)') if isPlaylist(cmd): if PLAY_PLAYLISTS: return playPlaylist(cmd) if 'ActivateWindow' in cmd: return activateWindowCommand(cmd) xbmc.executebuiltin(cmd) except Exception, e: utils.log('Error in playCommand') utils.log('Command: %s' % cmd) utils.log('Error: %s' % str(e))
def playCommand(cmd): try: cmd = favourite.tidy(cmd) #if a 'Super Favourite' favourite just do it if ADDONID in cmd: return xbmc.executebuiltin(cmd) #if in contentMode just do it if contentMode: xbmc.executebuiltin('ActivateWindow(Home)') #some items don't play nicely if launched from wrong window if cmd.lower().startswith('activatewindow'): cmd = cmd.replace('")', '",return)') #just in case return is missing return xbmc.executebuiltin(cmd) if cmd.startswith('RunScript'): #workaround bug in Frodo that can cause lock-up #when running a script favourite if FRODO: xbmc.executebuiltin('ActivateWindow(Home)') if isPlaylist(cmd): if PLAY_PLAYLISTS: return playPlaylist(cmd) if 'ActivateWindow' in cmd: return activateWindowCommand(cmd) xbmc.executebuiltin(cmd) except Exception, e: utils.log('Error in playCommand') utils.log('Command: %s' % cmd) utils.log('Error: %s' % str(e))
def playCommand(originalCmd, contentMode=False): try: xbmc.executebuiltin('Dialog.Close(busydialog)') #Isengard fix cmd = favourite.tidy(originalCmd) #if a 'Super Favourite' favourite just do it #if ADDONID in cmd: # return xbmc.executebuiltin(cmd) #if in contentMode just do it if contentMode: xbmc.executebuiltin( 'ActivateWindow(Home)' ) #some items don't play nicely if launched from wrong window if cmd.lower().startswith('activatewindow'): cmd = cmd.replace('")', '",return)') #just in case return is missing return xbmc.executebuiltin(cmd) if cmd.startswith('RunScript'): #workaround bug in Frodo that can cause lock-up #when running a script favourite if FRODO: xbmc.executebuiltin('ActivateWindow(Home)') if PLAY_PLAYLISTS: import playlist if playlist.isPlaylist(cmd): return playlist.play(cmd) if 'ActivateWindow' in cmd: return activateWindowCommand(cmd) if 'PlayMedia' in cmd: return playMedia(originalCmd) if cmd.lower().startswith('executebuiltin'): cmd = cmd.replace('"', '') cmd = cmd.lower() cmd = cmd.replace('"', '') cmd = cmd.replace('executebuiltin(', '') if cmd.endswith('))'): cmd = cmd[:-1] if cmd.endswith(')') and '(' not in cmd: cmd = cmd[:-1] xbmc.executebuiltin(cmd) except Exception, e: utils.log('Error in playCommand') utils.log('Command: %s' % cmd) utils.log('Error: %s' % str(e))
def playCommand(originalCmd, contentMode=False): try: xbmc.executebuiltin('Dialog.Close(busydialog)') #Isengard fix cmd = favourite.tidy(originalCmd) if cmd.lower().startswith('executebuiltin'): cmd = cmd.replace('"', '') cmd = cmd.lower() cmd = cmd.replace('"', '') cmd = cmd.replace('executebuiltin(', '') if cmd.endswith('))'): cmd = cmd[:-1] if cmd.endswith(')') and '(' not in cmd: cmd = cmd[:-1] #if a 'Super Favourite' favourite just do it #if ADDONID in cmd: # return xbmc.executebuiltin(cmd) #if in contentMode just do it if contentMode: xbmc.executebuiltin('ActivateWindow(Home)') #some items don't play nicely if launched from wrong window if cmd.lower().startswith('activatewindow'): cmd = cmd.replace('")', '",return)') #just in case return is missing return xbmc.executebuiltin(cmd) if cmd.startswith('RunScript'): #workaround bug in Frodo that can cause lock-up #when running a script favourite if FRODO: xbmc.executebuiltin('ActivateWindow(Home)') if PLAY_PLAYLISTS: import playlist if playlist.isPlaylist(cmd): return playlist.play(cmd) if 'ActivateWindow' in cmd: return activateWindowCommand(cmd) if 'PlayMedia' in cmd: return playMedia(originalCmd) xbmc.executebuiltin(cmd) except Exception, e: utils.log('Error in playCommand') utils.log('Command: %s' % cmd) utils.log('Error: %s' % str(e))
def playMedia(original): import re cmd = favourite.tidy(original) #.replace(',', '') #remove spurious commas processParentCommand(cmd) try: mode = int(favourite.getOption(original, 'mode')) except: mode = 0 if mode == PLAYMEDIA_MODE: xbmc.executebuiltin(cmd) return plugin = re.compile('"(.+?)"').search(cmd).group(1) if mode == SHOWPICTURE_MODE: xbmc.executebuiltin('ShowPicture(%s)' % plugin) return if len(plugin) < 1: xbmc.executebuiltin(cmd) return if mode == ACTIVATEWINDOW_MODE: try: winID = int(favourite.getOption(original, 'winID')) except: winID = 10025 #check if it is a different window and if so activate it id = xbmcgui.getCurrentWindowId() if id != winID: xbmc.executebuiltin('ActivateWindow(%d)' % winID) cmd = 'Container.Update(%s)' % plugin xbmc.executebuiltin(cmd) return if mode == RUNPLUGIN_MODE: cmd = 'RunPlugin(%s)' % plugin xbmc.executebuiltin(cmd) return #if all else fails just execute it xbmc.executebuiltin(cmd)
def playCommand(originalCmd, contentMode=False): try: xbmc.executebuiltin("Dialog.Close(busydialog)") # Isengard fix cmd = favourite.tidy(originalCmd) # if a 'Super Favourite' favourite just do it if ADDONID in cmd: return xbmc.executebuiltin(cmd) # if in contentMode just do it if contentMode: xbmc.executebuiltin("ActivateWindow(Home)") # some items don't play nicely if launched from wrong window if cmd.lower().startswith("activatewindow"): cmd = cmd.replace('")', '",return)') # just in case return is missing return xbmc.executebuiltin(cmd) if cmd.startswith("RunScript"): # workaround bug in Frodo that can cause lock-up # when running a script favourite if FRODO: xbmc.executebuiltin("ActivateWindow(Home)") if PLAY_PLAYLISTS: import playlist if playlist.isPlaylist(cmd): return playlist.play(cmd) if "ActivateWindow" in cmd: return activateWindowCommand(cmd) if "PlayMedia" in cmd: return playMedia(originalCmd) if cmd.lower().startswith("executebuiltin"): try: cmd = cmd.split('"', 1)[-1] cmd = cmd.rsplit('")')[0] except: pass xbmc.executebuiltin(cmd) except Exception, e: utils.log("Error in playCommand") utils.log("Command: %s" % cmd) utils.log("Error: %s" % str(e))
def playMedia(original): import re cmd = favourite.tidy(original) #.replace(',', '') #remove spurious commas parent = getParentCommand(cmd) if parent: xbmc.executebuiltin('Container.Update(%s)' % parent) xbmc.sleep(500) try: mode = int(favourite.getOption(original, 'mode')) except: mode = 0 if mode == PLAYMEDIA_MODE: xbmc.executebuiltin(cmd) return plugin = re.compile('"(.+?)"').search(cmd).group(1) if len(plugin) < 1: xbmc.executebuiltin(cmd) return if mode == ACTIVATEWINDOW_MODE: try: winID = int(favourite.getOption(original, 'winID')) except: winID = 10025 #check if it is a different window and if so activate it id = xbmcgui.getCurrentWindowId() if id != winID : xbmc.executebuiltin('ActivateWindow(%d)' % winID) cmd = 'Container.Update(%s)' % plugin xbmc.executebuiltin(cmd) return if mode == RUNPLUGIN_MODE: cmd = 'RunPlugin(%s)' % plugin xbmc.executebuiltin(cmd) return #if all else fails just execute it xbmc.executebuiltin(cmd)
def playMedia(original): import re cmd = favourite.tidy(original).replace(",", "") # remove spurious commas try: mode = int(favourite.getOption(original, "mode")) except: mode = 0 if mode == PLAYMEDIA_MODE: xbmc.executebuiltin(cmd) return plugin = re.compile('"(.+?)"').search(cmd).group(1) if len(plugin) < 1: xbmc.executebuiltin(cmd) return if mode == ACTIVATEWINDOW_MODE: try: winID = int(favourite.getOption(original, "winID")) except: winID = 10025 # check if it is a different window and if so activate it id = xbmcgui.getCurrentWindowId() if id != winID: xbmc.executebuiltin("ActivateWindow(%d)" % winID) cmd = "Container.Update(%s)" % plugin xbmc.executebuiltin(cmd) return if mode == RUNPLUGIN_MODE: cmd = "RunPlugin(%s)" % plugin xbmc.executebuiltin(cmd) return # if all else fails just execute it xbmc.executebuiltin(cmd)
def playCommand(cmd): try: cmd = favourite.tidy(cmd) #if a 'Super Favourite' favourite just do it if ADDONID in cmd: return xbmc.executebuiltin(cmd) #if in contentMode just do it if contentMode: xbmc.executebuiltin( 'ActivateWindow(Home)' ) #some items don't play nicely if launched from wrong window if cmd.lower().startswith('activatewindow'): cmd = cmd.replace('")', '",return)') #just in case return is missing return xbmc.executebuiltin(cmd) if cmd.startswith('RunScript'): #workaround bug in Frodo that can cause lock-up #when running a script favourite if FRODO: xbmc.executebuiltin('ActivateWindow(Home)') if isPlaylist(cmd): if PLAY_PLAYLISTS: return playPlaylist(cmd) if 'ActivateWindow' in cmd: return activateWindowCommand(cmd) xbmc.executebuiltin(cmd) except Exception, e: utils.log('Error in playCommand') utils.log('Command: %s' % cmd) utils.log('Error: %s' % str(e))
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with XBMC; see the file COPYING. If not, write to # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. # http://www.gnu.org/copyleft/gpl.html # import xbmc import favourite import utils FRODO = utils.FRODO if __name__ == '__main__': cmd = sys.argv[1] cmd = favourite.tidy(cmd) if cmd.startswith('RunScript'): #workaround bug in Frodo that can cause lock-up #when running a script favourite if FRODO: update = '%s' % (sys.argv[0]) update = 'Container.Update(%s,replace)' % update xbmc.executebuiltin(update) xbmc.executebuiltin('ActivateWindow(Home)') xbmc.executebuiltin(cmd)
# along with XBMC; see the file COPYING. If not, write to # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. # http://www.gnu.org/copyleft/gpl.html # import xbmc import favourite import utils FRODO = utils.FRODO if __name__ == '__main__': cmd = sys.argv[1] cmd = favourite.tidy(cmd) if cmd.startswith('RunScript'): #workaround bug in Frodo that can cause lock-up #when running a script favourite if FRODO: update = '%s' % (sys.argv[0]) update = 'Container.Update(%s,replace)' % update xbmc.executebuiltin(update) if cmd.lower().startswith('executebuiltin'): cmd = cmd[15:-1] xbmc.executebuiltin('ActivateWindow(Home)') xbmc.executebuiltin(cmd)