Filippo Giunchedi has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/401725 )
Change subject: Upgrade to 1.8 ...................................................................... Upgrade to 1.8 Bug: T183907 Change-Id: Ie6123058b098f17f61fcb69505471ab70693cc5a --- M debian/changelog M setup.py A tests/integration/originals/Cape_Town_under_the_clouds.webm A tests/integration/originals/Debris_flow_-_22_juillet_2013_-_Crue_torrentielle_a_Saint_Julien_Montdenis.webm M tests/integration/test_video.py A tests/integration/thumbnails/640px--Cape_Town_under_the_clouds.webm.jpg A tests/integration/thumbnails/640px--Debris_flow_-_22_juillet_2013_-_Crue_torrentielle_a_Saint_Julien_Montdenis.webm.jpg M tox.ini M wikimedia_thumbor/engine/stl/stl.py M wikimedia_thumbor/loader/video/__init__.py M wikimedia_thumbor/logging/filter/context/context.py M wikimedia_thumbor/logging/filter/http404/http404.py 12 files changed, 55 insertions(+), 8 deletions(-) Approvals: jenkins-bot: Verified Filippo Giunchedi: Looks good to me, approved diff --git a/debian/changelog b/debian/changelog index 0a00260..59b5c76 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +python-thumbor-wikimedia (1.8-1) jessie-wikimedia; urgency=low + + * New upstream release + + -- Gilles Dubuc <gil...@wikimedia.org> Wed, 3 Jan 2018 12:46:00 +0000 + python-thumbor-wikimedia (1.7-1) jessie-wikimedia; urgency=low * New upstream release diff --git a/setup.py b/setup.py index 57716a5..365555d 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name='wikimedia_thumbor', - version='1.7', + version='1.8', url='https://phabricator.wikimedia.org/diffusion/THMBREXT/', license='MIT', author='Gilles Dubuc, Wikimedia Foundation', diff --git a/tests/integration/originals/Cape_Town_under_the_clouds.webm b/tests/integration/originals/Cape_Town_under_the_clouds.webm new file mode 100644 index 0000000..82e16fc --- /dev/null +++ b/tests/integration/originals/Cape_Town_under_the_clouds.webm Binary files differ diff --git a/tests/integration/originals/Debris_flow_-_22_juillet_2013_-_Crue_torrentielle_a_Saint_Julien_Montdenis.webm b/tests/integration/originals/Debris_flow_-_22_juillet_2013_-_Crue_torrentielle_a_Saint_Julien_Montdenis.webm new file mode 100644 index 0000000..71b9428 --- /dev/null +++ b/tests/integration/originals/Debris_flow_-_22_juillet_2013_-_Crue_torrentielle_a_Saint_Julien_Montdenis.webm Binary files differ diff --git a/tests/integration/test_video.py b/tests/integration/test_video.py index f5d5d91..8da8d73 100644 --- a/tests/integration/test_video.py +++ b/tests/integration/test_video.py @@ -38,6 +38,32 @@ 1.0 ) + path = os.path.join( + os.path.dirname(__file__), + 'originals', + 'Cape_Town_under_the_clouds.webm' + ) + + self.run_and_check_ssim_and_size( + 'thumbor/unsafe/640x/' + path, + '640px--Cape_Town_under_the_clouds.webm.jpg', + 0.98, + 1.0 + ) + + path = os.path.join( + os.path.dirname(__file__), + 'originals', + 'Debris_flow_-_22_juillet_2013_-_Crue_torrentielle_a_Saint_Julien_Montdenis.webm' + ) + + self.run_and_check_ssim_and_size( + 'thumbor/unsafe/640x/' + path, + '640px--Debris_flow_-_22_juillet_2013_-_Crue_torrentielle_a_Saint_Julien_Montdenis.webm.jpg', + 0.99, + 1.0 + ) + def test_webm_with_seek(self): path = os.path.join( os.path.dirname(__file__), diff --git a/tests/integration/thumbnails/640px--Cape_Town_under_the_clouds.webm.jpg b/tests/integration/thumbnails/640px--Cape_Town_under_the_clouds.webm.jpg new file mode 100644 index 0000000..0cfa53a --- /dev/null +++ b/tests/integration/thumbnails/640px--Cape_Town_under_the_clouds.webm.jpg Binary files differ diff --git a/tests/integration/thumbnails/640px--Debris_flow_-_22_juillet_2013_-_Crue_torrentielle_a_Saint_Julien_Montdenis.webm.jpg b/tests/integration/thumbnails/640px--Debris_flow_-_22_juillet_2013_-_Crue_torrentielle_a_Saint_Julien_Montdenis.webm.jpg new file mode 100644 index 0000000..4c4fecd --- /dev/null +++ b/tests/integration/thumbnails/640px--Debris_flow_-_22_juillet_2013_-_Crue_torrentielle_a_Saint_Julien_Montdenis.webm.jpg Binary files differ diff --git a/tox.ini b/tox.ini index 157253d..2fca023 100644 --- a/tox.ini +++ b/tox.ini @@ -6,6 +6,7 @@ [testenv] setenv = VIRTUAL_ENV={envdir} deps = -r{toxinidir}/requirements.txt +commands = python -c 'print("done!")' [testenv:flake8] commands = flake8 {posargs} diff --git a/wikimedia_thumbor/engine/stl/stl.py b/wikimedia_thumbor/engine/stl/stl.py index 9dd3d47..a7cf8ec 100644 --- a/wikimedia_thumbor/engine/stl/stl.py +++ b/wikimedia_thumbor/engine/stl/stl.py @@ -18,6 +18,7 @@ from wikimedia_thumbor.engine import BaseWikimediaEngine from wikimedia_thumbor.shell_runner import ShellRunner +from wikimedia_thumbor.engine import CommandError BaseWikimediaEngine.add_format( 'application/sla', @@ -60,12 +61,12 @@ # ...so if we got at east that many bytes... if len(remainder) == triangles * 386: # ...and there aren't any extras... - extra = stream.read1() + extra = stream.read1(1) if len(extra) == 0: # ...this is as close to a golden STL file check as we're # going to get. return True - except: + except IndexError: pass return False @@ -95,9 +96,9 @@ try: self.command(command) - except: + except CommandError as e: ShellRunner.rm_f(tmppng) - raise + raise e tmpfile = open(tmppng, 'rb') png = tmpfile.read() diff --git a/wikimedia_thumbor/loader/video/__init__.py b/wikimedia_thumbor/loader/video/__init__.py index b0657b0..ead5319 100644 --- a/wikimedia_thumbor/loader/video/__init__.py +++ b/wikimedia_thumbor/loader/video/__init__.py @@ -129,7 +129,13 @@ def _parse_time(context, url, callback, output): - duration = float(output) + # T183907 Some files have completely corrupt duration fields, + # but we can still extract their first frame for a thumbnail + try: + duration = float(output) + except ValueError: + duration = 0.0 + unquoted_url = unquote(url) try: @@ -193,6 +199,13 @@ output_file, status ): + # T183907 Sometimes ffmpeg returns status 0 and actually fails to + # generate a thumbnail. We double-check the existence of the thumbnail + # in case of apparent success + if status == 0: + if os.stat(output_file.name).st_size == 0: + status = -1 + # If rendering the desired frame fails, attempt to render the # first frame instead if status != 0 and seek > 0: diff --git a/wikimedia_thumbor/logging/filter/context/context.py b/wikimedia_thumbor/logging/filter/context/context.py index b6056cb..0c29aa4 100644 --- a/wikimedia_thumbor/logging/filter/context/context.py +++ b/wikimedia_thumbor/logging/filter/context/context.py @@ -30,7 +30,7 @@ '.*thumbor running at \d+.\d+.\d+.\d+:([\d]+).*', unicode(record.msg) ) - except: + except ValueError: matches = None if matches: diff --git a/wikimedia_thumbor/logging/filter/http404/http404.py b/wikimedia_thumbor/logging/filter/http404/http404.py index 16c203c..6ddbcdc 100644 --- a/wikimedia_thumbor/logging/filter/http404/http404.py +++ b/wikimedia_thumbor/logging/filter/http404/http404.py @@ -14,7 +14,7 @@ try: matches = re.match('.*get_object failed.*', unicode(record.msg)) - except: + except ValueError: matches = None if self.flag == 'exclude': -- To view, visit https://gerrit.wikimedia.org/r/401725 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie6123058b098f17f61fcb69505471ab70693cc5a Gerrit-PatchSet: 1 Gerrit-Project: operations/debs/python-thumbor-wikimedia Gerrit-Branch: master Gerrit-Owner: Gilles <gdu...@wikimedia.org> Gerrit-Reviewer: Filippo Giunchedi <fgiunch...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits