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
d759f50b
Unverified
Commit
d759f50b
authored
Feb 27, 2021
by
Kevin Gutiérrez
Committed by
GitHub
Feb 27, 2021
Browse files
Move tracks to reusable method
parent
10a9bc0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
wagtailvideos/models.py
View file @
d759f50b
...
...
@@ -189,6 +189,12 @@ class AbstractVideo(CollectionMember, index.Indexed, models.Model):
def
get_current_transcodes
(
self
):
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
):
if
attrs
is
None
:
attrs
=
{}
...
...
@@ -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>"
)
tracks
=
[]
if
hasattr
(
self
,
'track_listing'
):
tracks
=
[
t
.
track_tag
()
for
t
in
self
.
track_listing
.
tracks
.
all
()]
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
):
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