コード例 #1
0
ファイル: default.py プロジェクト: akuala/repo.kuala
def checkStartupAction():

    #get access to RCB
    rcbAddon = None
    try:
        rcbAddon = xbmcaddon.Addon(id='script.games.rom.collection.browser')
    except:
        print 'RCB Service: Error while accessing "script.games.rom.collection.browser". Make sure the addon is installed.'
        return

    launchOnStartup = rcbAddon.getSetting('rcb_launchOnStartup')
    print 'RCB Service: launch RCB on startup = ' + str(launchOnStartup)

    if (launchOnStartup.lower() == 'true'):
        startupDelay = int(float(rcbAddon.getSetting('rcb_startupDelay')))
        xbmc.sleep(startupDelay)
        path = os.path.join(rcbAddon.getAddonInfo('path'), 'default.py')
        print 'RCB Service: launch RCB ' + str(path)
        xbmc.executescript("%s" % path)
        return

    #check scrape on XBMC startup setting
    scrapeOnStart = rcbAddon.getSetting('rcb_scrapOnStartUP')
    print 'RCB Service: scrape games on startup = ' + str(scrapeOnStart)

    if (scrapeOnStart.lower() == 'true'):
        #launch dbUpdate
        path = os.path.join(rcbAddon.getAddonInfo('path'), 'dbUpLauncher.py')
        print 'RCB Service: Starting DB Update' + str(path)
        xbmc.executescript("%s" % path)
コード例 #2
0
ファイル: home.py プロジェクト: Quihico/passion-xbmc
def showMain():
    # xbmc.enableNavSounds( 0 )
    w = None
    try:
        try:
            w = getWindow(Main, "arkanoid.xml", CWD, CURRENT_SKIN, "720p", FORCE_FALLBACK)
        except Exception, e:
            print_exc()
            # TypeError
            if CURRENT_SKIN == "Classic":
                # fatal error popup user for contact me
                xbmcgui.Dialog().ok("Fatal Error!!!", "Contact Frost to passion-xbmc.org")
                raise "Fatal Error: contact Frost to passion-xbmc.org"
            if str(e) == "XML File for Window is missing":
                # reset skin setting and reload script
                xbmcgui.Dialog().ok(
                    "Error!!!",
                    "XML File for Window is missing in Skin: %s" % CURRENT_SKIN,
                    "",
                    "Default skin will be loaded...",
                )
                print "Error on load xml in skin: %s" % CURRENT_SKIN
                sys.modules["__main__"].__settings__.setSetting("skin", "Classic")
                xbmc.executescript(os.path.join(CWD, "default.py"))
    except:
        print_exc()
    if w:
        w.doModal()
        del w
コード例 #3
0
def showMain():
    #xbmc.enableNavSounds( 0 )
    w = None
    try:
        try:
            w = getWindow(Main, "arkanoid.xml", CWD, CURRENT_SKIN, "720p",
                          FORCE_FALLBACK)
        except Exception, e:
            print_exc()
            #TypeError
            if CURRENT_SKIN == "Classic":
                # fatal error popup user for contact me
                xbmcgui.Dialog().ok("Fatal Error!!!",
                                    "Contact Frost to passion-xbmc.org")
                raise "Fatal Error: contact Frost to passion-xbmc.org"
            if str(e) == "XML File for Window is missing":
                #reset skin setting and reload script
                xbmcgui.Dialog().ok(
                    "Error!!!", "XML File for Window is missing in Skin: %s" %
                    CURRENT_SKIN, "", "Default skin will be loaded...")
                print "Error on load xml in skin: %s" % CURRENT_SKIN
                sys.modules["__main__"].__settings__.setSetting(
                    "skin", "Classic")
                xbmc.executescript(os.path.join(CWD, 'default.py'))
    except:
        print_exc()
    if w:
        w.doModal()
        del w
コード例 #4
0
def deleteShow(tvdbid, removefiles):
    ret = Sickbeard.DeleteShow(tvdbid, removefiles)
    dialog = xbmcgui.Dialog()
    dialog.ok('Delete Show', ret)
    xbmc.executescript(
        'special://home/addons/plugin.video.sickrage/resources/lib/refresh.py')
    return ret
コード例 #5
0
def deleteShow(tvdbid):
    ret = Sickbeard.DeleteShow(tvdbid)
    dialog = xbmcgui.Dialog()
    dialog.ok('Sickbeard XBMC', ret)
    xbmc.executescript(
        'special://home/addons/plugin.program.sickbeard/resources/lib/refresh.py'
    )
    return ret
コード例 #6
0
 def update(self):
     w = XinBox_Update.Update("XinBox_Update.xml",self.srcpath,"DefaultSkin",lang=self.lang)
     w.doModal()
     returnval = w.returnval
     del w
     if returnval == 1:
         xbmc.executescript("X:\\XinBox_Update.py")
         self.close()
コード例 #7
0
def autoexec():

    logging.basicConfig(filename='/home/osmc/.kodi/temp/Python.log',
                        level=logging.DEBUG)
    logging.debug('This message should go to the log file')

    xbmc.executebuiltin(
        "PlayMedia(/home/osmc/.kodi/userdata/playlists/video/play2.m3u)")
    xbmc.executebuiltin("PlayerControl(play)")
    #time.sleep(50)

    xbmc.executebuiltin("PlayerControl(repeatall)")

    #print("coppying files")
    while (1):
        #time.sleep(10)

        import gpio
        #logging.debug('while loop')
        flag = 'home/osmc/Movies/buffer/flag.py'
        Zip = 'home/osmc/Movies/buffer/files.zip'
        isFile = os.path.isfile(flag)
        print(isFile)

        if isFile == True:
            os.remove(flag)
            folder = '/home/osmc/Movies/files'
            for filename in os.listdir(folder):
                file_path = os.path.join(folder, filename)
                try:
                    if os.path.isfile(file_path) or os.path.islink(file_path):
                        os.unlink(file_path)
                    elif os.path.isdir(file_path):
                        shutil.rmtree(file_path)
                except Exception as e:
                    logging.debug('Failed to delete %s. Reason: %s' %
                                  (file_path, e))

            #file_name = "/home/osmc/Movies/buffer/files.zip"
            with zipfile.ZipFile("/home/osmc/Movies/buffer/files.zip",
                                 'r') as zip_ref:
                zip_ref.extractall("/home/osmc/Movies/")
            logging.debug('extraceted successfully')

            source = "/home/osmc/Movies/files/play2.m3u"
            destination = "/home/osmc/.kodi/userdata/playlists/video/play2.m3u"
            dest = shutil.copyfile(source, destination)
            logging.debug('file copied successfully')

            xbmc.executebuiltin("PlayerControl(stop)")
            logging.debug('player closed')
            time.sleep(20)
            xbmc.executescript("/home/osmc/.kodi/userdata/autoexec.py")
            os.remove(Zip)
            break
コード例 #8
0
ファイル: updatelatest.py プロジェクト: vajonam/ManoMeedia
 def _update_lib_and_latest ( self ):
     xbmc.output(msg='Udate script called' , level=xbmc.LOGDEBUG)
     xbmc.executebuiltin('UpdateLibrary(video)');
     xbmc.sleep(3000)
     while True :
             isScanning= xbmc.getCondVisibility('Library.IsScanning')
             xbmc.output(msg='Library started scanning ### ' + str(isScanning) , level=xbmc.LOGDEBUG)
             xbmc.sleep(1000)
             if not isScanning:
                     break
     xbmc.executescript('special://skin/scripts/latest/latest.py')
コード例 #9
0
ファイル: MovieSQL.py プロジェクト: whf839/xbmc-addons
    def connect(self,
                host=None,
                port=0,
                user=None,
                passwd=None,
                db=None,
                nowait=0):
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        connected = False
        trycount = 0
        while not connected:
            trycount += 1
            if trycount == 5:
                print "Giving up on the dbserver"
                return -1
            try:
                s.connect(('localhost', 33066))
            except:
                print "Attempting to start the db server"
                xbmc.executescript(
                    'special://home/plugins/video/KollectiONX/DBServer.py')
                time.sleep(1)
            else:
                print "Connected to the db server"
                connected = True

        z = {
            'command': 'connect',
            'params': {
                'host': host,
                'user': user,
                'passwd': passwd,
                'port': port,
                'db': db,
                'nowait': nowait
            }
        }

        p = pickle.dumps(z, 2)
        s.send("%010d%s" % (len(p), p))
        if nowait:
            print "Not waiting for results"
            self.connected = False
        else:
            results = s.recv(10)
            print "Got result %s" % results
            if int(results) == 0:
                self.connected = False
            else:
                self.connected = True

        s.close()
        return self.connected
コード例 #10
0
def startDaemon(hostName):
    TempFiles = ['cmd', 'log', 'pid', 'errors', 'kodiIPTVservice.log']
    for Tempfile in TempFiles:
        #just cleaning before start
        if fileExists(
                buildPath(ADDON.getSetting("config.misc.sysTempPath"),
                          '.IPTVdaemon', Tempfile)):
            os.remove(
                buildPath(ADDON.getSetting("config.misc.sysTempPath"),
                          '.IPTVdaemon', Tempfile))
        if fileExists(
                buildPath(ADDON.getSetting("config.misc.sysTempPath"),
                          Tempfile)):
            os.remove(
                buildPath(ADDON.getSetting("config.misc.sysTempPath"),
                          Tempfile))
    if ADDON.getSetting("daemonType") == "1":  #= kodi service
        xbmcgui.Window(10000).setProperty('plugin.video.IPTVplayer.HOST',
                                          hostName)
        #xbmcgui.Window(10000).setProperty("kodiIPTVserviceHeartBeat", str(long(time.time())))
        xbmc.executescript(
            buildPath(ADDON.getSetting("kodiIPTVpath"), 'kodiIPTVservice.py')
        )  # no parameters, we use main window property
        WaitTime = 10  #maximum 5 seconds wait for init.
        while WaitTime >= 1:
            myLog("initializing host %ds" % WaitTime)
            WaitTime = WaitTime - 1
            time.sleep(1)
            if xbmcgui.Window(10000).getProperty(
                    "kodiIPTVserviceHeartBeat").isdigit():
                break
    else:
        os.system("%s/IPTVdaemon.py restart %s PYTHON %s" %
                  (ADDON.getSetting("kodiIPTVpath"), hostName,
                   ADDON.getSetting("config.misc.sysTempPath")))
        WaitTime = 5  #maximum 5 seconds wait for init.
        while WaitTime >= 1:
            myLog("initializing host %ds" % WaitTime)
            WaitTime = WaitTime - 1
            time.sleep(1)
            if fileExists(
                    buildPath(ADDON.getSetting("config.misc.sysTempPath"),
                              '.IPTVdaemon', 'ret')):
                break
        if fileExists(
                buildPath(ADDON.getSetting("config.misc.sysTempPath"),
                          '.IPTVdaemon', 'pid')):
            with open(
                    buildPath(ADDON.getSetting("config.misc.sysTempPath"),
                              '.IPTVdaemon', 'pid'), 'r') as f:
                ADDON.setSetting("daemonPID", f.read().strip())
                f.close
    return
