Unverified Commit 8927a637 authored by Kevin Gutiérrez's avatar Kevin Gutiérrez Committed by GitHub
Browse files

Merge branch 'master' into feature/format

parents 95604afd c281c46a
......@@ -62,7 +62,7 @@ In a Streamfield:
A VideoChooserBlock is included
.. code:: python
from wagtail.admin.edit_handlers import StreamFieldPanel
from wagtail.core.fields import StreamField
from wagtail.core.models import Page
......@@ -103,10 +103,21 @@ be used to create new transcodes. It is assumed that your compiled
version of ffmpeg has the matching codec libraries required for the
transcode.
Disable transcode:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Transcode can be disabled using the ``WAGTAIL_VIDEOS_DISABLE_TRANSCODE`` setting.
.. code:: django
# settings.py
WAGTAIL_VIDEOS_DISABLE_TRANSCODE = True
Custom Video models:
~~~~~~~~~~~~~~~~~~~~
Same as Wagtail Images, a custom model can be used to replace the built in Video model using the
Same as Wagtail Images, a custom model can be used to replace the built in Video model using the
``WAGTAILVIDEOS_VIDEO_MODEL`` setting.
.. code:: django
......@@ -138,7 +149,7 @@ Same as Wagtail Images, a custom model can be used to replace the built in Video
unique_together = (
('video', 'media_format')
)
# Only needed if you are using the text tracks feature
class CustomTrackListing(AbstractTrackListing):
video = models.OneToOneField(AttributedVideo, related_name='track_listing', on_delete=models.CASCADE)
......
from django.apps import AppConfig
from django.conf import settings
from django.core.checks import Warning, register
from wagtailvideos import ffmpeg
......@@ -6,7 +7,10 @@ from wagtailvideos import ffmpeg
def ffmpeg_check(app_configs, **kwargs):
messages = []
if not ffmpeg.installed():
if (
not ffmpeg.installed()
and not getattr(settings, 'WAGTAIL_VIDEOS_DISABLE_TRANSCODE', False)
):
messages.append(
Warning(
'ffmpeg could not be found on your system. Transcoding will be disabled',
......
......@@ -51,15 +51,15 @@
</form>
</div>
<div class="col6">
<div class='row'>
<div class='col10 divider-after'>
<div class="row">
<div class="col10 divider-after">
{% video video controls style=max-width:100%;width:100%;height:auto; %}
</div>
<div class='col2'>
<dl style='margin-top: 0'>
<div class="col2">
<dl style="margin-top: 0;">
{% if video.thumbnail %}
<dt>{% trans "Thumbnail" %}</dt>
<dd><img src="{{ video.thumbnail.url }}" /></dd>
<dd><img src="{{ video.thumbnail.url }}" alt="{% trans 'Video thumbnail' %}" /></dd>
{% endif %}
<dt>{% trans "Filesize" %}</dt>
<dd>{% if filesize %}{{ filesize|filesizeformat }}{% else %}{% trans "File not found" %}{% endif %}</dd>
......@@ -77,7 +77,7 @@
</dl>
</div>
</div>
<div class="row" style='margin-top: 2em;'>
<div class="row" style="margin-top: 2em;">
{% if can_transcode %}
<h2 class="u-text-transform-uppercase">{% trans "Transcodes" %}</h2>
<p>{% trans "If you wish to generate HTML5 compliant transcodes use the form below. This may take a while depending on the length of the video." %}</p>
......@@ -88,11 +88,11 @@
<li>
{% blocktrans with media_format=transcode.media_format quality=transcode.quality %}{{ media_format }} ({{ quality }} quality){% endblocktrans %}
{% if transcode.processing %}
<span class='processing'>{% trans "(Processing... hold tight)" %} </span>
<span class="processing">{% trans "(Processing... hold tight)" %} </span>
{% endif %}
{% if transcode.error_message %}
<span class='transcode-error'>{% trans "ERROR:" %}</span>
<div class='transcode-error'>
<span class="transcode-error">{% trans "ERROR:" %}</span>
<div class="transcode-error">
<pre> {{ transcode.error_message }}</pre>
</div>
{% endif %}
......@@ -107,13 +107,13 @@
{% include "wagtailadmin/shared/field_as_li.html" with field=transcode_form.media_format li_classes="label-above label-uppercase" %}
{% include "wagtailadmin/shared/field_as_li.html" with field=transcode_form.quality li_classes="label-above label-uppercase" %}
<li>
<input class="button" type='submit' value="{% trans 'Start' %}" />
<input class="button" type="submit" value="{% trans 'Start' %}" />
</li>
</ul>
</form>
{% else %}
<br/><br/>
<span class='transcode-error'>{% trans "Ffmpeg is not found on your server. Please install if you wish to transcode videos into an HTML5 video compliant format." %}</span>
<span class="transcode-error">{% trans "Ffmpeg is not found on your server or you have disabled transcodes. Please install Ffmepg and make sure that transcoding is enabled if you wish to transcode videos into an HTML5 video compliant format." %}</span>
{% endif %}
{% if tracks_action_url %}
<h2 class="u-text-transform-uppercase">{% trans "Tracks" %}</h2>
......@@ -124,9 +124,9 @@
<li>{{ track }}</li>
{% endfor %}
</ul>
<a class='button' href="{{ tracks_action_url }}">{% trans "Edit" %}</a>
<a class="button" href="{{ tracks_action_url }}">{% trans "Edit" %}</a>
{% else %}
<a class='button' href="{{ tracks_action_url }}">{% trans "Add tracks" %}</a>
<a class="button" href="{{ tracks_action_url }}">{% trans "Add tracks" %}</a>
{% endif %}
{% endif %}
</div>
......
from distutils.version import LooseVersion
import wagtail
from django.conf import settings
from django.core.paginator import Paginator
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse
......@@ -130,7 +131,7 @@ def edit(request, video_id):
'video': video,
'form': form,
'filesize': video.get_file_size(),
'can_transcode': ffmpeg.installed(),
'can_transcode': ffmpeg.installed() and not getattr(settings, 'WAGTAIL_VIDEOS_DISABLE_TRANSCODE', False),
'transcodes': video.transcodes.all(),
'transcode_form': VideoTranscodeAdminForm(video=video),
'tracks_action_url': action_url,
......
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