Small cleanup.
This commit is contained in:
@@ -28,6 +28,10 @@ from subprocess import Popen, PIPE
|
||||
|
||||
from . import compat
|
||||
|
||||
VIDEO_MIMES = {'.mp4': 'video/mp4',
|
||||
'.webm': 'video/webm',
|
||||
'.ogv': 'video/ogg'}
|
||||
|
||||
|
||||
class Devnull(object):
|
||||
"""'Black hole' for output that should not be printed"""
|
||||
@@ -99,16 +103,16 @@ def call_subprocess(cmd):
|
||||
stdout = stdout.decode('utf8')
|
||||
return p.returncode, stdout, stderr
|
||||
|
||||
|
||||
def is_valid_html5_video(ext):
|
||||
"""Checks if ext is a supported HTML5 video."""
|
||||
return ext in ('.mp4', '.webm', '.ogv')
|
||||
return ext in VIDEO_MIMES.keys()
|
||||
|
||||
|
||||
def get_mime(ext):
|
||||
"""Returns mime type for extension."""
|
||||
mimes = {'.mp4': 'video/mp4',
|
||||
'.webm': 'video/webm',
|
||||
'.ogv': 'video/ogg'}
|
||||
return mimes[ext]
|
||||
return VIDEO_MIMES[ext]
|
||||
|
||||
|
||||
class cached_property(object):
|
||||
""" A property that is only computed once per instance and then replaces
|
||||
|
||||
@@ -166,8 +166,9 @@ def process_video(filepath, outpath, settings):
|
||||
thumb_name = os.path.join(outpath, get_thumb(settings, filename))
|
||||
try:
|
||||
generate_thumbnail(
|
||||
outname, thumb_name, settings['thumb_size'], settings['thumb_video_delay'],
|
||||
fit=settings['thumb_fit'], options=settings['jpg_options'])
|
||||
outname, thumb_name, settings['thumb_size'],
|
||||
settings['thumb_video_delay'], fit=settings['thumb_fit'],
|
||||
options=settings['jpg_options'])
|
||||
except Exception:
|
||||
return Status.FAILURE
|
||||
|
||||
|
||||
@@ -114,7 +114,6 @@ def test_image(settings, tmpdir):
|
||||
|
||||
def test_video(settings, tmpdir):
|
||||
settings['destination'] = str(tmpdir)
|
||||
settings['use_orig'] = False
|
||||
m = Video('stallman software-freedom-day-low.ogv', 'video', settings)
|
||||
file_path = join('video', 'stallman software-freedom-day-low.webm')
|
||||
assert str(m) == file_path
|
||||
|
||||
Reference in New Issue
Block a user