Add TranscodingType.description and set correct short_name
This commit is contained in:
@@ -8,5 +8,6 @@ class GetShortNameOfTranscodingTypeTestCase(SimpleTestCase):
|
|||||||
self.assertEqual(result, 'vp8')
|
self.assertEqual(result, 'vp8')
|
||||||
|
|
||||||
def test_gets_transcoding_by_transcoding_object(self):
|
def test_gets_transcoding_by_transcoding_object(self):
|
||||||
result = get_short_name_of_transcoding_type(TranscodingType(name='Looooong naaaaame', short_name='shrt nm'))
|
result = get_short_name_of_transcoding_type(TranscodingType(name='Looooong naaaaame', short_name='shrt nm',
|
||||||
|
description='Some Description'))
|
||||||
self.assertEqual(result, 'shrt nm')
|
self.assertEqual(result, 'shrt nm')
|
||||||
@@ -24,7 +24,7 @@ class VideoTestCase(UploadMixin, TestCase):
|
|||||||
models.Transcoding,
|
models.Transcoding,
|
||||||
video=video,
|
video=video,
|
||||||
quality='480p',
|
quality='480p',
|
||||||
type='video/webm',
|
type='video/webm; codecs="vp9, opus"',
|
||||||
url='http://480p.webm',
|
url='http://480p.webm',
|
||||||
)
|
)
|
||||||
transcoding2 = factories.create(
|
transcoding2 = factories.create(
|
||||||
@@ -38,7 +38,7 @@ class VideoTestCase(UploadMixin, TestCase):
|
|||||||
models.Transcoding,
|
models.Transcoding,
|
||||||
video=video,
|
video=video,
|
||||||
quality='720p',
|
quality='720p',
|
||||||
type='video/webm',
|
type='video/webm; codecs="vp9, opus"',
|
||||||
url='http://720p.webm',
|
url='http://720p.webm',
|
||||||
)
|
)
|
||||||
transcoding4 = factories.create(
|
transcoding4 = factories.create(
|
||||||
@@ -60,8 +60,8 @@ class VideoTestCase(UploadMixin, TestCase):
|
|||||||
self.assertInHTML(
|
self.assertInHTML(
|
||||||
"""<video width="853" height="480" controls="controls">
|
"""<video width="853" height="480" controls="controls">
|
||||||
<source src="http://480p.mp4" type='video/mp4' />
|
<source src="http://480p.mp4" type='video/mp4' />
|
||||||
<source src="http://480p.webm" type='video/webm' />
|
<source src="http://480p.webm" type='video/webm; codecs="vp9, opus"' />
|
||||||
You need a browser that understands HTML5 video and supports h.264 or vp8 codecs.
|
You need a browser that understands HTML5 video and supports h.264 or vp9 codecs.
|
||||||
</video>""",
|
</video>""",
|
||||||
content,
|
content,
|
||||||
)
|
)
|
||||||
@@ -96,7 +96,7 @@ class VideoTestCase(UploadMixin, TestCase):
|
|||||||
models.Transcoding,
|
models.Transcoding,
|
||||||
video=video,
|
video=video,
|
||||||
quality='480p',
|
quality='480p',
|
||||||
type='video/webm',
|
type='video/webm; codecs="vp8, vorbis"',
|
||||||
url='http://480p.webm',
|
url='http://480p.webm',
|
||||||
)
|
)
|
||||||
transcoding2 = factories.create(
|
transcoding2 = factories.create(
|
||||||
@@ -110,7 +110,7 @@ class VideoTestCase(UploadMixin, TestCase):
|
|||||||
models.Transcoding,
|
models.Transcoding,
|
||||||
video=video,
|
video=video,
|
||||||
quality='720p',
|
quality='720p',
|
||||||
type='video/webm',
|
type='video/webm; codecs="vp8, vorbis"',
|
||||||
url='http://720p.webm',
|
url='http://720p.webm',
|
||||||
)
|
)
|
||||||
transcoding4 = factories.create(
|
transcoding4 = factories.create(
|
||||||
@@ -130,7 +130,7 @@ class VideoTestCase(UploadMixin, TestCase):
|
|||||||
self.assertInHTML(
|
self.assertInHTML(
|
||||||
"""<video width="1280" height="720" controls="controls">
|
"""<video width="1280" height="720" controls="controls">
|
||||||
<source src="http://720p.mp4" type='video/mp4' />
|
<source src="http://720p.mp4" type='video/mp4' />
|
||||||
<source src="http://720p.webm" type='video/webm' />
|
<source src="http://720p.webm" type='video/webm; codecs="vp8, vorbis"' />
|
||||||
You need a browser that understands HTML5 video and supports h.264 or vp8 codecs.
|
You need a browser that understands HTML5 video and supports h.264 or vp8 codecs.
|
||||||
</video>""",
|
</video>""",
|
||||||
content,
|
content,
|
||||||
@@ -156,7 +156,7 @@ class VideoTestCase(UploadMixin, TestCase):
|
|||||||
models.Transcoding,
|
models.Transcoding,
|
||||||
video=video,
|
video=video,
|
||||||
quality='480p',
|
quality='480p',
|
||||||
type='video/webm',
|
type='video/webm; codecs="vp8, vorbis"',
|
||||||
url='http://480p.webm',
|
url='http://480p.webm',
|
||||||
)
|
)
|
||||||
transcoding2 = factories.create(
|
transcoding2 = factories.create(
|
||||||
@@ -170,7 +170,7 @@ class VideoTestCase(UploadMixin, TestCase):
|
|||||||
models.Transcoding,
|
models.Transcoding,
|
||||||
video=video,
|
video=video,
|
||||||
quality='720p',
|
quality='720p',
|
||||||
type='video/webm',
|
type='video/webm; codecs="vp8, vorbis"',
|
||||||
url='http://720p.webm',
|
url='http://720p.webm',
|
||||||
)
|
)
|
||||||
transcoding4 = factories.create(
|
transcoding4 = factories.create(
|
||||||
@@ -191,7 +191,7 @@ class VideoTestCase(UploadMixin, TestCase):
|
|||||||
self.assertInHTML(
|
self.assertInHTML(
|
||||||
"""<video width="1280" height="720" controls="controls">
|
"""<video width="1280" height="720" controls="controls">
|
||||||
<source src="http://720p.mp4" type='video/mp4' />
|
<source src="http://720p.mp4" type='video/mp4' />
|
||||||
<source src="http://720p.webm" type='video/webm' />
|
<source src="http://720p.webm" type='video/webm; codecs="vp8, vorbis"' />
|
||||||
You need a browser that understands HTML5 video and supports h.264 or vp8 codecs.
|
You need a browser that understands HTML5 video and supports h.264 or vp8 codecs.
|
||||||
</video>""",
|
</video>""",
|
||||||
content,
|
content,
|
||||||
@@ -221,7 +221,7 @@ class VideoTestCase(UploadMixin, TestCase):
|
|||||||
models.Transcoding,
|
models.Transcoding,
|
||||||
video=video,
|
video=video,
|
||||||
quality='480p',
|
quality='480p',
|
||||||
type='video/webm',
|
type='video/webm; codecs="vp8, vorbis"',
|
||||||
upload=movie,
|
upload=movie,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -234,7 +234,7 @@ class VideoTestCase(UploadMixin, TestCase):
|
|||||||
|
|
||||||
self.assertInHTML(
|
self.assertInHTML(
|
||||||
"""<video width="853" height="480" poster="{image}" controls="controls">
|
"""<video width="853" height="480" poster="{image}" controls="controls">
|
||||||
<source src="{url}" type='video/webm' />
|
<source src="{url}" type='video/webm; codecs="vp8, vorbis"' />
|
||||||
You need a browser that understands HTML5 video and supports vp8 codecs.
|
You need a browser that understands HTML5 video and supports vp8 codecs.
|
||||||
</video>""".format(url=movie.file.url, image=image.file.url),
|
</video>""".format(url=movie.file.url, image=image.file.url),
|
||||||
content,
|
content,
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ class Quality(NamedTuple):
|
|||||||
class TranscodingType(NamedTuple):
|
class TranscodingType(NamedTuple):
|
||||||
name: str
|
name: str
|
||||||
short_name: str
|
short_name: str
|
||||||
|
description: str
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
@@ -27,11 +28,12 @@ qualities = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
transcoding_types = (
|
transcoding_types = (
|
||||||
TranscodingType(name='video/webm', short_name='vp8'),
|
TranscodingType(name='video/webm', short_name='webm', description='Generic WebM'),
|
||||||
TranscodingType(name='video/webm; codecs="vp8, vorbis"', short_name='vp8'),
|
TranscodingType(name='video/webm; codecs="vp8, vorbis"', short_name='vp8', description='WebM with VP8 and Vorbis'),
|
||||||
TranscodingType(name='video/webm; codecs="vp9, opus"', short_name='vp9'),
|
TranscodingType(name='video/webm; codecs="vp9, opus"', short_name='vp9', description='WebM with VP9 and Opus'),
|
||||||
TranscodingType(name='video/mp4', short_name='h.264'),
|
TranscodingType(name='video/mp4', short_name='h.264', description='Generic MP4 with H.264'),
|
||||||
TranscodingType(name='video/mp4; codecs="avc1.64001f,mp4a.40.2"', short_name='h.264'),
|
TranscodingType(name='video/mp4; codecs="avc1.64001f,mp4a.40.2"', short_name='h.264',
|
||||||
|
description='MP4 with H.264 (AVC1 profile High, Level 3.1) and AAC-LC'),
|
||||||
)
|
)
|
||||||
|
|
||||||
class Upload(models.Model):
|
class Upload(models.Model):
|
||||||
|
|||||||
Reference in New Issue
Block a user