1 from django
import template
2 from django
.utils
.safestring
import mark_safe
3 from django
.utils
.translation
import ugettext
as _
6 from mygpo
.constants
import PODCAST_LOGO_SIZE
, PODCAST_LOGO_BIG_SIZE
8 register
= template
.Library()
10 def create_podcast_logo(podcast
, size
):
13 sha
= hashlib
.sha1(podcast
.logo_url
).hexdigest()
14 s
= '<img src="/logo/%d/%s.jpg" alt="%s" height="%d" width="%d" />' % (size
, sha
, _('Logo'), size
, size
)
16 s
= '<img src="/media/podcast-%d.png" alt="%s" height="%d" width="%d" />' % (hash(podcast
.title
)%5, _('No Logo available'), size
, size
)
21 def podcast_logo(podcast
):
22 return create_podcast_logo(podcast
, PODCAST_LOGO_SIZE
)
25 def podcast_logo_big(podcast
):
26 return create_podcast_logo(podcast
, PODCAST_LOGO_BIG_SIZE
)
29 def podcast_status_icon(action
):
30 if action
.action
== 1:
31 s
= '<img src="/media/subscribe.png" />'
33 s
= '<img src="/media/unsubscribe.png" />'