コード例 #11
0
ファイル: home.py プロジェクト: Quihico/passion-xbmc
def showMain():
    #xbmc.enableNavSounds( 0 )
    w = None
    try:
        w = Main( "arkanoid.xml", CWD, CURRENT_SKIN, FORCE_FALLBACK )
    except Exception, e:
        print_exc()
        #TypeError
        if CURRENT_SKIN == "Classic":
            # fatal error popup user for contact me
            xbmcgui.Dialog().ok( "Fatal Error!!!", "Contact Frost to passion-xbmc.org" )
            raise "Fatal Error: contact Frost to passion-xbmc.org"
        if str( e ) == "XML File for Window is missing":
            #reset skin setting and reload script
            xbmcgui.Dialog().ok( "Error!!!", "XML File for Window is missing in Skin: %s" % CURRENT_SKIN, "", "Default skin will be loaded..." )
            print "Error on load xml in skin: %s" % CURRENT_SKIN
            xbmc.Settings( CWD ).setSetting( "skin", "Classic" )
            xbmc.executescript( os.path.join( CWD, 'default.py' ) )
コード例 #12
0
ファイル: MovieSQL.py プロジェクト: drrlramsey/xbmc-addons
    def connect(self, host=None, port=0, user=None, passwd=None, db=None, nowait=0):
      s = socket.socket(socket.AF_INET,
                        socket.SOCK_STREAM)
      connected = False
      trycount = 0
      while not connected:
          trycount += 1
          if trycount == 5:
              print "Giving up on the dbserver"
              return -1
          try:
              s.connect(('localhost', 33066))
          except:
              print "Attempting to start the db server"
              xbmc.executescript('special://home/plugins/video/KollectiONX/DBServer.py')
              time.sleep(1)
          else:
              print "Connected to the db server"
              connected = True

      z = {'command': 'connect',
           'params': {
                      'host': host,
                      'user': user,
                      'passwd': passwd,
                      'port': port,
                      'db': db,
                      'nowait': nowait}}

      p = pickle.dumps(z,2)
      s.send("%010d%s" % (len(p), p))
      if nowait:
          print "Not waiting for results"
          self.connected = False
      else:
          results = s.recv(10)
          print "Got result %s" % results
          if int(results) == 0:
              self.connected = False
          else:
              self.connected = True

      s.close()
      return self.connected
コード例 #13
0
ファイル: default.py プロジェクト: noba3/KoTos
def AutoStart():

    if __settings__.getSetting("popupx") == 'true':
        xbmc.executebuiltin(
            'XBMC.Notification(IPTVxtra , diverse Auto-Starts werden vorbereitet ,4000,'
            + icon + ')')

# ------------------------------------------------------------------------------------------------------------------------------------------- wiederherstellen der DE Settings - START
    try:
        sxUser = 0
        sxBackup = 0
        saveset = xbmc.translatePath(
            'special://userdata/addon_data/plugin.video.iptvxtra-de/backup.xml'
        )
        orgset = xbmc.translatePath(
            'special://userdata/addon_data/plugin.video.iptvxtra-de/settings.xml'
        )

        if os.path.isfile(saveset) and not os.path.isfile(orgset):
            try:
                shutil.copy(saveset, orgset)
                if __settings__.getSetting("popup") == 'true':
                    xbmc.executebuiltin(
                        'XBMC.Notification(Backup Funktion , IPTVxtra DE-Settings wurden wiederhergestellt ,5000,'
                        + icon + ')')
                print ' ------------------------------------------------------------------------------ IPTVxtra Info-Message-Service 100'
                print ' -----------------------------------------------------------------------------------------------------------------'
            except:
                pass

        try:
            fobj = open(orgset, "r")
            for line in fobj:
                if "login" in line and "xbmcuser" in line: sxUser = 1
                if "sBackup" in line and "true" in line: sxBackup = 1
            fobj.close()
        except:
            pass
        if sxBackup == 0 and sxUser == 1:
            try:
                fobj = open(saveset, "r")
                for line in fobj:
                    if "sBackup" in line and "true" in line: sxBackup = 1
                    break
                fobj.close()
            except:
                pass

        if os.path.isfile(
                saveset) and sxBackup == 1 and sxUser == 1:  # wiederherstellen
            try:
                os.remove(orgset)
            except:
                pass
            try:
                shutil.copy(saveset, orgset)
                if __settings__.getSetting("popup") == 'true':
                    xbmc.executebuiltin(
                        'XBMC.Notification(Backup Funktion , IPTVxtra-DE Settings mussten wiederhergestellt werden ,5000,'
                        + icon + ')')
                print ' ------------------------------------------------------------------------------ IPTVxtra Info-Message-Service 102'
                print ' -----------------------------------------------------------------------------------------------------------------'
            except:
                print ' ------------------------------------------------------------------------------ IPTVxtra Info-Message-Service 103'
                print ' -----------------------------------------------------------------------------------------------------------------'
    except:
        print ' ------------------------------------------------------------------------------ IPTVxtra Info-Message-Service 104'
        print ' -----------------------------------------------------------------------------------------------------------------'

# --------------------------------------------------------------------------------------------------------------------------------------------------------------   ReplayPlayer

    try:
        os.remove(record_folder + 'IPTVxtra.m3u8')
    except:
        pass
    shutil.rmtree(record_folder, ignore_errors=True)
    try:
        if len(
                filter(lambda x: x.endswith("_stream.ts"),
                       os.listdir(record_folder))) > 0:
            for i in filter(lambda x: x.endswith("_stream.ts"),
                            os.listdir(record_folder)):
                try:
                    os.remove(record_folder + i)
                except:
                    pass
    except:
        pass
    shutil.rmtree(record_folder, ignore_errors=True)

    # --------------------------------------------------------------------------------------------------------------------------------------------------------------   EcoStream updater
    if __settings__.getSetting("ecodel") == 'true':
        try:
            if os.path.isdir(eco_dir) == True:
                shutil.rmtree(eco_dir)
                print ' --------------------------------------------------------  Verzeichnis service.xbmc.ecoupd wurde gelöscht'
        except:
            print ' --------------------------------------------------------  alter EcoUpdater-Service konnte nicht gelöscht werden'
        __settings__.setSetting("ecodel", "false")

# --------------------------------------------------------------------------------------------------------------------------------------------------------------   deutsches EPG
    if __settings__.getSetting("epgde") == 'true':
        try:
            if not os.path.isfile(xmltv2de) or os.stat(xmltv2de)[8] < (
                    int(time.time()) -
                    72000) or os.path.getsize(xmltv2de) < 1200000:
                ab = requests.get('http://iptvxtra.net/xbmc/_form/session/' +
                                  xbmcaddon.Addon(
                                      id='plugin.video.iptvxtra-de').
                                  getSetting("login").strip() + '.DE')
                if str(ab.status_code) == '200':
                    if __settings__.getSetting("popup") == 'true':
                        xbmc.executebuiltin(
                            'XBMC.Notification(XMLTV , deutsches EPG File wird geladen ,4000,'
                            + iconx + ')')
                    try:
                        urllib.urlretrieve(
                            'http://srv1.iptvxtra.net/xmltv/xmltv_de_2.xmx',
                            xmltv2de)
                    except:
                        urllib.urlretrieve(
                            'http://srv3.iptvxtra.net/xmltv/xmltv_de_2.xmx',
                            xmltv2de)
                    print ' --------------------------------------------------------  DE XMLTV geladen'
        except:
            print ' --------------------------------------------------------  DE I.XMLTV konnte nicht geladen werden'

# --------------------------------------------------------------------------------------------------------------------------------------------------------------   thailändisches EPG
    if __settings__.getSetting("epgth") == 'true':
        try:
            if not os.path.isfile(xmltv2th) or os.stat(xmltv2th)[8] < (
                    int(time.time()) -
                    72000) or os.path.getsize(xmltv2th) < 1800000:
                ab = requests.get('http://iptvxtra.net/xbmc/_form/session/' +
                                  xbmcaddon.Addon(
                                      id='plugin.video.iptvxtra-th').
                                  getSetting("login").strip() + '.TH')
                if str(ab.status_code) == '200':
                    if __settings__.getSetting("popup") == 'true':
                        xbmc.executebuiltin(
                            'XBMC.Notification(XMLTV , thailaendisches EPG File wird geladen ,4000,'
                            + iconx + ')')
                    try:
                        urllib.urlretrieve(
                            'http://srv1.iptvxtra.net/xmltv/xmltv_th_2.xmx',
                            xmltv2th)
                    except:
                        urllib.urlretrieve(
                            'http://srv3.iptvxtra.net/xmltv/xmltv_th_2.xmx',
                            xmltv2th)
                    print ' --------------------------------------------------------  TH XMLTV geladen'
        except:
            print ' --------------------------------------------------------  TH XMLTV konnte nicht geladen werden'

# --------------------------------------------------------------------------------------------------------------------------------------------------------------   Programm Starter
    if __settings__.getSetting("de") == 'true':
        __settings__.setSetting("th", "false")
        __settings__.setSetting("sport", "false")
        try:
            xbmc.executebuiltin('XBMC.RunAddon(plugin.video.iptvxtra-de)')
        except:
            __settings__.setSetting("de", "false")
            print ' --------------------------------------------------------  IPTVxtra-DE nicht installiert'

    if __settings__.getSetting("th") == 'true':
        __settings__.setSetting("de", "false")
        __settings__.setSetting("sport", "false")
        try:
            xbmc.executebuiltin('XBMC.RunAddon(plugin.video.iptvxtra-th)')
        except:
            __settings__.setSetting("th", "false")
            print ' --------------------------------------------------------  IPTVxtra-TH nicht installiert'

    if __settings__.getSetting("sport") == 'true':
        __settings__.setSetting("th", "false")
        __settings__.setSetting("de", "false")
        try:
            print ' --------------------------------------------------------  Plugin s.p.o.r.t.TV'
            xbmc.executebuiltin('XBMC.RunAddon(plugin.video.s.p.o.r.t)')
        except:
            __settings__.setSetting("sport", "false")
            print ' --------------------------------------------------------  Plugin s.p.o.r.t.TV nicht installiert'

    if __settings__.getSetting("alt1") == 'true':
        try:
            print ' --------------------------------------------------------  alternatives Plugin'
            xbmc.executebuiltin('XBMC.RunAddon(' +
                                __settings__.getSetting("alt2") + ')')
        except:
            __settings__.setSetting("alt1", "false")
            print ' --------------------------------------------------------  alternatives Plugin nicht installiert'

