audios
This commit is contained in:
parent
31570f7484
commit
97979c7570
|
@ -7,6 +7,9 @@ try:
|
||||||
except:
|
except:
|
||||||
import simplejson as json
|
import simplejson as json
|
||||||
from oxweb import youtube
|
from oxweb import youtube
|
||||||
|
from settings import MEDIA_URL
|
||||||
|
from os.path import join
|
||||||
|
|
||||||
|
|
||||||
flickr.API_KEY = settings.FLICKR_API_KEY
|
flickr.API_KEY = settings.FLICKR_API_KEY
|
||||||
flickr.SECRET = settings.FLICKR_SECRET
|
flickr.SECRET = settings.FLICKR_SECRET
|
||||||
|
@ -159,6 +162,18 @@ class Audio(models.Model):
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.caption + " - " + self.category.name
|
return self.caption + " - " + self.category.name
|
||||||
|
|
||||||
|
def get_dict(self):
|
||||||
|
path = join(MEDIA_URL, self.fil.url)
|
||||||
|
info = dict(title=self.caption, url=path)
|
||||||
|
return {
|
||||||
|
'info': info,
|
||||||
|
'flyover': {
|
||||||
|
'id': self.flyover.id,
|
||||||
|
'name': self.flyover.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class AudioCategory(models.Model):
|
class AudioCategory(models.Model):
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
description = models.TextField(blank=True, null=True)
|
description = models.TextField(blank=True, null=True)
|
||||||
|
@ -166,6 +181,20 @@ class AudioCategory(models.Model):
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
def get_dict(self):
|
||||||
|
audios = []
|
||||||
|
flyovers = []
|
||||||
|
for a in Audio.objects.filter(category=self):
|
||||||
|
audios.append(a.get_dict())
|
||||||
|
flyovers.append(a.flyover.geojson_as_dict())
|
||||||
|
return {
|
||||||
|
'audios': audios,
|
||||||
|
'flyovers': {
|
||||||
|
'type': 'FeatureCollection',
|
||||||
|
'features': flyovers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class Text(models.Model):
|
class Text(models.Model):
|
||||||
# url = models.URLField("FlickR URL")
|
# url = models.URLField("FlickR URL")
|
||||||
text = models.TextField()
|
text = models.TextField()
|
||||||
|
|
|
@ -218,6 +218,10 @@ $(function() {
|
||||||
var html = tmpl("tmpl_texts", {'texts': json.texts});
|
var html = tmpl("tmpl_texts", {'texts': json.texts});
|
||||||
$('#media').html(html);
|
$('#media').html(html);
|
||||||
|
|
||||||
|
case "audio":
|
||||||
|
var html = tmpl("tmpl_audios", {'audios': json.audios});
|
||||||
|
$('#media').html(html);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$.noop();
|
$.noop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,22 @@
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script type="text/html" id="tmpl_audios">
|
||||||
|
<div class="audiosWrapper">
|
||||||
|
<% for (var i=0; i<audios.length;i++) { var audio = audios[i]; %>
|
||||||
|
<div class="audioWrapper" data-id="<%= audio.flyover.id %>">
|
||||||
|
<audio src="<%= audio.info.url %>" controls="controls">
|
||||||
|
<a href="<%= audio.info.url %>" target="_blank" title="<%= audio.info.title %>" class="audioFail">Right-click and Save-As to download</a>
|
||||||
|
</audio>
|
||||||
|
<%= audio.info.title %>
|
||||||
|
</a>
|
||||||
|
<div>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
<script type="text/html" id="tmpl_about">
|
<script type="text/html" id="tmpl_about">
|
||||||
<div class="navContent" id="about">
|
<div class="navContent" id="about">
|
||||||
<div class="contentWrapper about">
|
<div class="contentWrapper about">
|
||||||
|
@ -148,7 +164,7 @@ University College London.</p>
|
||||||
<td class="imageCategory" data-type="image" data-id="5" data-lang_hi="कार्यकाल तले">Life underneath</td>
|
<td class="imageCategory" data-type="image" data-id="5" data-lang_hi="कार्यकाल तले">Life underneath</td>
|
||||||
<td class="imageCategory" data-type="image" data-id="3" data-lang_hi="संचय/विक्रय">Storing / Selling</td>
|
<td class="imageCategory" data-type="image" data-id="3" data-lang_hi="संचय/विक्रय">Storing / Selling</td>
|
||||||
<td class="videoCategory" data-type="video" data-id="3" data-lang_hi="भभका तले">Stills underneath</td>
|
<td class="videoCategory" data-type="video" data-id="3" data-lang_hi="भभका तले">Stills underneath</td>
|
||||||
<td class="audioCategory" data-type="audio" data-id="" data-lang_hi="भूमि ध्वनि">Ground Sounds</td>
|
<td class="audioCategory" data-type="audio" data-id="1" data-lang_hi="भूमि ध्वनि">Ground Sounds</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user