示例#1
0
文件: ical.py 项目: alphabernd/PyRfK
def ical():
        
    # init calendar
    cal = Calendar()
    cal.add('prodid', '-//Radio freies Krautchan//EN')
    cal.add('version', '2.0')
    cal.add('method', 'PUBLISH' )
      
    # add some useful iCal extensions
    cal.add('x-wr-calname', 'RfK')
    cal.add('x-wr-caldesc', 'Radio freies Krautchan')
    cal.add('x-wr-timezone', 'UTC')
    
    # adding planned shows
    result = get_shows()
    
    if result:
        for show in result:
            
            djs = get_djs(show)
            summary = "%s with %s" % (show.name, ', '.join(djs))
            
            event = Event()
            event.add('uid', str(show.show))
            event.add('summary', summary)
            event.add('description', show.description)
            event.add('dtstart', show.begin)
            event.add('dtend', show.end)
            cal.add_component(event)
            
    return Response(cal.to_ical(), mimetype='text/calendar')
示例#2
0
def ical():
    # init calendar
    cal = Calendar()
    cal.add('prodid', '-//Radio freies Krautchan//EN')
    cal.add('version', '2.0')
    cal.add('method', 'PUBLISH')

    # add some useful iCal extensions
    cal.add('x-wr-calname', 'RfK')
    cal.add('x-wr-caldesc', 'Radio freies Krautchan')
    cal.add('x-wr-timezone', 'UTC')

    # adding planned shows
    result = get_shows()

    if result:
        for show in result:
            djs = get_djs(show)
            summary = "%s with %s" % (show.name, ', '.join(djs))

            event = Event()
            event.add('uid', str(show.show))
            event.add('summary', summary)
            event.add('description', show.description)
            event.add('dtstart', show.begin)
            event.add('dtend', show.end)
            cal.add_component(event)

    return Response(cal.to_ical(), mimetype='text/calendar')
示例#3
0
文件: atom.py 项目: keios/PyRfK
def atom():
    # init feed
    feed = AtomFeed('Radio freies Krautchen', subtitle='Upcomming shows', url='http://radio.krautchan.net')

    # adding planned shows
    result = get_shows()

    if result:
        for show in result:
            djs = get_djs(show)
            author = ', '.join(djs)

            feed.add(id=str(show.show),
                     title=show.name,
                     content=show.description,
                     author=author,
                     url=url_for('show.show_view', show=show.show),
                     updated=show.begin,
                     published=show.begin)
    return feed.get_response()
示例#4
0
def atom():
    # init feed
    feed = AtomFeed('Radio freies Krautchen', subtitle='Upcomming shows', url='http://radio.krautchan.net')

    # adding planned shows
    result = get_shows()

    if result:
        for show in result:
            djs = get_djs(show)
            author = ', '.join(djs)

            feed.add(id=str(show.show),
                     title=show.name,
                     content=show.description,
                     author=author,
                     url=url_for('show.show_view', show=show.show),
                     updated=show.begin,
                     published=show.begin)

    return feed.get_response()