Exemplo n.º 1
0
def download_all(request):
    podcasts = get_subscribed_podcasts(request.user)
    response = simple.format_podcast_list(podcasts, "opml",
                                          request.user.username)
    response[
        "Content-Disposition"] = "attachment; filename=all-subscriptions.opml"
    return response
Exemplo n.º 2
0
def symbian_opml(request, device):
    subscriptions = simple.get_subscriptions(request.user, device.uid)
    subscriptions = map(symbian_opml_changes, subscriptions)

    response = simple.format_podcast_list(subscriptions, 'opml', request.user.username)
    response['Content-Disposition'] = 'attachment; filename=%s.opml' % device.uid
    return response
Exemplo n.º 3
0
def opml(request, device):
    response = simple.format_podcast_list(
        simple.get_subscriptions(request.user, device.uid), 'opml',
        request.user.username)
    response[
        'Content-Disposition'] = 'attachment; filename=%s.opml' % device.uid
    return response
Exemplo n.º 4
0
def opml(request, device):
    response = simple.format_podcast_list(
        simple.get_subscriptions(request.user, device.uid),
        'opml',
        request.user.username,
    )
    response['Content-Disposition'] = 'attachment; filename=%s.opml' % device.uid
    return response
Exemplo n.º 5
0
def opml(request, device):
    response = simple.format_podcast_list(
        simple.get_subscriptions(request.user, device.uid),
        "opml",
        request.user.username,
    )
    response["Content-Disposition"] = "attachment; filename=%s.opml" % device.uid
    return response
Exemplo n.º 6
0
Arquivo: lists.py Projeto: Mic92/mygpo
def get_list(request, plist, owner, format):
    """ Returns the contents of the podcast list """

    try:
        scale = int(request.GET.get('scale_logo', 64))
    except (TypeError, ValueError):
        return HttpResponseBadRequest('scale_logo has to be a numeric value')

    podcasts = Podcast.get_multi(plist.podcasts)

    domain = RequestSite(request).domain
    p_data = lambda p: podcast_data(p, domain, scale)
    title = '{title} by {username}'.format(title=plist.title,
            username=owner.username)

    return format_podcast_list(podcasts, format, title, json_map=p_data,
            jsonp_padding=request.GET.get('jsonp', ''),
            xml_template='podcasts.xml', request=request)
Exemplo n.º 7
0
def get_list(request, plist, owner, format):
    """ Returns the contents of the podcast list """

    try:
        scale = int(request.GET.get('scale_logo', 64))
    except (TypeError, ValueError):
        return HttpResponseBadRequest('scale_logo has to be a numeric value')

    domain = RequestSite(request).domain
    p_data = lambda p: podcast_data(p, domain, scale)
    title = '{title} by {username}'.format(title=plist.title,
            username=owner.username)

    objs = [entry.content_object for entry in plist.entries.all()]

    return format_podcast_list(objs, format, title, json_map=p_data,
            jsonp_padding=request.GET.get('jsonp', ''),
            xml_template='podcasts.xml', request=request)
Exemplo n.º 8
0
 def test_post_subscription_valid(self):
     sample_url = 'http://example.com/directory-podcast.xml'
     podcast = Podcast.objects.get_or_create_for_url(sample_url,
                                                     defaults={
                                                         'title':
                                                         'My Podcast'
                                                     }).object
     payloads = {
         'txt': sample_url,
         'json': json.dumps([sample_url]),
         #'opml': Exporter('Subscriptions').generate([sample_url]),
         'opml': Exporter('Subscriptions').generate([podcast]),
     }
     payloads = dict(
         (fmt, format_podcast_list([podcast], fmt, 'test title').content)
         for fmt in self.formats)
     for fmt in self.formats:
         url = self.subscriptions_urls[fmt]
         payload = payloads[fmt]
         response = self.client.generic('POST', url, payload, **self.extra)
         self.assertEqual(response.status_code, 200, response.content)
Exemplo n.º 9
0
 def test_post_subscription_valid(self):
     sample_url = "http://example.com/directory-podcast.xml"
     podcast = Podcast.objects.get_or_create_for_url(sample_url,
                                                     defaults={
                                                         "title":
                                                         "My Podcast"
                                                     }).object
     payloads = {
         "txt": sample_url,
         "json": json.dumps([sample_url]),
         #'opml': Exporter('Subscriptions').generate([sample_url]),
         "opml": Exporter("Subscriptions").generate([podcast]),
     }
     payloads = dict(
         (fmt, format_podcast_list([podcast], fmt, "test title").content)
         for fmt in self.formats)
     for fmt in self.formats:
         url = self.subscriptions_urls[fmt]
         payload = payloads[fmt]
         response = self.client.generic("POST", url, payload, **self.extra)
         self.assertEqual(response.status_code, 200, response.content)
Exemplo n.º 10
0
def list_opml(request, plist, owner):
    podcasts = [entry.content_object for entry in plist.entries.all()]
    return format_podcast_list(podcasts, 'opml', plist.title)
Exemplo n.º 11
0
Arquivo: views.py Projeto: Mic92/mygpo
def list_opml(request, plist, owner):
    podcasts = list(Podcast.get_multi(plist.podcasts))
    return format_podcast_list(podcasts, "opml", plist.title)
Exemplo n.º 12
0
def list_opml(request, plist, owner):
    podcasts = [entry.content_object for entry in plist.entries.all()]
    return format_podcast_list(podcasts, 'opml', plist.title)
Exemplo n.º 13
0
Arquivo: views.py Projeto: fk-lx/mygpo
def list_opml(request, plist, owner):
    podcasts = podcasts_groups_by_id(plist.podcasts)
    return format_podcast_list(podcasts, 'opml', plist.title)
Exemplo n.º 14
0
def download_all(request):
    podcasts = get_subscribed_podcasts(request.user)
    response = simple.format_podcast_list(podcasts, 'opml', request.user.username)
    response['Content-Disposition'] = 'attachment; filename=all-subscriptions.opml'
    return response