Beispiel #1
0
def generate_feed(config: Config, songs: List[Dict]) -> None:
    assert config.base_url, "Base URL is required to generate a feed!"
    feed_name = "index.xml"
    base_url = config.base_url
    fg = FeedGenerator()
    fg.load_extension("podcast")
    fg.id(base_url)
    fg.title(config.title)
    fg.subtitle(config.description)
    fg.link(href=base_url, rel="alternate")
    artists = {s["artist"] for s in songs if s.get("artist")}
    fg.author([{"name": artist} for artist in artists])
    fg.logo(urljoin(base_url, "favicon.ico"))
    fg.link(href=urljoin(base_url, feed_name), rel="self")
    fg.language("en")

    for song in songs[::-1]:
        fe = fg.add_entry()
        song_url = urljoin(base_url, song["src"])
        fe.id(song_url)
        fe.title(song["title"])
        fe.description(DESCRIPTION_TEMPLATE.render(song=song).strip())
        fe.link(href=urljoin(base_url, f'#{song["src"]}'))
        fe.enclosure(song_url, song["filesize"], "audio/mpeg")
        fe.published(entry_date(song["date"]))

    fg.rss_file(os.path.join(config.out_dir, feed_name))
Beispiel #2
0
  def makeRss(self):
    fg = FeedGenerator()
    fg.load_extension('podcast')
    fg.id('http://hypecast.blackmad.com/' + self.mode)
    fg.title('Hype Machine Robot Radio: ' + self.mode)
    fg.author( {'name':'David Blackmad','email':'*****@*****.**'} )
    fg.logo('http://dump.blackmad.com/the-hype-machine.jpg')
    fg.language('en')
    fg.link(href='http://hypecast.blackmad.com/' + self.mode)
    fg.description('Hype Machine Robot Radio: ' + self.mode)

    description = ' <br/>'.join(['%s. %s' % (index + 1, self.mk_song_id(s)) for index, s in enumerate(self.songs)])

    fe = fg.add_entry()
    fe.title(self.track_name)
    fe.description(description)
    fe.id(self.filename)
    # add length
    print(self.relative_dir)
    print(self.filename)
    fe.enclosure(url = 'http://hypecast.blackmad.com/%s' % (self.filename), type="audio/mpeg")

    rss_str = fg.rss_str()
    newItem = ET.fromstring(rss_str)[0].find('item')
    out = open(self.get_filename('xml'), 'w')
    out.write(ET.tostring(newItem))
    out.close()
    self.updateRss()
Beispiel #3
0
    def generate(self):
        url = self.configuration['network']['host'] + ":" + str(self.configuration['network']['port'])

        #Creating RSS feed
        fg = FeedGenerator()
        fg.load_extension('podcast')
        fg.title(self.configuration['rss']['title'])
        fg.author(dict(name=self.configuration['rss']['author'],email=self.configuration['rss']['email']))
        fg.logo(url + "/" + self.configuration['rss']['logo'])
        fg.description(self.configuration['rss']['description'])
        #fg.subtitle(self.configuration['settings']['subtitle'])
        fg.link(href=url + "/" + self.configuration['rss']['file_name'], rel='self')
        fg.language(self.configuration['rss']['language'])

        for file_name in os.listdir(self.configuration['system']['media_folder']):
            if file_name[0] != "." and file_name != self.configuration['rss']['file_name'] and file_name[-3:] != "jpg": #Skip hidden files and RSS file itself
                #for i in range(len(self.data_dict)):
                    #if (self.data_dict[i]['title'] == file_name[:-4]):
                fe = fg.add_entry()
                #fe.id((url + "/" + self.configuration['system']['media_folder'] + "/" + file_name).replace(" ", "%20"))
                fe.id((url + "/" + file_name).replace(" ", "%20"))
                fe.title(file_name[:-4])
                #fe.description("\n".join(self.data_dict[i]['links']))
                fe.description(file_name[:-4])
                #Get time and date of file modification, add timezone
                offset = timezone(timedelta(hours=1))
                pub_date = datetime.fromtimestamp(pathlib.Path(self.configuration['system']['media_folder'] + "/" + file_name).stat().st_mtime,tz=offset)
                fe.pubDate(pub_date)
                #file_size = os.path.getsize(self.configuration['system']['media_folder'] + "/" + file_name)
                fe.enclosure((url + "/" + file_name).replace(" ", "%20"), 0, 'audio/mpeg')

        fg.rss_str(pretty=True)
        fg.rss_file(self.configuration['system']['media_folder'] + "/" + self.configuration['rss']['file_name'])

        return True
Beispiel #4
0
def main():
    config = __import__('config')
    user = MyPlexUser.signin(config.username, config.password)

    with concurrent.futures.ThreadPoolExecutor(max_workers=2) as executor:
        for resource in user.resources():
            executor.submit(parse_resource, user, resource)

    print('Servers data parsed')
    paris = pytz.timezone('Europe/Paris')
    ordered = reversed(sorted(data, key=lambda x: paris.localize(x.addedAt)))
    print('Media sorted')

    fg = FeedGenerator()
    fg.id('http://satreix.fr/feeds/plex.rss')
    fg.generator('plex-feed')
    fg.title('PLEX feed')
    fg.subtitle('Newly added media content')
    fg.author({'name': 'satreix', 'email': '*****@*****.**'})
    fg.link(href='http://satreix.fr', rel='alternate')
    fg.logo('https://plex.tv/assets/img/googleplus-photo-cb6f717c8cfd8b48df6dbb09aa369198.png')
    fg.link(href='http://satreix.fr/feeds/plex.rss', rel='self')
    fg.language('en')

    for elt in list(ordered)[:50]:
        fe = fg.add_entry()
        fe.id(elt.getStreamUrl())
        fe.title('{} - {}'.format(elt.title, elt.server.friendlyName))
        fe.pubdate(paris.localize(elt.addedAt))
        fe.description(elt.summary, True)

    fg.rss_file('plex.rss', pretty=True)
    print('File written')
Beispiel #5
0
    def rss():
        fg = FeedGenerator()
        fg.id('http://dogear-2112.herokapp.com')

        fg.title('Dogear Newsfeed')
        fg.author({'name': 'Haley Cohen', 'email': '*****@*****.**'})
        fg.link(href='http://dogearnews.com', rel='alternate')
        fg.logo(
            'https://www.fixpocket.com/public_assets/uploads/beats/1523422664maxresdefault.jpg'
        )

        fg.subtitle('The Dogear Social Newsfeed')
        fg.link(href='http://localhost:5000/rss/index.rss', rel='self')
        fg.language('en')

        news = News.query.order_by("created_at desc").limit(25).all()
        for n in news:

            fe = fg.add_entry()
            fe.id(n.url)
            fe.title(n.title)
            fe.link(href=n.url)
            fe.enclosure(n.picture_url, 0, 'image/jpeg')

            #fe.pubDate(n.created_at)

        rssfeed = fg.rss_str(pretty=True)

        response = make_response(rssfeed)
        response.headers['Content-Type'] = 'application/rss+xml'
        return response
Beispiel #6
0
def main():
    session = vk.Session()
    api = vk.API(session)

    group_id = '96469126'

    group_info = api.groups.getById(group_ids=group_id, fields=['description', 'site', 'name', 'photo', 'gid'])

    assert len(group_info) == 1
    group_info = group_info[0]

    url = 'http://vk.com/club{}'.format(group_info['gid'])
    # a = api.wall.get(owner_id=-1 * group_info['gid'])
    #
    # with open('out', 'wb') as fio:
    #     pickle.dump(a, fio)

    with open('out', 'rb') as fio:
        data = pickle.loads(fio.read())

    assert len(data) > 1

    fg = FeedGenerator()
    fg.id(url)
    fg.title(_(group_info['name']))
    fg.description(_(group_info['description']))
    fg.logo(group_info['photo'])
    site_url = group_info.get('site', url) if group_info.get('site', url) else url
    fg.link(href=_(site_url))
    fg.link(href=_(site_url), rel='self')
    fg.link(href=_(site_url), rel='alternate')
    fg.author({'name': 'Alexander Sapronov', 'email': '*****@*****.**'})
    fg.webMaster('[email protected] (Alexander Sapronov)')

    pat = re.compile(r"#(\w+)")

    for x in data[1:]:
        post_link = "{}?w=wall-{}_{}".format(url, group_info['gid'], x['id'])
        e = fg.add_entry()
        # text = x.get('text', '').replace('<br>', '\n')
        text = x.get('text', '')

        e.description(_(text))
        e.author({'name': _(get_author_name(api, x.get('from_id')))})
        e.id(post_link)
        e.link(href=_(post_link))
        e.link(href=_(post_link), rel='alternate')

        tags = pat.findall(text)

        title = x.get('text', '')
        for tag in tags:
            e.category(term=_(tag))
            title = title.replace('#{}'.format(tag), '')

        title = re.sub('<[^<]+?>', ' ', title)
        title = textwrap.wrap(title, width=80)[0]
        e.title(_(title.strip()))

    fg.rss_file('rss.xml')
Beispiel #7
0
    def build(self):
        fg = FeedGenerator()

        fg.id(self.id)
        fg.title(self.title)
        # TODO: Get actual author, categories, etc details from the feed
        fg.author({'name': self.author, 'email': '*****@*****.**'})
        fg.link(href=self.link, rel='alternate')
        fg.logo(self.logo)
        fg.subtitle(self.subtitle)
        fg.language(self.language)

        fg.load_extension('podcast', rss=True)
        fg.podcast.itunes_category('Technology', 'Podcasting')
        fg.podcast.itunes_summary(self.subtitle)
        # TODO: Add podcast image covers, both standard RSS and Itune-compatible

        for item in self.items:
            fe = fg.add_entry()
            fe.id(item.id)
            fe.title(item.title)
            fe.description(item.description)
            # fe.description('Enjoy our first episode.')
            fe.pubdate(item.published_at)

            file_name = os.path.basename(item.file)
            file_location = "%s/%s/%s" % (settings.S3_HTTP_PREFIX, self.slug, file_name)
            file_size = str(os.path.getsize(item.file)).encode("utf-8").decode("utf-8")
            fe.enclosure(file_location, file_size, 'audio/mpeg')

        self.body = fg.rss_str(pretty=True).decode("utf-8")
