def read(self):
     """ Read admin from disk """
     quota = self.left = cfg.quota_size.get_float() # Quota for this period
     self.have_quota = bool(cfg.quota_size())
     data = sabnzbd.load_admin(BYTES_FILE_NAME)
     try:
         self.last_update, self.grand_total, \
         self.day_total, self.week_total, self.month_total, \
         self.end_of_day, self.end_of_week, self.end_of_month = data[:8]
         if len(data) == 11:
             self.quota, self.left, self.q_time = data[8:]
             logging.debug('Read quota q=%s l=%s reset=%s',
                           self.quota, self.left, self.q_time)
             if abs(quota - self.quota) > 0.5:
                 self.change_quota()
         else:
             self.quota = self.left = cfg.quota_size.get_float()
         res = self.reset_quota()
     except:
         # Get the latest data from the database and assign to a fake server
         logging.debug('Setting default BPS meter values')
         grand, month, week  = sabnzbd.proxy_get_history_size()
         if grand: self.grand_total['x'] = grand
         if month: self.month_total['x'] = month
         if week:  self.week_total['x'] = week
         self.quota = self.left = cfg.quota_size.get_float()
         res = False
     # Force update of counters
     self.update()
     return res
 def defaults(self):
     """ Get the latest data from the database and assign to a fake server
     """
     logging.debug('Setting default BPS meter values')
     grand, month, week  = sabnzbd.proxy_get_history_size()
     if grand: self.grand_total['x'] = grand
     if month: self.month_total['x'] = month
     if week:  self.week_total['x'] = week
     self.quota = self.left = cfg.quota_size.get_float()
Exemple #3
0
 def defaults(self):
     """ Get the latest data from the database and assign to a fake server
     """
     logging.debug('Setting default BPS meter values')
     grand, month, week  = sabnzbd.proxy_get_history_size()
     self.grand_total = {}
     self.month_total = {}
     self.week_total = {}
     self.day_total = {}
     if grand: self.grand_total['x'] = grand
     if month: self.month_total['x'] = month
     if week:  self.week_total['x'] = week
     self.quota = self.left = cfg.quota_size.get_float()
Exemple #4
0
 def read(self):
     """ Read admin from disk """
     data = sabnzbd.load_admin(BYTES_FILE_NAME)
     try:
         self.last_update, self.grand_total, \
         self.day_total, self.week_total, self.month_total, \
         self.end_of_day, self.end_of_week, self.end_of_month = data
     except:
         # Get the latest data from the database and assign to a fake server
         grand, month, week = sabnzbd.proxy_get_history_size()
         if grand: self.grand_total['x'] = grand
         if month: self.month_total['x'] = month
         if week: self.week_total['x'] = week
     # Force update of counters
     self.update()
Exemple #5
0
 def read(self):
     """ Read admin from disk """
     data = sabnzbd.load_admin(BYTES_FILE_NAME)
     try:
         self.last_update, self.grand_total, \
         self.day_total, self.week_total, self.month_total, \
         self.end_of_day, self.end_of_week, self.end_of_month = data
     except:
         # Get the latest data from the database and assign to a fake server
         grand, month, week  = sabnzbd.proxy_get_history_size()
         if grand: self.grand_total['x'] = grand
         if month: self.month_total['x'] = month
         if week:  self.week_total['x'] = week
     # Force update of counters
     self.update()