Remove ffmpeg binaries install step from debian preinst script

This commit is contained in:
advplyr 2024-07-28 16:55:45 -05:00
parent 2c453a34ee
commit 3ac604c665
2 changed files with 20 additions and 24 deletions

View File

@ -2,7 +2,6 @@
set -e set -e
set -o pipefail set -o pipefail
FFMPEG_INSTALL_DIR="/usr/lib/audiobookshelf-ffmpeg"
DEFAULT_DATA_DIR="/usr/share/audiobookshelf" DEFAULT_DATA_DIR="/usr/share/audiobookshelf"
CONFIG_PATH="/etc/default/audiobookshelf" CONFIG_PATH="/etc/default/audiobookshelf"
DEFAULT_PORT=13378 DEFAULT_PORT=13378
@ -46,25 +45,6 @@ add_group() {
fi 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() { setup_config() {
if [ -f "$CONFIG_PATH" ]; then if [ -f "$CONFIG_PATH" ]; then
echo "Existing config found." echo "Existing config found."
@ -83,8 +63,6 @@ setup_config() {
config_text="METADATA_PATH=$DEFAULT_DATA_DIR/metadata config_text="METADATA_PATH=$DEFAULT_DATA_DIR/metadata
CONFIG_PATH=$DEFAULT_DATA_DIR/config CONFIG_PATH=$DEFAULT_DATA_DIR/config
FFMPEG_PATH=$FFMPEG_INSTALL_DIR/ffmpeg
FFPROBE_PATH=$FFMPEG_INSTALL_DIR/ffprobe
PORT=$DEFAULT_PORT PORT=$DEFAULT_PORT
HOST=$DEFAULT_HOST" HOST=$DEFAULT_HOST"
@ -101,5 +79,3 @@ add_group 'audiobookshelf' ''
add_user 'audiobookshelf' '' 'audiobookshelf' 'audiobookshelf user-daemon' '/bin/false' add_user 'audiobookshelf' '' 'audiobookshelf' 'audiobookshelf user-daemon' '/bin/false'
setup_config setup_config
install_ffmpeg

View File

@ -216,6 +216,10 @@ class Database {
} }
} }
/**
*
* @param {string[]} extensions paths to extension binaries
*/
async loadExtensions(extensions) { async loadExtensions(extensions) {
// This is a hack to get the db connection for loading 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. // 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) { normalize(value) {
return `lower(unaccent(${value}))` return `lower(unaccent(${value}))`
} }
/**
*
* @param {string} query
* @returns {Promise<string>}
*/
async getNormalizedQuery(query) { async getNormalizedQuery(query) {
const escapedQuery = this.sequelize.escape(query) const escapedQuery = this.sequelize.escape(query)
const normalizedQuery = this.normalize(escapedQuery) const normalizedQuery = this.normalize(escapedQuery)
@ -838,6 +852,12 @@ class Database {
return normalizedQueryResult[0][0].normalized_query return normalizedQueryResult[0][0].normalized_query
} }
/**
*
* @param {string} column
* @param {string} normalizedQuery
* @returns {string}
*/
matchExpression(column, normalizedQuery) { matchExpression(column, normalizedQuery) {
const normalizedPattern = this.sequelize.escape(`%${normalizedQuery}%`) const normalizedPattern = this.sequelize.escape(`%${normalizedQuery}%`)
const normalizedColumn = this.normalize(column) const normalizedColumn = this.normalize(column)