Beispiel #8
0
def gen_feed(title,
             author,
             feed_url,
             url,
             subtitle,
             logo,
             categories=None,
             album=False,
             licenses=False):
    fg = FeedGenerator()
    fg.load_extension("podcast")

    fg.id(feed_url)
    fg.title(title)
    fg.author(author)
    fg.link(href=url)
    fg.link(href=feed_url, rel="self")
    fg.logo(logo)
    fg.subtitle(subtitle)
    fg.language("en")
    fg.generator(generator="reel2bits",
                 uri=f"https://{current_app.config['AP_DOMAIN']}",
                 version=g.cfg["REEL2BITS_VERSION"])

    if album and categories:
        fg.podcast.itunes_category(categories[0])
        fg.category([{"term": c, "label": c} for c in categories])

    if licenses:
        fg.rights("See individual tracks: " + ", ".join(licenses))

    return fg
Beispiel #9
0
class AtomHistory(View):
    """Atom History Page Controller"""

    @redirect_if_not_installed
    def get(self, request):

        self.__correlation_id = request.META["X-Correlation-ID"] if "X-Correlation-ID" in request.META else ""
        self.__fg = FeedGenerator()
        self.__context = Context()
        self.__option_entity = OptionEntity()

        self.__context.autoload_options()
        self.__context.push({
            "page_title": self.__context.get("app_name", os.getenv("APP_NAME", "Silverback")),
            "is_authenticated": request.user and request.user.is_authenticated
        })

        self.__fg.id('http://silverbackhq.org')
        self.__fg.title('Some Testfeed')
        self.__fg.author({'name': 'John Doe', 'email': '*****@*****.**'})
        self.__fg.link(href='http://example.com', rel='alternate')
        self.__fg.logo('http://ex.com/logo.jpg')
        self.__fg.subtitle('This is a cool feed!')
        self.__fg.link(href='http://silverbackhq.org/test.atom', rel='self')
        self.__fg.language('en')

        return HttpResponse(self.__fg.atom_str(), content_type='text/xml')
Beispiel #10
0
    def serialize(podcast: Podcast, pretty: bool = False) -> str:
        fg = FeedGenerator()
        fg.load_extension("podcast")
        # fg.podcast.itunes_author(podcast.author.name)
        # fg.podcast.itunes_category("Technology", "Podcasting")
        # fg.podcast.itunes_explicit("no")
        # fg.podcast.itunes_complete("no")
        # fg.podcast.itunes_new_feed_url("http://example.com/new-feed.rss")
        # fg.podcast.itunes_owner("John Doe", "*****@*****.**")
        # fg.podcast.itunes_summary("")
        fg.title(podcast.title)
        fg.description(podcast.description)
        fg.author(podcast.author.to_dict())
        fg.link(href=podcast.atom_url, rel="self")
        fg.logo(podcast.logo_url)

        for episode in podcast.episodes:
            fe = fg.add_entry()
            fe.id(podcast.episode_audio_url(episode))
            fe.title(episode.title)
            fe.description(episode.description)
            fe.enclosure(podcast.episode_audio_url(episode), 0, "audio/mpeg")
            # fe.author(**podcast.author.to_dict())
            # fe.podcast.itunes_author(podcast.author.name)

        return fg.rss_str(pretty=pretty).decode("utf-8")
Beispiel #11
0
def generate_feed(feed_config: FeedModel):
    rss_feed = FeedGenerator()
    rss_feed.id(feed_config.url)
    rss_feed.title(feed_config.name)

    req = Request(feed_config.url, data=None, headers={'User-Agent': UA})
    with urlopen(req) as request:
        soup = BeautifulSoup(request.read(), features="html.parser")

    rss_feed.author({
        'name':
        soup.find('meta', {'property': 'books:author'})['content'],
        'email':
        '*****@*****.**'
    })
    rss_feed.description(soup.find('meta', {'name': 'description'})['content'])
    rss_feed.link(href=feed_config.url, rel='alternate')
    rss_feed.logo(soup.find('div', class_='row fic-header').find('img')['src'])
    rss_feed.language('en')

    for chapter in soup.find(id='chapters').find_all('tr')[1:]:
        feed_entry = rss_feed.add_entry()
        link = urljoin(feed_config.url, chapter.find('a')['href'])
        time = datetime.strptime(
            chapter.find('time')['title'],
            '%A, %B %d, %Y %I:%M %p').replace(tzinfo=timezone.utc)
        title = chapter.find('a').text.strip()

        feed_entry.id(link)
        feed_entry.title(title)
        feed_entry.description(title)
        feed_entry.link(href=link, rel='alternate')
        feed_entry.published(time)

    return rss_feed
def generate_rss_from_articles(feed_settings, articles):
    """
    Creates a FeedGenerator feed from a set of feed_entries.
    
    :param feed_settings: a feed_settings object containing 
    :param articles: 
    :return: 
    """

    # create the feed
    output_feed = FeedGenerator()

    # add metadata to the feed
    # TODO this feels like it can be done without output_rss on every line but...Python newbie
    output_feed.title(feed_settings.title)
    output_feed.author(feed_settings.author)
    output_feed.link(href=feed_settings.source_page_url, rel='alternate')
    output_feed.link(href=feed_settings.output_url, rel='self')
    output_feed.logo(feed_settings.logo_img_url)
    output_feed.subtitle(feed_settings.subtitle)
    output_feed.language(feed_settings.language)
    # output_rss.id(UM_SOMETHING)

    # add each feed item
    for article in articles:
        feed_entry_added = output_feed.add_entry()
        feed_entry_added.id(article.link)  # ATOM
        # guid for RSS?
        feed_entry_added.link(href=article.link, rel='alternate')  # ATOM
        feed_entry_added.title(article.title)
        feed_entry_added.description(article.description)
        # feed_entry_added.link(article.link)

    return output_feed
Beispiel #13
0
def feed(column_id):
    api = Api(column_id)

    with request.urlopen(api.info) as stream:
        result = stream.read().decode('utf-8')

    if not result:
        return '', 404

    info = json.loads(result)

    with request.urlopen(api.posts) as stream:
        result = stream.read().decode('utf-8')
        entries = json.loads(result)

    fg = FeedGenerator()
    fg.id(str(entries[0]['slug']))
    fg.title(info['name'])
    fg.language('zh_CN')
    fg.icon(info['avatar']['template'].replace('{id}', info['avatar']['id']).replace('{size}', 's'))
    fg.logo(info['avatar']['template'].replace('{id}', info['avatar']['id']).replace('{size}', 'l'))
    fg.description(info['intro'])
    fg.author(dict(name=info['creator']['name']))
    fg.link(href=api.base_url + info['url'], rel='alternate')
    for entry in entries:
        fe = fg.add_entry()
        fe.id(entry['url'])
        fe.title(entry['title'])
        fe.published(entry['publishedTime'])
        fe.updated(entry['publishedTime'])
        fe.author(dict(name=entry['author']['name']))
        fe.link(href=api.base_url + entry['url'], rel='alternate')
        fe.content(entry['content'])

    return fg.atom_str(pretty=True)
Beispiel #14
0
    def build_feed(self):
        "Build the feed given our existing URL"
        # Get all the episodes
        page_content = str(requests.get(self.url).content)
        parser = BassdriveParser()
        parser.feed(page_content)
        links = parser.get_links()

        # And turn them into something usable
        fg = FeedGenerator()
        fg.id(self.url)
        fg.title(self.title)
        fg.description(self.title)
        fg.author({'name': self.dj})
        fg.language('en')
        fg.link({'href': self.url, 'rel': 'alternate'})
        fg.logo(self.logo)

        for link in links:
            fe = fg.add_entry()
            fe.author({'name': self.dj})
            fe.title(link[0])
            fe.description(link[0])
            fe.enclosure(self.url + link[1], 0, 'audio/mpeg')

            # Bassdrive always uses date strings of
            # [yyyy.mm.dd] with 0 padding on days and months,
            # so that makes our lives easy
            date_start = link[0].find('[')
            date_str = link[0][date_start:date_start+12]
            published = datetime.strptime(date_str, '[%Y.%m.%d]')
            fe.pubdate(UTC.localize(published))
            fe.guid((link[0]))

        return fg
def generate_feed(feed_config: FeedModel):
    rss_feed = FeedGenerator()
    rss_feed.id(feed_config.url)
    rss_feed.title(feed_config.name)

    metadata = fetch_metadata(feed_config.url)

    rss_feed.author({
        'name': metadata['author'],
        'email': f"{metadata['author']}@{feed_config.url.host}"
    })
    rss_feed.description(metadata['description'])
    rss_feed.link(href=feed_config.url, rel='alternate')
    rss_feed.logo(metadata['cover_image'])
    rss_feed.language('en')

    for i, chapter in metadata['zchapters']:
        feed_entry = rss_feed.add_entry()
        link = chapter['url']
        time = datetime.strptime(metadata['dateUpdated'],
                                 '%Y-%m-%d').replace(tzinfo=timezone.utc)
        title = chapter['title']

        feed_entry.id(link)
        feed_entry.title(title)
        feed_entry.description(title)
        feed_entry.link(href=link, rel='alternate')
        feed_entry.published(time)

    return rss_feed
Beispiel #16
0
def __init_feed(setup):
    feed = FeedGenerator()
    feed.id(setup.get("id"))
    feed.title(setup.get("title"))
    feed.subtitle(setup.get("subtitle"))
    feed.author({"name": setup.get("name"), "email": setup.get("email")})
    feed.link(href=setup.get("link"), rel="self")
    feed.logo(setup.get("logo"))
    return feed
