def idle_cb(self): if WIDGETS['statusbar_now_playing'].flags() & gtk.VISIBLE: track = players.get_playing(['mplayer', 'totem'], [self.cfg.get('search_dir', 'dir1')]) for key in track.keys(): e = recognizinig.engine(key, self.anime_data.db) m = e.match() try: ep = int(e._getEpisode().strip('/')) if m: #print m, ep if self.anime_data.db[m]['my_watched_episodes'] == \ ep - 1 and \ self.anime_data.db[m]['my_status'] == \ data.WATCHING: msg = 'Playing: ' + m + ' -- Episode: ' + str(ep) WIDGETS['statusbar_now_playing'].push(-1, msg) #print self.anime_data.db[m]['my_watched_episodes'] #print self.anime_data.db[m]['series_episodes'] if ep < self.anime_data.db[m]['series_episodes']: self.anime_data.db[m][ 'my_watched_episodes'] = ep MODCTL.anime_data.db[m]\ ['my_last_updated'] = datetime.datetime.now() MODCTL.anime_data.save() newep = str(ep) + ' / ' + str( self.anime_data.db[m]['series_episodes']) sw = self.tv[1].keylist i = 0 # row tracker for key in sw: if key == m: break else: i += 1 self.tv[1].liststore[str(i)][1] = newep except: break return True
def idle_cb(self): if WIDGETS['statusbar_now_playing'].flags() & gtk.VISIBLE: track = players.get_playing( ['mplayer', 'totem'], [self.cfg.get('search_dir', 'dir1')]) for key in track.keys(): e = recognizinig.engine(key, self.anime_data.db) m = e.match() try: ep = int(e._getEpisode().strip('/')) if m: #print m, ep if self.anime_data.db[m]['my_watched_episodes'] == \ ep - 1 and \ self.anime_data.db[m]['my_status'] == \ data.WATCHING: msg = 'Playing: ' + m + ' -- Episode: ' + str(ep) WIDGETS['statusbar_now_playing'].push(-1, msg) #print self.anime_data.db[m]['my_watched_episodes'] #print self.anime_data.db[m]['series_episodes'] if ep < self.anime_data.db[m]['series_episodes']: self.anime_data.db[m]['my_watched_episodes'] = ep MODCTL.anime_data.db[m]\ ['my_last_updated'] = datetime.datetime.now() MODCTL.anime_data.save() newep = str(ep) + ' / ' + str(self.anime_data.db[m]['series_episodes']) sw = self.tv[1].keylist i = 0 # row tracker for key in sw: if key == m: break else: i += 1 self.tv[1].liststore[str(i)][1] = newep except: break return True
# taken from test_mal.py mbasepath = os.path.split(os.path.abspath(__file__))[0] mbasepath2 = os.path.split(mbasepath)[0] envpath = os.path.join(mbasepath2, 'src', 'AniChou') sys.path.append(envpath) from recognizinig import engine # Read the text file fhandle = open("test_recognizing.txt") flist = fhandle.readlines() fhandle.close() for filename in flist: e = engine(filename) match = e.match() print "-----------------------------------------------------" print "Raw Filename: ", filename print "Filterd Name: ", e._getName() print "Filterd Episode: ", e._getEpisode() if match: print "DB Key: ", e.match() r = difflib.SequenceMatcher(None, e._getName(), match) print "Matching Ratio: ", r.ratio() else: print "Not found in locale db" print "-----------------------------------------------------" print ""