poddjango: Further lint fixes

This commit is contained in:
Ben Sturmfels 2024-02-23 15:06:59 +11:00
parent 75e3ab4d35
commit 49e3c43299
Signed by: bsturmfels
GPG key ID: 023C05E2C9C068F0
2 changed files with 21 additions and 9 deletions

View file

@ -29,10 +29,13 @@ from .models import Cast
# FIXME: Settings here should not be hard-coded for given casts, but # FIXME: Settings here should not be hard-coded for given casts, but
# should instead have settings from the main screen. # should instead have settings from the main screen.
class CastFeedBase(Feed):
def copyright_holder(self): return "Bradley M. Kuhn, Karen M. Sandler"
def license_no_html(self): return "Licensed under a Creative Commons Attribution-Share Alike 3.0 USA License." class CastFeedBase(Feed):
def copyright_holder(self):
return "Bradley M. Kuhn, Karen M. Sandler"
def license_no_html(self):
return "Licensed under a Creative Commons Attribution-Share Alike 3.0 USA License."
def item_copyright(self, item): def item_copyright(self, item):
year = 2008 year = 2008
@ -132,12 +135,14 @@ def podcast_helper_add_root_elements(self, handler):
'type': "application/rss+xml"}) 'type': "application/rss+xml"})
years = {} years = {}
for ii in self.items: years[ii['year']] = 1 for ii in self.items:
years[ii['year']] = 1
copyrightString = "" copyrightString = ""
ll = years.keys() ll = years.keys()
sorted(ll) sorted(ll)
for yy in ll: copyrightString += "%d, " % yy for yy in ll:
copyrightString += "%d, " % yy
copyrightString += "%s. %s" % (self.feed['copyrightHolder'], self.feed['copyrightLicense']) copyrightString += "%s. %s" % (self.feed['copyrightHolder'], self.feed['copyrightLicense'])
handler.addQuickElement('copyright', copyrightString) handler.addQuickElement('copyright', copyrightString)
@ -156,6 +161,7 @@ def podcast_helper_add_item_elements(self, handler, item):
'fileSize': item['enclosure'].length, 'fileSize': item['enclosure'].length,
'type': item['enclosure'].mime_type}) 'type': item['enclosure'].mime_type})
# http://www.feedforall.com/itune-tutorial-tags.htm # http://www.feedforall.com/itune-tutorial-tags.htm
# http://www.feedforall.com/mediarss.htm # http://www.feedforall.com/mediarss.htm
class iTunesFeedType(Rss201rev2Feed): class iTunesFeedType(Rss201rev2Feed):
@ -235,17 +241,23 @@ class CastFeed(CastFeedBase):
class Mp3CastFeed(CastFeed): class Mp3CastFeed(CastFeed):
def item_enclosure_mime_type(self): return "audio/mpeg" def item_enclosure_mime_type(self):
return "audio/mpeg"
def item_enclosure_url(self, item): def item_enclosure_url(self, item):
return add_domain(self.current_site.domain, item.mp3_path, self.is_secure) return add_domain(self.current_site.domain, item.mp3_path, self.is_secure)
def item_enclosure_length(self, item): def item_enclosure_length(self, item):
return item.mp3_length return item.mp3_length
class OggCastFeed(CastFeed): class OggCastFeed(CastFeed):
def item_enclosure_mime_type(self): return "audio/ogg" def item_enclosure_mime_type(self):
return "audio/ogg"
def item_enclosure_url(self, item): def item_enclosure_url(self, item):
return add_domain(self.current_site.domain, item.ogg_path, self.is_secure) return add_domain(self.current_site.domain, item.ogg_path, self.is_secure)
def item_enclosure_length(self, item): def item_enclosure_length(self, item):
return item.ogg_length return item.ogg_length

View file

@ -57,8 +57,8 @@ urlpatterns = [
] ]
if settings.DEBUG: if settings.DEBUG:
from django.conf.urls.static import static from django.conf.urls.static import static
urlpatterns += static('/', document_root='podjango/static') urlpatterns += static('/', document_root='podjango/static')
def all_tags_by_use_amount(): def all_tags_by_use_amount():