Hides empty images in release.

This commit is contained in:
=
2012-10-02 20:02:45 +01:00
parent 2e8575de42
commit 305f31583d
6 changed files with 41 additions and 32 deletions

View File

@@ -2,6 +2,7 @@ from django.contrib.sites.models import Site
from django.db.models.signals import post_save
from django.dispatch import Signal, receiver
import os
import rfc822
from core.utils import url
from datetime import datetime
from django.db import models
@@ -72,6 +73,10 @@ class Mix(_BaseModel):
#return 'media/%s/' % self.local_file.name
return '/audio/stream/%d' % self.id
def get_date_as_rfc822(self):
return rfc822.formatdate(rfc822.mktime_tz(rfc822.parsedate_tz(self.upload_date.strftime("%a, %d %b %Y %H:%M:%S"))))
@classmethod
def get_listing(cls, listing_type, user=None):
queryset = None

View File

@@ -8,7 +8,7 @@ def get_default_podcast(request):
request,
'inc/xml/podcast.xml',
{'items': mixes},
content_type='text/xml'
content_type='text/xml; charset=utf-8'
)

View File

@@ -286,4 +286,4 @@ window.MixCreateView = DSSEditableView.extend({
imageChanged:function (evt) {
this.sendImage = true;
}
});
});

View File

@@ -52,7 +52,9 @@ var ReleaseListView = Backbone.View.extend({
var date = s.match(/^(\w{3})[ ](\d{1,2}),[ ](\d{4})$/);
var m = monthNames[date[1]];
var d = String(date[2]);
if (d.length == 1) {d = "0" + d;}
if (d.length == 1) {
d = "0" + d;
}
var y = date[3];
return '' + y + m + d;
},
@@ -88,6 +90,9 @@ var ReleaseItemView = Backbone.View.extend({
},
render:function () {
$(this.el).html(this.template({"item":this.model.toJSON()}));
if (com.podnoms.utils.isEmpty(this.model.get('release_image'))){
$('#release-image-div', this.el).remove();
}
return this;
}
});

View File

@@ -1,14 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<ttl>60</ttl>
<!-- Automatically feed your weblog name and description to iTunes -->
<title>Deep South Sounds Podcast</title>
<description>Deep House Music with a Cork twist</description>
<!-- You can also autofeed the link to your podcast weblog -->
<link>http://www.deepsouthsounds.com/podcast/</link>
<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml"
href="http://deepsouthsounds.com/podcasts/"/>
<language>en-IE</language>
<copyright>All your muzik is belong to us</copyright>
<image>
<url>http://static.deepsouthsounds.com/img/dss-large.png</url>
<title>Deep South Sounds Podcast</title>
<link>http://www.deepsouthsounds.com</link>
<width>200</width>
<height>200</height>
<description>Deep House Music with a Cork twist</description>
</image>
<itunes:subtitle>Deep House Music with a Cork twist</itunes:subtitle>
<itunes:author>Deep South Sounds</itunes:author>
<itunes:summary>Deep House Music with a Cork twist</itunes:summary>
@@ -16,33 +24,24 @@
<itunes:name>Deep South Sounds</itunes:name>
<itunes:email>admin@deepsouthsounds.com</itunes:email>
</itunes:owner>
<!-- This is the image that shows in your iTunes listing -->
<itunes:image href="http://static.deepsouthsounds.com/img/dss-large.png"/>
<itunes:category text="Music">
<itunes:category text="Music Podcast"/>
</itunes:category>
<!--
This portion starts the actual listing of your podcast episodes. The above
just gives info on your podcast show. That's why we specify the weblog tag
here.
-->
<itunes:explicit>no</itunes:explicit>
{% for item in items %}
<item>
<title>{{ item.title }}</title>
<itunes:author>Episode author</itunes:author>
<itunes:subtitle>{{ item.title }}</itunes:subtitle>
<itunes:summary>{{ item.description }}</itunes:summary>
<enclosure url="{{ item.get_download_url }}" length="{episode_size}" type="audio/x-m4a"/>
<!-- url to your episode. I'm using the title permalink but any tag that generates a unique
URL to your episode will do. -->
<guid>item.get_download_url</guid>
<!-- The date/time stamp for your podcast. Again, iTunes is super-strict about this. If your
date/time stamp is not exactly how Apple wants it your feed will break. -->
<pubDate>{{ item.get_download_url }}</pubDate>
<!-- Insert episode length. -->
<itunes:duration></itunes:duration>
<itunes:keywords>deep, house, music</itunes:keywords>
</item>
<item>
<title>{{ item.title }}</title>
<itunes:author>Episode author</itunes:author>
<itunes:subtitle>{{ item.title }}</itunes:subtitle>
<itunes:summary>{{ item.description|escape }}</itunes:summary>
<itunes:image href="{{ item.get_image_url }}"/>
<itunes:explicit>no</itunes:explicit>
<enclosure url="{{ item.get_download_url }}" length="100" type="audio/x-m4a"/>
<guid>{{ item.get_download_url }}</guid>
<pubDate>{{ item.get_date_as_rfc822 }}</pubDate>
<itunes:duration>100</itunes:duration>
<itunes:keywords>deep, house, music</itunes:keywords>
</item>
{% endfor %}
</channel>
</rss>
</rss>

View File

@@ -7,13 +7,13 @@
<%= item.release_title %>
</h3>
</div>
<div class="span3">
<div class="span3" id="release-image-div">
<img class="release-image" src="<%= item.release_image %>"/>
</div>
<div class="span7">
<%= item.release_description %>
</div>
<div class="row bordered">
<div class="row well">
<div id="embed-insert"><%= item.embed_code %></div>
</div>
<div class="row">