Commit 69785b13 authored by Seb's avatar Seb
Browse files

Changed ffmpeg check to warning intead of error

parent ef5f2449
from __future__ import absolute_import, print_function, unicode_literals from __future__ import absolute_import, print_function, unicode_literals
from django.apps import AppConfig from django.apps import AppConfig
from django.core.checks import Error, register from django.core.checks import Warning, register
from wagtailvideos.utils import which from wagtailvideos.utils import ffmpeg_installed
def ffmpeg_check(app_configs, path=None, **kwargs): def ffmpeg_check(app_configs, path=None, **kwargs):
errors = [] messages = []
if which('ffmpeg', path=path) is None: if not ffmpeg_installed(path=path):
errors.append( messages.append(
Error( Warning(
'ffmpeg could not be found on your system, try installing it.', 'ffmpeg could not be found on your system. Transcoding will be disabled',
hint=None, hint=None,
obj='SystemCheckError', id='wagtailvideos.W001',
id='wagtailvideos.E001',
) )
) )
return errors return messages
class WagtailVideosApp(AppConfig): class WagtailVideosApp(AppConfig):
......
...@@ -4,3 +4,9 @@ try: ...@@ -4,3 +4,9 @@ try:
from shutil import which from shutil import which
except ImportError: except ImportError:
from distutils.spawn import find_executable as which from distutils.spawn import find_executable as which
def ffmpeg_installed(path=None):
if which('ffmpeg', path=path) is None:
return False
return True
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment