コード例 #1
0
ファイル: db_schema.py プロジェクト: AnthonyGuerreiro/Flexget
def set_flexget_db_version(manager=None):
    with Session() as session:
        db_version = session.query(FlexgetVersion).first()
        if not db_version:
            log.debug('entering flexget version %s to db', get_current_flexget_version())
            session.add(FlexgetVersion())
        elif db_version.version != get_current_flexget_version():
            log.debug('updating flexget version %s in db', get_current_flexget_version())
            db_version.version = get_current_flexget_version()
            db_version.created = datetime.now()
            session.commit()
        else:
            log.debug('current flexget version already exist in db %s', db_version.version)
コード例 #2
0
ファイル: options.py プロジェクト: AnthonyGuerreiro/Flexget
    def __call__(self, parser, namespace, values, option_string=None):
        from flexget.terminal import console
        current = get_current_flexget_version()
        latest = get_latest_flexget_version_number()

        # Print the version number
        console('%s' % get_current_flexget_version())
        # Check for latest version from server
        if latest:
            if current == latest:
                console('You are on the latest release.')
            else:
                console('Latest release: %s' % latest)
        else:
            console('Error getting latest version number from https://pypi.python.org/pypi/FlexGet')
        parser.exit()
コード例 #3
0
ファイル: manager.py プロジェクト: Lukeid/Flexget
 def crash_report(self):
     """
     This should be called when handling an unexpected exception. Will create a new log file containing the last 50
     debug messages as well as the crash traceback.
     """
     if not self.unit_test:
         filename = os.path.join(self.config_base, datetime.now().strftime('crash_report.%Y.%m.%d.%H%M%S%f.log'))
         with codecs.open(filename, 'w', encoding='utf-8') as outfile:
             outfile.writelines(logger.debug_buffer)
             traceback.print_exc(file=outfile)
         log.critical('An unexpected crash has occurred. Writing crash report to %s. '
                      'Please verify you are running the latest version of flexget by using "flexget -V" '
                      'from CLI or by using version_checker plugin'
                      ' at http://flexget.com/wiki/Plugins/version_checker. You are currently using'
                      ' version %s', filename, get_current_flexget_version())
     log.debug('Traceback:', exc_info=True)
コード例 #4
0
ファイル: version_checker.py プロジェクト: Farbdose/Flexget
    def on_task_start(self, task, config):
        if not config:
            return

        config = self.prepare_config(config)
        current_version = get_current_flexget_version()

        if config.get("check_for_dev_version") is False and current_version.endswith("dev"):
            log.debug("dev version detected, skipping check")
            return

        if config.get("lookup") == "always":
            always_check = True
        else:
            always_check = False
        interval = config.get("interval")

        session = Session()
        last_check = session.query(LastVersionCheck).first()
        if not always_check:
            if last_check:
                time_dif = datetime.now() - last_check.last_check_time
                should_poll = time_dif.days > interval
            else:
                should_poll = True

            if not should_poll:
                log.debug("version check interval not met, skipping check")
                return

        latest_version = get_latest_flexget_version_number()
        if not latest_version:
            log.warning("Could not get latest version of flexget")
            return
        elif latest_version != current_version:
            log.warning(
                "You are not running latest Flexget Version. Current is %s and latest is %s",
                current_version,
                latest_version,
            )
        if last_check:
            log.debug("updating last check time")
            last_check.update()
        else:
            last_check = LastVersionCheck()
            log.debug("creating instance of last version check in DB")
            session.add(last_check)
コード例 #5
0
ファイル: version_checker.py プロジェクト: Flexget/Flexget
    def on_task_start(self, task, config):
        if not config:
            return

        config = self.prepare_config(config)
        current_version = get_current_flexget_version()

        if config.get('check_for_dev_version') is False and current_version.endswith('dev'):
            log.debug('dev version detected, skipping check')
            return

        always_check = bool(config.get('lookup') == 'always')
        interval = config.get('interval')

        session = Session()
        last_check = session.query(LastVersionCheck).first()
        if not always_check:
            if last_check:
                time_dif = datetime.now() - last_check.last_check_time
                should_poll = time_dif.days > interval
            else:
                should_poll = True

            if not should_poll:
                log.debug('version check interval not met, skipping check')
                return

        latest_version = get_latest_flexget_version_number()
        if not latest_version:
            log.warning('Could not get latest version of flexget')
            return
        elif latest_version != current_version:
            log.warning(
                'You are not running latest Flexget Version. Current is %s and latest is %s',
                current_version,
                latest_version,
            )
        if last_check:
            log.debug('updating last check time')
            last_check.update()
        else:
            last_check = LastVersionCheck()
            log.debug('creating instance of last version check in DB')
            session.add(last_check)
コード例 #6
0
 def __init__(self):
     self.version = get_current_flexget_version()
コード例 #7
0
ファイル: db_schema.py プロジェクト: AnthonyGuerreiro/Flexget
 def __init__(self):
     self.version = get_current_flexget_version()