# --------------------------------------------------------------------------------------------------------------------------------------------------------------   Player Info
    if __settings__.getSetting("playerinfox") == 'true':
        try:
            print ' --------------------------------------------------------  Playerinfo gestartet'
            if __settings__.getSetting("popup") == 'true':
                xbmc.executebuiltin(
                    'XBMC.Notification(Stream Restart , Stream-Restarter wird geladen ,4000,'
                    + iconb + ')')
            xbmc.sleep(3000)
            xbmc.executescript(
                'special://home/addons/plugin.program.iptvxtra/playerinfo.py')
        except:
            __settings__.setSetting("playerinfox", "false")
            print ' --------------------------------------------------------  Playerinfo kann nicht gestartet werden'

# --------------------------------------------------------------------------------------------------------------------------------------------------------------   EcoUpdater
    if __settings__.getSetting("eco") == 'true':
        try:
            xbmc.executebuiltin(
                'XBMC.RunPlugin(plugin://plugin.program.ecoupd)')
        except:
            __settings__.setSetting("eco", "false")
            xbmc.executebuiltin(
                'XBMC.Notification(Error EcoUpdater, der EcoUpdater ist nicht installiert ,4000,'
                + icon + ')')
            print ' --------------------------------------------------------  EcoUpdater nicht installiert'


# --------------------------------------------------------------------------------------------------------------------------------------------------------------   advancedsettings
    if __settings__.getSetting("as") == 'true':
        try:
            __settings__.setSetting("as", "false")
            xbmc.executebuiltin(
                'XBMC.Notification(advancedsettings.xml, die advancedsettings.xml wurde kopiert - beim nächsten Neustart ist diese erst aktiv ,6000,'
                + icon + ')')
        except:
            __settings__.setSetting("as", "false")
            xbmc.executebuiltin(
                'XBMC.Notification(Error advancedsettings.xml, die advancedsettings.xml wurde nicht integriert ,4000,'
                + icon + ')')
            print ' --------------------------------------------------------  advancedsettings.xml nicht installiert'
コード例 #14
0
# Put this file into Q:\scripts folder to be executed when XBMC starts.
import os
import xbmc

# Change this path according your XBMC setup (you may not need 'My Scripts')
mavudprcvr = xbmc.translatePath(os.path.join( "special://home/", "addons", "plugin.program.multiroomaudio", "resources", "lib", "rcvUDP.py" ) )
xbmc.executescript(mavudprcvr)
mavudpsndr = xbmc.translatePath(os.path.join( "special://home/", "addons", "plugin.program.multiroomaudio", "resources", "lib", "sendUDP.py" ) )
xbmc.executescript(mavudpsndr)

コード例 #15
0
def folder_scan(id):
    url = url_folder_scan(id)
    xbmc.executescript(url)
コード例 #16
0
# Put this file into Q:\scripts folder to be executed when XBMC starts.
import os
import xbmc

# Change this path according your XBMC setup (you may not need 'My Scripts')
mavudprcvr = xbmc.translatePath(
    os.path.join("special://home/", "addons", "plugin.program.multiroomaudio",
                 "resources", "lib", "rcvUDP.py"))
xbmc.executescript(mavudprcvr)
mavudpsndr = xbmc.translatePath(
    os.path.join("special://home/", "addons", "plugin.program.multiroomaudio",
                 "resources", "lib", "sendUDP.py"))
xbmc.executescript(mavudpsndr)
コード例 #17
0
def set_switch(sys_dict,DISTRO):
    import os
    AUTO_UPGRADE_FILE= os.path.join(os.getenv("HOME"), ".noupgrades")
    UPGRADE_PATH = os.path.join(os.getenv("HOME"),".upgrade")
    GUI_SETTINGS = os.path.join(os.getenv("HOME"),".xbmc","userdata","guisettings.xml")
    XBMC_NOLIMIT_FILE = os.path.join(os.getenv("HOME"),".nolimit")
    XBMC_AUDIOENGINE_FILE = os.path.join(os.getenv("HOME"),".audioengine")
    XBMC_NOSHUTWARN_FILE = os.path.join(os.getenv("HOME"), ".nowarning")
    XBMC_KHEAD_FILE = os.path.join(os.getenv("HOME"), ".kernelheaders")
    XBMC_OCV_FILE = os.path.join(os.getenv("HOME"), ".opencv")
    REMOTE_REPEAT_FILTER_FILE = os.path.join(os.getenv("HOME"),".no-repeat-filter")
    REMOTE_FOLDER = "/etc/lirc"
    REBOOT_ACTION = False
    REBOOT_MESSAGE = []
    RESTART_ACTION = False
    RESTART_MESSAGE = []
    if "sys.upgrade" in sys_dict:
        if sys_dict["sys.upgrade"] == "true":
            if os.path.isfile(AUTO_UPGRADE_FILE):
                os.remove(AUTO_UPGRADE_FILE)
                try:
                    xbmc.executebuiltin('XBMC.Notification("'+DISTRO+" updates are enabled"+'",,2000,"'+'")')
                except:
                    syslog.syslog(DISTRO+" updates are enabled")
        else:
            if not os.path.isfile(AUTO_UPGRADE_FILE):
                f=open(AUTO_UPGRADE_FILE,'w')
                f.close()
                try:
                    xbmc.executebuiltin('XBMC.Notification("'+DISTRO+" auto-updates are disabled"+'",,2000,"'+'")')
                except:
                    syslog.syslog(DISTRO+" auto-updates are disabled")

    if "sys.notification" in sys_dict:
        if sys_dict["sys.notification"] == "true":
            import xbmcaddon
            xbmc.executescript(os.path.join(xbmcaddon.Addon("script.raspbmc.settings").getAddonInfo('path'),'resources','lib','update_notify.py'))
        else:
            import xbmcgui
            window = xbmcgui.Window(10000)
            window.setProperty('RUNS_stopnow','true')

    if "sys.upgradenow" in sys_dict:
        if sys_dict["sys.upgradenow"] == "true":
            if os.path.isfile(AUTO_UPGRADE_FILE):
                os.remove(AUTO_UPGRADE_FILE)


    if "remote.filter" in sys_dict:
        if sys_dict["remote.filter"]== "false":
            if not os.path.isfile(REMOTE_REPEAT_FILTER_FILE):
                f=open(REMOTE_REPEAT_FILTER_FILE,'w')
                f.close()
                REBOOT_ACTION = True
                REBOOT_MESSAGE.append("IR Remote repeat filter is disabled")
        else:
            if os.path.isfile(REMOTE_REPEAT_FILTER_FILE):
                os.remove(REMOTE_REPEAT_FILTER_FILE)
                REBOOT_ACTION = True
                REBOOT_MESSAGE.append("IR Remote repeat filter is restored")

    if DISTRO == "Raspbmc":
        if "sys.xbmc.res" in sys_dict:
            if sys_dict["sys.xbmc.res"] == "true":
                if not os.path.isfile(XBMC_NOLIMIT_FILE):
                    f=open(XBMC_NOLIMIT_FILE,'w')
                    f.close()
                    try:
                        clear_resolution_settings(GUI_SETTINGS)
                    except:
                        pass
                    RESTART_ACTION = True
                    RESTART_MESSAGE.append("XBMC Resolution limit is removed")
                    #xbmc.executebuiltin('XBMC.Notification('+'"XBMC Resolution limit is removed","Please restart xbmc for it to take effect",2000,"'+'")')
            else:
                if os.path.isfile(XBMC_NOLIMIT_FILE):
                    os.remove(XBMC_NOLIMIT_FILE)
                    clear_resolution_settings(GUI_SETTINGS)
                    RESTART_ACTION = True
                    RESTART_MESSAGE.append("XBMC Resolution limit is restored")
                    #xbmc.executebuiltin('XBMC.Notification('+'"XBMC Resolution limit is restored","Please restart xbmc for it to take effect",2000,"'+'")')

        if "sys.xbmc.ae" in sys_dict:
            if sys_dict["sys.xbmc.ae"] == "true":
                if not os.path.isfile(XBMC_AUDIOENGINE_FILE):
                    f=open(XBMC_AUDIOENGINE_FILE,'w')
                    f.close()
                    RESTART_ACTION = True
                    RESTART_MESSAGE.append("Audio Engine is enabled")
            else:
                if os.path.isfile(XBMC_AUDIOENGINE_FILE):
                    os.remove(XBMC_AUDIOENGINE_FILE)
                    RESTART_ACTION = True
                    RESTART_MESSAGE.append("Audio Engine is disabled")

        if "sys.xbmc.shut" in sys_dict:
            if sys_dict["sys.xbmc.shut"] == "true":
                if not os.path.isfile(XBMC_NOSHUTWARN_FILE):
                    f=open(XBMC_NOSHUTWARN_FILE,'w')
                    f.close()
                    RESTART_ACTION = True
                    RESTART_MESSAGE.append("Shutdown warnings are disabled")
            else:
                if os.path.isfile(XBMC_NOSHUTWARN_FILE):
                    os.remove(XBMC_NOSHUTWARN_FILE)
                    RESTART_ACTION = True
                    RESTART_MESSAGE.append("Shutdown warnings are enabled")
                    
        if "sys.xbmc.headers" in sys_dict:
            if sys_dict["sys.xbmc.headers"] == "true":
                if not os.path.isfile(XBMC_KHEAD_FILE):
                    f=open(XBMC_KHEAD_FILE,'w')
                    f.close()
                    REBOOT_ACTION = True
                    REBOOT_MESSAGE.append("Kernel headers are available")
            else:
                if os.path.isfile(XBMC_KHEAD_FILE):
                    os.remove(XBMC_KHEAD_FILE)
                    RESTART_ACTION = False                    
                    

        if "remote.filter" in sys_dict:
            if sys_dict["remote.filter"]== "false":
                if not os.path.isfile(REMOTE_REPEAT_FILTER_FILE):
                    f=open(REMOTE_REPEAT_FILTER_FILE,'w')
                    f.close()
                    REBOOT_ACTION = True
                    REBOOT_MESSAGE.append("IR Remote repeat filter is disabled")
            else:
                if os.path.isfile(REMOTE_REPEAT_FILTER_FILE):
                    os.remove(REMOTE_REPEAT_FILTER_FILE)
                    REBOOT_ACTION = True
                    REBOOT_MESSAGE.append("IR Remote repeat filter is restored")

        if "remote.gpio.enable" in sys_dict and "remote.gpio.profile" in sys_dict:
            if sys_dict["remote.gpio.enable"] == "true" and os.path.isfile("/usr/bin/sudo"):
                REMOTE_INDEX=int(sys_dict["remote.gpio.profile"])
                REMOTE_LIST={0:"custom-lircd.conf", 1:"xbox-lircd.conf", 2:"rc6-mce-lircd.conf",
                             3:"atilibusb-lircd.conf", 4:"apple-silver-A1294-lircd.conf",
                             5:"ttusbir-lircd.conf", 6:"philips-srm-7500-lircd.conf",
                             7:"samsung-lircd.conf", 8:"kls-1.6-lircd.conf", 9:"hauppage45-pvr350-lircd.conf"}
                if os.path.isfile(os.path.join(REMOTE_FOLDER,REMOTE_LIST[0])):
                    if not os.path.islink(os.path.join(REMOTE_FOLDER,REMOTE_LIST[0])):
                        os.system("sudo rm "+os.path.join(REMOTE_FOLDER,REMOTE_LIST[0]))
                if not os.path.isfile(os.path.join(REMOTE_FOLDER,REMOTE_LIST[0])):
                    os.system("sudo ln -s /home/pi/lircd.conf "+os.path.join(REMOTE_FOLDER,REMOTE_LIST[0]))
                #    if os.path.isfile(os.path.join(REMOTE_FOLDER,"lircd.conf")):
                #        if not os.path.islink(os.path.join(REMOTE_FOLDER,"lircd.conf")):
                #            os.system("sudo cp -a "+os.path.join(REMOTE_FOLDER,"lircd.conf")+" "+os.path.join(REMOTE_FOLDER,REMOTE_LIST[0]))
                #    if not os.path.isfile(os.path.join(REMOTE_FOLDER,REMOTE_LIST[0])):
                #        os.system("sudo touch "+os.path.join(REMOTE_FOLDER,REMOTE_LIST[0]))
                if os.path.isfile(os.path.join(REMOTE_FOLDER,"lircd.conf")):
                    if os.path.islink(os.path.join(REMOTE_FOLDER,"lircd.conf")):
                        if os.path.realpath(os.path.join(REMOTE_FOLDER,"lircd.conf")) != os.path.join(REMOTE_FOLDER,REMOTE_LIST[REMOTE_INDEX]):
                            os.system("sudo rm "+os.path.join(REMOTE_FOLDER,"lircd.conf"))
                    else:
                        os.system("sudo rm "+os.path.join(REMOTE_FOLDER,"lircd.conf"))

                if not os.path.isfile(os.path.join(REMOTE_FOLDER,"lircd.conf")):
                    os.system("sudo ln -s "+os.path.join(REMOTE_FOLDER,REMOTE_LIST[REMOTE_INDEX])+" "+os.path.join(REMOTE_FOLDER,"lircd.conf"))
                    REBOOT_ACTION = True
                    REBOOT_MESSAGE.append("GPIO IR Remote configuration file updated")

    return     RESTART_ACTION,RESTART_MESSAGE,REBOOT_ACTION,REBOOT_MESSAGE
