Ejemplo n.º 1
0
    def doAutoMode(self):

        self.showAll()
        failed = False

        self.autoModeOn = True

        self.timerOff()
        #self.flirc.format()

        for i in range(self.buttonMin + 10,
                       self.buttonMax + 1):  #+10 ignore 'Functional' Buttons
            if not self._onClick(i):
                failed = True
                break
        self.timerOn()

        self.autoModeOn = False
        self.getControl(self.style + GO_STOP + 1000).setVisible(False)

        self.showAll()
        self.currentButton = 0
        self.loseFocus()

        if failed:
            return

        utils.setSetting('autoStart', 'false')

        self.lockInfobox = True
        self._setFocus(self.style + GO)
        self.lockInfobox = False

        self.setInfoBox(utils.getString(utils.AUTO_OK))
        self.sleep(10 * INFOSECS)
Ejemplo n.º 2
0
def MainList():
    DoMainList()
    return

    attempts = 0
    while attempts < 5:
        attempts += 1
        if DoMainList():
            return
        xbmc.sleep(100)

    xbmc.sleep(5000)

    #try again
    if DoMainList():
        return

    showSettings = False
    if showSettings:
        utils.DialogOK(GETTEXT(30043), GETTEXT(30044))

        APPLICATION.addonSettings()

        if DoMainList():
            return

    showFallackMessage = False
    if showFallackMessage:
        utils.DialogOK(GETTEXT(30043), GETTEXT(30052))

    utils.setSetting('FALLBACK', 'true')
    if DoMainList():
        return   
Ejemplo n.º 3
0
    def doAutoMode(self):        
        
        self.showAll()
        failed = False

        self.autoModeOn = True

        self.timerOff()
        #self.flirc.format()

        for i in range(self.buttonMin+10, self.buttonMax+1): #+10 ignore 'Functional' Buttons
            if not self._onClick(i):             
                failed = True
                break 
        self.timerOn()            

        self.autoModeOn = False
        self.getControl(self.style + GO_STOP + 1000).setVisible(False)

        self.showAll()
        self.currentButton = 0
        self.loseFocus()

        if failed:
            return

        utils.setSetting('autoStart', 'false')

        self.lockInfobox = True
        self._setFocus(self.style + GO)
        self.lockInfobox = False

        self.setInfoBox(utils.getString(utils.AUTO_OK))
        self.sleep(10*INFOSECS)
Ejemplo n.º 4
0
    def doFirstRun(self):
        if not self.firstRun:
            return

        self.showControl(PAGE1, False)
        self.showControl(PAGE2, False)
        self.showControl(PAGE3, False)
        self.showControl(PAGE4, False)
        self.showControl(PAGE5, False)
        self.showControl(CHECK_FOR_DOWNLOAD, False)

        self.getControl(MAIN).setPosition(0,0)

        hadClient = utils.HasClient()

        if True: #utils.getSetting('FIRSTRUN').lower() == 'true':
            utils.setSetting('FIRSTRUN', 'false')
            self.checkInternet()
            self.checkEmailAddress()
            if (not hadClient) and utils.HasClient():
                self.checkInitialSetup()

        self.showControl(PAGE5, False)
        self.showControl(PAGE4, False)
        self.showControl(PAGE3, False)
        self.showControl(PAGE2, False)
        self.showControl(PAGE1, True)  

        self.firstRun = False 
Ejemplo n.º 5
0
 def configureRemote(self):
     if (utils.getSetting('remote_selection') == '1'):
         self.remote_base_path = utils.getSetting('remote_path_2')
         self.remote_vfs = XBMCFileSystem(utils.getSetting('remote_path_2'))
         utils.setSetting("remote_path", "")
     elif (utils.getSetting('remote_selection') == '0'):
         self.remote_base_path = utils.getSetting('remote_path')
         self.remote_vfs = XBMCFileSystem(utils.getSetting("remote_path"))
def selectInstance():
    instance = getSetting("instance", unicode)
    instances = client.instances_(sort_by="health")
    if instances:
        preselect = instances.index(instance) if instance in instances else -1
        index = selectDialog(instances, heading=30105, preselect=preselect)
        if index >= 0:
            setSetting("instance", instances[index], unicode)