Beispiel #17
0
def create_feed_generator():
    fg = FeedGenerator()
    fg.id("https://github.com/fadawar/postoj-rss")
    fg.title("Postoj.sk")
    fg.author({"name": "Postoj.sk"})
    fg.link(href="https://www.postoj.sk", rel="alternate")
    fg.logo("https://www.postoj.sk/assets/frontend/build/img/brand-main.png")
    fg.subtitle("Konzervatívny denník")
    fg.language("sk")
    return fg
Beispiel #18
0
def rssvideoschannel(request, channel_id):
    channel = Channel.objects.get(channel_id=channel_id)
    if not channel:
        return Http404

    videos = channel.video_set.order_by('-pub_date')
    fg = FeedGenerator()
    fg.load_extension('podcast')

    channelURL = ''.join([
        'http://',
        get_current_site(request).domain,
        reverse('you2rss:videoperchannel', args=(channel_id, ))
    ])
    fg.id(channelURL)
    fg.title(channel.title_text)
    fg.author({'name': 'pon sko', 'email': '*****@*****.**'})
    fg.link(href=channelURL, rel='alternate')
    description = channel.description_text
    if len(description) < 2:
        description = "no desc"
    fg.subtitle(description)
    fg.description(description)
    fg.language('en')
    fg.logo(logo=channel.thumbnail)
    fg.image(url=channel.thumbnail, title=channel.title_text)
    fg.podcast.itunes_image(channel.thumbnail)

    for video in videos:
        fe = fg.add_entry()
        fe.author(name=channel.title_text)
        videodesc = video.description_text
        if len(videodesc) < 2:
            videodesc = "no desc"
        fe.content(videodesc)
        fileURL = ''.join([
            'http://',
            get_current_site(request).domain,
            reverse('you2rss:rssfile', args=(video.video_id, ))
        ])

        fe.enclosure(fileURL, '1337', 'audio/mpeg')
        fe.id(fileURL)
        fe.link(href=fileURL, rel='alternate')
        fe.podcast.itunes_image(video.thumbnail)
        fe.pubdate(video.pub_date)
        fe.published(video.pub_date)
        fe.title(video.title_text)

    rssdata = fg.rss_str(pretty=True)
    response = HttpResponse(rssdata,
                            content_type='application/rss+xml; charset=UTF-8')
    response['Content-Length'] = len(rssdata)
    return response
Beispiel #19
0
def rss(request):
    # track it!
    #   v=1              // Version.
    #   &tid=UA-XXXXX-Y  // Tracking ID / Property ID.
    #   &cid=555         // Anonymous Client ID.

    #   &t=pageview      // Pageview hit type.
    #   &dh=mydemo.com   // Document hostname.
    #   &dp=/home        // Page.
    #   &dt=homepage     // Title.
    angrates_uuid = uuid.UUID('f93c5388-f60b-5159-bbfc-d08d6f7b401f')
    x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
    if x_forwarded_for:
        ip = x_forwarded_for.split(',')[0]
    else:
        ip = request.META.get('REMOTE_ADDR')

    cid = uuid.uuid5(angrates_uuid, ip)

    data = {
        'v': 1,
        'tid': 'UA-19269567-1',
        'cid': cid,
        't': 'pageview',
        'dh': 'armstrongandgettybingo.com',
        'dp': '/rss/',
        'dt': 'Podcast',
    }

    requests.post('https://www.google-analytics.com/collect', data=data)

    fg = FeedGenerator()
    fg.load_extension('podcast')
    fg.id('http://www.armstrongandgettybingo.com/rss')
    fg.podcast.itunes_category('News & Politics', 'Conservative (Right)')
    fg.podcast.itunes_explicit('no')
    fg.title('The Armstrong and Getty Show (Bingo)')
    fg.author( {'name':'Ben Friedland','email':'*****@*****.**'} )
    fg.link( href='http://www.armstrongandgettybingo.com', rel='alternate' )
    fg.logo('https://s3-us-west-1.amazonaws.com/bencast/bingologo.png')
    fg.subtitle('Armstrong and Getty Bingo')
    fg.description('The Armstrong and Getty Show - Unofficial Feed including Archives back to 2001.')
    fg.link( href='http://www.armstrongandgettybingo.com/rss', rel='self' )
    fg.language('en')
    pacific = pytz.timezone('America/Los_Angeles')

    for hour in Hour.objects.all().order_by('-pub_date'):
        fe = fg.add_entry()
        fe.id(hour.link)
        fe.title(hour.title)
        fe.description(hour.description)
        fe.enclosure(hour.link, 0, 'audio/mpeg')
        fe.published(pacific.localize(hour.pub_date))
    return HttpResponse(fg.rss_str(pretty=True), content_type='application/rss+xml')
def generateRss(articlesList=exampleArticlesList,
                directoryPath='public_files',
                baseUrl='https://engn1931z99.pythonanywhere.com/'):
    """  list of article dictionaries ->
    Create a feed, which contains all the entries (1 entry for each article in articlesList), with all the information as requested.
    The RSS file should be saved in the specified directory.
    """

    # following method from http://lkiesow.github.io/python-feedgen/ for overall generation
    fg = FeedGenerator()
    fg.load_extension('podcast')
    fg.title('arXiv.org EE SP RSS Podcast')
    fg.link(href=baseUrl)
    fg.language('en')

    #get most recent image for the main podcast picture
    images = sorted(
        [f for f in os.listdir(directoryPath) if f.endswith('.png')]
    )  #method adapted from https://stackoverflow.com/questions/9788119/how-to-get-the-most-recent-file
    most_recent_image = images[-1]
    fg.logo(baseUrl + 'files?filename=' +
            most_recent_image)  #posts to image as well as logo

    fg.author({'name': 'Jason Webster', 'email': '*****@*****.**'})
    fg.podcast.itunes_owner('Jason Webster', '*****@*****.**')
    fg.podcast.itunes_category('Science & Medicine', 'Natural Sciences')
    fg.description('The Best Podcast in the Universe')
    fg.skipDays('Saturday', 'Sunday')

    now = datetime.datetime.now(tz=datetime.timezone.utc)
    fg.pubDate(now)

    for article in articlesList:
        fe = fg.add_entry()
        mp3 = article['articleId'] + '.mp3'
        png = article['articleId'] + '.png'
        fe.id(baseUrl + 'files?filename=' + mp3)
        fe.title(article['title'])
        fe.enclosure(baseUrl + 'files?filename=' + mp3,
                     str(os.path.getsize(directoryPath + '/' + mp3)),
                     'audio/mpeg')
        fe.description('Authors: ' + article['authors'] + '\n' +
                       'Article Id: ' + article['articleId'] + '\n' +
                       'Abstract: ' + article['abstract'] + '\n')
        fe.podcast.itunes_explicit('clean')
        fe.podcast.itunes_image(baseUrl + 'files?filename=' + png)
        fe.pubdate(now)
        mp3_file = MP3(directoryPath + '/' + article['articleId'] + '.mp3')

        duration = str(datetime.timedelta(seconds=int(mp3_file.info.length)))
        fe.podcast.itunes_duration(duration)

    fg.rss_file(directoryPath + '/podcast.xml', pretty=True)
Beispiel #21
0
def create_fg():
  # Create the feed
  fg = FeedGenerator()
  fg.id("http://www.accre.vanderbilt.edu")
  fg.title("ACCRE's Status Feed")
  fg.author(dict(name="Josh Arnold", email="*****@*****.**"))
  fg.link(href="http://www.accre.vanderbilt.edu", rel="alternate")
  fg.logo("http://www.accre.vanderbilt.edu/"
          "wp-content/themes/ashford/favicon.ico")
  fg.subtitle("ACCRE's Status Feed")
  fg.language('en')
  return fg
Beispiel #22
0
def staticrss(request, podcast_id):
    podcast = Podcast.objects.get(id=podcast_id)
    if not podcast:
        return Http404

    pods = podcast.pod_set.order_by('-audio_link')
    fg = FeedGenerator()
    fg.load_extension('podcast')

    channelURL = ''.join([
        'http://',
        get_current_site(request).domain,
        reverse('you2rss:staticrss', args=(podcast_id, ))
    ])
    fg.id(channelURL)
    fg.title(podcast.title_text)
    fg.author({'name': 'pon sko', 'email': '*****@*****.**'})
    fg.link(href=channelURL, rel='alternate')
    description = podcast.description_text
    if len(description) < 2:
        description = "no desc"
    fg.subtitle(description)
    fg.description(description)
    fg.language('en')
    fg.logo(logo=podcast.thumbnail)
    fg.image(url=podcast.thumbnail, title=podcast.title_text)
    fg.podcast.itunes_image(podcast.thumbnail)
    for pod in pods:
        fe = fg.add_entry()
        fe.author(name=podcast.title_text)
        desc = pod.description_text
        if len(desc) < 2:
            desc = "no desc"
        fe.content(desc)
        fileURL = pod.audio_link
        #''.join(['http://', get_current_site(request).domain,
        #                   reverse('you2rss:rssfile', args=(video.video_id,))])

        fe.enclosure(fileURL, pod.audio_size, pod.audio_type)
        fe.id(fileURL)
        fe.link(href=fileURL, rel='alternate')
        fe.podcast.itunes_image(podcast.thumbnail)
        fe.pubdate(pod.pub_date)
        fe.published(pod.pub_date)
        fe.title(pod.title_text)

    rssdata = fg.rss_str(pretty=True)
    response = HttpResponse(rssdata,
                            content_type='application/rss+xml; charset=UTF-8')
    response['Content-Length'] = len(rssdata)
    return response
def podcast():
    #locale.setlocale(locale.LC_ALL, "it_IT.utf8")

