metadata: fix failure to get exif data for compressed SWF files.

Fix Exiftool not being able to get the metadata for compressed SWF
files. Exiftool requires Compress::Zlib as an optional dependency to
decompress compressed SWF files, but it wasn't in the Docker image.

Archive::Zip is required for Zip files and Digest::MD5 for certain other
metadata (see "DEPENDENCIES" in exiftool README).
This commit is contained in:
evazion
2021-09-15 18:28:54 -05:00
parent e16aa7b1c5
commit f359d44763
3 changed files with 18 additions and 5 deletions

View File

@@ -49,7 +49,7 @@ apt-get -y install $LIBSSL_DEV_PKG build-essential automake libxml2-dev libxslt-
apt-get -y install libpq-dev postgresql-client
apt-get -y install liblcms2-dev $LIBJPEG_TURBO_DEV_PKG libexpat1-dev libgif-dev libpng-dev libexif-dev
apt-get -y install gcc g++
apt-get -y install exiftool
apt-get -y install exiftool perl perl-modules
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list

View File

@@ -21,9 +21,7 @@ DANBOORU_RUNTIME_DEPS="
ca-certificates mkvtoolnix postgresql-client-12 libpq5
zlib1g libfftw3-3 libwebp6 libwebpmux3 libwebpdemux2 liborc-0.4.0 liblcms2-2
libpng16-16 libjpeg-turbo8 libexpat1 libglib2.0 libgif7 libexif12 libvpx6
"
EXTRA_DEPS="
busybox
perl perl-modules busybox
"
apt_install() {
@@ -64,6 +62,8 @@ install_ffmpeg() {
ffprobe -version
}
# https://github.com/exiftool/exiftool/blob/master/README
# Optional dependencies: Compress::Zlib (for SWF files), Archive::Zip (ZIP), Digest::MD5
install_exiftool() {
EXIFTOOL_URL="https://github.com/exiftool/exiftool/archive/refs/tags/${EXIFTOOL_VERSION}.tar.gz"
curl -L "$EXIFTOOL_URL" | tar -C /usr/local/src -xzvf -
@@ -73,6 +73,9 @@ install_exiftool() {
make -j "$(nproc)" install
exiftool -ver
perl -e 'require Compress::Zlib' || exit 1
perl -e 'require Archive::Zip' || exit 1
perl -e 'require Digest::MD5' || exit 1
}
install_ruby() {
@@ -126,7 +129,7 @@ cleanup() {
}
apt-get update
apt_install $COMMON_BUILD_DEPS $DANBOORU_RUNTIME_DEPS $EXTRA_DEPS
apt_install $COMMON_BUILD_DEPS $DANBOORU_RUNTIME_DEPS
install_asdf
install_exiftool
install_ffmpeg

View File

@@ -180,6 +180,16 @@ class MediaFileTest < ActiveSupport::TestCase
end
end
context "a compressed SWF file" do
should "get all the metadata" do
@metadata = MediaFile.open("test/files/compressed.swf").metadata
assert_equal(true, @metadata["Flash:Compressed"])
assert_not_equal("Install Compress::Zlib to extract compressed information", @metadata["ExifTool:Warning"])
assert_equal(6, @metadata.count)
end
end
context "a greyscale image without an embedded color profile" do
should "successfully generate a thumbnail" do
@image = MediaFile.open("test/files/test-grey-no-profile.jpg")