Esempio n. 1
0
def show_capture(*args):
    """Usage:
    recorder show capture [--duration=<duration>] [options]

Capture a show.

Options:
    --duration,-d=<duration> Set the duration, overrides show setting

Examples:
    1. Capture an episode of the show 'nighttalk'
        recorder show capture nighttalk

    2. Capture an episode of the show 'nighttalk', but only 35 minutes
        recorder show capture nighttalk -d 35m

    """

    config = Configuration()
    if len(config.stations) == 0:
        print('No stations defined, add stations at first!')
        sys.exit(0)

    if len(config.shows) == 0:
        print('No shows defined, add shows at first!')
        sys.exit(0)
    args = args[0]
    if args['<show>'] in config.shows:
        show = config.shows[args['<show>']]
        try:
            recorder = Recorder()
            recorder.capture(show)
        except Exception as e:
            print('Unable to capture recording: %s' % e)
    else:
        print('Unknown show %r' % args['<show>'])
Esempio n. 2
0
def show_capture(*args):
    """Usage:
    recorder show capture [--duration=<duration>] [options]

Capture a show.

Options:
    --duration,-d=<duration> Set the duration, overrides show setting

Examples:
    1. Capture an episode of the show 'nighttalk'
        recorder show capture nighttalk

    2. Capture an episode of the show 'nighttalk', but only 35 minutes
        recorder show capture nighttalk -d 35m

    """
    config = Configuration()
    if len(config.stations) == 0:
        print('No stations defined, add stations at first!')
        sys.exit(0)

    if len(config.shows) == 0:
        print('No shows defined, add shows at first!')
        sys.exit(0)
    args = args[0]
    if args['<show>'] in config.shows:
        show = config.shows[args['<show>']]
        try:
            recorder = Recorder()
            episode = recorder.capture(config, show)
            db = database.open('episodes_db')
            db[episode.slug] = episode
            db.close()
        except Exception as e:
            logging.error('Unable to capture recording: {}'.format(e))
    else:
        print('Unknown show %r' % args['<show>'])
Esempio n. 3
0
def show_capture(*args):
    """Usage:
    recorder show capture [--duration=<duration>] [options]

Capture a show.

Options:
    --duration,-d=<duration> Set the duration, overrides show setting

Examples:
    1. Capture an episode of the show 'nighttalk'
        recorder show capture nighttalk

    2. Capture an episode of the show 'nighttalk', but only 35 minutes
        recorder show capture nighttalk -d 35m

    """
    config = Configuration()
    if len(config.stations) == 0:
        print("No stations defined, add stations at first!")
        sys.exit(0)

    if len(config.shows) == 0:
        print("No shows defined, add shows at first!")
        sys.exit(0)
    args = args[0]
    if args["<show>"] in config.shows:
        show = config.shows[args["<show>"]]
        try:
            recorder = Recorder()
            episode = recorder.capture(config, show)
            with shelve.open(os.path.join(app_folder, "episodes_db")) as db:
                db[episode.slug] = episode
        except Exception as e:
            logging.error("Unable to capture recording: {}".format(e))
    else:
        print("Unknown show %r" % args["<show>"])