in various audio metadata format (MP3, OGG, etc...)"""
#FIXME: should be given by timeside
- unavailable_extensions = ['wav', 'aiff', 'aif', 'flac']
+ unavailable_extensions = ['wav', 'aiff', 'aif', 'flac', 'webm']
metadata_mapping = {
'mp3' : {
{# spaces between li and a elements breaks layout #}
-<!--<ul id="nav">
- <a href="{% url telemeta-home %}" class="darkblue">{% trans "Home" %}</a>
- <a href="{% url telemeta-collections %}" class="blue">{% trans "Collections" %}</a>
- <a href="{% url telemeta-items %}" class="green">{% trans "Items" %}</a></li>
- <a href="{% url telemeta-geo-continents %}" class="yellow">{% trans "Geo Navigator" %}</a>
- <a href="{% url telemeta-search-criteria %}" class="orange">{% trans "Advanced search" %}</a>
- {% if user.is_authenticated %}
- <a href="{% url telemeta-users %}" class="red">{% trans "Users" %}</a>
- {% endif %}
- {% if user.is_staff %}
- <a href="{% url telemeta-admin %}" class="violet">{% trans "Admin" %}</a>
-{% endif %}
-</ul>-->
-
<ul id="nav">
{% if user.is_authenticated %}
<li><a href="#desk#" class="blue">{% trans "Desk" %}</a></span>
});
{% endif %}
</script>
+
+{% if "video" in mime_type %}
+<link href="http://vjs.zencdn.net/c/video-js.css" rel="stylesheet">
+<script src="http://vjs.zencdn.net/c/video.js"></script>
+{% endif %}
+
{% endif %}
{% endblock %}
{% if "video" in mime_type %}
<div>
- <video width="362" controls="controls" preload="auto">
+ <video id="my_video_1" class="video-js vjs-default-skin" width="362" height="240" controls preload="auto" data-setup="{}">
+ <!-- Hello Chrome and Firefox (and Opera?) -->
<source src="{% url telemeta-item-export item.public_id mime_type|mime_to_ext %}" type="{{ mime_type }}" />
</video>
+ <div id="videotime"></div>
</div>
+ <script>
+ (function(){
+ var v = document.getElementsByTagName('video')[0]
+ var t = document.getElementById('videotime');
+ v.addEventListener('timeupdate',function(event){
+ t.innerHTML = v.currentTime;
+ },false);
+ })();
+ </script>
{% endif %}
<!-- </div> -->
previous, next = self.item_previous_next(item)
mime_type = self.item_analyze(item)
- print mime_type
playlists = get_playlists(request)
public_access = get_public_access(item.public_access, str(item.recorded_from_date).split('-')[0],
str(item.recorded_to_date).split('-')[0])
time = value.split(':')
time[2] = time[2].split('.')[0]
time = ':'.join(time)
- item.approx_duration = str(time)
+ item.approx_duration = time
item.save()
if analysis.analyzer_id == 'mime_type':
mime_type = analysis.value
analyzer_id='resolution', unit='bits',
value=unicode(decoder.audiowidth))
analysis.save()
+ analysis = MediaItemAnalysis(item=item, name='Duration',
+ analyzer_id='duration', unit='s',
+ value=unicode(datetime.timedelta(0,decoder.duration)))
+ analysis.save()
for analyzer in analyzers_sub:
value = analyzer.result()
- if analyzer.id() == 'duration':
- approx_value = int(round(value))
- item.approx_duration = approx_value
- try:
- item.save()
- except:
- pass
- value = datetime.timedelta(0,value)
-
analysis = MediaItemAnalysis(item=item, name=analyzer.name(),
analyzer_id=analyzer.id(),
unit=analyzer.unit(), value=str(value))
analysis.save()
+ #FIXME: parse tags on first load
+# tags = decoder.tags
+
return mime_type
def item_analyze_xml(self, request, public_id):
else:
flag = flag[0]
- mime_type = self.item_analyze(item)
- if mime_type:
- format = mime_type
-
- else:
- decoder = timeside.decoder.FileDecoder(audio)
- format = decoder.format()
-
+ format = self.item_analyze(item)
dc_metadata = dublincore.express_item(item).to_list()
mapping = DublinCoreToFormatMetadata(extension)
metadata = mapping.get_metadata(dc_metadata)