Exemple #1
0
def section4(tree, titles):
    items = []

    song = models.ProgramItem(tree[3][0]['title'], tree[3][0]['duration'])
    song.time = tree[3][0]['time']

    set_song_subtitle(song)

    items.append(song)

    for index, item in enumerate(tree[3][1:-2]):
        index = models.Assignment(item['title'], item['duration'],
                                  item['assignee'])
        index.time = item['time']
        items.append(index)

    comments = models.ProgramItem(tree[3][-2]['title'], 3)
    comments.time = tree[3][-2]['time']
    items.append(comments)

    prayer = models.Assignment(tree[3][-1]['title'], 5,
                               tree[3][-1]['assignee'])
    prayer.time = tree[3][-1]['time']

    set_song_subtitle(prayer)

    items.append(prayer)

    section = models.Section(titles[3], items)

    return section
def section1_part2(section):
    comments = section.find(id='p4')

    opening_comments = comments.get_text()
    comments_duration = 1

    item = models.ProgramItem(opening_comments, comments_duration)

    return item
def section4_parts(section):
    list_items = section.findAll('li')
    items = []

    song = list_items[0]
    items.append(models.ProgramItem(song.get_text(), 3))

    for item in list_items[1:-2]:
        text, duration = extract_name_and_duration(item)
        items.append(models.Assignment(text, duration))

    end_comments = list_items[-2]
    items.append(models.ProgramItem(end_comments.get_text(), 3))

    end_song = list_items[-1]
    items.append(models.Assignment(end_song.get_text(), 5))

    return items
Exemple #4
0
def section1(tree, titles):
    item0 = tree[0][0]
    song = models.Assignment(item0['title'], 5, item0['assignee'])
    song.time = item0['time']

    set_song_subtitle(song)

    item1 = tree[0][1]
    comments = models.ProgramItem(item1['title'], 3)
    comments.time = item1['time']

    items = [song, comments]

    section = models.Section(titles[0], items)

    return section