rendered paste body def play(self): conf = self.conf prev_time = 100000 while True: row = None try: self.cur.execute("SELECT * FROM playlist_clips WHERE start_at > ? ORDER BY start_at LIMIT 1", (prev_time,)) row = self.cur.fetchone() if not row: self.cur.execute("SELECT count(start_at) AS count FROM playlist_clips") row = self.cur.fetchone() if row['count'] > 0: prev_time = util.hhmmss_to_seconds(time.localtime(time.time())[3:6]) - 1 continue else: prev_time = row['start_at'] except: pass if not row: time.sleep(1) continue curr_time = util.hhmmss_to_seconds(time.localtime(time.time())[3:6]) vobj = { 'url': os.path.join(conf.media_dir, row['file']), 'start': row['seek_start'], 'end': row['seek_length'], }