Ejemplo n.º 7
0
 def configureRemote(self):
     if(utils.getSetting('remote_selection') == '1'):
         self.remote_base_path = utils.getSetting('remote_path_2');
         self.remote_vfs = XBMCFileSystem(utils.getSetting('remote_path_2'))
         utils.setSetting("remote_path","")
     elif(utils.getSetting('remote_selection') == '0'):
         self.remote_base_path = utils.getSetting('remote_path');
         self.remote_vfs = XBMCFileSystem(utils.getSetting("remote_path"))
Ejemplo n.º 8
0
def reboot():
    version = utils.getSetting('dVersion')

    utils.setSetting('cVersion', version)
    utils.setSetting('dVersion', '0.0.0')

    cmd = 'recoveryflash'

    utils.reboot(cmd)
Ejemplo n.º 9
0
def reboot():
    version = utils.getSetting('dVersion') 

    utils.setSetting('cVersion', version)
    utils.setSetting('dVersion', '0.0.0')

    cmd = 'recoveryflash /recovery/update.zip'

    utils.reboot(cmd)
Ejemplo n.º 10
0
def RemoveShortcut(url):
    shortcuts = utils.getSetting('ADDONS')

    url += '|'

    if url not in shortcuts:
        return False

    update = shortcuts.replace(url, '')

    utils.setSetting('ADDONS', update)

    return True
Ejemplo n.º 11
0
def SetResolvedUrl(url, success=True, listItem=None, windowed=True):
    skin = utils.getSetting('SKIN')
    if skin == 'Thumbnails':
        windowed = False
    if skin == 'Thumbnails + Zoom':
        windowed = False

    #APPLICATION.setResolvedUrl(url, success=success, listItem=listItem, windowed=windowed)
    pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    xbmc.Player(xbmc.PLAYER_CORE_AUTO).play(pl, windowed=windowed)
    utils.setSetting('PARAMS', PARAMS)
    import playbackTimer
    playbackTimer.restart()
Ejemplo n.º 12
0
 def configureRemote(self):
     if(utils.getSetting('remote_selection') == '1'):
         self.remote_base_path = utils.getSetting('remote_path_2');
         self.remote_vfs = XBMCFileSystem(utils.getSetting('remote_path_2'))
         utils.setSetting("remote_path","")
     elif(utils.getSetting('remote_selection') == '0'):
         self.remote_base_path = utils.getSetting('remote_path');
         self.remote_vfs = XBMCFileSystem(utils.getSetting("remote_path"))
     elif(utils.getSetting('remote_selection') == '2'):
         self.remote_base_path = "/"
         self.remote_vfs = DropboxFileSystem("/")
     elif(utils.getSetting('remote_selection') == '3'):
         self.remote_base_path = '/Kodi Backup/'
         self.remote_vfs = GoogleDriveFilesystem('/Kodi Backup/')
Ejemplo n.º 13
0
def init():
    # Get the path to the mc2xml executable
    pathToExecutable = utils.getSetting('path_to_mc2xml')
    if(not utils.isNullOrEmpty(pathToExecutable)):
        # Set the xmltv output path
        xmltvPath = os.path.join(pathToExecutable, "xmltv.xml")

        # See if the file does not exist
        if(not os.path.isfile(xmltvPath)):
            # Log
            utils.log("[Init] The tv guide information hasn't been set. Clearing the last run time to ensure it runs at startup.")

            # Clear the last run time
            utils.setSetting("last_run_time", "")
Ejemplo n.º 14
0
 def configureRemote(self):
     if(utils.getSetting('remote_selection') == '1'):
         self.remote_base_path = utils.getSetting('remote_path_2');
         self.remote_vfs = XBMCFileSystem(utils.getSetting('remote_path_2'))
         utils.setSetting("remote_path","")
     elif(utils.getSetting('remote_selection') == '0'):
         self.remote_base_path = utils.getSetting('remote_path');
         self.remote_vfs = XBMCFileSystem(utils.getSetting("remote_path"))
     elif(utils.getSetting('remote_selection') == '2'):
         self.remote_base_path = "/"
         self.remote_vfs = DropboxFileSystem("/")
     elif(utils.getSetting('remote_selection') == '3'):
         self.remote_base_path = '/Kodi Backup/'
         self.remote_vfs = GoogleDriveFilesystem('/Kodi Backup/')
