예제 #1
0
    def run(self):
        session = get_session()
        beanstalk = beanstalkc.Connection(host='localhost', port=11300)

        while self.active:
            # Look for episodes that we want, that should be or become available shortly and set to searching.
            waiting_episodes = Episode.get_waiting(session)
            for ep in waiting_episodes:
                print 'Set to {} :: {}'.format(ESTATE_SEARCHING, unicode(ep))
                ep.state = ESTATE_SEARCHING
            session.commit()

            print beanstalk.peek_ready()

            # The basic way this works is that we will peek at various job queues and make sure
            # spawn subprocesses to manage those queues.

            # Any episodes that require searching, spawn a process to search NZB repository.
            # SPAWN SEARCH PROCESS

            # Any episode that has a candidate NZB, spawn a download process.
            # SPAWN DOWNLOAD PROCESS

            # Any episode that has completed download, begin stitching of file.
            # SPAWN FILE STITCHER/REPAIR/UNCOMPRESS

            # Any episode that is complete but for post processing...
            # SPAWN post processor.

            time.sleep(self.sleep_time)
        beanstalk.close()
예제 #2
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.
        session = get_session()

        # Lookup local series info.
        series = session.query(Series).filter_by(tvdb_id=args.series_id).first()

        for episode in series.episodes:
            print ' - {e.id}: S{e.season:02d}E{e.episode:02d} {e.air_date} [{e.state:^10s}] > {e.name}'.format(e=episode)
예제 #3
0
파일: show.py 프로젝트: xealot/avsnatch
    def start(self, args, config):
        term = Terminal()
        session = get_session()

        # Lookup local series info.
        shows = session.query(Series).all()

        for show in shows:
            print '- {s.tvdb_id}: {s.name} {s.airday} at {s.airtime} on {s.network} and is {t.green}{s.status}{t.normal}'.format(t=term, s=show)
예제 #4
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.
        session = get_session()

        episode = session.query(Episode).filter_by(id=args.episode_id).first()
        print 'Episode {e.id}: S{e.season:02d}E{e.episode:02d} {e.air_date} [{e.state:^10s}] > {e.name}'.format(e=episode)

        if args.state and args.state in EPISODE_STATES:
            episode.state = args.state
            session.commit()
            print 'Updated episode state to: {}'.format(args.state)
예제 #5
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))