This repository was archived by the owner on Aug 19, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathupdate_meta.sh
More file actions
executable file
·58 lines (52 loc) · 2.12 KB
/
Copy pathupdate_meta.sh
File metadata and controls
executable file
·58 lines (52 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
set -euo pipefail
FILE="meta.json"
if [ ! -f "$FILE" ]; then
echo "❌ $FILE bulunamadı!"
exit 1
fi
TS=$(date -u +"%Y-%m-%dT%H:%M:%S.%7NZ")
NEWVER="${1:-}"
CLEAN="$(mktemp)"
grep -vE '^\s*//' "$FILE" > "$CLEAN"
if command -v jq >/dev/null 2>&1; then
if [ -n "$NEWVER" ]; then
jq --arg ts "$TS" --arg ver "$NEWVER" \
'.timestamp = $ts
| .version = $ver
| .imagePathLinux = ("/var/lib/jellyfin/plugins/JMSFusion_" + $ver + "/icon.png")
| .imagePathWindows = ("%ProgramData%/Jellyfin/Server/plugins/JMSFusion_" + $ver + "/icon.png")' \
"$CLEAN" > "${FILE}.tmp"
else
jq --arg ts "$TS" '.timestamp = $ts' "$CLEAN" > "${FILE}.tmp"
fi
mv "${FILE}.tmp" "$FILE"
else
echo "⚠️ jq yok; sed ile güncelliyorum."
sed -E -i "s#\"timestamp\"\\s*:\\s*\"[^\"]*\"#\"timestamp\": \"$TS\"#g" "$FILE"
if [ -n "$NEWVER" ]; then
sed -E -i "s#\"version\"\\s*:\\s*\"[^\"]*\"#\"version\": \"$NEWVER\"#g" "$FILE" || true
if grep -qE "\"imagePathLinux\"" "$FILE"; then
sed -E -i \
"s#(\"imagePathLinux\"\\s*:\\s*\")/var/lib/jellyfin/plugins/JMSFusion_[^\"]+/icon\\.png(\")#\1/var/lib/jellyfin/plugins/JMSFusion_${NEWVER}/icon.png\2#g" \
"$FILE" || true
else
sed -E -i "s#}\\s*$#,\n \"imagePathLinux\": \"/var/lib/jellyfin/plugins/JMSFusion_${NEWVER}/icon.png\"\n}#g" "$FILE" || true
fi
if grep -qE "\"imagePathWindows\"" "$FILE"; then
sed -E -i \
"s#(\"imagePathWindows\"\\s*:\\s*\")%ProgramData%/Jellyfin/Server/plugins/JMSFusion_[^\"]+/icon\\.png(\")#\1%ProgramData%/Jellyfin/Server/plugins/JMSFusion_${NEWVER}/icon.png\2#g" \
"$FILE" || true
else
sed -E -i "s#}\\s*$#,\n \"imagePathWindows\": \"%ProgramData%/Jellyfin/Server/plugins/JMSFusion_${NEWVER}/icon.png\"\n}#g" "$FILE" || true
fi
fi
fi
rm -f "$CLEAN"
echo "✅ meta.json güncellendi:"
echo " timestamp = $TS"
[ -n "$NEWVER" ] && {
echo " version = $NEWVER"
echo " imagePathLinux = /var/lib/jellyfin/plugins/JMSFusion_${NEWVER}/icon.png"
echo " imagePathWindows= %ProgramData%/Jellyfin/Server/plugins/JMSFusion_${NEWVER}/icon.png"
}