Ejemplo n.º 15
0
    def __init__(self):
        self.local_path = xbmc.makeLegalFilename(xbmc.translatePath("special://home"),False);
      
	if(utils.getSetting('remote_selection') == '1'):
	    self.remote_path = utils.getSetting('remote_path_2')
	    utils.setSetting("remote_path","")
        elif(utils.getSetting('remote_selection') == '0'):
            self.remote_path = utils.getSetting("remote_path")

        #fix slashes
        self.remote_path = self.remote_path.replace("\\","/")
        
        #check if trailing slash is included
        if(self.remote_path[-1:] != "/"):
            self.remote_path = self.remote_path + "/"
        
        utils.log(utils.getString(30046))
Ejemplo n.º 16
0
def performUpdate(response, silent):
    try:
        version = response['Version']
        link = response['Link']
        md5 = response['MD5']
    except:
        return

    path = getDownloadPath()

    if utils.generateMD5(path) != md5:
        if (not silent) and (not utils.yesno(1, 10, 11)):
            return

        dp = None

        if not silent:
            dp = utils.progress(1, 14, 15)

        hash = 0
        count = 0
        nTries = 3

        if not silent:
            nTries = 1

        while (count < nTries) and (hash != md5):
            count += 1
            try:
                download(link, path, dp)
                hash = utils.generateMD5(path)
            except Exception, e:
                utils.deleteFile(path)
                if str(e) == 'Canceled':
                    return

        if hash != md5:
            utils.unflagUpdate()
            utils.deleteFile(path)
            utils.setSetting('dVersion', '0.0.0')
            if not silent:
                utils.ok(1, 24, 13)
            return
Ejemplo n.º 17
0
def performUpdate(response, silent):
    try:
        version = response['Version']
        link    = response['Link']
        md5     = response['MD5']
    except:
        return

    path = getDownloadPath()

    if utils.generateMD5(path) != md5:
        if (not silent) and (not utils.yesno(1, 10, 11)):
            return

        dp = None
    
        if not silent:
            dp = utils.progress(1, 14, 15)

        hash   = 0
        count  = 0
        nTries = 3

        if not silent:
            nTries = 1
    
        while (count < nTries) and (hash != md5):
            count += 1
            try:        
                download(link,path,version,dp)
                hash = utils.generateMD5(path)
            except Exception, e:
                utils.deleteFile(path)
                if str(e) == 'Canceled':                    
                    return

        if hash != md5:
            utils.unflagUpdate()
            utils.deleteFile(path)
            utils.setSetting('dVersion', '0.0.0')
            if not silent:
                utils.ok(1, 24, 13)
            return
Ejemplo n.º 18
0
def startService():
    # Log
    utils.log("Main loop execution started.")

    # Run until XBMC exits
    while(not xbmc.abortRequested):
        # Get the update interval
        updateInterval = int(utils.getSetting("update_interval"))

        # Get the current time
        now = dt.datetime.now()

        # Get the last run time
        lastRunTimeString = utils.getSetting("last_run_time")

        # Ensure a run time exists and is in the correct format
        if(utils.isNullOrEmpty(lastRunTimeString) or len(lastRunTimeString) != 14):
            # Set the last run time to now minus the update interval + 1 hour to ensure it runs now
            lastRunTimeString = utils.convertDateToString(now - dt.timedelta(hours = updateInterval + 1))

            # Update the settings
            utils.setSetting("last_run_time", lastRunTimeString)

        # Convert the string to datetime
        lastRunTime = utils.convertStringToDate(lastRunTimeString)

        # Set the next run time
        nextRunTime = lastRunTime + dt.timedelta(hours = updateInterval)

        # See if an update is required
        if(nextRunTime < now):
            # Run the update
            update.UpdateGuideInformation()

            # Update the settings
            utils.setSetting("last_run_time", utils.convertDateToString(dt.datetime.now()))

        # Sleep
        time.sleep(1)

    # Log
    utils.log("Main loop execution ended.")
