diff --git a/podcasting/conf.py b/podcasting/conf.py
index 33d400b..515608a 100644
--- a/podcasting/conf.py
+++ b/podcasting/conf.py
@@ -7,3 +7,4 @@ class PodcastingAppConf(AppConf):
PAGINATE_BY = 10
FEED_ENTRIES = None
IMG_PATH = 'img'
+ AUDIO_PATH = 'audio'
diff --git a/podcasting/feeds.py b/podcasting/feeds.py
index 996dd1d..62af057 100644
--- a/podcasting/feeds.py
+++ b/podcasting/feeds.py
@@ -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:
@@ -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")
@@ -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:
@@ -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
@@ -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")
@@ -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:
@@ -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
diff --git a/podcasting/forms.py b/podcasting/forms.py
index 5fbc618..086d149 100644
--- a/podcasting/forms.py
+++ b/podcasting/forms.py
@@ -44,6 +44,7 @@ class Meta:
"title",
"subtitle",
"description",
+ "show_categories",
"twitter_tweet_prefix",
"feedburner",
"itunes",
@@ -262,6 +263,7 @@ class Meta:
"title",
"subtitle",
"description",
+ "show_categories",
"twitter_tweet_prefix",
"feedburner",
"itunes",
diff --git a/podcasting/models.py b/podcasting/models.py
index a34f845..5bd77c7 100644
--- a/podcasting/models.py
+++ b/podcasting/models.py
@@ -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):
"""
@@ -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,
@@ -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()
)
@@ -638,6 +662,7 @@ def as_tweet(self):
self.title,
result["url"],
)
+ print(self.tweet_text)
return self.tweet_text
def tweet(self):
@@ -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()
)
@@ -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.
It is very
important to remember that for episode artwork to display in iTunes, image must be
diff --git a/podcasting/templates/podcasting/_show_list.html b/podcasting/templates/podcasting/_show_list.html
index 6741b70..ce7e61b 100644
--- a/podcasting/templates/podcasting/_show_list.html
+++ b/podcasting/templates/podcasting/_show_list.html
@@ -6,8 +6,8 @@