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
d0858e1e
Unverified
Commit
d0858e1e
authored
Mar 03, 2021
by
seb-b
Committed by
GitHub
Mar 03, 2021
Browse files
Merge pull request #72 from jkevingutierrez/patch-1
Move tracks to reusable method
parents
10a9bc0b
d759f50b
Changes
1
Hide whitespace changes
Inline
Side-by-side
wagtailvideos/models.py
View file @
d0858e1e
...
@@ -189,6 +189,12 @@ class AbstractVideo(CollectionMember, index.Indexed, models.Model):
...
@@ -189,6 +189,12 @@ class AbstractVideo(CollectionMember, index.Indexed, models.Model):
def
get_current_transcodes
(
self
):
def
get_current_transcodes
(
self
):
return
self
.
transcodes
.
exclude
(
processing
=
True
).
filter
(
error_message__exact
=
''
)
return
self
.
transcodes
.
exclude
(
processing
=
True
).
filter
(
error_message__exact
=
''
)
def
get_tracks
(
self
):
tracks
=
[]
if
hasattr
(
self
,
'track_listing'
):
tracks
=
[
t
.
track_tag
()
for
t
in
self
.
track_listing
.
tracks
.
all
()]
return
tracks
def
video_tag
(
self
,
attrs
=
None
):
def
video_tag
(
self
,
attrs
=
None
):
if
attrs
is
None
:
if
attrs
is
None
:
attrs
=
{}
attrs
=
{}
...
@@ -207,12 +213,8 @@ class AbstractVideo(CollectionMember, index.Indexed, models.Model):
...
@@ -207,12 +213,8 @@ class AbstractVideo(CollectionMember, index.Indexed, models.Model):
sources
.
append
(
"<p>Sorry, your browser doesn't support playback for this video</p>"
)
sources
.
append
(
"<p>Sorry, your browser doesn't support playback for this video</p>"
)
tracks
=
[]
if
hasattr
(
self
,
'track_listing'
):
tracks
=
[
t
.
track_tag
()
for
t
in
self
.
track_listing
.
tracks
.
all
()]
return
mark_safe
(
return
mark_safe
(
"<video {0}>
\n
{1}
\n
{2}
\n
</video>"
.
format
(
flatatt
(
attrs
),
"
\n
"
.
join
(
sources
),
"
\n
"
.
join
(
tracks
)))
"<video {0}>
\n
{1}
\n
{2}
\n
</video>"
.
format
(
flatatt
(
attrs
),
"
\n
"
.
join
(
sources
),
"
\n
"
.
join
(
self
.
get_
tracks
()
)))
def
do_transcode
(
self
,
media_format
,
quality
):
def
do_transcode
(
self
,
media_format
,
quality
):
transcode
,
created
=
self
.
transcodes
.
get_or_create
(
transcode
,
created
=
self
.
transcodes
.
get_or_create
(
...
...
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