Пример #1
0
def videometadata(ctx, city, date, outpath):
    """Generate metadata for video records.

    city: The meetup series.

    \b
    date: The date. May be:
        - YYYY-MM-DD or YY-MM-DD (e.g. 2015-08-27)
        - YYYY-MM or YY-MM (e.g. 2015-08)
        - MM (e.g. 08): the given month in the current year
        - pN (e.g. p1): show the N-th last meetup
    """
    db = ctx.obj['db']
    today = ctx.obj['now'].date()

    event = cliutil.get_event(db, city, date, today)

    data = event.as_dict()
    cliutil.handle_raw_output(ctx, data)

    evdir = "{}-{}".format(event.city.name, event.slug)

    config = OrderedDict()
    config['speaker'] = ''
    config['title'] = ''
    config['lightning'] = True
    config['speaker_only'] = False
    config['widescreen'] = False
    config['speaker_vid'] = "*.MTS"
    config['screen_vid'] = "*.ts"
    config['event'] = event.name
    if event.number:
        config['event'] += " #{}".format(event.number)
    config['date'] = event.date.strftime("%Y-%m-%d")
    config['url'] = "https://pyvo.cz/{}/{}/".format(event.series_slug,
                                                    event.slug)

    print(evdir)
    cfgdump(os.path.join(outpath, evdir), config)

    if event.talks:
        for talknum, talk in enumerate(event.talks, start=1):
            config['speaker'] = ', '.join(s.name for s in talk.speakers)
            config['title'] = talk.title
            config['lightning'] = talk.is_lightning
            talkdir = "{:02d}-{}".format(talknum, slugify(talk.title))
            print(talkdir)
            cfgdump(os.path.join(outpath, evdir, talkdir), config)
Пример #2
0
def calendar(ctx, date, agenda, year):
    """Show a 3-month calendar of meetups.

    \b
    date: The date around which the calendar is centered. May be:
        - YYYY-MM-DD, YY-MM-DD, YYYY-MM or YY-MM (e.g. 2015-08)
        - MM (e.g. 08): the given month in the current year
        - pN (e.g. p1): N-th last month
        - +N (e.g. +2): N-th next month
        - Omitted: today
        - YYYY: Show the entire year, as with -y
    """
    do_full_year = year
    today = ctx.obj['now'].date()
    db = ctx.obj['db']
    term = ctx.obj['term']

    date_info = cliutil.parse_date(date)
    if 'relative' in date_info:
        year = today.year
        month = today.month + date_info['relative']
    elif 'date_based' in date_info:
        year = date_info.get('year', today.year)
        month = date_info.get('month', today.month)
        if 'month' not in date_info and 'day' not in date_info:
            do_full_year = True
    else:
        raise click.UsageError('Unknown date format')

    if agenda is None:
        agenda = not do_full_year

    if do_full_year:
        first_month = 1
        num_months = 12
    else:
        first_month = month - 1
        num_months = 3

    calendar = get_calendar(db, year, first_month, num_months)
    cliutil.handle_raw_output(ctx, list(calendar.values()))

    render_calendar(term, calendar, today, agenda)
Пример #3
0
def calendar(ctx, date, agenda, year):
    """Show a 3-month calendar of meetups.

    \b
    date: The date around which the calendar is centered. May be:
        - YYYY-MM-DD, YY-MM-DD, YYYY-MM or YY-MM (e.g. 2015-08)
        - MM (e.g. 08): the given month in the current year
        - pN (e.g. p1): N-th last month
        - +N (e.g. +2): N-th next month
        - Omitted: today
        - YYYY: Show the entire year, as with -y
    """
    do_full_year = year
    today = ctx.obj['now'].date()
    db = ctx.obj['db']
    term = ctx.obj['term']

    date_info = cliutil.parse_date(date)
    if 'relative' in date_info:
        year = today.year
        month = today.month + date_info['relative']
    elif 'date_based' in date_info:
        year = date_info.get('year', today.year)
        month = date_info.get('month', today.month)
        if 'month' not in date_info and 'day' not in date_info:
            do_full_year = True
    else:
        raise click.UsageError('Unknown date format')

    if agenda is None:
        agenda = not do_full_year

    if do_full_year:
        first_month = 1
        num_months = 12
    else:
        first_month = month - 1
        num_months = 3

    calendar = get_calendar(db, year, first_month, num_months)
    cliutil.handle_raw_output(ctx, list(calendar.values()))

    render_calendar(term, calendar, today, agenda)
Пример #4
0
def show(ctx, city, date):
    """Show a particular meetup.

    city: The meetup series.

    \b
    date: The date. May be:
        - YYYY-MM-DD or YY-MM-DD (e.g. 2015-08-27)
        - YYYY-MM or YY-MM (e.g. 2015-08)
        - MM (e.g. 08): the given month in the current year
        - pN (e.g. p1): show the N-th last meetup
        - +N (e.g. +2): show the N-th next meetup
        - Omitted: show the next meetup (same as +1)
    """
    db = ctx.obj['db']
    today = ctx.obj['now'].date()
    term = ctx.obj['term']

    event = cliutil.get_event(db, city, date, today)

    data = event.as_dict()
    cliutil.handle_raw_output(ctx, data)
    render_event(term, event, today, verbose=ctx.obj['verbose'])
Пример #5
0
def show(ctx, city, date):
    """Show a particular meetup.

    city: The meetup series.

    \b
    date: The date. May be:
        - YYYY-MM-DD or YY-MM-DD (e.g. 2015-08-27)
        - YYYY-MM or YY-MM (e.g. 2015-08)
        - MM (e.g. 08): the given month in the current year
        - pN (e.g. p1): show the N-th last meetup
        - +N (e.g. +2): show the N-th next meetup
        - Omitted: show the next meetup (same as +1)
    """
    db = ctx.obj['db']
    today = ctx.obj['now'].date()
    term = ctx.obj['term']

    event = cliutil.get_event(db, city, date, today)

    data = event.as_dict()
    cliutil.handle_raw_output(ctx, data)
    render_event(term, event, today, verbose=ctx.obj['verbose'])