def add_series(self, tvdb_key, meta = None): if not meta: meta = tvdb.get_series_details(tvdb_key) self.db.execute(''' insert into series (tvdb_series, series_name, eztv_name) VALUES (?,?,?)''' ,(tvdb_key,meta['name'], re.sub('[tT]he (.*)', r'\1, The', meta['name']))) self.db.commit() log.info("added series %s" %(meta['name'], ))
def add_series(self, tvdb_key, meta=None): if not meta: meta = tvdb.get_series_details(tvdb_key) self.db.execute( ''' insert into series (tvdb_series, series_name, eztv_name) VALUES (?,?,?)''', (tvdb_key, meta['name'], re.sub('[tT]he (.*)', r'\1, The', meta['name']))) self.db.commit() log.info("added series %s" % (meta['name'], ))
def loadTvShow(self, metadata): log.debug("Loading details for tv show id: %s" % str(metadata.getId())) #seriesInfo = tvdb.get_series_all(metadata.getId(), banners=False) seriesInfo = tvdb.get_series_details(metadata.getId()) cover = "http://thetvdb.com/banners/%s" % seriesInfo['poster'] if seriesInfo['fanart'] is not None and len(seriesInfo['fanart']) > 0: metadata.fanart("http://thetvdb.com/banners/%s" % seriesInfo['fanart']) log.debug("Loaded details: %s" % str(seriesInfo)) cast = seriesInfo['actors'] try: metadata.rating(float(seriesInfo['rating'])) except: log.warning("Could not parse rating from '%s'" % str(seriesInfo['rating'])) firstAired = seriesInfo['first_aired'] if firstAired: firstAired = firstAired.date() metadata.studio(seriesInfo['network']).cover(cover) metadata.title(seriesInfo['name']).plot(seriesInfo['overview']).plotoutline(seriesInfo['overview']).premiered(str(firstAired)) metadata.genre(", ".join(seriesInfo['genre'])).duration(seriesInfo['runtime']).cast(cast) return seriesInfo