コード例 #1
0
ファイル: properFinder.py プロジェクト: hazell20/SickGear
def _set_last_proper_search(when):

    logger.log(u'Setting the last Proper search in the DB to %s' % when,
               logger.DEBUG)

    my_db = db.DBConnection()
    sql_results = my_db.select('SELECT * FROM info')

    if 0 == len(sql_results):
        my_db.action(
            'INSERT INTO info (last_backlog, last_indexer, last_proper_search) VALUES (?,?,?)',
            [0, 0, sbdatetime.totimestamp(when)])
    else:
        my_db.action('UPDATE info SET last_proper_search=%s' %
                     sbdatetime.totimestamp(when))
コード例 #2
0
    def _set_last_runtime(self, when):
        logger.log('Setting the last backlog runtime in the DB to %s' % when,
                   logger.DEBUG)

        my_db = db.DBConnection()
        sql_results = my_db.select('SELECT * FROM info')

        if len(sql_results) == 0:
            my_db.action(
                'INSERT INTO info (last_backlog, last_indexer, last_run_backlog) VALUES (?,?,?)',
                [1, 0, sbdatetime.totimestamp(when, default=0)])
        else:
            my_db.action('UPDATE info SET last_run_backlog=%s' %
                         sbdatetime.totimestamp(when, default=0))

        self.nextBacklog = datetime.datetime.fromtimestamp(1)
コード例 #3
0
 def last_recent_search(self, value):
     try:
         my_db = db.DBConnection('cache.db')
         my_db.action('INSERT OR REPLACE INTO "lastrecentsearch" (name, datetime) VALUES (?,?)',
                      [self.get_id(), sbdatetime.totimestamp(value, default=0)])
     except (BaseException, Exception):
         pass
     self._last_recent_search = value