#    base_url = "https://podcast02.unitedradio.it/virginradio.it//NEW/upload/uploadedContent/repliche/drfeelgood/"
    base_url = "http://podcast.mediaset.net/repliche//2020/1/8/"
    base_url_2="_drfeelgood.mp3"


    today= dt.datetime.today().replace(hour=9,minute=0, second=0)

    days=[today+dt.timedelta(days=i) for i in range(-6,1)]
    days=list(filter(lambda x: (x.weekday()<5), days))

    urls=[ base_url+day(d.weekday())+d.strftime("_%d%m%Y")+base_url_2 for d in days]

    fg=FeedGenerator()
    fg.load_extension("podcast")
    fg.title("Rock and Talk")
    fg.description("Last episodes from Virgin Radio Rock and Talk")
    fg.link(href="https://www.virginradio.it/sezioni/1154/rock-talk")



    fg.podcast.itunes_author("Virgin Radio")
    fg.podcast.itunes_category("Speech", "Rock")
    fg.podcast.itunes_explicit("no")
    fg.podcast.itunes_complete("no")
    fg.podcast.itunes_new_feed_url("http://example.com/new-feed.rss")
    fg.podcast.itunes_summary("Last episodes from Virgin Radio Rock and Talk")

    fg.logo(logo="https://www.virginradio.it/resizer/628/355/true/1548173388720.png--.png?1548173388000")
    fg.image(url="https://www.virginradio.it/resizer/628/355/true/1548173388720.png--.png?1548173388000", title="Rock and talk")
    fg.podcast.itunes_image("https://www.virginradio.it/resizer/628/355/true/1548173388720.png--.png?1548173388000")



    for d,u in zip(days,urls):
        fe = fg.add_entry()
        fe.id(u)
        gg=d.strftime("%A %d %B")
        fe.title(gg)
        fe.description(gg)
        fe.summary(gg)
        #fe.link(href=u, rel="alternate")
        fe.link(href="https://www.virginradio.it/sezioni/1154/rock-talk", rel="alternate") 
        fe.enclosure(u, 0, "audio/mpeg")
        fe.published(pytz.utc.localize(d))

    #fg.rss_file("podcast.xml")

    return fg.rss_str(pretty=True)
Beispiel #24
0
 def _create_feed(self) -> FeedGenerator:
     fg = FeedGenerator()
     fg.id(self.URL + "content")
     fg.title(self.config.get('lw', 'blogTitle'))
     fg.author({
         "name": self.config.get('lw', 'blogAuthor'),
         "email": self.config.get('lw', 'blogAuthorEmail')
     })
     fg.link(href=self.URL, rel="alternate")
     fg.logo(self.URL + "image/favicon.ico")
     fg.subtitle(self.config.get('lw', 'blogSubTitle'))
     fg.link(href=self.URL + "content/rss.xml", rel="self")
     fg.language(self.config.get('lw', 'blogLang'))
     return fg
Beispiel #25
0
 def get_feedgenerator(self):
     fg = FeedGenerator()
     fg.id('http://pod.w-me.net')
     fg.title('W-Me Podcast')
     fg.description('W-Me podcast')
     fg.author( {'name':'Alex Dai','email':'*****@*****.**'} )
     fg.link( href='http://pod.w-me.net', rel='alternate' )
     fg.logo('http://pandodaily.files.wordpress.com/2012/08/shutterstock_58664.jpg')
     #fg.subtitle('This is a cool feed!')
     fg.link( href='http://pod.w-me.net/feed.atom', rel='self' )
     fg.language('en')
     fg.load_extension('podcast')
     fg.podcast.itunes_category('Technology', 'Podcasting')   
     return fg
Beispiel #26
0
def setup_feed():
    fg = FeedGenerator()

    fg.load_extension('podcast')

    fg.language('en')
    fg.id('https://jdelman.me/potato')
    fg.author(name='Potato', email='*****@*****.**')
    fg.link(href='https://jdelman.me/potato', rel='alternate')
    fg.logo('https://jdelman.me/static/potato.jpg')
    fg.title("Potato - Josh's Saved Videos")
    fg.subtitle("Automatically generated RSS.")

    return fg
Beispiel #27
0
def setup_feed():
    fg = FeedGenerator()

    fg.load_extension("podcast")

    fg.language("en")
    fg.id("https://jdelman.me/potato")
    fg.author(name="Potato", email="*****@*****.**")
    fg.link(href="https://jdelman.me/potato", rel="alternate")
    fg.logo("https://jdelman.me/static/potato.jpg")
    fg.title("Potato - Josh's Saved Videos")
    fg.subtitle("Automatically generated RSS.")

    return fg
Beispiel #28
0
    def get(self):
        fg = FeedGenerator()
        fg.id("http://test.ts")
        fg.title("My Test Feed")
        fg.icon("https://avatars1.githubusercontent.com/u/715660?v=3&s=32")
        fg.author({'name': "The Author", 'email': "*****@*****.**"})

        fg.link(href="http://example.org/index.atom?page=2", rel="next")

        fg.link(href="http://test.ts", rel="alternate")
        fg.logo("https://avatars1.githubusercontent.com/u/715660?v=3&s=32")
        fg.description("Este é o monstro do lago 1")
        fg.subtitle("This is an example feed!")
        fg.language("en-us")
        # Handle this:
        #< sy:updatePeriod > hourly < / sy:updatePeriod >
        #< sy:updateFrequency > 1 < / sy:updateFrequency >

        fg.lastBuildDate(datetime.now(pytz.timezone("America/Sao_Paulo")))

        fi = fg.add_item()
        fi.id("http://test.ts/id/1", )
        #fi.link(link="http://test.ts/id/1")
        fi.title("Monstro do Lago 1")
        fi.description("Este é o monstro do lago 1")
        fi.comments("http://test.ts/id/1/comments")
        fi.pubdate(datetime.now(pytz.timezone("America/Sao_Paulo")))

        fi = fg.add_item()
        fi.id("http://test.ts/id/2")
        fi.title("Monstro do Lago 2")
        fi.description("Este é o monstro do lago 2")
        fi.pubdate(datetime.now(pytz.timezone("America/Sao_Paulo")))

        #test = fg.atom_str(pretty=True)

        rss_str = fg.rss_str(pretty=True)
        self.set_header("Content-Type", 'application/xml; charset="utf-8"')
        #self.set_header("Content-Disposition",
        # "attachment; filename='test.xml'")
        self.write(rss_str)


        #if regexp.search(word) is not None:
        #    print
        #    'matched'
        if self.is_browser_mobile():
            print("buu")
        else:
            print(self.request.headers["User-Agent"])
Beispiel #29
0
def feedbase():
    fg = FeedGenerator()
    fg.load_extension('podcast')
    fg.title('SCOTUS Audio ' + TERM + 'Term')
    fg.subtitle(
        'This is an automated feed of the mp3 files from the SCOTUS website. NOT AFFILIATED WITH THE COURT OR THE JUSTICES.'
    )
    fg.link(href=LINK, rel='self')
    fg.language('en')
    if HOME:
        fg.link(href=HOME, rel='alternate')
    if LOGO:
        fg.logo(LOGO)
    return fg
Beispiel #30
0
class Feed:
    def __init__(self, baseURL, audioDir):
        self.baseURL = baseURL
        self.dir = audioDir
        self.fg = FeedGenerator()
        self.fg.load_extension('podcast')
        self.fg.id(baseURL)
        self.fg.title('Yesterdays Baseball')
        self.fg.author(name='MLB')
        self.fg.link(href=baseURL, rel='alternate')
        self.fg.logo(
            'http://en.wikipedia.org/wiki/Major_League_Baseball_logo#/media/File:Major_League_Baseball.svg'
        )
        self.fg.icon(
            'http://en.wikipedia.org/wiki/Major_League_Baseball_logo#/media/File:Major_League_Baseball.svg'
        )
        self.fg.subtitle(
            "Awright, 'arry? See that ludicrous display last night?")
        self.fg.link(href=baseURL + 'podcast.xml', rel='self')
        self.fg.language('en')
        self.fg.podcast.itunes_explicit('no')
        self.fg.podcast.itunes_complete('no')
        self.fg.podcast.itunes_new_feed_url(baseURL + 'podcast.xml')
        self.fg.podcast.itunes_summary(
            "Awright, 'arry? See that ludicrous display last night?")
        self.addAllEntries()

    def __repr__(self):
        return self.fg.rss_str(pretty=True)

    def addAllEntries(self):
        for root, dirs, files in os.walk(self.dir):
            for f in files:
                if os.path.splitext(f)[1] in MIME_TYPES.keys():
                    self.addEntry(root, f)

    def addEntry(self, root, f):
        path = os.path.join(root, f)
        fileName, fileExtension = os.path.splitext(f)
        print "Adding...", path
        fe = self.fg.add_entry()
        fe.id(self.baseURL + f)
        mediafile = ID3(path)

        fe.title(mediafile['TIT2'].text[0] + " " + fileName)
        fe.summary(mediafile['TPE1'].text[0])
        fe.content(mediafile['TPE1'].text[0])

        fe.enclosure(self.baseURL + f, 0, MIME_TYPES[fileExtension])
Beispiel #31
0
    def get(self):
        fg = FeedGenerator()
        fg.id("http://test.ts")
        fg.title("My Test Feed")
        fg.icon("https://avatars1.githubusercontent.com/u/715660?v=3&s=32")
        fg.author({'name': "The Author", 'email': "*****@*****.**"})

        fg.link(href="http://example.org/index.atom?page=2", rel="next")

        fg.link(href="http://test.ts", rel="alternate")
        fg.logo("https://avatars1.githubusercontent.com/u/715660?v=3&s=32")
        fg.description("Este é o monstro do lago 1")
        fg.subtitle("This is an example feed!")
        fg.language("en-us")
        # Handle this:
        #< sy:updatePeriod > hourly < / sy:updatePeriod >
        #< sy:updateFrequency > 1 < / sy:updateFrequency >

        fg.lastBuildDate(datetime.now(pytz.timezone("America/Sao_Paulo")))

        fi = fg.add_item()
        fi.id("http://test.ts/id/1", )
        #fi.link(link="http://test.ts/id/1")
        fi.title("Monstro do Lago 1")
        fi.description("Este é o monstro do lago 1")
        fi.comments("http://test.ts/id/1/comments")
        fi.pubdate(datetime.now(pytz.timezone("America/Sao_Paulo")))

        fi = fg.add_item()
        fi.id("http://test.ts/id/2")
        fi.title("Monstro do Lago 2")
        fi.description("Este é o monstro do lago 2")
        fi.pubdate(datetime.now(pytz.timezone("America/Sao_Paulo")))

        #test = fg.atom_str(pretty=True)

        rss_str = fg.rss_str(pretty=True)
        self.set_header("Content-Type", 'application/xml; charset="utf-8"')
        #self.set_header("Content-Disposition",
        # "attachment; filename='test.xml'")
        self.write(rss_str)

        #if regexp.search(word) is not None:
        #    print
        #    'matched'
        if self.is_browser_mobile():
            print("buu")
        else:
            print(self.request.headers["User-Agent"])
Beispiel #32
0
def main():
    now = datetime.now()
    today_day_of_week = now.weekday()
    most_recent_sunday = now - timedelta(
        days=today_day_of_week + 1)  # sunday is day 6

    fg = FeedGenerator()
    fg.load_extension('podcast')
    fg.id(URL)
    fg.title('Wicked Bites Radio')
    fg.category(term='Food')
    fg.language('en')
    fg.logo(
        'http://www.nedine.com/wp-content/themes/wickedbites/images/logo.png')
    fg.link(href='http://www.nedine.com', rel='alternate')
    fg.link(href=URL, rel='self')
    fg.description('The Pat Whitley Restaurant Show')
    fg.podcast.itunes_category('Food')
    fg.podcast.itunes_summary('Pat Whitley Restaurant Show')
    fg.podcast.itunes_explicit('no')
    fg.podcast.itunes_new_feed_url(URL)
    fg.podcast.itunes_category('Arts', 'Food')
    fg.podcast.itunes_owner('Eric Biagiotti', '*****@*****.**')

    for i in range(10):
        datestamp = (most_recent_sunday - timedelta(weeks=i))
        url = 'http://www.nedine.com/Radio/Shows/%s.mp3' % datestamp.strftime(
            '%m%d%y')

        r = requests.head(url)
        if r.status_code == 200:
            entry = fg.add_entry(order='append')
            entry.id(url)
            entry.title(datestamp.strftime('%m/%d/%Y'))
            entry.pubDate(datestamp.strftime('%Y-%m-%d 00:00:00 UTC'))
            entry.description(
                datestamp.strftime('Wicked Bites Radio show for %A, %B %e %Y'))
            entry.podcast.itunes_summary(
                datestamp.strftime('Wicked Bites Radio show for %A, %B %e %Y'))
            entry.enclosure(url, r.headers.get('Content-Length', 0),
                            'audio/mpeg')

    fg.rss_file('wickedbites.rss')

    s3_connection = boto.connect_s3()
    bucket = s3_connection.get_bucket('ebiagiotti')
    key = boto.s3.key.Key(bucket, 'wickedbites.rss')
    key.set_contents_from_filename('wickedbites.rss', policy='public-read')
    def add_feed(self, feed_id, yt_playlist):
        feed = FeedGenerator()

        feed.load_extension("podcast")
        feed.id(feed_id)
        feed.title(yt_playlist["snippet"]["title"])
        feed.author({"name": yt_playlist["snippet"]["channelTitle"]})
        feed.description(yt_playlist["snippet"]["description"])
        feed.logo(yt_playlist["snippet"]["thumbnails"]["standard"]["url"])
        feed.link(href="https://www.youtube.com/playlist?list=%s" % (yt_playlist["id"]))
        feed.rss_str(pretty=True)
        feed.last_updated = 0

        self.feeds[feed_id] = feed

        return feed
Beispiel #34
0
def gen_feed():
    fg = FeedGenerator()
    fg.id(f'{ID}')
    fg.title(f'{USERNAME} notes')
    fg.author({'name': USERNAME, 'email': '*****@*****.**'})
    fg.link(href=ID, rel='alternate')
    fg.description(f'{USERNAME} notes')
    fg.logo(ME.get('icon', {}).get('url'))
    fg.language('en')
    for item in DB.outbox.find({'type': 'Create'}, limit=50):
        fe = fg.add_entry()
        fe.id(item['activity']['object'].get('url'))
        fe.link(href=item['activity']['object'].get('url'))
        fe.title(item['activity']['object']['content'])
        fe.description(item['activity']['object']['content'])
    return fg
Beispiel #35
0
    def _build_feed(self):
        router = Router(self._config)
        fp = filterPlaceholders

        fg = FeedGenerator()
        fg.id(self._config.site_prefix)
        fg.title(self._config.site_name)
        fg.author({
            'name': fp(self._config.author),
            'email': fp(self._config.email)
        })
        fg.link(href=self._config.domain_name + self._config.site_prefix,
                rel='alternate')
        fg.logo(fp(self._config.site_logo))
        fg.subtitle(fp(self._config.description))
        fg.description(fp(self._config.description) or ' ')
        fg.language(fp(self._config.language))
        fg.lastBuildDate(moment.now().locale(self._config.locale).date)
        fg.pubDate(moment.now().locale(self._config.locale).date)

        for post in self._posts[:10]:
            meta = post.meta
            fe = fg.add_entry()
            fe.title(meta['title'])
            fe.link(href=self._config.domain_name +
                    router.gen_permalink_by_meta(meta))
            fe.guid(router.gen_permalink_by_meta(meta), True)
            fe.pubDate(meta['date'].date)
            fe.author({
                'name': meta['author'],
                'uri': fp(self._config.author_homepage),
                'email': fp(self._config.email)
            })
            fe.content(post.parsed)

        if not os.path.exists(
                unify_joinpath(self._config.build_dir, 'feed/atom')):
            os.makedirs(unify_joinpath(self._config.build_dir, 'feed/atom'))

        fg.rss_file(unify_joinpath(self._config.build_dir, 'feed/index.xml'))
        fg.rss_file(unify_joinpath(self._config.build_dir, 'feed/index.html'))
        fg.atom_file(
            unify_joinpath(self._config.build_dir, 'feed/atom/index.xml'))
        fg.atom_file(
            unify_joinpath(self._config.build_dir, 'feed/atom/index.html'))
Beispiel #36
0
def user_rss(user, subnodes):
    fg = FeedGenerator()
    # not sure what this field is for
    fg.id(f'https://anagora.org/feed/@{user}.rss')
    fg.title(f'Agora feed for user @{user}')
    fg.author({'name': 'anagora.org/@{user}', 'email': '*****@*****.**'})
    fg.logo('https://anagora.org/favicon.ico')
    fg.subtitle('The Agora is a crowdsourced distributed knowledge graph.')
    fg.link(href=f'https://anagora.org/feed/@{user}', rel='self')
    fg.language('en')
    for subnode in subnodes:
        fe = fg.add_entry()
        fe.id(f'{subnode.uri}')
        fe.title(f'{subnode.uri}')
        fe.content(f'{subnode.content}')
        fe.description(f'A post by user @{user} in node [[{subnode.node}]].')
        fe.link(href=f'https://anagora.org/@{user}/{subnode.node}')
    return fg.rss_str(pretty=True)
class CommonNetworkFeedgen(object):
    """
    For setting up rss feeds
    """

    def __init__(self):
        self.feedgen_connection = FeedGenerator()
        self.feedgen_connection.id('http://lernfunk.de/media/654321')
        self.feedgen_connection.title('MediaKraken Notification Feed')
        self.feedgen_connection.author(
            {'name': 'John Doe', 'email': '*****@*****.**'})
        self.feedgen_connection.link(
            href='http://example.com', rel='alternate')
        self.feedgen_connection.logo('http://ex.com/logo.jpg')
        self.feedgen_connection.subtitle('This is a cool feed!')
        self.feedgen_connection.link(
            href='http://larskiesow.de/test.atom', rel='self')
        self.feedgen_connection.language('en')
Beispiel #38
0
def gen_feed():
    fg = FeedGenerator()
    fg.id(f"{ID}")
    fg.title(f"{USERNAME} notes")
    fg.author({"name": USERNAME, "email": "*****@*****.**"})
    fg.link(href=ID, rel="alternate")
    fg.description(f"{USERNAME} notes")
    fg.logo(ME.get("icon", {}).get("url"))
    fg.language("en")
    for item in DB.activities.find(
        {"box": Box.OUTBOX.value, "type": "Create"}, limit=50
    ):
        fe = fg.add_entry()
        fe.id(item["activity"]["object"].get("url"))
        fe.link(href=item["activity"]["object"].get("url"))
        fe.title(item["activity"]["object"]["content"])
        fe.description(item["activity"]["object"]["content"])
    return fg
Beispiel #39
0
    def render(self, data, accepted_media_type=None, renderer_context=None):
        """
        Renders *obj* into serialized XML.
        """
        if data is None:
            return ''
        
        fg = FeedGenerator()
        myclass = type(renderer_context['view']).__name__ 

        if myclass == 'CollectionViewSet':           
            feed_url = data['url']
            feed_title = data['name']
            feed_description = data['description']
            resources = data['resources']
        elif myclass in ['ResourceViewSet','ResourceSearch']:
            feed_url = "http://social.honzta.es/api/resources/"
            feed_title = "SocialLearning resources"
            feed_description = "SocialLearning resources"
            resources = data
        else: 
            feed_url = "http://social.honzta.es/api/resources/"
            feed_title = "SocialLearning resources"
            feed_description = "SocialLearning resources"
            resources = []
        
        fg.id(feed_url)
        fg.title(feed_title)
        fg.subtitle(feed_description)
        fg.author( {'name':'SocialLearning','email':'*****@*****.**'} )
        fg.link( href=feed_url, rel='alternate' )
        fg.logo('http://www.ovtt.org/sites/default/files/styles/ampliacion_noticia/public/logo_hontza_fondo-claro_opaco.png')        
        fg.link( href=feed_url+'?format=rss', rel='self' )
        fg.language('en')

        for item in resources:
            fe = fg.add_entry()
            fe.id(item['resource'] or 'http://social.honzta.es/api/resources/1/')
            fe.title(item['title'] or 'Not available')
            fe.link({'href':item['url'] or 'http://social.honzta.es/api/resources/1/'})
            #fe.content(item['title'])
            #fe.description(item['description'])

        return fg.rss_str(pretty=True)
