当前位置: 首页>>代码示例>>Python>>正文


Python FeedGenerator.logo方法代码示例

本文整理汇总了Python中feedgen.feed.FeedGenerator.logo方法的典型用法代码示例。如果您正苦于以下问题:Python FeedGenerator.logo方法的具体用法?Python FeedGenerator.logo怎么用?Python FeedGenerator.logo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在feedgen.feed.FeedGenerator的用法示例。


在下文中一共展示了FeedGenerator.logo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: feed

# 需要导入模块: from feedgen.feed import FeedGenerator [as 别名]
# 或者: from feedgen.feed.FeedGenerator import logo [as 别名]
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)
开发者ID:richardchien,项目名称:zhihu-columns-feed,代码行数:37,代码来源:app.py

示例2: makeRss

# 需要导入模块: from feedgen.feed import FeedGenerator [as 别名]
# 或者: from feedgen.feed.FeedGenerator import logo [as 别名]
  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':'[email protected]'} )
    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()
开发者ID:blackmad,项目名称:hypecast,代码行数:30,代码来源:hypecast.py

示例3: build_feed

# 需要导入模块: from feedgen.feed import FeedGenerator [as 别名]
# 或者: from feedgen.feed.FeedGenerator import logo [as 别名]
    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
开发者ID:bspeice,项目名称:elektricity,代码行数:37,代码来源:bassdrive.py

示例4: main

# 需要导入模块: from feedgen.feed import FeedGenerator [as 别名]
# 或者: from feedgen.feed.FeedGenerator import logo [as 别名]
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': '[email protected]'})
    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')
开发者ID:WarmongeR1,项目名称:vk2rss,代码行数:62,代码来源:using_api.py

示例5: rss

# 需要导入模块: from feedgen.feed import FeedGenerator [as 别名]
# 或者: from feedgen.feed.FeedGenerator import logo [as 别名]
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':'[email protected]'} )
    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')
开发者ID:ben174,项目名称:angrates,代码行数:56,代码来源:views.py

示例6: create_fg

# 需要导入模块: from feedgen.feed import FeedGenerator [as 别名]
# 或者: from feedgen.feed.FeedGenerator import logo [as 别名]
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="[email protected]"))
  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
开发者ID:accre,项目名称:accre.github.io,代码行数:14,代码来源:feed_package.py

示例7: get_feedgenerator

# 需要导入模块: from feedgen.feed import FeedGenerator [as 别名]
# 或者: from feedgen.feed.FeedGenerator import logo [as 别名]
 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':'[email protected]'} )
     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
开发者ID:die2live,项目名称:MCTVRipper,代码行数:16,代码来源:PodcastGenerator.py

示例8: setup_feed

# 需要导入模块: from feedgen.feed import FeedGenerator [as 别名]
# 或者: from feedgen.feed.FeedGenerator import logo [as 别名]
def setup_feed():
    fg = FeedGenerator()

    fg.load_extension("podcast")

    fg.language("en")
    fg.id("https://jdelman.me/potato")
    fg.author(name="Potato", email="[email protected]")
    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
开发者ID:jdelman,项目名称:potato,代码行数:16,代码来源:tasks.py

示例9: get

# 需要导入模块: from feedgen.feed import FeedGenerator [as 别名]
# 或者: from feedgen.feed.FeedGenerator import logo [as 别名]
    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': "[email protected]"})

        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"])
开发者ID:piraz,项目名称:firenado,代码行数:52,代码来源:handlers.py

示例10: add_feed

# 需要导入模块: from feedgen.feed import FeedGenerator [as 别名]
# 或者: from feedgen.feed.FeedGenerator import logo [as 别名]
    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
开发者ID:tomvanderlee,项目名称:youtube-podcaster,代码行数:18,代码来源:podcastupdater.py

示例11: CommonNetworkFeedgen

# 需要导入模块: from feedgen.feed import FeedGenerator [as 别名]
# 或者: from feedgen.feed.FeedGenerator import logo [as 别名]
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': '[email protected]'})
        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')
开发者ID:MediaKraken,项目名称:MediaKraken_Deployment,代码行数:20,代码来源:common_network_feedgen.py

示例12: render

# 需要导入模块: from feedgen.feed import FeedGenerator [as 别名]
# 或者: from feedgen.feed.FeedGenerator import logo [as 别名]
    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':'[email protected]'} )
        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)
开发者ID:alabarga,项目名称:SocialLearning,代码行数:46,代码来源:renderers.py

示例13: __init__

# 需要导入模块: from feedgen.feed import FeedGenerator [as 别名]
# 或者: from feedgen.feed.FeedGenerator import logo [as 别名]
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])
开发者ID:DerekParks,项目名称:shark,代码行数:45,代码来源:podcastRSS.py

示例14: createFeed

# 需要导入模块: from feedgen.feed import FeedGenerator [as 别名]
# 或者: from feedgen.feed.FeedGenerator import logo [as 别名]
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": "[email protected]"})
    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)
开发者ID:AnkushAppy,项目名称:dumper-zone,代码行数:23,代码来源:dorukcan.py

示例15: rss

# 需要导入模块: from feedgen.feed import FeedGenerator [as 别名]
# 或者: from feedgen.feed.FeedGenerator import logo [as 别名]
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
开发者ID:shockham,项目名称:ceia,代码行数:23,代码来源:routes.py


注:本文中的feedgen.feed.FeedGenerator.logo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。