forked from 0x2620/pandora
rebuild timelines in encoding pipe
This commit is contained in:
parent
3f59138c66
commit
d543e35f3f
3 changed files with 15 additions and 9 deletions
|
@ -4,13 +4,14 @@
|
||||||
import os
|
import os
|
||||||
from os.path import join, dirname, basename, splitext, exists
|
from os.path import join, dirname, basename, splitext, exists
|
||||||
import time
|
import time
|
||||||
|
from glob import glob
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
import monkey_patch.models
|
import monkey_patch.models
|
||||||
from ... import models
|
from ... import models
|
||||||
|
from ... import tasks
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
"""
|
"""
|
||||||
|
@ -21,14 +22,12 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
def handle(self, **options):
|
def handle(self, **options):
|
||||||
offset = 0
|
offset = 0
|
||||||
chunk = 50
|
chunk = 100
|
||||||
count = pos = models.Item.objects.count()
|
count = pos = models.Item.objects.count()
|
||||||
while offset <= count:
|
while offset <= count:
|
||||||
for i in models.Item.objects.all().order_by('id')[offset:offset+chunk]:
|
for i in models.Item.objects.all().order_by('id')[offset:offset+chunk]:
|
||||||
print pos, i.itemId
|
if not os.path.exists(os.path.join(i.timeline_prefix, 'cuts.json')) or \
|
||||||
for s in i.streams():
|
not glob('%s/timelinekeyframes16p0.jpg'%i.timeline_prefix):
|
||||||
s.make_timeline()
|
print i.itemId
|
||||||
i.update_timeline()
|
tasks.rebuild_timeline.delay(i.itemId)
|
||||||
pos -= 1
|
|
||||||
offset += chunk
|
offset += chunk
|
||||||
time.sleep(30) #keep load down
|
|
||||||
|
|
|
@ -64,6 +64,13 @@ def update_timeline(itemId):
|
||||||
item = models.Item.objects.get(itemId=itemId)
|
item = models.Item.objects.get(itemId=itemId)
|
||||||
item.update_timeline()
|
item.update_timeline()
|
||||||
|
|
||||||
|
@task(queue="encoding")
|
||||||
|
def rebuild_timeline(itemId):
|
||||||
|
i = models.Item.objects.get(itemId=itemId)
|
||||||
|
for s in i.streams():
|
||||||
|
s.make_timeline()
|
||||||
|
i.update_timeline()
|
||||||
|
|
||||||
@task(queue="encoding")
|
@task(queue="encoding")
|
||||||
def load_subtitles(itemId):
|
def load_subtitles(itemId):
|
||||||
item = models.Item.objects.get(itemId=itemId)
|
item = models.Item.objects.get(itemId=itemId)
|
||||||
|
|
|
@ -82,7 +82,7 @@ def join_tiles(source_paths, target_path):
|
||||||
target_path, small_mode, small_tile_h, small_tile_i
|
target_path, small_mode, small_tile_h, small_tile_i
|
||||||
)
|
)
|
||||||
data['target_images']['small'].save(image_file)
|
data['target_images']['small'].save(image_file)
|
||||||
print image_file
|
#print image_file
|
||||||
if mode == 'antialias':
|
if mode == 'antialias':
|
||||||
# render full tile
|
# render full tile
|
||||||
resized = data['target_images']['large'].resize((
|
resized = data['target_images']['large'].resize((
|
||||||
|
|
Loading…
Reference in a new issue