from __future__ import print_function
This commit is contained in:
parent
47d8d67c3d
commit
6b1ce30eb2
22 changed files with 109 additions and 81 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
from __future__ import division, with_statement
|
||||
from __future__ import division, with_statement, print_function
|
||||
|
||||
import os
|
||||
from os.path import exists
|
||||
|
|
@ -272,7 +272,7 @@ def stream(video, target, profile, info, audio_track=0, flags={}):
|
|||
else:
|
||||
cmd += [enc_target]
|
||||
|
||||
#print cmd
|
||||
#print(cmd)
|
||||
p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
|
|
@ -289,7 +289,7 @@ def stream(video, target, profile, info, audio_track=0, flags={}):
|
|||
return False, stdout
|
||||
if format == 'mp4':
|
||||
cmd = ['qt-faststart', "%s.mp4" % enc_target, enc_target]
|
||||
#print cmd
|
||||
#print(cmd)
|
||||
p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
|
||||
stdout=open('/dev/null', 'w'),
|
||||
stderr=subprocess.STDOUT,
|
||||
|
|
@ -311,7 +311,7 @@ def stream(video, target, profile, info, audio_track=0, flags={}):
|
|||
|
||||
|
||||
def run_command(cmd, timeout=10):
|
||||
#print cmd
|
||||
#print(cmd)
|
||||
p = subprocess.Popen(cmd, stdout=open('/dev/null', 'w'),
|
||||
stderr=subprocess.STDOUT,
|
||||
close_fds=True)
|
||||
|
|
@ -425,7 +425,7 @@ def timeline(video, prefix, modes=None, size=None):
|
|||
p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||
close_fds=True)
|
||||
#print cmd
|
||||
#print(cmd)
|
||||
#p = subprocess.Popen(cmd)
|
||||
p.wait()
|
||||
|
||||
|
|
@ -535,7 +535,7 @@ def timeline_strip(item, cuts, info, prefix):
|
|||
widths = divide(duration, frames)
|
||||
frame = frame
|
||||
if _debug:
|
||||
print widths, duration, frames, cuts[c], cuts[c + 1]
|
||||
print(widths, duration, frames, cuts[c], cuts[c + 1])
|
||||
for s in range(int(frames)):
|
||||
frame_ratio = widths[s] / timeline_height
|
||||
if video_ratio > frame_ratio:
|
||||
|
|
@ -547,7 +547,7 @@ def timeline_strip(item, cuts, info, prefix):
|
|||
top = int((video_height - height) / 2)
|
||||
box = (0, top, video_width, top + height)
|
||||
if _debug:
|
||||
print frame, 'cut', c, 'frame', s, frame, 'width', widths[s], box
|
||||
print(frame, 'cut', c, 'frame', s, frame, 'width', widths[s], box)
|
||||
#FIXME: why does this have to be frame+1?
|
||||
frame_image = Image.open(item.frame((frame+1)/fps))
|
||||
frame_image = frame_image.crop(box).resize((widths[s], timeline_height), Image.ANTIALIAS)
|
||||
|
|
@ -559,7 +559,7 @@ def timeline_strip(item, cuts, info, prefix):
|
|||
if x == timeline_width - 1:
|
||||
timeline_file = '%sStrip64p%04d.png' % (prefix, i)
|
||||
if _debug:
|
||||
print 'writing', timeline_file
|
||||
print('writing', timeline_file)
|
||||
timeline_image.save(timeline_file)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
from __future__ import print_function
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.conf import settings
|
||||
import os
|
||||
|
|
@ -28,8 +30,8 @@ class Command(BaseCommand):
|
|||
resolution = int(profile)
|
||||
qs = models.Stream.objects.filter(file__oshash=oshash, format=format, resolution=resolution)
|
||||
if qs.count() == 0:
|
||||
print 'add', f
|
||||
print oshash, resolution, format
|
||||
print('add', f)
|
||||
print(oshash, resolution, format)
|
||||
qs = models.File.objects.filter(oshash=oshash)
|
||||
if qs.count() == 1:
|
||||
stream = models.Stream()
|
||||
|
|
@ -48,6 +50,6 @@ class Command(BaseCommand):
|
|||
for s in models.Stream.objects.exclude(format=format, resolution=resolution).filter(source=None):
|
||||
s.source = models.Stream.objects.get(file=s.file, resolution=resolution, format=format)
|
||||
s.save()
|
||||
print "update streams"
|
||||
print("update streams")
|
||||
for s in models.Stream.objects.filter(source=None):
|
||||
update_stream.delay(s.id)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
|
|
@ -22,19 +24,19 @@ class Command(BaseCommand):
|
|||
base, ext = os.path.splitext(os.path.basename(f))
|
||||
if base.startswith('timeline') and ext == '.png':
|
||||
if base in ('timeline.overview', 'timeline.overview.8'):
|
||||
print 'delete', f
|
||||
print('delete', f)
|
||||
os.unlink(f)
|
||||
else:
|
||||
n = re.compile('timeline(\d+)p(\d+)').findall(base)
|
||||
if not n:
|
||||
n = re.compile('timeline(\d+)p').findall(base)
|
||||
target = 'timelineantialias%sp.jpg' % n[0]
|
||||
print f, target
|
||||
print(f, target)
|
||||
target = os.path.join(os.path.dirname(f), target)
|
||||
os.rename(f, target)
|
||||
else:
|
||||
n = tuple(map(int, n[0]))
|
||||
target = 'timelineantialias%dp%d.jpg' % n
|
||||
print f, target
|
||||
print(f, target)
|
||||
target = os.path.join(os.path.dirname(f), target)
|
||||
os.rename(f, target)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
from __future__ import print_function
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.conf import settings
|
||||
import os
|
||||
|
|
@ -18,4 +20,4 @@ class Command(BaseCommand):
|
|||
for f in glob(os.path.join(settings.MEDIA_ROOT, 'media', '*', '*', '*', '*')):
|
||||
oshash = f[-19:].replace('/', '')
|
||||
if models.File.objects.filter(oshash=oshash).count() == 0:
|
||||
print f
|
||||
print(f)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
from __future__ import division
|
||||
from __future__ import division, print_function
|
||||
|
||||
from datetime import datetime
|
||||
import time
|
||||
|
|
@ -52,7 +52,7 @@ def fill_queue():
|
|||
elif f.data:
|
||||
f.extract_stream()
|
||||
else:
|
||||
print 'not sure what to do with' ,f
|
||||
print('not sure what to do with' ,f)
|
||||
check.append(f)
|
||||
in_queue.append(f.oshash)
|
||||
for f in File.objects.filter(encoding=True).exclude(oshash__in=in_queue):
|
||||
|
|
@ -61,7 +61,7 @@ def fill_queue():
|
|||
elif f.data:
|
||||
f.extract_stream()
|
||||
else:
|
||||
print 'not sure what to do with' ,f
|
||||
print('not sure what to do with' ,f)
|
||||
check.append(f)
|
||||
return check
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue