Skip to content

Commit d4e8ecd

Browse files
Release 2.19.2
1 parent c981623 commit d4e8ecd

File tree

3 files changed

+33
-21
lines changed

3 files changed

+33
-21
lines changed

.github/workflows/BuildImage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
echo "MULTI_ARCH=${{ env.MULTI_ARCH }}" >> $GITHUB_OUTPUT
3333
if [[ -z "${{ env.MOD_VERSION }}" ]]; then
3434
# **** If the mod needs to be versioned, set the versioning logic below. Otherwise leave as is. ****
35-
MOD_VERSION="2.19.0"
35+
MOD_VERSION="2.19.2"
3636
else
3737
MOD_VERSION=${{ env.MOD_VERSION }}
3838
echo "MOD_VERSION_OVERRIDE=true" >> $GITHUB_OUTPUT

root/etc/s6-overlay/s6-rc.d/init-mod-radarr-striptracks-add-package/run

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/with-contenv bash
2+
# shellcheck shell=bash
23

34
cat <<EOF
45
----------------
@@ -23,14 +24,14 @@ fi
2324
for file in /usr/local/bin/striptracks*.sh
2425
do
2526
# Change ownership
26-
if [ $(stat -c '%G' $file) != "abc" ]; then
27+
if [ "$(stat -c '%G' "$file")" != "abc" ]; then
2728
echo "Changing ownership on $file script."
28-
lsiown abc:abc $file
29+
lsiown abc:abc "$file"
2930
fi
3031

3132
# Make executable
32-
if [ ! -x $file ]; then
33+
if [ ! -x "$file" ]; then
3334
echo "Making $file script executable."
34-
chmod +x $file
35+
chmod +x "$file"
3536
fi
3637
done

root/usr/local/bin/striptracks.sh

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -980,49 +980,60 @@ function call_api {
980980
local message="$2" # Message to log
981981
local method="$3" # HTTP method to use (GET, POST, PUT, DELETE)
982982
local endpoint="$4" # API endpoint to call
983-
local data # Data to send with the request. All subsequent arguments are treated as data.
983+
local -a curl_data_args=() # Use array instead of string for safer argument passing (see issue #118)
984984

985985
# Process remaining data values
986986
shift 4
987987
while (( "$#" )); do
988-
# Escape double quotes in data parameter
989-
local param="${1//\"/\\\"}"
990-
case "$param" in
988+
case "$1" in
991989
"{"*|"["*)
992-
data+=" --json \"$param\""
990+
curl_data_args+=(--json "$1")
993991
shift
994992
;;
995993
*=*)
996-
data+=" --data-urlencode \"$param\""
994+
curl_data_args+=(--data-urlencode "$1")
997995
shift
998996
;;
999997
*)
1000-
data+=" --data-raw \"$param\""
998+
curl_data_args+=(--data-raw "$1")
1001999
shift
10021000
;;
10031001
esac
10041002
done
10051003

1004+
local -a curl_args=(
1005+
-s
1006+
--fail-with-body
1007+
-H "X-Api-Key: $striptracks_apikey"
1008+
-H "Content-Type: application/json"
1009+
-H "Accept: application/json"
1010+
)
1011+
10061012
local url="$striptracks_api_url/$endpoint"
1007-
[ $striptracks_debug -ge 1 ] && echo "Debug|$message Calling ${striptracks_type^} API using $method and URL '$url'${data:+ with$data}" | log
1013+
local data_info=""
1014+
[ ${#curl_data_args[@]} -gt 0 ] && data_info=" with data: ${curl_data_args[*]}"
1015+
[ $striptracks_debug -ge 1 ] && echo "Debug|$message Calling ${striptracks_type^} API using $method and URL '$url'$data_info" | log
10081016
if [ "$method" = "GET" ]; then
1009-
method="-G"
1017+
curl_args+=(-G)
10101018
else
1011-
method="-X $method"
1019+
curl_args+=(-X "$method")
10121020
fi
1013-
local curl_cmd="curl -s --fail-with-body -H \"X-Api-Key: $striptracks_apikey\" -H \"Content-Type: application/json\" -H \"Accept: application/json\" ${data:+$data} $method \"$url\""
1014-
[ $striptracks_debug -ge 2 ] && echo "Debug|Executing: $curl_cmd" | sed -E 's/(X-Api-Key: )[^"]+/\1[REDACTED]/' | log
1021+
# Add data arguments and url to curl arguments array
1022+
curl_args+=("${curl_data_args[@]}")
1023+
curl_args+=(--url "$url")
1024+
[ $striptracks_debug -ge 2 ] && echo "Debug|Executing: curl ${curl_args[*]}" | sed -E 's/(X-Api-Key: )[^ ]+/\1[REDACTED]/' | log
10151025
unset striptracks_result
10161026
# (See issue #104)
10171027
declare -g striptracks_result
10181028

10191029
# Retry up to five times if database is locked
10201030
local i=0
10211031
for ((i=1; i <= 5; i++)); do
1022-
striptracks_result=$(eval "$curl_cmd")
1032+
striptracks_result=$(curl "${curl_args[@]}")
10231033
local curl_return=$?
10241034
if [ $curl_return -ne 0 ]; then
1025-
local message=$(echo -e "[$curl_return] curl error when calling: \"$url\"${data:+ with$data}\nWeb server returned: $(echo $striptracks_result | jq -jcM 'if type=="array" then map(.errorMessage) | join(", ") else (if has("title") then "[HTTP \(.status?)] \(.title?) \(.errors?)" elif has("message") then .message else "Unknown JSON format." end) end')" | awk '{print "Error|"$0}')
1035+
local error_message="$(echo $striptracks_result | jq -jcM 'if type=="array" then map(.errorMessage) | join(", ") else (if has("title") then "[HTTP \(.status?)] \(.title) \(.errors?)" elif has("message") then .message else "Unknown JSON format." end) end')"
1036+
local message=$(echo -e "[$curl_return] curl error when calling: \"$url\"$data_info\nWeb server returned: $error_message" | awk '{print "Error|"$0}')
10261037
echo "$message" | log
10271038
echo "$message" >&2
10281039
break
@@ -1133,7 +1144,8 @@ function check_video {
11331144
# Create temporary filename
11341145
local basename="$(basename -- "${striptracks_video}")"
11351146
local fileroot="${basename%.*}"
1136-
export striptracks_tempvideo="$(dirname -- "${striptracks_video}")/$(mktemp -u -- "${fileroot:0:5}.tmp.XXXXXX")"
1147+
# ._ prefixed files are ignored by Radarr/Sonarr (see issues #65 and #115)
1148+
export striptracks_tempvideo="$(dirname -- "${striptracks_video}")/$(mktemp -u -- "._${fileroot:0:5}.tmp.XXXXXX")"
11371149
[ $striptracks_debug -ge 1 ] && echo "Debug|Using temporary file \"$striptracks_tempvideo\"" | log
11381150
}
11391151
function detect_languages {
@@ -1260,7 +1272,6 @@ function detect_languages {
12601272
local message="Warn|No languages found in any profile or custom format. Unable to use automatic language detection."
12611273
echo "$message" | log
12621274
echo "$message" >&2
1263-
change_exit_status 20
12641275
else
12651276
# Final determination of configured languages in profiles or custom formats
12661277
local profileLangNames="$(echo $profileLanguages | jq -crM '[.[].name]')"

0 commit comments

Comments
 (0)