示例#1
0
    def get_fast_sync(self):

        new_fast_sync = compare_version(self.server['auth/server-version'],
                                        "4.2.0.23")
        enable_fast_sync = False

        if settings('SyncInstallRunDone.bool'):

            if settings('kodiCompanion.bool'):
                for plugin in self.server['api'].get_plugins():

                    if plugin['Name'] in ("Emby.Kodi Sync Queue",
                                          "Kodi companion"):
                        enable_fast_sync = True

                        break

                if new_fast_sync > 0:
                    self.fast_sync(enable_fast_sync)

                elif enable_fast_sync:

                    if not self.fast_sync_plugin():
                        dialog("ok", heading="{emby}", line1=_(33128))

                        raise Exception("Failed to retrieve latest updates")
                else:
                    raise LibraryException('CompanionMissing')

                LOG.info("--<[ retrieve changes ]")
    def check_update(self, forced=False):
        ''' Check for objects build version and compare.
            This pulls a dict that contains all the information for the build needed.
        '''
        LOG.info("--[ check updates/%s ]", objects.version)
        kodi = "DEV" if settings('devMode.bool') else xbmc.getInfoLabel(
            'System.BuildVersion')

        try:
            versions = requests.get(
                'http://kodi.emby.media/Public%20testing/Dependencies/databases.json'
            ).json()
            build = find(versions, kodi)

            if not build:
                raise Exception("build %s incompatible?!" % kodi)

            label, zipfile = build.split('-', 1)

            if label == 'DEV' and forced:
                LOG.info("--[ force/objects/%s ]", label)

            elif label == objects.version:
                LOG.info("--[ objects/%s ]", objects.version)

                return False

            get_objects(zipfile, label + '.zip')
            self.reload_objects()

            dialog("notification",
                   heading="{emby}",
                   message=_(33156),
                   icon="{emby}")
            LOG.info("--[ new objects/%s ]", objects.version)

            try:
                if compare_version(self.settings['addon_version'],
                                   objects.embyversion) < 0:
                    dialog("ok",
                           heading="{emby}",
                           line1="%s %s" % (_(33160), objects.embyversion))
            except Exception:
                pass

        except Exception as error:
            LOG.exception(error)

        return True
示例#3
0
    def check_version(self):
        ''' Check the database version to ensure we do not need to do a reset.
        '''
        with Database('emby') as embydb:

            version = emby_db.EmbyDatabase(embydb.cursor).get_version()
            LOG.info("---[ db/%s ]", version)

        if version and compare_version(version, "3.1.0") < 0:
            resp = dialog("yesno", heading=_('addon_name'), line1=_(33022))

            if not resp:

                LOG.warn("Database version is out of date! USER IGNORED!")
                dialog("ok", heading=_('addon_name'), line1=_(33023))

                raise Exception("User backed out of a required database reset")
            else:
                reset()

                raise Exception("Completed database reset")
示例#4
0
    def check_update(self, forced=False, versions=None):
        ''' Check for objects build version and compare.
            This pulls a dict that contains all the information for the build needed.
        '''
        LOG.info("--[ check updates/%s ]", objects.version)

        if settings('devMode.bool'):
            kodi = "DEV"
        elif not self.addon_version.replace(".", "").isdigit():

            LOG.info("[ objects/beta check ]")
            kodi = "beta-%s" % xbmc.getInfoLabel('System.BuildVersion')
        else:
            kodi = xbmc.getInfoLabel('System.BuildVersion')

        try:
            versions = versions or requests.get(OBJ).json()
            build, key = find(versions, kodi)

            if not build:
                raise Exception("build %s incompatible?!" % kodi)

            label, min_version, zipfile = build['objects'][0].split('-', 2)

            if label == 'DEV' and forced:
                LOG.info("--[ force/objects/%s ]", label)

            elif compare_version(self.addon_version, min_version) < 0:
                try:
                    build['objects'].pop(0)
                    versions[key]['objects'] = build['objects']
                    LOG.info("<[ patch min not met: %s ]", min_version)

                    return self.check_update(versions=versions)

                except Exception as error:
                    LOG.info("--<[ min add-on version not met: %s ]",
                             min_version)

                    return False

            elif label == objects.version:
                LOG.info("--<[ objects/%s ]", objects.version)

                return False

            self.get_objects(zipfile, label + '.zip')
            self.reload_objects()

            dialog("notification",
                   heading="{emby}",
                   message=_(33156),
                   icon="{emby}")
            LOG.info("--<[ new objects/%s ]", objects.version)

            try:
                if compare_version(self.addon_version,
                                   objects.embyversion) < 0:
                    dialog("ok",
                           heading="{emby}",
                           line1="%s %s" % (_(33160), objects.embyversion))
            except Exception:
                pass

        except Exception as error:
            LOG.exception(error)

        return True