forked from 0x2620/pandora
add encodingProfile api call, minor fixes
This commit is contained in:
parent
7f9a4e252e
commit
33725ff9d4
7 changed files with 20 additions and 8 deletions
5
README
5
README
|
@ -42,3 +42,8 @@ add pandora repository:
|
||||||
sudo add-apt-repository ppa:gstreamer-developers/ppa
|
sudo add-apt-repository ppa:gstreamer-developers/ppa
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install oxtools mkvtoolnix
|
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
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ import tasks
|
||||||
from user.models import getUserJSON
|
from user.models import getUserJSON
|
||||||
from user.views import api_login, api_logout, api_register, api_contact, api_recover, api_preferences, api_findUser
|
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.models import File
|
||||||
from archive import extract
|
from archive import extract
|
||||||
|
|
|
@ -207,6 +207,7 @@ def stream(video, target, profile, info):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def run_command(cmd, timeout=10):
|
def run_command(cmd, timeout=10):
|
||||||
|
#print cmd
|
||||||
p = subprocess.Popen(cmd, stdout=open('/dev/null', 'w'), stderr=subprocess.STDOUT)
|
p = subprocess.Popen(cmd, stdout=open('/dev/null', 'w'), stderr=subprocess.STDOUT)
|
||||||
while timeout > 0:
|
while timeout > 0:
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
|
@ -30,7 +30,7 @@ import ox
|
||||||
import models
|
import models
|
||||||
|
|
||||||
from item.utils import oxid, parse_path
|
from item.utils import oxid, parse_path
|
||||||
import item.models
|
from item.models import getItem
|
||||||
import item.tasks
|
import item.tasks
|
||||||
|
|
||||||
@login_required_json
|
@login_required_json
|
||||||
|
@ -73,7 +73,6 @@ def api_update(request):
|
||||||
volume, created = models.Volume.objects.get_or_create(user=user, name=data['volume'])
|
volume, created = models.Volume.objects.get_or_create(user=user, name=data['volume'])
|
||||||
all_files = []
|
all_files = []
|
||||||
for f in data['files']:
|
for f in data['files']:
|
||||||
#print f
|
|
||||||
path = f['path']
|
path = f['path']
|
||||||
folder = path.split('/')
|
folder = path.split('/')
|
||||||
name = folder.pop()
|
name = folder.pop()
|
||||||
|
@ -114,7 +113,7 @@ def api_update(request):
|
||||||
else:
|
else:
|
||||||
if not item:
|
if not item:
|
||||||
item_info = parse_path(folder)
|
item_info = parse_path(folder)
|
||||||
item = item.models.getItem(item_info)
|
item = getItem(item_info)
|
||||||
file_object = models.File()
|
file_object = models.File()
|
||||||
file_object.oshash = oshash
|
file_object.oshash = oshash
|
||||||
file_object.name = name
|
file_object.name = name
|
||||||
|
@ -160,6 +159,11 @@ def api_update(request):
|
||||||
return render_to_json_response(response)
|
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
|
@login_required_json
|
||||||
def api_upload(request):
|
def api_upload(request):
|
||||||
'''
|
'''
|
||||||
|
@ -223,6 +227,7 @@ def firefogg_upload(request):
|
||||||
elif form.cleaned_data['done']:
|
elif form.cleaned_data['done']:
|
||||||
f.available = True
|
f.available = True
|
||||||
f.save()
|
f.save()
|
||||||
|
#FIXME: this fails badly if rabbitmq goes down
|
||||||
item.tasks.updateStreams.delay(f.item.itemId)
|
item.tasks.updateStreams.delay(f.item.itemId)
|
||||||
response['result'] = 1
|
response['result'] = 1
|
||||||
response['done'] = 1
|
response['done'] = 1
|
||||||
|
|
|
@ -8,6 +8,7 @@ import math
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import unicodedata
|
||||||
from glob import glob
|
from glob import glob
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
|
@ -33,6 +33,6 @@ def updateStreams(itemId):
|
||||||
create stream, extract timeline and create derivatives
|
create stream, extract timeline and create derivatives
|
||||||
'''
|
'''
|
||||||
item = models.Item.objects.get(itemId=itemId)
|
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()
|
item.updateStreams()
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
# Django settings for pandora project.
|
# Django settings for pandora project.
|
||||||
import os
|
import os
|
||||||
from os.path import join
|
from os.path import join, normpath
|
||||||
|
|
||||||
SITENAME = 'Pan.do/ra'
|
SITENAME = 'Pan.do/ra'
|
||||||
SITEID = 'pandora'
|
SITEID = 'pandora'
|
||||||
|
@ -67,8 +67,8 @@ APPEND_SLASH = False
|
||||||
|
|
||||||
# Absolute path to the directory that holds media.
|
# Absolute path to the directory that holds media.
|
||||||
# Example: "/home/media/media.lawrence.com/"
|
# Example: "/home/media/media.lawrence.com/"
|
||||||
MEDIA_ROOT = join(PROJECT_ROOT, '..', 'data')
|
MEDIA_ROOT = normpath(join(PROJECT_ROOT, '..', 'data'))
|
||||||
STATIC_ROOT = join(PROJECT_ROOT, '..', 'static')
|
STATIC_ROOT = normpath(join(PROJECT_ROOT, '..', 'static'))
|
||||||
TESTS_ROOT = join(PROJECT_ROOT, 'tests')
|
TESTS_ROOT = join(PROJECT_ROOT, 'tests')
|
||||||
|
|
||||||
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
||||||
|
|
Loading…
Reference in a new issue