mirror of
https://github.com/auricom/home-cluster.git
synced 2025-09-17 18:24:14 +02:00
fix: music_transcode
This commit is contained in:
@@ -36,8 +36,6 @@ spec:
|
|||||||
- |
|
- |
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
export LD_LIBRARY_PATH="/app"
|
|
||||||
|
|
||||||
curl --location raw.githubusercontent.com/auricom/home-ops/main/scripts/transcode_music/transcode.bash --output /tmp/transcode.bash
|
curl --location raw.githubusercontent.com/auricom/home-ops/main/scripts/transcode_music/transcode.bash --output /tmp/transcode.bash
|
||||||
chmod a+x /tmp/transcode.bash
|
chmod a+x /tmp/transcode.bash
|
||||||
curl --location raw.githubusercontent.com/auricom/home-ops/main/scripts/transcode_music/transcode_exclude.cfg --output /tmp/transcode_exclude.cfg
|
curl --location raw.githubusercontent.com/auricom/home-ops/main/scripts/transcode_music/transcode_exclude.cfg --output /tmp/transcode_exclude.cfg
|
||||||
|
@@ -27,7 +27,7 @@ if [ -z "$TRANSCODE_DB" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$TRANSCODE_FREAC_BIN" ]; then
|
if [ -z "$TRANSCODE_FREAC_BIN" ]; then
|
||||||
export TRANSCODE_FREAC_BIN="/app/freac.AppImage"
|
export TRANSCODE_FREAC_BIN="/app/freaccmd"
|
||||||
fi
|
fi
|
||||||
if [ -z "$TRANSCODE_COVER_EXTENSIONS" ]; then
|
if [ -z "$TRANSCODE_COVER_EXTENSIONS" ]; then
|
||||||
export TRANSCODE_COVER_EXTENSIONS="png jpg"
|
export TRANSCODE_COVER_EXTENSIONS="png jpg"
|
||||||
@@ -57,6 +57,7 @@ if [ $? -eq 0 ]; then
|
|||||||
else
|
else
|
||||||
export TRANSCODE_FD_BIN="fd"
|
export TRANSCODE_FD_BIN="fd"
|
||||||
fi
|
fi
|
||||||
|
export LD_LIBRARY_PATH=$(dirname $TRANSCODE_FREAC_BIN)
|
||||||
|
|
||||||
test ! -d $TRANSCODE_DB && mkdir -p $TRANSCODE_DB
|
test ! -d $TRANSCODE_DB && mkdir -p $TRANSCODE_DB
|
||||||
|
|
||||||
@@ -97,13 +98,16 @@ transcode()
|
|||||||
output_file=$2
|
output_file=$2
|
||||||
md5_file=$3
|
md5_file=$3
|
||||||
|
|
||||||
|
echo "INFO: Processing file $1..."
|
||||||
if [ $MODE_DRY_RUN == false ]; then
|
if [ $MODE_DRY_RUN == false ]; then
|
||||||
$TRANSCODE_FREAC_BIN freaccmd --encoder=opus --bitrate 64 "$input_file" -o "$output_file"
|
output=$($TRANSCODE_FREAC_BIN --encoder=opus --bitrate 64 "$input_file" -o "$output_file")
|
||||||
if [ $? -ne 0 ]; then exit 1; fi
|
result=$(echo "$output" | grep -c "Could not process")
|
||||||
|
if [ $result -eq 1 ]; then
|
||||||
|
echo -e "$output"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
mkdir -p "$TRANSCODE_DB/$(dirname "$input_file")"
|
mkdir -p "$TRANSCODE_DB/$(dirname "$input_file")"
|
||||||
echo "$(md5sum "$input_file" | awk '{ print $1 }')" > "$md5_file"
|
echo "$(md5sum "$input_file" | awk '{ print $1 }')" > "$md5_file"
|
||||||
else
|
|
||||||
echo "INFO: transcoding $1"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,9 +275,9 @@ remove_absent_from_source()
|
|||||||
|
|
||||||
if [ $MODE_DRY_RUN == false ]; then
|
if [ $MODE_DRY_RUN == false ]; then
|
||||||
cd "$TRANSCODE_OUTPUT_DIR"
|
cd "$TRANSCODE_OUTPUT_DIR"
|
||||||
fd --type empty --exec-batch rmdir
|
$TRANSCODE_FD_BIN --type empty --exec-batch rmdir
|
||||||
cd "$TRANSCODE_DB"
|
cd "$TRANSCODE_DB"
|
||||||
fd --type empty --exec-batch rmdir
|
$TRANSCODE_FD_BIN --type empty --exec-batch rmdir
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user