Beispiel #40
0
    def get_rss_by_show_id(self, show_id):
        show = self.get_show_by_show_id(show_id)
        if show is None:
            warnings.warn("get_show_by_show_id({}) returned None".format(show_id))
            return None
        eps = self.get_episodes_by_show_id(show_id)
        if eps is None:
            warnings.warn("get_episodes_by_show_id({}) returned None".format(show_id))

        fg = FeedGenerator()
        fg.load_extension("podcast")
        fg.id(show_id)
        fg.title(show["name"])
        if "href" in show:
            fg.link(href=show["href"], rel="via")
        if "images" in show and show["images"]:
            fg.logo(show["images"][0]["url"])
        if "languages" in show and show["languages"]:
            fg.language(show["languages"][0])
        fg.description(show.get("description", None))

        for ep in eps:
            if "external_urls" not in ep or not ep["external_urls"]:
                continue
            url = None
            for key, value in ep["external_urls"].items():
                if url is None or not key == "spotify":
                    url = value
            fe = fg.add_entry(order="append")
            fe.title(ep["name"])
            fe.id(ep["id"])
            fe.description(ep.get("description", None))
            fe.link(href=url)
            try:
                published = datetime_parse(ep["release_date"])
                if published.tzinfo is None:
                    published = published.astimezone(timezone.utc)
                fe.published(published)
            except Exception:
                pass
            if "duration_ms" in ep:
                fe.podcast.itunes_duration(int(ep["duration_ms"] / 1000))
        return fg.rss_str(pretty=True)
Beispiel #41
0
class Feed:
  def __init__(self, baseURL, audioDir):
    self.baseURL = baseURL
    self.dir = audioDir
    self.fg = FeedGenerator()
    self.fg.load_extension('podcast')
    self.fg.id(baseURL)
    self.fg.title('Yesterdays Baseball')
    self.fg.author( name='MLB' )
    self.fg.link( href=baseURL, rel='alternate' )
    self.fg.logo('http://en.wikipedia.org/wiki/Major_League_Baseball_logo#/media/File:Major_League_Baseball.svg')
    self.fg.icon('http://en.wikipedia.org/wiki/Major_League_Baseball_logo#/media/File:Major_League_Baseball.svg')
    self.fg.subtitle("Awright, 'arry? See that ludicrous display last night?")
    self.fg.link( href=baseURL+'podcast.xml', rel='self' )
    self.fg.language('en')
    self.fg.podcast.itunes_explicit('no')
    self.fg.podcast.itunes_complete('no')
    self.fg.podcast.itunes_new_feed_url(baseURL+'podcast.xml')
    self.fg.podcast.itunes_summary("Awright, 'arry? See that ludicrous display last night?")
    self.addAllEntries()

  def __repr__(self):
    return self.fg.rss_str(pretty=True)

  def addAllEntries(self):
    for root, dirs, files in os.walk(self.dir):
      for f in files:
        if os.path.splitext(f)[1] in MIME_TYPES.keys(): 
          self.addEntry(root,f)

  def addEntry(self,root,f):
    path = os.path.join(root,f)
    fileName, fileExtension = os.path.splitext(f)
    print "Adding...",path
    fe = self.fg.add_entry()
    fe.id(self.baseURL+f)
    mediafile = ID3(path)

    fe.title(mediafile['TIT2'].text[0] + " " + fileName)
    fe.summary(mediafile['TPE1'].text[0])
    fe.content(mediafile['TPE1'].text[0])

    fe.enclosure(self.baseURL+f, 0, MIME_TYPES[fileExtension])
Beispiel #42
0
    def render_rss(self, post_list):
        router = Router(self._config)
        fg = FeedGenerator()
        fg.id(self._config.site_prefix)
        fg.title(self._config.site_name)
        fg.author({'name': self._config.author, 'email': self._config.email})
        fg.link(href=self._config.site_prefix, rel='alternate')
        fg.logo(self._config.site_logo)
        fg.subtitle(self._config.description)
        fg.language('zh-CN')
        fg.lastBuildDate(moment.now().locale('Asia/Shanghai').date)
        fg.pubDate(moment.now().locale('Asia/Shanghai').date)

        for post in post_list[:10]:
            meta = post.meta
            fe = fg.add_entry()
            fe.title(meta['title'])
            fe.link(href=router.gen_permalink_by_meta(meta))
            fe.guid(router.gen_permalink_by_meta(meta), True)
            fe.pubDate(meta['date'].date)
            fe.author({
                'name': meta['author'],
                'uri': self._config.author_homepage,
                'email': self._config.email
            })
            fe.content(post.parsed)

        if not os.path.exists(
                Utils.unify_joinpath(self._config.build_dir, 'feed/atom')):
            os.makedirs(
                Utils.unify_joinpath(self._config.build_dir, 'feed/atom'))

        fg.rss_file(
            Utils.unify_joinpath(self._config.build_dir, 'feed/index.xml'))
        fg.rss_file(
            Utils.unify_joinpath(self._config.build_dir, 'feed/index.html'))
        fg.atom_file(
            Utils.unify_joinpath(self._config.build_dir,
                                 'feed/atom/index.xml'))
        fg.atom_file(
            Utils.unify_joinpath(self._config.build_dir,
                                 'feed/atom/index.html'))
Beispiel #43
0
def rss():
    fg = FeedGenerator()
    fg.id('http://shockham.com/')
    fg.title('shockham.')
    fg.author({'name': 'shockham', 'email': ''})
    fg.link(href='http://shockham.com', rel='alternate')
    fg.logo(url_for('static', filename='images/new_logo.png'))
    fg.subtitle('RSS feed for shockhams site!')
    fg.link(href='http://shockham.com/rss', rel='self')
    fg.language('en')

    concepts = Concept.objects(Q(slug__ne='none') & Q(parent__ne='none'))
    for concept in concepts:
        fe = fg.add_entry()
        fe.id('http://shockham.com/' + concept.slug)
        fe.title(concept.title)

    response = make_response(fg.rss_str(pretty=True))
    response.headers["Content-Type"] = "application/xml"

    return response
Beispiel #44
0
def createFeed(links, titles):
    # feed dosyasini olustur
    fg = FeedGenerator()
    fg.load_extension("podcast")
    fg.id("http://twitter.com/dorukcankisin")
    fg.title(DIZI_TITLE)
    fg.author({"name": "dorukcan kisin", "email": "*****@*****.**"})
    fg.link(href="http://twitter.com/dorukcankisin", rel="alternate")
    fg.logo(DIZI_LOGO)
    fg.subtitle(DIZI_TITLE + " videocast")
    fg.language("en")

    for i, url in enumerate(links):
        fe = fg.add_entry()
        fe.id(url)
        fe.enclosure(url, 0, "video/mp4")
        fe.title(titles[i])
        fe.description(titles[i])

    fg.rss_file("rss.xml")
    return fg.rss_str(pretty=True)
Beispiel #45
0
def make_feed(query, url):
    query = query.options(joinedload(tables.Event.city))
    query = query.options(joinedload(tables.Event.venue))
    query = query.order_by(desc(tables.Event.date))
    from feedgen.feed import FeedGenerator
    fg = FeedGenerator()
    fg.id('http://pyvo.cz')
    fg.title('Pyvo')
    fg.logo(url_for('static', filename='images/krygl.png', _external=True))
    fg.link(href=url, rel='self')
    fg.subtitle('Srazy Pyvo.cz')
    for event in query:
        fe = fg.add_entry()
        url = filters.event_url(event, _external=True)
        fe.id(url)
        fe.link(href=url, rel='alternate')
        fe.title(event.title)
        fe.summary(event.description)
        fe.published(event.start)
        fe.updated(event.start)
        # XXX: Put talks into fe.dscription(), videos in link(..., rel='related')
    return fg
Beispiel #46
0
def make_feed(query, url):
    query = query.options(joinedload(tables.Event.city))
    query = query.options(joinedload(tables.Event.venue))
    query = query.order_by(desc(tables.Event.date))
    from feedgen.feed import FeedGenerator
    fg = FeedGenerator()
    fg.id('http://pyvo.cz')
    fg.title('Pyvo')
    fg.logo('http://ex.com/logo.jpg')
    fg.link(href=url, rel='self')
    fg.subtitle('Srazy Pyvo.cz')
    for event in query:
        fe = fg.add_entry()
        url = url_for('city', cityslug=event.city.slug, _external=True) + '#{}'.format(event.date)
        fe.id(url)
        fe.link(href=url, rel='alternate')
        fe.title(event.title)
        fe.summary(event.description)
        fe.published(event.start)
        fe.updated(event.start)
        # XXX: Put talks into fe.dscription(), videos in link(..., rel='related')
    return fg