コード例 #18
0
ファイル: autoexec.py プロジェクト: rkramesh/Random
import os, xbmc

# create playlists from iTunes playlist file
xbmc.executescript('/home/osmc/py-up.py')
xbmc.executescript('/home/osmc/slack/slackbot/run.py')

コード例 #19
0
ファイル: default.py プロジェクト: pmietlicki/kodi-repo
    f = open(RootDir + "trace.txt", "a")
    f.write(string + '\n')
    f.close()

######################################################################  
def get_system_platform():
    platform = "unknown"
    if xbmc.getCondVisibility( "system.platform.linux" ):
        platform = "linux"
    elif xbmc.getCondVisibility( "system.platform.xbox" ):
        platform = "xbox"
    elif xbmc.getCondVisibility( "system.platform.windows" ):
        platform = "windows"
    elif xbmc.getCondVisibility( "system.platform.osx" ):
        platform = "osx"
#    Trace("Platform: %s"%platform)
    return platform

#############################################################################
#############################################################################


#retrieve the platform.
#platform = get_system_platform()

shutil.copyfile(RootDir + 'startup.plx', aPiPortailDir + 'startup.plx')

xbmc.executescript(aPiPortailDir + 'default.py')

#xbmc.sleep(1000)
コード例 #20
0
def MAIN():
    try: output.PRINT_DEBUG = ( XBMC_SETTINGS.getSetting( "script_debug" ) == "true" )
    except: print_exc()

    # print depend of output.PRINT_DEBUG is True or False
    print "bypass_debug: %s" % str( "-" * 100 )
    print "bypass_debug: Starting %s %s, %s, SVN r%s. Built on %s" % ( __script__, __version__, __statut__, __svn_revision__, __date__ )
    print "bypass_debug: The executable script running is: %s" % os.path.join( os.getcwd(), "default.py" )
    print "bypass_debug: %s" % str( "-" * 100 )
    dialog_error = False
    updating = False
    try:
        from utilities import getUserSkin
        current_skin, force_fallback = getUserSkin()
        print "bypass_debug: load default skin:[%s]" % current_skin
        print "bypass_debug: default skin use force fallback: %s" % repr( force_fallback )
        del getUserSkin
    except:
        pass

    #setup skins utilities and reload xbmc skin if necessary
    import skins_utilities
    if skins_utilities.setupUtilities():
        print "Reloaded Skin: %s" % xbmc.getSkinDir()
        xbmc.executebuiltin( "XBMC.Notification(%s,Reloaded Skin...,3000,%s)" % ( xbmc.getSkinDir(), os.path.join( os.getcwd(), "default.tbn" ), ) )
        xbmc.executebuiltin( "XBMC.ReloadSkin()" )
        xbmc.sleep( 2000 )

    # INITIALISATION CHEMINS DE FICHIER LOCAUX
    try:
        import CONF
        setconf = False
        config = CONF.ReadConfig()

        DIALOG_PROGRESS.update( -1, __language__( 101 ), __language__( 110 ) )
        curversion =  config.get('Version','version')
        if "1." in curversion:
            setconf = True
            
        if not config.getboolean( 'InstallPath', 'pathok' ):
            setconf = True

        if setconf:
            # GENERATION DES INFORMATIONS LOCALES
            CONF.SetConfiguration()
    except:
        dialog_error = True
        print "Error while setting the configuration"
        print_exc()

    # CHECK SCRIPT UPDATE AVAILABILITY AND UPDATE CONFIGUARTION FILE
    try:
        import CHECKMAJ
        try:
            CHECKMAJ.UPDATE_STARTUP = ( XBMC_SETTINGS.getSetting( "update_startup" ) == "true" )
        except:
            CHECKMAJ.UPDATE_STARTUP = False
            print_exc()
        print "CHECKMAJ.UPDATE_STARTUP = %s"%str(CHECKMAJ.UPDATE_STARTUP)
        if CHECKMAJ.UPDATE_STARTUP:
            DIALOG_PROGRESS.update( -1, __language__( 102 ), __language__( 110 ) )
            CHECKMAJ.go()
        del CHECKMAJ
    except:
        # In case of an Exception here we still load the script
        print "Error while checking availability of an update for the installer"
        print "We still going to start the script ..."
        print_exc()

    # RETRIEVING CONFIGURATION FROM CONF FILE
    try:
        config = CONF.ReadConfig()
        del CONF
    except:
        print "Error while reading the configuration"
        dialog_error = True
        print_exc()

    try:
        updating = config.getboolean( 'Version', 'UPDATING' )
    except:
        # Issue with conf file, stopping update
        dialog_error = True
        print_exc()
    try:
        if not updating:
            try:
                # LANCEMENT DU SCRIPT
                try:
                    import Home
                    DIALOG_PROGRESS.close()
                    HomeAction = Home.show_home()
                except:
                    print_exc()
                    HomeAction = "error"

                if HomeAction == "error":
                    import MainGui
                    MainGui.show_main()
            except:
                print "bypass_debug: MAIN: Exception while loading the script"
                print_exc()
                dialog_error = True
        else:
            # UPDATING THE SCRIPT
            try:
                scriptmaj = config.get( 'Version', 'SCRIPTMAJ' )
                xbmc.executescript( scriptmaj )
            except:
                print "bypass_debug: MAIN: Exception while updating of the script"
                print_exc()
                dialog_error = True

        if dialog_error: xbmcgui.Dialog().ok( __language__( 111 ), __language__( 112 ) )
    except:
        print_exc()
    DIALOG_PROGRESS.close()
コード例 #21
0
import xbmc
xbmc.executescript('Q:\scripts\ResumeX\lib\engine.py')
        
コード例 #22
0
ファイル: autoexec.py プロジェクト: OpenElf/openviewhelper
#!/usr/bin/python

############### Imports ################################################

import os,xbmc

########################################################################


xbmc.executescript('/home/pi/.xbmc/addons/plugin.video.openviewportal/scripts/ov_script.py')
コード例 #23
0
ファイル: default.py プロジェクト: struart/script.filecleaner
                        existing_file.close()
                        file_to_move.close()
                        success.append(bool(xbmcvfs.delete(new_path) and xbmcvfs.rename(p, new_path)))
                    else:
                        debug("This file isn't larger than the existing file. Deleting it instead of moving.")
                        existing_file.close()
                        file_to_move.close()
                        success.append(bool(xbmcvfs.delete(p)))
                else:
                    debug("Moving %r to %r." % (p, new_path))
                    success.append(bool(xbmcvfs.rename(p, new_path)))
            else:
                debug("File %r no longer exists." % p, xbmc.LOGWARNING)
                success.append(False)

        return any(success)

if __name__ == "__main__":
    cleaner = Cleaner()
    results, exit_status = cleaner.cleanup()
    if results:
        # Videos were cleaned. Ask the user to view the log file.
        if xbmcgui.Dialog().yesno(utils.translate(32514), results, utils.translate(32519)):
            xbmc.executescript("special://home/addons/script.filecleaner/viewer.py")
    elif exit_status == 0:
        # Everything went well, but no videos needed cleaning. Show a notification.
        notify(utils.translate(32520))
    else:
        debug("Cleaning finished with exit status %d" % exit_status, xbmc.LOGERROR)

