From 2e3dafe08ed10fa41b4ac6518f3c4c57fa846f19 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Mon, 18 May 2020 22:44:43 -0400 Subject: [PATCH] update mediatools to 9a61482, add cachebuster to dockerfile --- docker/app/Dockerfile | 10 +++++++--- lib/philomena/processors/gif.ex | 30 +----------------------------- lib/philomena/processors/webm.ex | 14 +------------- 3 files changed, 9 insertions(+), 45 deletions(-) diff --git a/docker/app/Dockerfile b/docker/app/Dockerfile index 701df499..870941fc 100644 --- a/docker/app/Dockerfile +++ b/docker/app/Dockerfile @@ -1,5 +1,9 @@ FROM elixir:1.10.3 +# cache bust git repos +ADD https://api.github.com/repos/derpibooru/cli_intensities/git/refs/heads/master /tmp/cli_intensities_version.json +ADD https://api.github.com/repos/derpibooru/mediatools/git/refs/heads/master /tmp/mediatools_version.json + RUN apt-get update; \ apt-get -qq -y install apt-transport-https; \ echo "deb https://deb.nodesource.com/node_12.x stretch main" >> /etc/apt/sources.list; \ @@ -7,12 +11,12 @@ RUN apt-get update; \ wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -; \ wget -qO - https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -; \ apt-get update; \ - apt-get -qq -y install inotify-tools postgresql-client build-essential git ffmpeg libavformat-dev libavcodec-dev nodejs libmagic-dev libpng-dev gifsicle optipng libjpeg-progs librsvg2-bin; \ + apt-get -qq -y install inotify-tools postgresql-client build-essential git ffmpeg libavformat-dev libavcodec-dev libswscale-dev nodejs libmagic-dev libpng-dev gifsicle optipng libjpeg-progs librsvg2-bin; \ cd /tmp; \ git clone https://github.com/derpibooru/cli_intensities; \ git clone https://github.com/derpibooru/mediatools; \ - (cd cli_intensities; make install); \ - (cd mediatools; make install); \ + (cd cli_intensities && make install); \ + (cd mediatools && make install); \ mix local.hex --force; \ mix local.rebar --force diff --git a/lib/philomena/processors/gif.ex b/lib/philomena/processors/gif.ex index 84c232fd..bd9cf916 100644 --- a/lib/philomena/processors/gif.ex +++ b/lib/philomena/processors/gif.ex @@ -35,37 +35,9 @@ defmodule Philomena.Processors.Gif do end defp preview(duration, file) do - h264_equiv = Briefly.create!(extname: ".mp4") preview = Briefly.create!(extname: ".png") - # Hack workaround for broken FFmpeg behavior which - # cannot correctly seek in GIF image files - - {_output, 0} = - System.cmd("ffmpeg", [ - "-loglevel", - "0", - "-y", - "-i", - file, - "-c:v", - "libx264", - h264_equiv - ]) - - {_output, 0} = - System.cmd("ffmpeg", [ - "-loglevel", - "0", - "-y", - "-i", - h264_equiv, - "-ss", - to_string(duration / 2), - "-frames:v", - "1", - preview - ]) + {_output, 0} = System.cmd("mediathumb", [file, to_string(duration / 2), preview]) preview end diff --git a/lib/philomena/processors/webm.ex b/lib/philomena/processors/webm.ex index d7af3d6f..37df53ff 100644 --- a/lib/philomena/processors/webm.ex +++ b/lib/philomena/processors/webm.ex @@ -28,19 +28,7 @@ defmodule Philomena.Processors.Webm do defp preview(duration, file) do preview = Briefly.create!(extname: ".png") - {_output, 0} = - System.cmd("ffmpeg", [ - "-loglevel", - "0", - "-y", - "-i", - file, - "-ss", - to_string(duration / 2), - "-frames:v", - "1", - preview - ]) + {_output, 0} = System.cmd("mediathumb", [file, to_string(duration / 2), preview]) preview end