from django.conf.urls.defaults import *
from telemeta.models import MediaItem, MediaCollection
-#from telemeta.core import ComponentManager
from telemeta.web.base import WebView
import os.path
import telemeta.config
telemeta.config.check()
# initialization
-#comp_mgr = ComponentManager()
web_view = WebView()
# query sets for Django generic views
url(r'^items/(?P<public_id>[A-Z0-9_]+)/visualize/(?P<visualizer_id>[0-9a-z_]+)/(?P<width>[0-9A-Z]+)x(?P<height>[0-9A-Z]+)/$',
web_view.item_visualize,
name="telemeta-item-visualize"),
+ url(r'^items/(?P<public_id>[A-Z0-9_]+)/analyze/(?P<analyzer_id>[0-9a-z_]+)/$',
+ web_view.item_analyze,
+ name="telemeta-item-analyze"),
url(r'^items/(?P<public_id>[A-Z0-9_]+)/item_xspf.xml$',
web_view.item_playlist,
dict(template="telemeta/mediaitem_xspf.xml", mimetype="application/xspf+xml"),
grapher_id = 'waveform'
analyzers = [{'name':'','id':'','unit':'','value':''}]
- # TODO: override timeside analyzer process when caching
+ # TODO: override timeside analyzer process when caching : write results to XML file in data/
self.analyzer_mode = 0
if self.analyzer_mode:
'visualizers': graphers, 'visualizer_id': grapher_id,'analysers': analyzers,
'audio_export_enabled': getattr(settings, 'TELEMETA_DOWNLOAD_ENABLED', False)
})
+
+ def item_analyze(self, request, public_id):
+ # TODO: return an XML stream of the analyzed metadata
+ # response = HttpResponse(stream_from_file(media), mimetype = mime_type)
+ # return response
+ pass
def item_visualize(self, request, public_id, visualizer_id, width, height):
mime_type = 'image/png'
item = MediaItem.objects.get(public_id=public_id)
audio = os.path.join(os.path.dirname(__file__), item.file.path)
decoder = timeside.decoder.FileDecoder(audio)
- print decoder.format(), mime_type
+# print decoder.format(), mime_type
if decoder.format() == mime_type:
# source > stream
response = HttpResponse(stream_from_file(audio), mimetype = mime_type)