update mediatools to 9a61482, add cachebuster to dockerfile

This commit is contained in:
byte[] 2020-05-18 22:44:43 -04:00
parent 6810b9a947
commit 2e3dafe08e
3 changed files with 9 additions and 45 deletions

View file

@ -1,5 +1,9 @@
FROM elixir:1.10.3 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; \ RUN apt-get update; \
apt-get -qq -y install apt-transport-https; \ apt-get -qq -y install apt-transport-https; \
echo "deb https://deb.nodesource.com/node_12.x stretch main" >> /etc/apt/sources.list; \ 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://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -; \
wget -qO - https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -; \ wget -qO - https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -; \
apt-get update; \ 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; \ cd /tmp; \
git clone https://github.com/derpibooru/cli_intensities; \ git clone https://github.com/derpibooru/cli_intensities; \
git clone https://github.com/derpibooru/mediatools; \ git clone https://github.com/derpibooru/mediatools; \
(cd cli_intensities; make install); \ (cd cli_intensities && make install); \
(cd mediatools; make install); \ (cd mediatools && make install); \
mix local.hex --force; \ mix local.hex --force; \
mix local.rebar --force mix local.rebar --force

View file

@ -35,37 +35,9 @@ defmodule Philomena.Processors.Gif do
end end
defp preview(duration, file) do defp preview(duration, file) do
h264_equiv = Briefly.create!(extname: ".mp4")
preview = Briefly.create!(extname: ".png") preview = Briefly.create!(extname: ".png")
# Hack workaround for broken FFmpeg behavior which {_output, 0} = System.cmd("mediathumb", [file, to_string(duration / 2), preview])
# 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
])
preview preview
end end

View file

@ -28,19 +28,7 @@ defmodule Philomena.Processors.Webm do
defp preview(duration, file) do defp preview(duration, file) do
preview = Briefly.create!(extname: ".png") preview = Briefly.create!(extname: ".png")
{_output, 0} = {_output, 0} = System.cmd("mediathumb", [file, to_string(duration / 2), preview])
System.cmd("ffmpeg", [
"-loglevel",
"0",
"-y",
"-i",
file,
"-ss",
to_string(duration / 2),
"-frames:v",
"1",
preview
])
preview preview
end end