コード例 #24
0
                    controlId).getSelectedPosition()
                self.category = None
                self.area = None
                self.alcohol = None
                xbmc.executebuiltin("ActivateWindow(busydialog)")
                meals = mealsdb_api.Filter().ingredient(ingredient)
                xbmc.executebuiltin("Dialog.Close(busydialog)")
                self.list_meals(meals)
            elif identifier == 'meal_listing':
                meal_id = self.getControl(
                    controlId).getSelectedItem().getProperty('id')
                self.meal_player(meal_id)


if __name__ == '__main__':

    if len(sys.argv) <= 1:
        #Start interface
        main = Main(
            'script-meal-Main.xml',
            addon_path,
            'default',
            '',
        )
        main.doModal()
        del main
        sys.modules.clear()
    else:
        #Start screensaver
        xbmc.executescript(os.path.join(addon_path, 'meal.py'))
コード例 #25
0
import os
HOME_DIR    =   os.getcwd().replace(";","")+"\\"
RETURN      =   False
if os.path.isfile(HOME_DIR +'emuflag.chk')  :   ## Return Active
    os.remove(HOME_DIR +'emuflag.chk')
    RETURN = True
if (RETURN) :
    import xbmc
    xbmc.executescript(HOME_DIR + 'default.py')
コード例 #26
0
    def __init__(self):
        viewtype.__init__(self)
        self.args = Info()
        self.watched = getWatched()

        if not xbmcgui.Window(10000).getProperty("plugin.video.illicoweb_running") == "True":
            addon_log("** Service not running **")
            xbmc.executescript(os.path.join(xbmc.translatePath(ADDON.getAddonInfo("path")), "service.py"))

        if self.args.isempty():
            self._login()
            self._add_directory_root()

        elif self.args.setwatched or self.args.setunwatched:
            strwatched = self.args.setwatched or self.args.setunwatched
            if self.args.all:
                url, label = strwatched.split("*")
                seasonNo = url[url.rfind(",") + 1 :]
                url = "/" + url[: url.rfind(",")]
                data = self._getShowJSON(url)

                seasons = simplejson.loads(data)["body"]["SeasonHierarchy"]["seasons"]

                # [body][SeasonHierarchy][seasons] seasons
                for i in seasons:
                    # addon_log(i['seasonNo'] + ' ==? ' + seasonNo)
                    if str(i["seasonNo"]) == seasonNo:
                        for ep in i["episodes"]:
                            setWatched(ep["orderURI"] + "*" + ep["title"], bool(self.args.setunwatched), False)

                # [body][main] seasons
                i = simplejson.loads(data)["body"]["main"]
                if str(i["seasonNo"]) == seasonNo:
                    for ep in i["episodes"]:
                        setWatched(ep["orderURI"] + "*" + ep["title"], bool(self.args.setunwatched), False)

                # xbmc.executebuiltin( 'Container.Refresh' )
            else:
                setWatched(strwatched, bool(self.args.setunwatched))

        elif self.args.addtofavourites or self.args.removefromfavourites:
            # turn dict back into url, decode it and format it in xml
            f = unquote_plus(self.args.addtofavourites or self.args.removefromfavourites)
            f = parse_qs(urlparse("?" + f.replace(", ", "&").replace('"', "%22")).query)
            favourite = '<favourite label="%s" category="%s" url="%s" />' % (
                unquote_plus(f["label"][0]),
                f["category"][0],
                f["url"][0],
            )

            if os.path.exists(FAVOURITES_XML):
                favourites = open(FAVOURITES_XML).read()
            else:
                favourites = "<favourites>\n</favourites>\n"
            if self.args.removefromfavourites or favourite not in favourites:
                if self.args.removefromfavourites:
                    addon_log("Removing %s from favourites" % favourite)
                    favourites = favourites.replace("  %s\n" % favourite, "")
                    refresh = True
                else:
                    favourites = favourites.replace("</favourites>", "  %s\n</favourites>" % (favourite))
                    refresh = False
                file(FAVOURITES_XML, "w").write(favourites)
                if refresh:
                    if favourites == "<favourites>\n</favourites>\n":
                        try:
                            os.remove(FAVOURITES_XML)
                        except:
                            pass
                        xbmc.executebuiltin("Action(ParentDir)")
                        xbmc.sleep(1000)
                    xbmc.executebuiltin("Container.Refresh")

        elif self.args.favoris:
            self._add_directory_favourites()

        elif self.args.live:
            self._playLive(unquote_plus(self.args.live).replace(" ", "+"))

        elif self.args.episode:
            self._checkCookies()
            self._playEpisode(unquote_plus(self.args.episode).replace(" ", "+"))

        elif self.args.channel:
            url = unquote_plus(self.args.channel).replace(" ", "+")

            shows, fanart, livelist = self._getShows(url)

            listitems = []
            if "channels" in shows:
                for channel in shows["channels"]:
                    self._addChannelToGalaxie(channel, listitems, fanart)
            else:
                for i in shows:
                    if "submenus" in i:
                        for show in i["submenus"]:
                            self._addShowToChannel(show, listitems, fanart)
                    else:
                        self._addShowToChannel(i, listitems, fanart)

            if listitems:
                # Sort list by ListItem Label
                listitems = self.natural_sort(listitems, False)

            if len(listitems) == 0:
                live = livelist[0][0]
                self._playLive(live[live.find('"') :].replace('"', ""))
                return

            listitems = livelist + listitems
            addon_log("Adding Shows to Channel")
            OK = self._add_directory_items(listitems)
            self._set_content(OK, "episodes", False)

        elif self.args.show:
            OK = False
            listitems = self._getSeasons(unquote_plus(self.args.show).replace(" ", "+"))

            if listitems:
                from operator import itemgetter

                listitems = self.natural_sort(listitems, True)
                addon_log("Adding Seasons to Show")
                OK = self._add_directory_items(listitems)
            self._set_content(OK, "episodes", False)

        elif self.args.season:
            url = unquote_plus(self.args.season).replace(" ", "+")
            season = url[url.rfind(",") + 1 :]
            url = url[: url.rfind(",")]

            data = self._getShowJSON(url)
            self._addEpisodesToSeason(data, season)
コード例 #27
0
ファイル: autoexec.py プロジェクト: WLCD/xbmc-tdtool-script
# based off work from eldo (xbmc forums)

import os, xbmc

# turn on device 1
os.system("tdtool -n 1")
xbmc.sleep(1000)

# call playback related script
xbmc.executescript("special://home/scripts/playeractions.py")
xbmc.sleep(1000)

# call idle script
xbmc.executescript("special://home/scripts/idletime.py")
コード例 #28
0
ファイル: default.py プロジェクト: AMOboxTV/AMOBox.LegoBuild
    f = open(RootDir + "trace.txt", "a")
    f.write(string + '\n')
    f.close()

######################################################################  
def get_system_platform():
    platform = "unknown"
    if xbmc.getCondVisibility( "system.platform.linux" ):
        platform = "linux"
    elif xbmc.getCondVisibility( "system.platform.xbox" ):
        platform = "xbox"
    elif xbmc.getCondVisibility( "system.platform.windows" ):
        platform = "windows"
    elif xbmc.getCondVisibility( "system.platform.osx" ):
        platform = "osx"
#    Trace("Platform: %s"%platform)
    return platform

#############################################################################
#############################################################################


#retrieve the platform.
#platform = get_system_platform()

shutil.copyfile(RootDir + 'startup.plx', NaviXDir + 'startup.plx')

xbmc.executescript(NaviXDir + 'default.py')

#xbmc.sleep(1000)
コード例 #29
0
ファイル: home.py プロジェクト: Quihico/passion-xbmc
    def onClick( self, controlID ):
        try:
            if self.GAME and self.GAME.GameOver:
                del self.GAME
                self.GAME = None

            if self.GAME and controlID == 500:
                if not self.GAME.threadLevel and not self.GAME.ballRunning:
                    self.GAME.startLevel()
                elif self.GAME.vaus_statut == "LASER":
                    #else:
                    self.launchFire()

            elif not self.GAME and controlID == 201:
                mode = ( controlID - 200 )
                self.launchGame( 0, mode )

            elif not self.GAME and controlID == 202:
                mode = ( controlID - 200 )
                self.launchGame( 0, mode )

            elif not self.GAME and controlID == 203:
                mode = ( controlID - 200 )
                #browse custom stage
                stg = utilities.getBrowseDialog( os.path.join( BASE_RESOURCE_PATH, "custom_levels" )+os.sep,
                    heading="Select Your Stage", mask=".stage" )
                if stg and os.path.isfile( stg ):
                    f = open( stg, "r" )
                    bg, stage = eval( f.read() )
                    f.close()
                    #test valide stage and background
                    error_info = "Bad file! %s" % stg
                    if not len( stage ) == 260: raise error_info
                    for colrow in stage:
                        if not ( 0 <= colrow <= 10 ): raise error_info
                    if os.path.exists( bg ): bg = bg
                    elif bg and not os.path.exists( bg ): bg = os.path.join( MEDIAS_PATH, bg )
                    stageName = os.path.splitext( os.path.basename( stg ) )[ 0 ]
                    customlevel = bg, stage, stageName
                    self.launchGame( 0, mode, customlevel )

            elif not self.GAME and controlID == 204:
                mode = ( controlID - 200 )
                stage_path = utilities.getBrowseDialog( os.path.join( BASE_RESOURCE_PATH, "media", "stages" )+os.sep,
                    heading="Select Practice Stage", dlg_type=2, shares="pictures", use_thumbs=True )
                level_id = os.path.splitext( os.path.basename( stage_path ) )[ 0 ].split( "_" )[ -1 ]
                if level_id.isdigit():
                    mode = ( mode, 5 )[ "tournament" in os.path.basename( stage_path ).lower() ]
                    self.launchGame( int( level_id ), mode )

            elif controlID == 122:
                import editor
                w = editor.levelEditor( "levelEditor.xml", CWD, CURRENT_SKIN, FORCE_FALLBACK )
                w.doModal()
                del w, editor

            elif controlID == 125:
                w = HighScores( "highScores.xml", CWD, CURRENT_SKIN, FORCE_FALLBACK )
                w.doModal()
                del w

            elif controlID == 320:
                self.closeGame()

            elif controlID == 123:
                self._stop_game()

            elif controlID == 126:
                settings = xbmc.Settings( CWD )
                skin_setting = settings.getSetting( "skin" )
                settings.openSettings()
                xbmc.sleep( 500 )
                self.setSettings()
                if skin_setting != xbmc.Settings( CWD ).getSetting( "skin" ):
                    self.closeGame()
                    xbmc.executescript( os.path.join( CWD, 'default.py' ) )

            elif controlID == 127:
                import infos
                w = infos.Info( "infos.xml", CWD, CURRENT_SKIN, FORCE_FALLBACK )
                w.doModal()
                del w, infos
        except:
            print_exc()