Ejemplo n.º 19
0
    def onClick(self, controlId):        
        utils.Log('onClick %d' % controlId)

        if controlId == SKIP_INTERNET:
            self.checkForInternetSkip = True
            self.checkForInternet     = False
            return

        if controlId == CONNECT_INTERNET:
            import androidApp
            androidApp.launchAndroid('com.mbx.settingsmbox')
            return

        if controlId == SKIP_INITIAL:
            self.checkForInitialSetup = False
            return

        if controlId == SKIP_EMAIL:
            self.checkForEmail = False
            return

        if controlId == SUBMIT_EMAIL:
            control = self.getControl(ENTER_EMAIL)
            text    = control.getLabel().strip()

            if len(text) > 0:
                self.checkForEmail = False
                utils.setSetting('CLIENT', text)
                retur

        if controlId == ENTER_EMAIL:
            control = self.getControl(ENTER_EMAIL)
            text    = control.getLabel().strip()
            text    = utils.GetText(title=GETTEXT(30016), text=text, hidden=False, allowEmpty=True)
            if text == None:
                return
            control.setLabel(text if len(text) > 0 else ' ')
            return

        if controlId == SETTINGS:
            self.addonSettings()
Ejemplo n.º 20
0
def doSSDPDiscovery():
    searchTarget = "urn:hyperion-project.org:device:basic:1"
    filteredResponse = []
    ipPortUsnList = []
    selectedServer = -1
    # start sync search
    response = ssdp.discover(searchTarget)

    for item in response:
        if item.st == searchTarget:
            filteredResponse.append(item)

    if len(filteredResponse) > 0:
        ipPortUsnList = getSSDPData(filteredResponse)
        # if there is more than one entry the user should select one
        if len(filteredResponse) > 1:
            selectedServer = xbmcgui.Dialog().select(getLS(32102), buildSelectList(ipPortUsnList))
        else:
            xbmcgui.Dialog().ok('Hyperion Control', getLS(32103), '-> '+ipPortUsnList[0]["ip"]+':'+str(ipPortUsnList[0]["port"]))
            selectedServer = 0

        #check user input and push settings if valid
        if selectedServer > -1:
            setSetting('SSDPUSN', ipPortUsnList[selectedServer]["usn"])
            setSetting('ip', ipPortUsnList[selectedServer]["ip"])
            setSetting('port', ipPortUsnList[selectedServer]["port"])
        # TODO SSDP USN checks on usual startup to sync ip and port if required. Requires async ssdp
    else:
        xbmcgui.Dialog().ok('Hyperion Control', getLS(32104))
    return
Ejemplo n.º 21
0
def AddAddonShortcut():
    import glob

    path = xbmc.translatePath(os.path.join('special://home', 'addons', '*.*'))
    shortcuts = utils.getSetting('ADDONS').split('|')

    #don't allow sortcut to self
    shortcuts.append(ADDONID)

    names = []

    for addon in glob.glob(path):
        try:
            name = addon.lower().rsplit(os.path.sep, 1)[-1]
            if name not in shortcuts:
                realname = xbmcaddon.Addon(name).getAddonInfo('name')
                names.append([Capitalize(realname), name])
        except:
            pass

    if len(names) < 1:
        return

    names.sort()

    addons = []
    for name in names:
        addons.append(name[0])

    option = xbmcgui.Dialog().select('Select addon', addons)

    if option < 0:
        return False

    update = utils.getSetting('ADDONS') + names[option][1] + '|'

    utils.setSetting('ADDONS', update)

    return True
Ejemplo n.º 22
0
                download(link, path, dp)
                hash = utils.generateMD5(path)
            except Exception, e:
                utils.deleteFile(path)
                if str(e) == 'Canceled':
                    return

        if hash != md5:
            utils.unflagUpdate()
            utils.deleteFile(path)
            utils.setSetting('dVersion', '0.0.0')
            if not silent:
                utils.ok(1, 24, 13)
            return

    utils.setSetting('dVersion', version)

    if not utils.okReboot(1, 23, 16, 18, delay=15):
        return

    reboot()