Beispiel #47
0
def get_feed(db):
    fg = FeedGenerator()
    fg.id('http://www.academis.eu/feed')
    fg.title('Academis Blog')
    fg.author( {'name':'Kristian Rother','email':'*****@*****.**'} )
    fg.link( href='http://www.academis.eu', rel='alternate' )
    fg.logo('http://www.academis.eu/static/images/academis_kr350.png')
    fg.subtitle('Articles on Python programming, Data analysis and Leadership in tech')
    fg.link( href='http://www.academis.eu/academis.atom', rel='self' )
    fg.language('en')
    fg.contributor( name='Kristian Rother', email='*****@*****.**' )

    for title, slug in get_all_posts(db):
        title, content = get_post(db, slug)
        fe = fg.add_entry()
        fe.id('http://www.academis.eu/posts/{}'.format(slug))
        fe.link(href='http://www.academis.eu/posts/{}'.format(slug))
        fe.title(title)
        fe.description(content[:300])

    rssfeed  = fg.rss_str(pretty=True)
    fg.rss_file('rss.xml') # Write the RSS feed to a file
    return rssfeed
Beispiel #48
0
  def makePassThroughRss(self):
    fg = FeedGenerator()
    fg.load_extension('podcast')
    fg.id('http://hypecast.blackmad.com/' + self.mode)
    fg.title('Hype Machine PassThru Radio: ' + self.mode)
    fg.author( {'name':'David Blackmad','email':'*****@*****.**'} )
    fg.logo('http://themelkerproject.com/wp-content/uploads/2013/10/the-hype-machine.jpg')
    fg.language('en')
    fg.link(href='http://hypecast.blackmad.com/' + self.mode)
    fg.description('Hype Machine PassThru: ' + self.mode)

    # description = '<br/>'.join(['%s. %s' % (index + 1, self.mk_song_id(s)) for index, s in enumerate(self.songs)])

    for s in self.songs:
      fe = fg.add_entry()
      fe.title(self.mk_song_id(s))
      fe.id(s['mediaid'])
      fe.description(s['description'])
      fe.podcast.itunes_image(s['thumb_url'])
      # add length
      fe.enclosure(url = 'http://hypecast.blackmad.com/%s/%s' % ('hypecasts', s['filename']), type="audio/mpeg")

    podcast_xml_file = os.path.join(self.output_dir, 'podcast.xml')
    fg.rss_file(podcast_xml_file)
Beispiel #49
0
def get_feed(csv_path, feed_type):
    """Writes a podcast feed based on a CSV file of URLS. 

    Parameters:
    urlfilepath -- path of CSV file containing date,url entries
    feedtype    -- type of feed, possible values: 'atom' or 'rss'

    """
    with open(csv_path, encoding='utf-8') as file:
        rows = [row for row in csv.reader(file)]

    fg = FeedGenerator()
    fg.title("Audio from the interwebs")
    fg.logo(FEED_LOGO)
    fg.id(FEED_ID)

    for row in rows:
        # for each row from CSV file, add a FeedEntry object to the
        # Feedgenerator
        date, url, title = row
        url_quoted = urllib.parse.quote(url, ':/')
        domain = urllib.parse.urlparse(url).netloc
        content = "This audio file from {} was added on {}.".format(domain, date) 
        fe = fg.add_entry()            
        fe.id(url)
        fe.title(title)
        fe.link({'href': url_quoted, 'rel' : 'enclosure'})
        fe.content(content)
        fe.published(date)

    if feed_type == 'atom':
        func = fg.atom_str
    else:
        func = fg.rss_str

    return func(pretty=True, encoding='UTF-8')
Beispiel #50
0
from feedgen.feed import FeedGenerator

fg = FeedGenerator()
fg.load_extension('podcast')

nodelist = Orgnode.makelist(sys.argv[1])

info = nodelist[0]
properties = info.Properties()
fg.podcast.itunes_category('Technology', 'Podcasting')

fg.title(info.Heading())
fg.author( {'name':properties['author'],'email':properties['email']} )
fg.id(properties["id"])
fg.link( href='http://whoomin.marboo.biz', rel='alternate' )
fg.logo(properties["logo"])
fg.subtitle(properties["subtitle"])
fg.link(href=properties["link"], rel='self' )
fg.language(properties["language"])
fg.image(properties["image"], height="140", width="140")
fg.rights(properties["copyright"])
fg.podcast.itunes_author(properties["author"])
fg.podcast.itunes_subtitle(properties["subtitle"])
fg.podcast.itunes_summary(properties["summary"])
#fg.podcast.itunes_keywords(properties["keywords"])
#fg.ttl(1440)

for i in range(1, len(nodelist)):
    node = nodelist[i]
    if node.Todo() == "DRAFT":
        continue
Beispiel #51
0
else:
	print "critical: not every post in", POSTS_DIR, "seems to have gotten a html file"
	print "debug:", len(posts), "/", processed_posts
	sys.exit(1)

#print posts

newlist = sorted(posts, key=lambda k: k['date'], reverse=True) # sort by dates, reverse to get newest on top
posts = newlist # extremely ugly code but whatever

print "generating rss feed...",
fg = FeedGenerator()
fg.title(SITE_TITLE + ' RSS')
fg.author({'name': AUTHOR_NAME, 'email':AUTHOR_EMAIL})
fg.link(href=SITE_ROOT_URL,rel='alternate')
fg.logo(SITE_ROOT_URL+'avatar.png')
fg.link(href=SITE_ROOT_URL+'rss.xml',rel='self')
fg.description(SITE_TITLE +' rss feed')
fg.id(SITE_ROOT_URL)
fg.language('en')
for p in posts:
	fe = fg.add_entry()
	fe.id(p['full_url'])
	fe.link(href=p['full_url'],rel='alternate')
	rfc2822 = utils.formatdate(time.mktime(p['date'].timetuple())) # https://stackoverflow.com/a/3453277
	fe.pubDate(rfc2822)
	fe.title(clean(p['title']))
	#fe.description(clean(p['body'])) # maybe include this in the future.... causes issues with image urls atm
fg.rss_file(os.path.join(SITE_ROOT,'rss.xml'))
print "ok"
	parser.add_argument("input_directory", help="Media location, output XML location.", action=readable_dir)
	parser.add_argument("url", help="URL to the directory provided in input_directory.")
	
	args = parser.parse_args()
	
	if not args.url.endswith("/"):
		args.url += "/"
	
	fg = FeedGenerator()
	fg.load_extension('podcast')
	fg.podcast.itunes_category('Technology')
	
	fg.id(args.url)
	fg.title("Simon's Custom Feed")
	fg.link(href=args.url)
	fg.logo("https://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Python-logo-notext.svg/480px-Python-logo-notext.svg.png")
	fg.subtitle("All the media that doesn't have an RSS feed, but I want in my player.")
	fg.language('en-GB')
	
	file_list = [f for f in os.listdir(args.input_directory) if (os.path.isfile(os.path.join(args.input_directory, f)) and not typelookup(f) == "")]
	
	# TODO: Theoretically, all file lengths could be fetched at once to save calling out multiple times.
	for f in file_list:
		fe = fg.add_entry()
		popen = subprocess.Popen(["ffmpeg", "-i", os.path.join(args.input_directory, f), "-f", "null", "-"], stdout = subprocess.DEVNULL, stderr = subprocess.PIPE)
		popen.wait()
		answer = toseconds(popen.stderr.readlines()[-2].decode("utf-8").split(" ")[1].split("=")[1].split(".")[0])
		#fe.id(args.url+f)
		fe.id(getmd5(os.path.join(args.input_directory, f)))
		fe.title(f)
		fe.enclosure(args.url+f, str(answer), typelookup(f))
Beispiel #53
0
def main():
    if len(sys.argv) != 2 or not (
            sys.argv[1].endswith('rss') or
            sys.argv[1].endswith('atom') or
            sys.argv[1] == 'torrent' or
            sys.argv[1] == 'podcast'):
        print(USAGE)
        exit()

    arg = sys.argv[1]

    fg = FeedGenerator()
    fg.id('http://lernfunk.de/_MEDIAID_123')
    fg.title('Testfeed')
    fg.author({'name': 'Lars Kiesow', 'email': '*****@*****.**'})
    fg.link(href='http://example.com', rel='alternate')
    fg.category(term='test')
    fg.contributor(name='Lars Kiesow', email='*****@*****.**')
    fg.contributor(name='John Doe', email='*****@*****.**')
    fg.icon('http://ex.com/icon.jpg')
    fg.logo('http://ex.com/logo.jpg')
    fg.rights('cc-by')
    fg.subtitle('This is a cool feed!')
    fg.link(href='http://larskiesow.de/test.atom', rel='self')
    fg.language('de')
    fe = fg.add_entry()
    fe.id('http://lernfunk.de/_MEDIAID_123#1')
    fe.title('First Element')
    fe.content('''Lorem ipsum dolor sit amet, consectetur adipiscing elit. Tamen
            aberramus a proposito, et, ne longius, prorsus, inquam, Piso, si
            ista mala sunt, placet. Aut etiam, ut vestitum, sic sententiam
            habeas aliam domesticam, aliam forensem, ut in fronte ostentatio
            sit, intus veritas occultetur? Cum id fugiunt, re eadem defendunt,
            quae Peripatetici, verba.''')
    fe.summary(u'Lorem ipsum dolor sit amet, consectetur adipiscing elit…')
    fe.link(href='http://example.com', rel='alternate')
    fe.author(name='Lars Kiesow', email='*****@*****.**')

    if arg == 'atom':
        print_enc(fg.atom_str(pretty=True))
    elif arg == 'rss':
        print_enc(fg.rss_str(pretty=True))
    elif arg == 'podcast':
        # Load the podcast extension. It will automatically be loaded for all
        # entries in the feed, too. Thus also for our “fe”.
        fg.load_extension('podcast')
        fg.podcast.itunes_author('Lars Kiesow')
        fg.podcast.itunes_category('Technology', 'Podcasting')
        fg.podcast.itunes_explicit('no')
        fg.podcast.itunes_complete('no')
        fg.podcast.itunes_new_feed_url('http://example.com/new-feed.rss')
        fg.podcast.itunes_owner('John Doe', '*****@*****.**')
        fg.podcast.itunes_summary('Lorem ipsum dolor sit amet, consectetur ' +
                                  'adipiscing elit. Verba tu fingas et ea ' +
                                  'dicas, quae non sentias?')
        fe.podcast.itunes_author('Lars Kiesow')
        print_enc(fg.rss_str(pretty=True))

    elif arg == 'torrent':
        fg.load_extension('torrent')
        fe.link(href='http://example.com/torrent/debian-8-netint.iso.torrent',
                rel='alternate',
                type='application/x-bittorrent, length=1000')
        fe.torrent.filename('debian-8.4.0-i386-netint.iso.torrent')
        fe.torrent.infohash('7661229811ef32014879ceedcdf4a48f256c88ba')
        fe.torrent.contentlength('331350016')
        fe.torrent.seeds('789')
        fe.torrent.peers('456')
        fe.torrent.verified('123')
        print_enc(fg.rss_str(pretty=True))

    elif arg.startswith('dc.'):
        fg.load_extension('dc')
        fg.dc.dc_contributor('Lars Kiesow')
        if arg.endswith('.atom'):
            print_enc(fg.atom_str(pretty=True))
        else:
            print_enc(fg.rss_str(pretty=True))

    elif arg.startswith('syndication'):
        fg.load_extension('syndication')
        fg.syndication.update_period('daily')
        fg.syndication.update_frequency(2)
        fg.syndication.update_base('2000-01-01T12:00+00:00')
        if arg.endswith('.rss'):
            print_enc(fg.rss_str(pretty=True))
        else:
            print_enc(fg.atom_str(pretty=True))

    elif arg.endswith('atom'):
        fg.atom_file(arg)

    elif arg.endswith('rss'):
        fg.rss_file(arg)
				exit(1)
			if args['--subcategory'] is not None:
				fg.podcast.itunes_category(args['--category'], args['--subcategory'])
			else:
				fg.podcast.itunes_category(args['--category'])
		
		#Podcast Details
		fg.title(args['--title'])
		fg.link(href=args['--link'], rel='alternate')
		fg.description(args['--desc'])
		
		if args['--id'] is not None:
			fg.id(args['--id'])
		
		if args['--logo'] is not None:
			fg.logo(logo=args['--logo'])
			fg.image(url=args['--logo'], title=args['--title'])
			fg.podcast.itunes_image(args['--logo'])
			
		if args['--language'] is not None:
			fg.language(args['--language'])
			
		if args['--feed-link'] is not None:
			fg.link(href=args['--feed-link'], rel='self')
		
		#Clean-up link string: trim spaces and remove trailing slash
		link = args['--link'].strip()
		if link[len(link) - 1] == '/':
			link = link[:len(link)-1]
		
		#Generate feed items from files in directory.