コード例 #30
0
                self.ingredient = ingredient
                self.last_focused_drink = 0
                self.last_focused_ingredient = self.getControl(controlId).getSelectedPosition()
                self.category = None
                self.glass = None
                self.alcohol = None
                xbmc.executebuiltin( "ActivateWindow(busydialog)" )
                cocktails = cocktailsdb_api.Filter().ingredient(ingredient)
                xbmc.executebuiltin( "Dialog.Close(busydialog)" )
                self.list_cocktails(cocktails)
            elif identifier == 'cocktail_listing':
                cocktail_id = self.getControl(controlId).getSelectedItem().getProperty('id')
                self.cocktail_player(cocktail_id)


if __name__ == '__main__':

    if len(sys.argv) <= 1:
        #Start interface
        main = Main(
            'script-cocktail-Main.xml',
            addon_path,
            'default',
            '',
        )
        main.doModal()
        del main
    else:
        #Start screensaver
        xbmc.executescript(os.path.join(addon_path, 'cocktail.py'))
コード例 #31
0
	def onClick(self,controlId):
		if controlId == REGULAR_PANEL_CONTROL:
			identifier = self.getControl(controlId).getSelectedItem().getProperty('category')
			self.focused_item = self.getControl(controlId).getSelectedPosition()
			if identifier == 'screensaver':
				self.reset_variables()
				xbmc.executescript(os.path.join(addon_path,'cocktail.py'))
			elif identifier == 'search':
				self.last_focused_mainmenu_item = self.focused_item
				self.reset_variables()
				self.search()
			elif identifier == 'alcohol':
				self.last_focused_mainmenu_item = self.focused_item
				self.reset_variables()
				self.alcoholic_type()
			elif identifier == 'glass':
				self.last_focused_mainmenu_item = self.focused_item
				self.reset_variables()
				self.glass_type()
			elif identifier == 'categories':
				self.last_focused_mainmenu_item = self.focused_item
				self.reset_variables()
				self.categories()
			elif identifier == 'ingredient':
				self.last_focused_mainmenu_item = self.focused_item
				self.reset_variables()
				self.ingredient_picker()
			elif identifier == 'favourites':
				self.last_focused_mainmenu_item = self.focused_item
				self.reset_variables()
				self.list_favourites()
			elif identifier == 'category_selection':
				category = self.getControl(controlId).getSelectedItem().getLabel()
				self.ingredient = None
				self.last_focused_category_item = self.focused_item
				self.category = category
				self.glass = None
				self.alcohol = None
				xbmc.executebuiltin( "ActivateWindow(busydialog)" )
				cocktails = cocktailsdb_api.Filter().category(category)
				xbmc.executebuiltin( "Dialog.Close(busydialog)" )
				self.list_cocktails(cocktails)
			elif identifier == 'alcoholic_selection':
				tipo = self.getControl(controlId).getSelectedItem().getLabel()
				self.ingredient = None
				self.last_focused_alchool_item = self.focused_item
				self.category = None
				self.glass = None
				self.alcohol = tipo
				xbmc.executebuiltin( "ActivateWindow(busydialog)" )
				cocktails = cocktailsdb_api.Filter().alcohol(tipo)
				xbmc.executebuiltin( "Dialog.Close(busydialog)" )
				self.list_cocktails(cocktails)
			elif identifier == 'glass_selection':
				glass = self.getControl(controlId).getSelectedItem().getLabel()
				self.last_focused_glass_item = self.focused_item
				self.ingredient = None
				self.category = None
				self.glass = glass
				self.alcohol = None
				xbmc.executebuiltin( "ActivateWindow(busydialog)" )
				cocktails = cocktailsdb_api.Filter().glass(glass)
				xbmc.executebuiltin( "Dialog.Close(busydialog)" )
				self.list_cocktails(cocktails)
			elif identifier == 'video_listing':
				youtube_id = self.getControl(controlId).getSelectedItem().getProperty('video_id')
				player = xbmc.Player()
				player.play('plugin://plugin.video.youtube/play/?video_id='+youtube_id)
				while player.isPlaying():
					xbmc.sleep(200)
				xbmc.sleep(500)
				self.getControl(INGREDIENT_DRINK_PANEL_CONTROL).reset()
				self.getControl(REGULAR_PANEL_CONTROL).reset()
				self.getControl(REGULAR_PANEL_CONTROL).addItems(self.youtube_videos)
				self.setFocusId(REGULAR_PANEL_CONTROL)
				self.getControl(REGULAR_PANEL_CONTROL).selectItem(self.focused_item)
		
		if controlId == INGREDIENT_DRINK_PANEL_CONTROL:
			identifier = self.getControl(controlId).getSelectedItem().getProperty('category')
			if identifier == 'ingredient_picker':
				ingredient = self.getControl(controlId).getSelectedItem().getLabel()
				self.ingredient = ingredient
				self.last_focused_drink = 0
				self.last_focused_ingredient = self.getControl(controlId).getSelectedPosition()
				self.category = None
				self.glass = None
				self.alcohol = None
				xbmc.executebuiltin( "ActivateWindow(busydialog)" )
				cocktails = cocktailsdb_api.Filter().ingredient(ingredient)
				xbmc.executebuiltin( "Dialog.Close(busydialog)" )
				self.list_cocktails(cocktails)
			elif identifier == 'cocktail_listing':
				cocktail_id = self.getControl(controlId).getSelectedItem().getProperty('id')
				self.cocktail_player(cocktail_id)
コード例 #32
0
# Put this file into Q:\scripts folder to be executed when XBMC starts.
import os
import xbmc

# Change this path according your XBMC setup (you may not need 'My Scripts')
script_path = xbmc.translatePath(os.path.join(os.getcwd(),'startup.py'))
xbmc.executescript(script_path)

コード例 #33
0
import xbmc

xbmc.executescript('special://home/addons/script.ibus.bmw/bmwdaemon.py')
コード例 #34
0
def deleteShow(tvdbid, removefiles):
    ret = Sickbeard.DeleteShow(tvdbid, removefiles)
    dialog = xbmcgui.Dialog()
    dialog.ok('Delete Show', ret)
    xbmc.executescript('special://home/addons/plugin.video.sickrage/resources/lib/refresh.py')
    return ret
コード例 #35
0
            PROGRESS_POSITIONS_BAR[2], PROGRESS_POSITIONS_BAR[3],
            MEDIA_DIR + "progress_bar_overlay.png")
        self.addControl(self.progressBarOver)

        self.progressLabel = xbmcgui.ControlLabel(PROGRESS_POSITIONS_LABEL[0],
                                                  PROGRESS_POSITIONS_LABEL[1],
                                                  PROGRESS_POSITIONS_LABEL[2],
                                                  PROGRESS_POSITIONS_LABEL[3],
                                                  text, "font10", "FFFFFFFF")
        self.addControl(self.progressLabel)

    def update_progress(self, width, text=""):
        if text != "":
            self.progressLabel.setLabel(text)

        self.new_width = int((width * PROGRESS_POSITIONS_BAR[2]) / 100)
        if self.new_width > PROGRESS_POSITIONS_BAR[2]:
            self.progressBar.setWidth(PROGRESS_POSITIONS_BAR[2])
        else:
            self.progressBar.setWidth(self.new_width)


#xbmc.enableNavSounds(0)

check_connection()

run = Main()
del run

xbmc.executescript(HOME_DIR + "game.py")
コード例 #36
0
import xbmc

xbmc.executescript("/home/bigfatpaulyj/.xbmc/addons/script.ptest.test1/default.py")
コード例 #37
0
ファイル: autoexec.py プロジェクト: vdeku/daledewd-xbmc-repo
import os
import xbmc

# You may need to change this path according your XBMC setup.
script_path = xbmc.translatePath(
    os.path.join(os.getcwd(), '..', 'addons', 'plugin.video.greader.ddl.video',
                 'httpserver.py'))
xbmc.executescript(script_path)
コード例 #38
0
ファイル: default.py プロジェクト: noba3/KoTos
def AutoStart():

    if __settings__.getSetting("popupx") == 'true':
        xbmc.executebuiltin('XBMC.Notification(IPTVxtra , diverse Auto-Starts werden vorbereitet ,4000,'+icon+')')


# ------------------------------------------------------------------------------------------------------------------------------------------- wiederherstellen der DE Settings - START
    try:
        sxUser = 0
        sxBackup = 0
        saveset = xbmc.translatePath('special://userdata/addon_data/plugin.video.iptvxtra-de/backup.xml')
        orgset = xbmc.translatePath('special://userdata/addon_data/plugin.video.iptvxtra-de/settings.xml')

        if os.path.isfile(saveset) and not os.path.isfile(orgset):
            try:
                shutil.copy(saveset, orgset)
                if __settings__.getSetting("popup") == 'true': xbmc.executebuiltin('XBMC.Notification(Backup Funktion , IPTVxtra DE-Settings wurden wiederhergestellt ,5000,'+icon+')')
                print ' ------------------------------------------------------------------------------ IPTVxtra Info-Message-Service 100'
                print ' -----------------------------------------------------------------------------------------------------------------'
            except: pass

        try:
            fobj = open(orgset, "r") 
            for line in fobj:
                if "login" in line and "xbmcuser" in line: sxUser = 1
                if "sBackup" in line and "true" in line: sxBackup = 1
            fobj.close()
        except: pass
        if sxBackup == 0 and sxUser == 1:
            try:
                fobj = open(saveset, "r") 
                for line in fobj:
                    if "sBackup" in line and "true" in line: sxBackup = 1
                    break
                fobj.close()
            except: pass

        if os.path.isfile(saveset) and sxBackup == 1 and sxUser == 1:        # wiederherstellen  
            try: os.remove(orgset)
            except: pass
            try: 
                shutil.copy(saveset, orgset)
                if __settings__.getSetting("popup") == 'true': xbmc.executebuiltin('XBMC.Notification(Backup Funktion , IPTVxtra-DE Settings mussten wiederhergestellt werden ,5000,'+icon+')')
                print ' ------------------------------------------------------------------------------ IPTVxtra Info-Message-Service 102'
                print ' -----------------------------------------------------------------------------------------------------------------'
            except:
                print ' ------------------------------------------------------------------------------ IPTVxtra Info-Message-Service 103'
                print ' -----------------------------------------------------------------------------------------------------------------'
    except: 
        print ' ------------------------------------------------------------------------------ IPTVxtra Info-Message-Service 104'
        print ' -----------------------------------------------------------------------------------------------------------------'

