Example #1
0
 def search_for_updates(self):
   series = [ x['tvdb_series'] for x in self.subs.get_series() ]
   for i in series:
     tvdb_data = tvdb.get_series_all(i, banners=False, actors=False)
     episodes = [ x['tvdb_episode'] for x in self.subs.get_episodes(i) ]
     new_episodes = [ e for e in tvdb_data['episodes'] if e['id'] not in episodes ]
     for e in new_episodes:
       self.subs.add_episode(i, e['id'], e)
Example #2
0
 def get_series_info(self, id):
     tvdb.API_KEY = self.key
     teste = lambda reg: reg['id'] == id
     infos = self.search(teste, self.cached_series_all, 1)[0]
     if not infos['id']:
         try:
             infos = tvdb.get_series_all(id)
             self.cached_series_all.append(infos)
         except Exception as E:
             print E
             infos = {'id': None, 'name': '', 'overview': u'Indisponível'}
     return infos
Example #3
0
def get_series_data(series_name):
    series_name = series_name.lower()
    global series_data
    if series_name not in series_data:
        #print 'getting data for', series_name
        if series_name == 'the daily show':
            series = tvdb.get_series('The Daily Show with Jon Stewart')[0]
        else:
            series = tvdb.get_series(series_name)[0]
        raw_data = tvdb.get_series_all(series['id'])
        series_data[series_name] = {'season_episode': {}, 'aired': {}}
        for data in raw_data['episodes']:
            if 'season_number' in data and 'episode_number' in data:
                series_data[series_name]['season_episode']['%s %s' % (data['season_number'], data['episode_number'])] = data
            if 'first_aired' in data and data['first_aired']:
                dt = data['first_aired']
                series_data[series_name]['aired'][date(dt.year, dt.month, dt.day)] = data
    return series_data[series_name]
Example #4
0
def get_series_data(series_name):
    series_name = series_name.lower()
    global series_data
    if series_name not in series_data:
        tvdb_series_name = get_tvdb_name(series_name)
        matches = tvdb.get_series(tvdb_series_name)
        if not matches:
            series_data[tvdb_series_name] = None
            return None
        series = matches[0]
        raw_data = tvdb.get_series_all(series['id'])
        series_data[series_name] = {'season_episode': {}, 'aired': {}}
        for data in raw_data['episodes']:
            if 'season_number' in data and 'episode_number' in data:
                series_data[series_name]['season_episode']['%s %s' % (data['season_number'], data['episode_number'])] = data
            if 'first_aired' in data and data['first_aired']:
                dt = data['first_aired']
                series_data[series_name]['aired'][date(dt.year, dt.month, dt.day)] = data
    return series_data.get(series_name)
Example #5
0
def get_series_data(series_name):
    series_name = series_name.lower()
    global series_data
    if series_name not in series_data:
        # print 'getting data for', series_name
        if series_name == "the daily show":
            series = tvdb.get_series("The Daily Show with Jon Stewart")[0]
        else:
            series = tvdb.get_series(series_name)[0]
        raw_data = tvdb.get_series_all(series["id"])
        series_data[series_name] = {"season_episode": {}, "aired": {}}
        for data in raw_data["episodes"]:
            if "season_number" in data and "episode_number" in data:
                series_data[series_name]["season_episode"][
                    "%s %s" % (data["season_number"], data["episode_number"])
                ] = data
            if "first_aired" in data and data["first_aired"]:
                dt = data["first_aired"]
                series_data[series_name]["aired"][date(dt.year, dt.month, dt.day)] = data
    return series_data[series_name]
Example #6
0
def get_series_data(series_name):
    series_name = series_name.lower()
    global series_data
    if series_name not in series_data:
        tvdb_series_name = get_tvdb_name(series_name)
        matches = tvdb.get_series(tvdb_series_name)
        if not matches:
            series_data[tvdb_series_name] = None
            return None
        series = matches[0]
        raw_data = tvdb.get_series_all(series['id'])
        series_data[series_name] = {'season_episode': {}, 'aired': {}}
        for data in raw_data['episodes']:
            if 'season_number' in data and 'episode_number' in data:
                series_data[series_name]['season_episode'][
                    '%s %s' %
                    (data['season_number'], data['episode_number'])] = data
            if 'first_aired' in data and data['first_aired']:
                dt = data['first_aired']
                series_data[series_name]['aired'][date(dt.year, dt.month,
                                                       dt.day)] = data
    return series_data.get(series_name)