def cacheEpisodeList(self, id): # Cache filename cacheFileName = Globals().nsCacheFilePrefix + str( id ) # Get the data parser = TvRage() epList = parser.getEpisodeList( id ) if not epList: return False # In case something went wrong during parsing... showEpList = {} showEpList['fetch_time'] = int( datetime.utcnow().strftime("%s") ) # Timestamp (UTC) showEpList['episode_list'] = epList # Open the file for writing tools.msgDebug("Writing cache file %s..." % cacheFileName, __name__) fp = open( cacheFileName, "wb" ) cPickle.dump( showEpList, fp, cPickle.HIGHEST_PROTOCOL ) fp.close() # At this point we suppose everything hopefully went well return True