def performManualUpdate(response, silent):
    try:
        import xbmcgui
        path = getDownloadPath()
        select_name = ['Cancel']
        select_url = ['Cancel']

        for i in json.loads(response):
Ejemplo n.º 23
0
def performManualUpdate(response, silent):
    try:
        import xbmcgui
        path = getDownloadPath()
        select_name=['Cancel']
        select_url=['Cancel']
        
        for i in json.loads(response):
        
           cVersion = utils.getSetting('cVersion')
           
           if not cVersion in i['Version']:
               select_name.append(i['Version'])
               select_url.append(i['Link']+'*'+i['Version']+'*'+i['MD5'])
               
        link = select_url[xbmcgui.Dialog().select('Your Current Firmware '+ cVersion , select_name)]
        
        if 'Cancel' in link:
            return
        url = link.split('*')[0]
        version = link.split('*')[1]
        md5 = link.split('*')[2]
        
        if utils.generateMD5(path) != md5:
            if (not silent) and (not utils.yesno(1, 11, 0)):
            
                return
    
            dp = None
        
            if silent:
                dp = utils.progress(1, 14, 15)
    
            hash   = 0
            count  = 0
            nTries = 3
    
            if not silent:
                nTries = 1
        
            while (count < nTries) and (hash != md5):
                count += 1
                try:        
                    download(url,path,version,dp)
                    hash = utils.generateMD5(path)
                except Exception, e:
                    utils.deleteFile(path)
                    if str(e) == 'Canceled':                    
                        return
    
            if hash != md5:
                utils.unflagUpdate()
                utils.deleteFile(path)
                utils.setSetting('dVersion', '0.0.0')
                if not silent:
                    utils.ok(1, 24, 13)
                return
            
        utils.setSetting('dVersion', version)
        
        
        if not utils.okReboot(1, 23, 16, 18, delay = 15):
            return
    
        reboot()
Ejemplo n.º 24
0
                download(link,path,version,dp)
                hash = utils.generateMD5(path)
            except Exception, e:
                utils.deleteFile(path)
                if str(e) == 'Canceled':                    
                    return

        if hash != md5:
            utils.unflagUpdate()
            utils.deleteFile(path)
            utils.setSetting('dVersion', '0.0.0')
            if not silent:
                utils.ok(1, 24, 13)
            return
        
    utils.setSetting('dVersion', version)

    if not utils.okReboot(1, 23, 16, 18, delay = 15):
        return

    reboot()
    
    
def performManualUpdate(response, silent):
    try:
        import xbmcgui
        path = getDownloadPath()
        select_name=['Cancel']
        select_url=['Cancel']
        
        for i in json.loads(response):
Ejemplo n.º 25
0
def performManualUpdate(response, silent):
    try:
        import xbmcgui
        path = getDownloadPath()
        select_name = ['Cancel']
        select_url = ['Cancel']

        for i in json.loads(response):

            cVersion = utils.getSetting('cVersion')

            if not cVersion in i['Version']:
                select_name.append(i['Version'])
                select_url.append(i['Link'] + '*' + i['Version'] + '*' +
                                  i['MD5'])

        link = select_url[xbmcgui.Dialog().select(
            'Your Current Firmware ' + cVersion, select_name)]

        if 'Cancel' in link:
            return
        url = link.split('*')[0]
        version = link.split('*')[1]
        md5 = link.split('*')[2]

        if utils.generateMD5(path) != md5:
            if (not silent) and (not utils.yesno(1, 11, 0)):

                return

            dp = None

            if silent:
                dp = utils.progress(1, 14, 15)

            hash = 0
            count = 0
            nTries = 3

            if not silent:
                nTries = 1

            while (count < nTries) and (hash != md5):
                count += 1
                try:
                    download(url, path, version, dp)
                    hash = utils.generateMD5(path)
                except Exception, e:
                    utils.deleteFile(path)
                    if str(e) == 'Canceled':
                        return

            if hash != md5:
                utils.unflagUpdate()
                utils.deleteFile(path)
                utils.setSetting('dVersion', '0.0.0')
                if not silent:
                    utils.ok(1, 24, 13)
                return

        utils.setSetting('dVersion', version)

        if not utils.okReboot(1, 23, 16, 18, delay=15):
            return

        reboot()