Пример #1
0
def formula1():
    pages = _config['pages']['sport']['formula1']
    f1feed = bbcparse.Feed(rss.bbc_feed(pages['feed']), 'formula1')
    entries = f1feed.get_entries(sport=True,
                                 max = ttxutils.hexdiff(
                                     pages['last'], pages['first']))

    if not entries:
        return None
    pagenum = pages['first']
    f1entries = list()
    for contents in entries:
        if '/formula1/' in contents['link']:
            contents['section'] = 'Formula 1'
            f1entries.append(contents)

    for contents in f1entries:
        sport_page(pagenum, contents)
        pagenum = ttxutils.nextpage(pagenum)
        if pagenum > pages['last']:
            break

    f1_index(f1entries)

    return [f1entries[0], pages['first']]
Пример #2
0
def football():
    pages = _config['pages']['sport']['football']
    footballfeed = bbcparse.Feed(rss.bbc_feed(pages['feed']), 'football')
    entries = footballfeed.get_entries(sport=True,
                                       max = ttxutils.hexdiff(
                                           pages['last'], pages['first']))
    if not entries:
        return None

    pagenum = pages['first']
    footentries = list()
    for contents in entries:
        if '/football/' in contents['link']:
            contents['section'] = 'Football'
            footentries.append(contents)

    count = 2
    for contents in footentries:
        sport_page(pagenum, contents, add_to_newsreel=(count>0))
        pagenum = ttxutils.nextpage(pagenum)
        count -= 1
        if pagenum > pages['last']:
            break

    football_index(footentries)

    # league tables go here
    leagues()
    fixtures()
    football_gossip()
    football_guide(pages)

    return [footentries[0], pages['first']]
Пример #3
0
def rugby_union():
    pages = _config['pages']['sport']['rugby_union']
    feed = bbcparse.Feed(rss.bbc_feed(pages['feed']), 'rugby_union')
    raw_entries = feed.get_entries(sport=True,
                                   max = ttxutils.hexdiff(
                                       pages['last'], pages['first']))
    if not raw_entries:
        return None

    pagenum = pages['first']
    entries = list()
    for contents in raw_entries:
        if '/rugby-union/' in contents['link']:
            contents['section'] = 'Rugby Union'
            entries.append(contents)

    for contents in entries:
        sport_page(pagenum, contents)
        pagenum = ttxutils.nextpage(pagenum)
        if pagenum > pages['last']:
            break

    rugby_union_index(entries)

    return [entries[0], pages['first']]
Пример #4
0
def cricket():
    pages = _config['pages']['sport']['cricket']
    feed = bbcparse.Feed(rss.bbc_feed(pages['feed']), 'cricket')
    raw_entries = feed.get_entries(sport=True,
                                   max = ttxutils.hexdiff(
                                       pages['last'], pages['first']))

    if not raw_entries:
        return None

    pagenum = pages['first']
    entries = list()
    for contents in raw_entries:
        if '/cricket/' in contents['link']:
            contents['section'] = 'Cricket'
            entries.append(contents)

    for contents in entries:
        sport_page(pagenum, contents)
        pagenum = ttxutils.nextpage(pagenum)
        if pagenum > pages['last']:
            break

    scorecards = cricket_fixtures()
    cricket_index(entries, scorecards)

    return [entries[0], pages['first']]
Пример #5
0
def makenews():

    headlines = []

    region = _config['bbc_news_regions'][_config['bbc_news_region']]
    news = _config['pages']['news']['main']
    regional = _config['pages']['news']['regional']

    newsfeed = bbcparse.Feed(rss.bbc_feed(news['feed']), 'newsmain')
    numstories = ttxutils.hexdiff(news['last'], news['first'])
    stories = newsfeed.get_entries(max=numstories)

    regionalfeed = bbcparse.Feed(rss.bbc_feed(region['feed']), "newsregional")
    numstories = ttxutils.hexdiff(regional['last'], regional['first'])
    regionalstories = regionalfeed.get_entries(max=numstories)

    page = news['first']
    if stories:
        for story in stories:
            news_page(page, story, add_to_newsreel=True)
            page = ttxutils.nextpage(page)
        news_index(stories, news)
        news_headlines(stories, news)
        news_summary(stories, news)
        topstory = copy.deepcopy(stories[0])
        topstory['section'] = 'UK News'
        headlines.append((topstory, news['first']))

    page = regional['first']
    if regionalstories:
        for story in regionalstories:
            news_page(page, story)
            page = ttxutils.nextpage(page)
        news_headlines(regionalstories, regional, region['name'])
        topregstory = copy.deepcopy(regionalstories[0])
        topregstory['section'] += ' News'
        headlines.append((topregstory, regional['first']))

    scitech = _config['pages']['news']['scitech']
    scitechfeed = bbcparse.Feed(rss.bbc_feed(scitech['feed']), "newssci")
    scitechstories = scitechfeed.get_entries()
    if scitechstories:
        news_scitech(scitechstories, scitech)

    return headlines
Пример #6
0
def entertainment():
    pages = _config['pages']['entertainment']
    feed = bbcparse.Feed(rss.bbc_feed(pages['feed']), 'football')
    entries = feed.get_entries(
        max=ttxutils.hexdiff(pages['last'], pages['first']))

    if not entries:
        return None

    header = [
        "€C€]€U|$xl0l<h<h<t(|$|l4|`<t`<<th<`<t(|$",
        "€C€]€U¬1¬j5j5jwj7} ¬ ¬k5¬j5¬j55¬jwj5¬ ¬",
        "€S#######################################"
    ]
    footer = [
        "€C€]€DTV    520  Lottery   555  Music 530",
        "€C€]€DFilms 540  Newsround 570  Games 550",
        "€ANext News€B FilmIndex€CTV Index€FEntsIndex",
    ]
    fastext = [0x540, 0x520, 0x500]
    pagenum = pages['first']

    for contents in entries:
        nextpage = ttxutils.nextpage(pagenum)
        if nextpage > pages['last']:
            nextpage = pages['index']
        ttxutils.news_page("Entertainment",
                           pages,
                           pagenum,
                           contents,
                           header,
                           footer,
                           fasttext=[nextpage, 0x540, 0x520, 0x500])
        pagenum = ttxutils.nextpage(pagenum)
        if pagenum > pages['last']:
            break

    entertainment_index(pages, entries)

    return (entries[0], pages['first'])