コード例 #1
0
ファイル: show.py プロジェクト: xealot/avsnatch
    def start(self, args, config):
        #:TODO: Move this logic into the CORE so it can be used via library access.
        today = datetime.today()
        session = get_session()

        # Lookup Series Information
        tv = load_info_source('tv', config['TVDB_API_KEY'])
        series = tv.get_series(args.series_id)
        episodes = series.pop('episodes')

        # Add series and episode data to database.
        series = Series(**series)
        session.merge(series)

        for e in episodes:
            episode = Episode(**e)
            episode.state = ESTATE_SKIPPED if episode.air_date < today else ESTATE_WANTED
            session.merge(episode)

        session.commit()

        print 'The series, "{}" has been added/updated along with {} episodes.'.format(series.name, len(episodes))
コード例 #2
0
ファイル: snatch.py プロジェクト: xealot/avsnatch
 def do_add(self):
     """Search for and add a new show to the tracker"""
     tv = load_info_source('tv', self.config)
     search = raw_input('Enter Show Title: ')
     tv.find_show(search)
     print search
コード例 #3
0
ファイル: showsearch.py プロジェクト: xealot/avsnatch
 def start(self, args, config):
     tv = load_info_source('tv', config['TVDB_API_KEY'])
     if not args.id:
         self.print_search_results(tv.find_series(args.search))
     else:
         self.print_series(tv.get_series(args.search))
コード例 #4
0
ファイル: snatch.py プロジェクト: xealot/avsnatch
 def do_add(self):
     """Search for and add a new show to the tracker"""
     tv = load_info_source('tv', self.config)
     search = raw_input('Enter Show Title: ')
     tv.find_show(search)
     print search
コード例 #5
0
ファイル: showsearch.py プロジェクト: xealot/avsnatch
 def start(self, args, config):
     tv = load_info_source('tv', config['TVDB_API_KEY'])
     if not args.id:
         self.print_search_results(tv.find_series(args.search))
     else:
         self.print_series(tv.get_series(args.search))