Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Websites UFRPE
Wagtail Videos
Commits
cf51df57
Commit
cf51df57
authored
May 31, 2017
by
Tim Heap
Browse files
Move w.utils.ffmpeg_installed to w.ffmpeg.installed
parent
c8f67197
Changes
5
Hide whitespace changes
Inline
Side-by-side
tests/test_admin_views.py
View file @
cf51df57
...
...
@@ -106,7 +106,7 @@ class TestVideoAddView(TestCase, WagtailTestUtils):
root_collection
=
Collection
.
get_first_root_node
()
self
.
assertEqual
(
video
.
collection
,
root_collection
)
@
patch
(
'wagtailvideos.
models.
ffmpeg
_
installed'
)
@
patch
(
'wagtailvideos.ffmpeg
.
installed'
)
def
test_add_no_ffmpeg
(
self
,
ffmpeg_installed
):
ffmpeg_installed
.
return_value
=
False
...
...
wagtailvideos/apps.py
View file @
cf51df57
...
...
@@ -3,12 +3,12 @@ from __future__ import absolute_import, print_function, unicode_literals
from
django.apps
import
AppConfig
from
django.core.checks
import
Warning
,
register
from
wagtailvideos
.utils
import
ffmpeg
_installed
from
wagtailvideos
import
ffmpeg
def
ffmpeg_check
(
app_configs
,
**
kwargs
):
messages
=
[]
if
not
ffmpeg
_
installed
():
if
not
ffmpeg
.
installed
():
messages
.
append
(
Warning
(
'ffmpeg could not be found on your system. Transcoding will be disabled'
,
...
...
wagtailvideos/
utils
.py
→
wagtailvideos/
ffmpeg
.py
View file @
cf51df57
from
__future__
import
absolute_import
,
print_function
,
unicode_literals
try
:
from
shutil
import
which
except
ImportError
:
from
distutils.spawn
import
find_executable
as
which
def
ffmpeg_
installed
(
path
=
None
):
def
installed
(
path
=
None
):
return
which
(
'ffmpeg'
,
path
=
path
)
is
not
None
wagtailvideos/models.py
View file @
cf51df57
...
...
@@ -29,7 +29,7 @@ from wagtail.wagtailcore.models import CollectionMember
from
wagtail.wagtailsearch
import
index
from
wagtail.wagtailsearch.queryset
import
SearchableQuerySetMixin
from
wagtailvideos
.utils
import
ffmpeg
_installed
from
wagtailvideos
import
ffmpeg
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -356,6 +356,9 @@ def video_delete(sender, instance, **kwargs):
# Fields that need the actual video file to create
@
receiver
(
post_save
,
sender
=
Video
)
def
video_saved
(
sender
,
instance
,
**
kwargs
):
if
not
ffmpeg
.
installed
():
return
if
hasattr
(
instance
,
'_from_signal'
):
return
instance
.
thumbnail
=
instance
.
get_thumbnail
()
...
...
wagtailvideos/views/videos.py
View file @
cf51df57
...
...
@@ -15,10 +15,10 @@ from wagtail.wagtailadmin.utils import (
from
wagtail.wagtailcore.models
import
Collection
from
wagtail.wagtailsearch.backends
import
get_search_backends
from
wagtailvideos
import
ffmpeg
from
wagtailvideos.forms
import
VideoTranscodeAdminForm
,
get_video_form
from
wagtailvideos.models
import
Video
from
wagtailvideos.permissions
import
permission_policy
from
wagtailvideos.utils
import
ffmpeg_installed
permission_checker
=
PermissionPolicyChecker
(
permission_policy
)
...
...
@@ -120,7 +120,7 @@ def edit(request, video_id):
'video'
:
video
,
'form'
:
form
,
'filesize'
:
video
.
get_file_size
(),
'can_transcode'
:
ffmpeg
_
installed
(),
'can_transcode'
:
ffmpeg
.
installed
(),
'transcodes'
:
video
.
transcodes
.
all
(),
'transcode_form'
:
VideoTranscodeAdminForm
(
video
=
video
),
'user_can_delete'
:
permission_policy
.
user_has_permission_for_instance
(
request
.
user
,
'delete'
,
video
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment