Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions podcasting/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ class PodcastingAppConf(AppConf):
PAGINATE_BY = 10
FEED_ENTRIES = None
IMG_PATH = 'img'
AUDIO_PATH = 'audio'
28 changes: 20 additions & 8 deletions podcasting/feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,14 @@ def add_root_elements(self, handler):
super(ITunesElements, self).add_root_elements(handler)

show = self.feed["show"]
site = Site.objects.get_current()

if show.original_image:
if imagekit:
itunes_sm_url = show.img_itunes_sm.url
itunes_lg_url = show.img_itunes_lg.url
elif photologue:
site = Site.objects.get_current()
#site = Site.objects.get_current()
itunes_sm_url = "%s%s" % (site.domain, show.original_image.get_img_itunes_sm_url())
itunes_lg_url = "%s%s" % (site.domain, show.original_image.get_img_itunes_lg_url())
elif easy_thumbnails:
Expand All @@ -96,9 +97,9 @@ def add_root_elements(self, handler):
itunes_sm_url = show.original_image.url
itunes_lg_url = show.original_image.url
if itunes_sm_url and itunes_lg_url:
handler.addQuickElement("itunes:image", attrs={"href": itunes_lg_url})
handler.addQuickElement("itunes:image", attrs={"href": 'https://{0}{1}'.format(site.domain,itunes_lg_url)})
handler.startElement("image", {})
handler.addQuickElement("url", itunes_sm_url)
handler.addQuickElement("url", 'https://{0}{1}'.format(site.domain,itunes_sm_url))
handler.addQuickElement("title", self.feed["title"])
handler.addQuickElement("link", self.feed["link"])
handler.endElement("image")
Expand All @@ -110,7 +111,10 @@ def add_root_elements(self, handler):
handler.addQuickElement("itunes:name", show.owner.get_full_name())
handler.addQuickElement("itunes:email", show.owner.email)
handler.endElement("itunes:owner")
handler.addQuickElement("itunes:category", attrs={"text": self.feed["categories"][0]})
#CATEGORY/SUBCATEGORY SETUP
handler.startElement("itunes:category",attrs={"text": self.feed["categories"][0]})
handler.addQuickElement("itunes:category", attrs={"text": self.feed["categories"][1]})
handler.endElement("itunes:category")
handler.addQuickElement("itunes:summary", show.description)
handler.addQuickElement("itunes:explicit", show.get_explicit_display())
if show.redirect:
Expand All @@ -134,6 +138,8 @@ def add_item_elements(self, handler, item):

show = item["show"]
episode = item["episode"]
site = Site.objects.get_current()

if episode.original_image:
if imagekit:
itunes_sm_url = episode.img_itunes_sm.url
Expand Down Expand Up @@ -161,9 +167,9 @@ def add_item_elements(self, handler, item):
itunes_sm_url = episode.original_image.url
itunes_lg_url = episode.original_image.url
if itunes_sm_url and itunes_lg_url:
handler.addQuickElement("itunes:image", attrs={"href": itunes_lg_url})
handler.addQuickElement("itunes:image", attrs={"href":'https://{0}{1}'.format(site.domain,itunes_lg_url)})
handler.startElement("image", {})
handler.addQuickElement("url", itunes_sm_url)
handler.addQuickElement("url", 'https://{0}{1}'.format(site.domain,itunes_sm_url))
handler.addQuickElement("title", episode.title)
handler.addQuickElement("link", episode.get_absolute_url())
handler.endElement("image")
Expand Down Expand Up @@ -216,7 +222,10 @@ def link(self, show):
return show.link

def categories(self, show):
return ("Music",)
categories = show.show_categories.split(",")
#print("Show Catgories = {0}{1}".format(categories[0],categories[1]))
return (categories)
#return ("Sports","Golf",)

def feed_copyright(self, show):
if licenses:
Expand Down Expand Up @@ -263,7 +272,10 @@ def item_categories(self, episode):
def item_enclosure_url(self, episode):
try:
e = episode.enclosure_set.get(mime=self.mime)
return e.url
enclosureSite = Site.objects.get_current()
enclosureShow = enclosureSite.domain
enclosure_url = "https://{0}/media/{1}".format(enclosureShow,e.url)
return enclosure_url
except Enclosure.DoesNotExist:
pass

Expand Down
2 changes: 2 additions & 0 deletions podcasting/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class Meta:
"title",
"subtitle",
"description",
"show_categories",
"twitter_tweet_prefix",
"feedburner",
"itunes",
Expand Down Expand Up @@ -262,6 +263,7 @@ class Meta:
"title",
"subtitle",
"description",
"show_categories",
"twitter_tweet_prefix",
"feedburner",
"itunes",
Expand Down
33 changes: 29 additions & 4 deletions podcasting/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,21 @@ def get_episode_upload_folder(instance, pathname):
settings.PODCASTING_IMG_PATH, instance.slug, slugify(root), ext
)

def get_enclosure_upload_folder(instance, pathname):
"A standardized pathname for uploaded enclosure files."
root, ext = os.path.splitext(pathname)
if instance.episodes.count() == 1:
return "audio/{1}/{2}{3}".format(
settings.PODCASTING_AUDIO_PATH,
instance.episodes.all()[0].slug,
slugify(root),
ext
)
else:
return "{0}/podcasts/episodes/{1}/{2}{3}".format(
settings.PODCASTING_AUDIO_PATH, instance.slug, slugify(root), ext
)


class Show(models.Model):
"""
Expand Down Expand Up @@ -242,6 +257,15 @@ class Show(models.Model):
),
)

show_categories = models.CharField(
_("Categories"),
max_length=255,
blank=True,
help_text=_(
"""Enter the category/subcategory of the show, separated by a comma."""
),
)

if "photologue" in settings.INSTALLED_APPS:
original_image = models.ForeignKey(
Photo,
Expand Down Expand Up @@ -390,7 +414,7 @@ def __str__(self):
return self.title

def get_share_url(self):
return "http://{0}{1}".format(
return "{0}{1}".format(
Site.objects.get_current(), self.get_absolute_url()
)

Expand Down Expand Up @@ -638,6 +662,7 @@ def as_tweet(self):
self.title,
result["url"],
)
print(self.tweet_text)
return self.tweet_text

def tweet(self):
Expand All @@ -659,7 +684,7 @@ def seconds_total(self):
return 0

def get_share_url(self):
return "http://{0}{1}".format(
return "{0}{1}".format(
Site.objects.get_current(), self.get_absolute_url()
)

Expand Down Expand Up @@ -696,8 +721,8 @@ class Enclosure(models.Model):

episodes = models.ManyToManyField(Episode, verbose_name=_("Episodes"))

url = models.URLField(
_("url"),
url = models.FileField(
upload_to=get_enclosure_upload_folder,
help_text=_(
"""URL of the media file. <br /> It is <strong>very</strong>
important to remember that for episode artwork to display in iTunes, image must be
Expand Down
4 changes: 2 additions & 2 deletions podcasting/templates/podcasting/_show_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ <h2>{% trans "Podcast Shows" %}</h2>
{% for show in show_list %}
<div class="podcast-show">
<h3><a href="{{ show.get_absolute_url }}">{{ show.title }}</a></h3>
<a href="{{ show.img_show_lg.url }}" rel="facebox">
<img src="{{ show.img_show_sm.url }}" alt="{{ show.title }}" class="left" />
<a href="{{ show.itunes_lg.url }}" rel="facebox">
<img src="{{ show.itunes_sm.url }}" alt="{{ show.title }}" class="left" />
</a>
<h4>{{ show.subtitle }}</h4>
<p><a href="{{ show.link }}">{{ show.link }}</a></p>
Expand Down