From 3ac604c6653beb23c87abad7bc2f21a68c55af6f Mon Sep 17 00:00:00 2001 From: advplyr Date: Sun, 28 Jul 2024 16:55:45 -0500 Subject: [PATCH] Remove ffmpeg binaries install step from debian preinst script --- build/debian/DEBIAN/preinst | 24 ------------------------ server/Database.js | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/build/debian/DEBIAN/preinst b/build/debian/DEBIAN/preinst index c4692ed3..e30bc490 100644 --- a/build/debian/DEBIAN/preinst +++ b/build/debian/DEBIAN/preinst @@ -2,7 +2,6 @@ set -e set -o pipefail -FFMPEG_INSTALL_DIR="/usr/lib/audiobookshelf-ffmpeg" DEFAULT_DATA_DIR="/usr/share/audiobookshelf" CONFIG_PATH="/etc/default/audiobookshelf" DEFAULT_PORT=13378 @@ -46,25 +45,6 @@ add_group() { fi } -install_ffmpeg() { - echo "Starting FFMPEG Install" - - WGET="wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz --output-document=ffmpeg-git-amd64-static.tar.xz" - - if ! cd "$FFMPEG_INSTALL_DIR"; then - echo "Creating ffmpeg install dir at $FFMPEG_INSTALL_DIR" - mkdir "$FFMPEG_INSTALL_DIR" - chown -R 'audiobookshelf:audiobookshelf' "$FFMPEG_INSTALL_DIR" - cd "$FFMPEG_INSTALL_DIR" - fi - - $WGET - tar xvf ffmpeg-git-amd64-static.tar.xz --strip-components=1 --no-same-owner - rm ffmpeg-git-amd64-static.tar.xz - - echo "Good to go on Ffmpeg... hopefully" -} - setup_config() { if [ -f "$CONFIG_PATH" ]; then echo "Existing config found." @@ -83,8 +63,6 @@ setup_config() { config_text="METADATA_PATH=$DEFAULT_DATA_DIR/metadata CONFIG_PATH=$DEFAULT_DATA_DIR/config -FFMPEG_PATH=$FFMPEG_INSTALL_DIR/ffmpeg -FFPROBE_PATH=$FFMPEG_INSTALL_DIR/ffprobe PORT=$DEFAULT_PORT HOST=$DEFAULT_HOST" @@ -101,5 +79,3 @@ add_group 'audiobookshelf' '' add_user 'audiobookshelf' '' 'audiobookshelf' 'audiobookshelf user-daemon' '/bin/false' setup_config - -install_ffmpeg diff --git a/server/Database.js b/server/Database.js index 6b582ec0..935ddc20 100644 --- a/server/Database.js +++ b/server/Database.js @@ -216,6 +216,10 @@ class Database { } } + /** + * + * @param {string[]} extensions paths to extension binaries + */ async loadExtensions(extensions) { // This is a hack to get the db connection for loading extensions. // The proper way would be to use the 'afterConnect' hook, but that hook is never called for sqlite due to a bug in sequelize. @@ -827,10 +831,20 @@ class Database { } } + /** + * + * @param {string} value + * @returns {string} + */ normalize(value) { return `lower(unaccent(${value}))` } + /** + * + * @param {string} query + * @returns {Promise} + */ async getNormalizedQuery(query) { const escapedQuery = this.sequelize.escape(query) const normalizedQuery = this.normalize(escapedQuery) @@ -838,6 +852,12 @@ class Database { return normalizedQueryResult[0][0].normalized_query } + /** + * + * @param {string} column + * @param {string} normalizedQuery + * @returns {string} + */ matchExpression(column, normalizedQuery) { const normalizedPattern = this.sequelize.escape(`%${normalizedQuery}%`) const normalizedColumn = this.normalize(column)