コード例 #1
0
 def update(self, show_info=None, get_everything=False):
     if show_info is None:
         tvrage = TVRage()
         show_info = tvrage.get_info(self.tvrage_id)
         show_info.name = show_info.name.replace(u"\u2019", "'") # Kill Tabatha\u2019s ... here
         if show_info.name.startswith("'"): # Kill >>'Til Death<< here
             show_info.name = show_info.name.replace("'","",1)
         attr_list = ["name","network","genres","active","country","runtime","timezone","tvrage_id"]
         if self.update_attrs(show_info,attr_list):
             self.put()
     for season_info in show_info.seasons:
         logging.debug("Update or create Season...")
         Season.update_or_create(self, season_info, get_everything=get_everything)
コード例 #2
0
 def update_or_create(cls, name, show_id=None):
     tvrage = TVRage()
     if name is not None:
         show_info = tvrage.get_info_by_name(name)
     else:
         show_info = tvrage.get_info(show_id)
     if show_info is None:
         return False
     logging.debug("Show exists..?")
     show = Show.all().filter("tvrage_id =",show_info.tvrage_id).get()
     if show is None:
         logging.debug("Creating Show...")
         show = Show(name=show_info.name,
                     network=show_info.network,
                     genres=show_info.genres,
                     active=show_info.active,
                     country=show_info.country,
                     runtime=show_info.runtime,
                     timezone=show_info.timezone,
                     tvrage_id=show_info.tvrage_id,
                     added=datetime.datetime.now())
         show.put()
     show.update(show_info)