# --------------------------------------------------------------------------------------------------------------------------------------------------------------   ReplayPlayer

    try: os.remove(record_folder + 'IPTVxtra.m3u8')
    except: pass
    shutil.rmtree(record_folder, ignore_errors=True)
    try:
        if len(filter(lambda x: x.endswith("_stream.ts"), os.listdir(record_folder))) > 0:
            for i in filter(lambda x: x.endswith("_stream.ts"), os.listdir(record_folder)):
                try: os.remove(record_folder + i)
                except: pass
    except: pass
    shutil.rmtree(record_folder, ignore_errors=True)

# --------------------------------------------------------------------------------------------------------------------------------------------------------------   EcoStream updater
    if __settings__.getSetting("ecodel") == 'true':
        try:
            if os.path.isdir(eco_dir) == True:
                shutil.rmtree(eco_dir)
                print ' --------------------------------------------------------  Verzeichnis service.xbmc.ecoupd wurde gelöscht'
        except:
            print ' --------------------------------------------------------  alter EcoUpdater-Service konnte nicht gelöscht werden'
        __settings__.setSetting("ecodel", "false")

# --------------------------------------------------------------------------------------------------------------------------------------------------------------   deutsches EPG
    if __settings__.getSetting("epgde") == 'true':
        try:
            if not os.path.isfile(xmltv2de) or os.stat(xmltv2de)[8] < (int(time.time()) - 72000) or os.path.getsize(xmltv2de) < 1200000:
                ab = requests.get('http://iptvxtra.net/xbmc/_form/session/' + xbmcaddon.Addon(id = 'plugin.video.iptvxtra-de').getSetting("login").strip() + '.DE')
                if str(ab.status_code) == '200':
                    if __settings__.getSetting("popup") == 'true':
                        xbmc.executebuiltin('XBMC.Notification(XMLTV , deutsches EPG File wird geladen ,4000,'+iconx+')')
                    try: urllib.urlretrieve('http://srv1.iptvxtra.net/xmltv/xmltv_de_2.xmx', xmltv2de)
                    except: urllib.urlretrieve('http://srv3.iptvxtra.net/xmltv/xmltv_de_2.xmx', xmltv2de)
                    print ' --------------------------------------------------------  DE XMLTV geladen'
        except:
            print ' --------------------------------------------------------  DE I.XMLTV konnte nicht geladen werden'

# --------------------------------------------------------------------------------------------------------------------------------------------------------------   thailändisches EPG
    if __settings__.getSetting("epgth") == 'true':
        try:
            if not os.path.isfile(xmltv2th) or os.stat(xmltv2th)[8] < (int(time.time()) - 72000) or os.path.getsize(xmltv2th) < 1800000:
                ab = requests.get('http://iptvxtra.net/xbmc/_form/session/' + xbmcaddon.Addon(id = 'plugin.video.iptvxtra-th').getSetting("login").strip() + '.TH')
                if str(ab.status_code) == '200':
                        if __settings__.getSetting("popup") == 'true':
                            xbmc.executebuiltin('XBMC.Notification(XMLTV , thailaendisches EPG File wird geladen ,4000,'+iconx+')')
                        try: urllib.urlretrieve('http://srv1.iptvxtra.net/xmltv/xmltv_th_2.xmx', xmltv2th)
                        except: urllib.urlretrieve('http://srv3.iptvxtra.net/xmltv/xmltv_th_2.xmx', xmltv2th)
                        print ' --------------------------------------------------------  TH XMLTV geladen'
        except:
            print ' --------------------------------------------------------  TH XMLTV konnte nicht geladen werden'

# --------------------------------------------------------------------------------------------------------------------------------------------------------------   Programm Starter
    if __settings__.getSetting("de") == 'true':
        __settings__.setSetting("th", "false")
        __settings__.setSetting("sport", "false")
        try:
            xbmc.executebuiltin('XBMC.RunAddon(plugin.video.iptvxtra-de)')
        except:
            __settings__.setSetting("de", "false")
            print ' --------------------------------------------------------  IPTVxtra-DE nicht installiert'

    if __settings__.getSetting("th") == 'true':
        __settings__.setSetting("de", "false")
        __settings__.setSetting("sport", "false")
        try:
            xbmc.executebuiltin('XBMC.RunAddon(plugin.video.iptvxtra-th)')
        except:
            __settings__.setSetting("th", "false")
            print ' --------------------------------------------------------  IPTVxtra-TH nicht installiert'

    if __settings__.getSetting("sport") == 'true':
        __settings__.setSetting("th", "false")
        __settings__.setSetting("de", "false")
        try:
            print ' --------------------------------------------------------  Plugin s.p.o.r.t.TV'
            xbmc.executebuiltin('XBMC.RunAddon(plugin.video.s.p.o.r.t)')
        except:
            __settings__.setSetting("sport", "false")
            print ' --------------------------------------------------------  Plugin s.p.o.r.t.TV nicht installiert'

    if __settings__.getSetting("alt1") == 'true':
        try:
            print ' --------------------------------------------------------  alternatives Plugin'
            xbmc.executebuiltin('XBMC.RunAddon('+ __settings__.getSetting("alt2")+')')
        except:
            __settings__.setSetting("alt1", "false")
            print ' --------------------------------------------------------  alternatives Plugin nicht installiert'

# --------------------------------------------------------------------------------------------------------------------------------------------------------------   Player Info
    if __settings__.getSetting("playerinfox") == 'true':
        try:
            print ' --------------------------------------------------------  Playerinfo gestartet'
            if __settings__.getSetting("popup") == 'true':
                xbmc.executebuiltin('XBMC.Notification(Stream Restart , Stream-Restarter wird geladen ,4000,'+iconb+')')
            xbmc.sleep(3000)
            xbmc.executescript('special://home/addons/plugin.program.iptvxtra/playerinfo.py')
        except:
            __settings__.setSetting("playerinfox", "false")
            print ' --------------------------------------------------------  Playerinfo kann nicht gestartet werden'

# --------------------------------------------------------------------------------------------------------------------------------------------------------------   EcoUpdater
    if __settings__.getSetting("eco") == 'true':
        try:
            xbmc.executebuiltin('XBMC.RunPlugin(plugin://plugin.program.ecoupd)')
        except:
            __settings__.setSetting("eco", "false")
            xbmc.executebuiltin('XBMC.Notification(Error EcoUpdater, der EcoUpdater ist nicht installiert ,4000,'+icon+')')
            print ' --------------------------------------------------------  EcoUpdater nicht installiert'

# --------------------------------------------------------------------------------------------------------------------------------------------------------------   advancedsettings
    if __settings__.getSetting("as") == 'true':
        try:
            __settings__.setSetting("as", "false")
            xbmc.executebuiltin('XBMC.Notification(advancedsettings.xml, die advancedsettings.xml wurde kopiert - beim nächsten Neustart ist diese erst aktiv ,6000,'+icon+')')
        except:
            __settings__.setSetting("as", "false")
            xbmc.executebuiltin('XBMC.Notification(Error advancedsettings.xml, die advancedsettings.xml wurde nicht integriert ,4000,'+icon+')')
            print ' --------------------------------------------------------  advancedsettings.xml nicht installiert'
コード例 #39
0
ファイル: home.py プロジェクト: mrbusta/passion-xbmc
    def onClick(self, controlID):
        try:
            if self.GAME and self.GAME.GameOver:
                del self.GAME
                self.GAME = None

            if self.GAME and controlID == 500:
                if not self.GAME.threadLevel and not self.GAME.ballRunning:
                    self.GAME.startLevel()
                elif self.GAME.vaus_statut == "LASER":
                    #else:
                    self.launchFire()

            elif not self.GAME and controlID == 201:
                mode = (controlID - 200)
                self.launchGame(0, mode)

            elif not self.GAME and controlID == 202:
                mode = (controlID - 200)
                self.launchGame(0, mode)

            elif not self.GAME and controlID == 203:
                mode = (controlID - 200)
                #browse custom stage
                stg = utilities.getBrowseDialog(
                    os.path.join(BASE_RESOURCE_PATH, "custom_levels") + os.sep,
                    heading="Select Your Stage",
                    mask=".stage")
                if stg and os.path.isfile(stg):
                    f = open(stg, "r")
                    bg, stage = eval(f.read())
                    f.close()
                    #test valide stage and background
                    error_info = "Bad file! %s" % stg
                    if not len(stage) == 260: raise error_info
                    for colrow in stage:
                        if not (0 <= colrow <= 10): raise error_info
                    if os.path.exists(bg): bg = bg
                    elif bg and not os.path.exists(bg):
                        bg = os.path.join(MEDIAS_PATH, bg)
                    stageName = os.path.splitext(os.path.basename(stg))[0]
                    customlevel = bg, stage, stageName
                    self.launchGame(0, mode, customlevel)

            elif not self.GAME and controlID == 204:
                mode = (controlID - 200)
                stage_path = utilities.getBrowseDialog(
                    os.path.join(BASE_RESOURCE_PATH, "media", "stages") +
                    os.sep,
                    heading="Select Practice Stage",
                    dlg_type=2,
                    shares="pictures",
                    use_thumbs=True)
                level_id = os.path.splitext(
                    os.path.basename(stage_path))[0].split("_")[-1]
                if level_id.isdigit():
                    mode = (mode, 5)["tournament" in os.path.basename(
                        stage_path).lower()]
                    self.launchGame(int(level_id), mode)

            elif controlID == 122:
                import editor
                w = editor.levelEditor("levelEditor.xml", CWD, CURRENT_SKIN,
                                       FORCE_FALLBACK)
                w.doModal()
                del w, editor

            elif controlID == 125:
                w = HighScores("highScores.xml", CWD, CURRENT_SKIN,
                               FORCE_FALLBACK)
                w.doModal()
                del w

            elif controlID == 320:
                self.closeGame()

            elif controlID == 123:
                self._stop_game()

            elif controlID == 126:
                settings = xbmc.Settings(CWD)
                skin_setting = settings.getSetting("skin")
                settings.openSettings()
                xbmc.sleep(500)
                self.setSettings()
                if skin_setting != xbmc.Settings(CWD).getSetting("skin"):
                    self.closeGame()
                    xbmc.executescript(os.path.join(CWD, 'default.py'))

            elif controlID == 127:
                import infos
                w = infos.Info("infos.xml", CWD, CURRENT_SKIN, FORCE_FALLBACK)
                w.doModal()
                del w, infos
        except:
            print_exc()