Beispiel #55
0
        print_enc("  syndication.rss  -- Generate DC extension test output (rss format) and print it to stdout.")
        print_enc("")
        exit()

    arg = sys.argv[1]

    fg = FeedGenerator()
    fg.id("http://lernfunk.de/_MEDIAID_123")
    fg.title("Testfeed")
    fg.author({"name": "Lars Kiesow", "email": "*****@*****.**"})
    fg.link(href="http://example.com", rel="alternate")
    fg.category(term="test")
    fg.contributor(name="Lars Kiesow", email="*****@*****.**")
    fg.contributor(name="John Doe", email="*****@*****.**")
    fg.icon("http://ex.com/icon.jpg")
    fg.logo("http://ex.com/logo.jpg")
    fg.rights("cc-by")
    fg.subtitle("This is a cool feed!")
    fg.link(href="http://larskiesow.de/test.atom", rel="self")
    fg.language("de")
    fe = fg.add_entry()
    fe.id("http://lernfunk.de/_MEDIAID_123#1")
    fe.title("First Element")
    fe.content(
        """Lorem ipsum dolor sit amet, consectetur adipiscing elit. Tamen
			aberramus a proposito, et, ne longius, prorsus, inquam, Piso, si ista
			mala sunt, placet. Aut etiam, ut vestitum, sic sententiam habeas aliam
			domesticam, aliam forensem, ut in fronte ostentatio sit, intus veritas
			occultetur? Cum id fugiunt, re eadem defendunt, quae Peripatetici,
			verba."""
    )
Beispiel #56
0
local_location = 'path/to/mp3_files/*.mp3'


# ----------------------
# Generate actual feed
# ----------------------
# Generate feed
fg = FeedGenerator()
fg.load_extension('podcast')

# Add descriptive variables to the feed
fg.id(feed_url)
fg.title(feed_title)
fg.author({'name': feed_author, 'email': feed_author_email})
fg.link(href=feed_homepage, rel='alternate')
fg.logo(cover_image)
fg.subtitle(feed_description)
fg.link(href=feed_url, rel='self')
fg.language('en')
fg.podcast.itunes_block(True)
fg.podcast.itunes_complete(True)


# Loop through each MP3 and add it to the feed as an episode
for i, track in enumerate(glob.glob(local_location)):
    # Some podcast players respect the itunes_order attribute, which is set
    # below, but many only look at the date and time of the episode. So, here
    # we pretend that the first episode happened 7 days ago, and each
    # subsequent episode is released 1 hour later.
    episode_date = (datetime.now(tz=pytz.utc) -
                    timedelta(days=7) +
Beispiel #57
0
from feedgen.feed import FeedGenerator

fg = FeedGenerator()
fg.load_extension('podcast')

# Meta
fg.id('http://podcast.writethedocs.org/')
fg.title('Write the Docs Podcast')
fg.author({'name': 'Eric Holscher', 'email': '*****@*****.**'})
#fg.link(href='', rel='alternate')
fg.logo('http://conf.writethedocs.org/img/stickers/sticker-wtd-colors.png')
fg.subtitle('All things documentation')
fg.link(href='http://podcast.writethedocs.org/rss.xml', rel='self')
fg.language('en')

# Podcast Meta
fg.podcast.itunes_category('Technology')
fg.podcast.itunes_image('http://conf.writethedocs.org/img/stickers/sticker-wtd-colors.png')
fg.podcast.itunes_owner(name='Eric Holscher', email='*****@*****.**')
fg.podcast.itunes_summary('A podcast about all things documentation')

# Entries
fe = fg.add_entry()
fe.id('http://podcast.writethedocs.org/episodes/heidi-waterhouse.html')
fe.title('Episode One: Heidi Waterhouse')
fe.enclosure(url='')

# Write
fg.rss_str(pretty=True)
fg.rss_file('rss.xml')
Beispiel #58
0
		print_enc ('  podcast     -- Generator Podcast test output and print it to stdout.')
		print_enc ('')
		exit()

	arg = sys.argv[1]

	fg = FeedGenerator()
	fg.id('http://lernfunk.de/_MEDIAID_123')
	fg.title('Testfeed')
	fg.author( {'name':'Lars Kiesow','email':'*****@*****.**'} )
	fg.link( href='http://example.com', rel='alternate' )
	fg.category(term='test')
	fg.contributor( name='Lars Kiesow', email='*****@*****.**' )
	fg.contributor( name='John Doe', email='*****@*****.**' )
	fg.icon('http://ex.com/icon.jpg')
	fg.logo('http://ex.com/logo.jpg')
	fg.rights('cc-by')
	fg.subtitle('This is a cool feed!')
	fg.link( href='http://larskiesow.de/test.atom', rel='self' )
	fg.language('de')
	fe = fg.add_entry()
	fe.id('http://lernfunk.de/_MEDIAID_123#1')
	fe.title('First Element')
	fe.content('''Lorem ipsum dolor sit amet, consectetur adipiscing elit. Tamen
			aberramus a proposito, et, ne longius, prorsus, inquam, Piso, si ista
			mala sunt, placet. Aut etiam, ut vestitum, sic sententiam habeas aliam
			domesticam, aliam forensem, ut in fronte ostentatio sit, intus veritas
			occultetur? Cum id fugiunt, re eadem defendunt, quae Peripatetici,
			verba.''')
	fe.summary('Lorem ipsum dolor sit amet, consectetur adipiscing elit...')
	fe.link( href='http://example.com', rel='alternate' )
#!/usr/bin/python
# -*- coding: utf-8 -*-

from feedgen.feed import FeedGenerator
fg = FeedGenerator()
fg.id('http://wuduoyi.com/')
fg.title("Wuduoyi's Note")
fg.author({'name':'Duoyi Wu','email':'*****@*****.**'})
fg.link(href='http://wuduoyi.com', rel='alternate')
fg.logo('http://wuduoyi.com/favicon.ico')
fg.link(href='http://wuduoyi.com/atom.xml', rel='self')
fg.description(description = u'Wuduoyi 的个人笔记')

fe = fg.add_entry()
fe.id('http://wuduoyi.com/note/G-ossip/')
fe.link(link={'href': 'http://wuduoyi.com/note/G-ossip/'})
fe.title(u'八卦某 G 的前端开发方式及流程')
fe.pubdate('2014-4-1 10:00:00 +0800')
fe.description(description = u'''
    话说本人从毕业到现在一直在某 B 公司工作,前些年折腾过不少开发方式和工具,但总觉得或许有更好的方案,所以很好奇其它公司内部是如何工作的,我曾经浏览过某 Y 公司内部无所不包的 TWiki,也拜访过某 F 总部了解他们的开发流程,但对某 G 公司却了解不多,只零零碎碎知道一些,这两天抽空梳理了之前收集到的各种资料,希望能给 FEX 后续改进提供参考。
''')
fe.updated('2014-4-1 10:00:00 +0800')

fe = fg.add_entry()
fe.id('http://wuduoyi.com/note/hhvm/')
fe.link(link={'href': 'http://wuduoyi.com/note/hhvm/'})
fe.title(u'HHVM 是如何提升 PHP 性能的?')
fe.pubdate('2014-1-1 10:00:00 +0800')
fe.description(description = u'''
HHVM 是 Facebook 开发的高性能 PHP 虚拟机,宣称比官方的快9倍,我很好奇,于是抽空简单了解了一下,并整理出这篇文章
''')