add encodingProfile api call, minor fixes

This commit is contained in:
j 2010-11-15 20:15:52 +01:00
parent 7f9a4e252e
commit 33725ff9d4
7 changed files with 20 additions and 8 deletions

5
README
View file

@ -42,3 +42,8 @@ add pandora repository:
sudo add-apt-repository ppa:gstreamer-developers/ppa
sudo apt-get update
sudo apt-get install oxtools mkvtoolnix
H264:
install ffmpeg with x264 enabled, install qt-faststart from (ffmpeg/tools)
set VIDEO_H264 = True in local_settings.py

View file

@ -34,7 +34,7 @@ import tasks
from user.models import getUserJSON
from user.views import api_login, api_logout, api_register, api_contact, api_recover, api_preferences, api_findUser
from archive.views import api_update, api_upload, api_editFile
from archive.views import api_update, api_upload, api_editFile, api_encodingProfile
from archive.models import File
from archive import extract

View file

@ -207,6 +207,7 @@ def stream(video, target, profile, info):
return True
def run_command(cmd, timeout=10):
#print cmd
p = subprocess.Popen(cmd, stdout=open('/dev/null', 'w'), stderr=subprocess.STDOUT)
while timeout > 0:
time.sleep(0.2)

View file

@ -30,7 +30,7 @@ import ox
import models
from item.utils import oxid, parse_path
import item.models
from item.models import getItem
import item.tasks
@login_required_json
@ -73,7 +73,6 @@ def api_update(request):
volume, created = models.Volume.objects.get_or_create(user=user, name=data['volume'])
all_files = []
for f in data['files']:
#print f
path = f['path']
folder = path.split('/')
name = folder.pop()
@ -114,7 +113,7 @@ def api_update(request):
else:
if not item:
item_info = parse_path(folder)
item = item.models.getItem(item_info)
item = getItem(item_info)
file_object = models.File()
file_object.oshash = oshash
file_object.name = name
@ -160,6 +159,11 @@ def api_update(request):
return render_to_json_response(response)
@login_required_json
def api_encodingProfile(request):
response = json_response({'profile': settings.VIDEO_PROFILE})
return render_to_json_response(response)
@login_required_json
def api_upload(request):
'''
@ -223,6 +227,7 @@ def firefogg_upload(request):
elif form.cleaned_data['done']:
f.available = True
f.save()
#FIXME: this fails badly if rabbitmq goes down
item.tasks.updateStreams.delay(f.item.itemId)
response['result'] = 1
response['done'] = 1

View file

@ -8,6 +8,7 @@ import math
import random
import re
import subprocess
import unicodedata
from glob import glob
from django.db import models

View file

@ -33,6 +33,6 @@ def updateStreams(itemId):
create stream, extract timeline and create derivatives
'''
item = models.Item.objects.get(itemId=itemId)
if item.files.filter(is_main=True, is_video=True, availble=False).count() == 0:
if item.files.filter(is_main=True, is_video=True, available=False).count() == 0:
item.updateStreams()

View file

@ -2,7 +2,7 @@
# vi:si:et:sw=4:sts=4:ts=4
# Django settings for pandora project.
import os
from os.path import join
from os.path import join, normpath
SITENAME = 'Pan.do/ra'
SITEID = 'pandora'
@ -67,8 +67,8 @@ APPEND_SLASH = False
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = join(PROJECT_ROOT, '..', 'data')
STATIC_ROOT = join(PROJECT_ROOT, '..', 'static')
MEDIA_ROOT = normpath(join(PROJECT_ROOT, '..', 'data'))
STATIC_ROOT = normpath(join(PROJECT_ROOT, '..', 'static'))
TESTS_ROOT = join(PROJECT_ROOT, 'tests')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a