コード例 #40
0
import xbmc, xbmcgui, sys, os, time
origpath =
newpath =

for root, dirs, files in os.walk(origpath, topdown=False):
    for name in files:
        os.remove(os.path.join(root, name))
    for name in dirs:
        os.rmdir(os.path.join(root, name))
os.rmdir(origpath)
os.rename(newpath,origpath)
xbmc.executescript(origpath + "\\default.py")
コード例 #41
0
    def onClick(self,controlId):
        if controlId == REGULAR_PANEL_CONTROL:
            identifier = self.getControl(controlId).getSelectedItem().getProperty('category')
            self.focused_item = self.getControl(controlId).getSelectedPosition()
            if identifier == 'screensaver':
                self.reset_variables()
                xbmc.executescript(os.path.join(addon_path,'cocktail.py'))
            elif identifier == 'search':
                self.last_focused_mainmenu_item = self.focused_item
                self.reset_variables()
                self.search()
            elif identifier == 'alcohol':
                self.last_focused_mainmenu_item = self.focused_item
                self.reset_variables()
                self.alcoholic_type()
            elif identifier == 'glass':
                self.last_focused_mainmenu_item = self.focused_item
                self.reset_variables()
                self.glass_type()
            elif identifier == 'categories':
                self.last_focused_mainmenu_item = self.focused_item
                self.reset_variables()
                self.categories()
            elif identifier == 'ingredient':
                self.last_focused_mainmenu_item = self.focused_item
                self.reset_variables()
                self.ingredient_picker()
            elif identifier == 'favourites':
                self.last_focused_mainmenu_item = self.focused_item
                self.reset_variables()
                self.list_favourites()
            elif identifier == 'category_selection':
                category = self.getControl(controlId).getSelectedItem().getLabel()
                self.ingredient = None
                self.last_focused_category_item = self.focused_item
                self.category = category
                self.glass = None
                self.alcohol = None
                xbmc.executebuiltin( "ActivateWindow(busydialog)" )
                cocktails = cocktailsdb_api.Filter().category(category)
                xbmc.executebuiltin( "Dialog.Close(busydialog)" )
                self.list_cocktails(cocktails)
            elif identifier == 'alcoholic_selection':
                tipo = self.getControl(controlId).getSelectedItem().getLabel()
                self.ingredient = None
                self.last_focused_alchool_item = self.focused_item
                self.category = None
                self.glass = None
                self.alcohol = tipo
                xbmc.executebuiltin( "ActivateWindow(busydialog)" )
                cocktails = cocktailsdb_api.Filter().alcohol(tipo)
                xbmc.executebuiltin( "Dialog.Close(busydialog)" )
                self.list_cocktails(cocktails)
            elif identifier == 'glass_selection':
                glass = self.getControl(controlId).getSelectedItem().getLabel()
                self.last_focused_glass_item = self.focused_item
                self.ingredient = None
                self.category = None
                self.glass = glass
                self.alcohol = None
                xbmc.executebuiltin( "ActivateWindow(busydialog)" )
                cocktails = cocktailsdb_api.Filter().glass(glass)
                xbmc.executebuiltin( "Dialog.Close(busydialog)" )
                self.list_cocktails(cocktails)
            elif identifier == 'video_listing':
                youtube_id = self.getControl(controlId).getSelectedItem().getProperty('video_id')
                player = xbmc.Player()
                player.play('plugin://plugin.video.youtube/play/?video_id='+youtube_id)
                while player.isPlaying():
                    xbmc.sleep(200)
                xbmc.sleep(500)
                self.getControl(INGREDIENT_DRINK_PANEL_CONTROL).reset()
                self.getControl(REGULAR_PANEL_CONTROL).reset()
                self.getControl(REGULAR_PANEL_CONTROL).addItems(self.youtube_videos)
                self.setFocusId(REGULAR_PANEL_CONTROL)
                self.getControl(REGULAR_PANEL_CONTROL).selectItem(self.focused_item)

        if controlId == INGREDIENT_DRINK_PANEL_CONTROL:
            identifier = self.getControl(controlId).getSelectedItem().getProperty('category')
            if identifier == 'ingredient_picker':
                ingredient = self.getControl(controlId).getSelectedItem().getLabel()
                self.ingredient = ingredient
                self.last_focused_drink = 0
                self.last_focused_ingredient = self.getControl(controlId).getSelectedPosition()
                self.category = None
                self.glass = None
                self.alcohol = None
                xbmc.executebuiltin( "ActivateWindow(busydialog)" )
                cocktails = cocktailsdb_api.Filter().ingredient(ingredient)
                xbmc.executebuiltin( "Dialog.Close(busydialog)" )
                self.list_cocktails(cocktails)
            elif identifier == 'cocktail_listing':
                cocktail_id = self.getControl(controlId).getSelectedItem().getProperty('id')
                self.cocktail_player(cocktail_id)
コード例 #42
0
ファイル: autoexec.py プロジェクト: amitca71/xbmc-scripting
# Adding this code to your own autoexec.py will cause all previously
# saved myTV Alarm Clocks to be setup on XBMC startup.

import xbmc

xbmc.executescript(xbmc.translatePath('Q:/scripts/myTV/AlarmClock.py'))

コード例 #43
0





















#xbmc.enableNavSounds(0)

check_connection()

run = Main()
del run

xbmc.executescript(HOME_DIR+"game.py")
コード例 #44
0
ファイル: default.py プロジェクト: amitca71/xbmc-scripting
                    f = open(autoexecfile, "w")
                    f.write("import xbmc\n")
                    f.write(Script)
                    f.close()
                    return


    def removeauto(self):
            if os.access("P:\\scripts\\", os.F_OK)==0:
                    return
            autoexecfile = "P:\\scripts\\autoexec.py"
            if os.path.exists(autoexecfile):
                    fh = open(autoexecfile)
                    lines = [ line for line in fh if not line.strip().startswith(Script) ]
                    fh.close()
                    f = open(autoexecfile, "w")
                    f.writelines(lines)
                    f.close()
                    return
            return
        
m = main()
m.gui()
if enabled == 1:
        print "1"
        xbmc.executescript('Q:\\scripts\\ResumeX\\engine.py')
else:
        print "2"
        pass
del m
コード例 #45
0
ファイル: default.py プロジェクト: shangdawei/seventft
            self.passme = 1
            dialog = xbmcgui.DialogProgress()
            dialog.create("ResumeX Disabled - OK!")
            time.sleep(2)
            dialog.close()
        if self.passme !=1:
            if dialog.yesno("ResumeX","Enable window resume?"):
                self.winresume = "yes"
            else:
                self.winresume = "no"
            dialog = xbmcgui.DialogProgress()
            dialog.create("ResumeX Enabled - OK!")
            time.sleep(2)
            dialog.close()
        self.writesettings()

            

    def writesettings(self):
        f = open(SETTINGFILE, "wb")
        f.write("<settings>\n")
        f.write("\t<ENABLED>"+self.enable+"</ENABLED>\n")
        f.write("\t<WINRESUME>"+self.winresume+"</WINRESUME>\n")
        f.write("</settings>\n")
        f.close()
        
m = main()
m.gui()
xbmc.executescript('Q:\scripts\ResumeX\lib\engine.py')
del m
コード例 #46
0
ファイル: autoexec.py プロジェクト: jacaba1/limitlessled-kodi
import xbmc
xbmc.executescript('special://home/userdata/playeractions.py')
コード例 #47
0
ファイル: service.py プロジェクト: linuxvalley/addon
def updaterCheck():
    # updater check
    updated, needsReload = updater.check(background=True)
    if needsReload:
        xbmc.executescript(__file__)
        exit(0)
コード例 #48
0
    f.write(string + '\n')
    f.close()


######################################################################
def get_system_platform():
    platform = "unknown"
    if xbmc.getCondVisibility("system.platform.linux"):
        platform = "linux"
    elif xbmc.getCondVisibility("system.platform.xbox"):
        platform = "xbox"
    elif xbmc.getCondVisibility("system.platform.windows"):
        platform = "windows"
    elif xbmc.getCondVisibility("system.platform.osx"):
        platform = "osx"
#    Trace("Platform: %s"%platform)
    return platform


#############################################################################
#############################################################################

#retrieve the platform.
#platform = get_system_platform()

shutil.copyfile(RootDir + 'startup.plx', NaviXDir + 'startup.plx')

xbmc.executescript(NaviXDir + 'default.py')

#xbmc.sleep(1000)
コード例 #49
0
            self.winresume = "-"
            self.passme = 1
            dialog = xbmcgui.DialogProgress()
            dialog.create("ResumeX Disabled - OK!")
            time.sleep(2)
            dialog.close()
        if self.passme != 1:
            if dialog.yesno("ResumeX", "Enable window resume?"):
                self.winresume = "yes"
            else:
                self.winresume = "no"
            dialog = xbmcgui.DialogProgress()
            dialog.create("ResumeX Enabled - OK!")
            time.sleep(2)
            dialog.close()
        self.writesettings()

    def writesettings(self):
        f = open(SETTINGFILE, "wb")
        f.write("<settings>\n")
        f.write("\t<ENABLED>" + self.enable + "</ENABLED>\n")
        f.write("\t<WINRESUME>" + self.winresume + "</WINRESUME>\n")
        f.write("</settings>\n")
        f.close()


m = main()
m.gui()
xbmc.executescript("Q:\scripts\ResumeX\lib\engine.py")
del m
コード例 #50
0
ファイル: autoexec.py プロジェクト: OpenPrismCube/meta-elmo
#
#      Copyright (C) 2005-2008 Team XBMC
#      http://www.xbmc.org
#
#  This Program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2, or (at your option)
#  any later version.
#
#  This Program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  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
#

# auto execute scripts when xbmc starts, place this file in xbmchome\scripts\
# 
# note: - do not execute more than one script at a time which asks for user input!

import xbmc

xbmc.executescript('/home/root/.xbmc/addons/script.mbox/default.py')
#xbmc.executescript('c:\\Documents and Settings\\lael98\\Application Data\XBMC\\addons\\script.mbox\\default.py')
#xbmc.executescript('/pvr/script.mythbox/default.py')