stream processing

This commit is contained in:
j 2011-08-19 18:54:42 +02:00
parent 0562b8c643
commit af671dc779
6 changed files with 17 additions and 17 deletions

View file

@ -89,3 +89,12 @@ def update_files(user, volume, files):
#FIXME: can this have any bad consequences? i.e. on the selction of used item files. #FIXME: can this have any bad consequences? i.e. on the selction of used item files.
models.Instance.objects.filter(volume=volume).exclude(file__oshash__in=all_files).delete() models.Instance.objects.filter(volume=volume).exclude(file__oshash__in=all_files).delete()
@task(queue="encoding")
def process_stream(fileId):
file = models.Stream.objects.get(id=fileId)
streams = file.streams.filter(source=None)
if streams.count() >0:
stream = streams[0]
stream.make_timeline()
stream.extract_derivatives()
return True

View file

@ -191,7 +191,7 @@ def firefogg_upload(request):
f.save() f.save()
#FIXME: this fails badly if rabbitmq goes down #FIXME: this fails badly if rabbitmq goes down
try: try:
t = item.tasks.update_streams.delay(f.item.itemId) t = tasks.process_stream.delay(f.id)
response['resultUrl'] = t.task_id response['resultUrl'] = t.task_id
except: except:
pass pass
@ -270,7 +270,7 @@ def moveFiles(request):
else: else:
c.rendered = False c.rendered = False
c.save() c.save()
item.tasks.update_streams.delay(itemId) item.tasks.update_timeline.delay(itemId)
response = json_response(text='updated') response = json_response(text='updated')
response['data']['itemId'] = i.itemId response['data']['itemId'] = i.itemId
return render_to_json_response(response) return render_to_json_response(response)

View file

@ -791,7 +791,7 @@ class Item(models.Model):
def streams(self): def streams(self):
return [video.streams.filter(source=None)[0] for video in self.main_videos()] return [video.streams.filter(source=None)[0] for video in self.main_videos()]
def update_streams(self, force=False): def update_timeline(self, force=False):
streams = self.streams() streams = self.streams()
self.make_timeline() self.make_timeline()
self.data['cuts'] = extract.cuts(self.timeline_prefix) self.data['cuts'] = extract.cuts(self.timeline_prefix)

View file

@ -25,20 +25,10 @@ def update_external(itemId):
item = models.Item.objects.get(itemId=itemId) item = models.Item.objects.get(itemId=itemId)
item.update_external() item.update_external()
@task(queue="default")
@task(queue="encoding") def update_timeline(itemId):
def update_streams(itemId):
'''
create stream, extract timeline and create derivatives
'''
item = models.Item.objects.get(itemId=itemId) item = models.Item.objects.get(itemId=itemId)
videos = item.main_videos() item.update_timeline()
for video in videos:
for f in video.streams.filter(source=None):
f.extract_derivatives()
#if item.files.filter(is_main=True, is_video=True, available=False).count() == 0:
# item.update_streams()
return True
def load_subtitles(itemId): def load_subtitles(itemId):
item = models.Item.objects.get(itemId=itemId) item = models.Item.objects.get(itemId=itemId)

View file

@ -305,7 +305,7 @@
{"id": "player", "title": "Player"}, {"id": "player", "title": "Player"},
{"id": "timeline", "title": "Timeline"}, {"id": "timeline", "title": "Timeline"},
{"id": "map", "title": "Map"}, {"id": "map", "title": "Map"},
{"id": "calendar", "title": "Calendar"}, {"id": "calendar", "title": "Calendar"}
], ],
"layers": [ "layers": [
{ {

View file

@ -3,5 +3,6 @@ base=`pwd`
bzr pull http://code.0x2620.org/pandora/ bzr pull http://code.0x2620.org/pandora/
cd static/oxjs cd static/oxjs
bzr pull http://code.0x2620.org/oxjs/ bzr pull http://code.0x2620.org/oxjs/
./tools/build/build.py
cd $base cd $base
test -e src/python-ox && cd src/python-ox && bzr pull http://code.0x2620.org/python-ox/ test -e src/python-ox && cd src/python-ox && bzr pull http://code.0x2620.org/python-ox/