Spaces:
Paused
Paused
Update start.sh
Browse files
start.sh
CHANGED
|
@@ -5,17 +5,17 @@ LIBRARY_FILE=/defaults/library.json
|
|
| 5 |
MEDIA_DIR=/data/media/movies
|
| 6 |
TV_DIR=/data/media/tvshows
|
| 7 |
CONFIG_DIR=/data/config
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
mkdir -p "$MEDIA_DIR" "$TV_DIR" "$CONFIG_DIR"
|
| 10 |
|
| 11 |
# Téléchargement des médias si absents
|
| 12 |
if [ -f "$LIBRARY_FILE" ]; then
|
| 13 |
python3 -c "
|
| 14 |
import json, os, subprocess
|
| 15 |
-
|
| 16 |
with open('$LIBRARY_FILE') as f:
|
| 17 |
data = json.load(f)
|
| 18 |
-
|
| 19 |
for name, url in data.items():
|
| 20 |
dest = os.path.join('$MEDIA_DIR', name + '.' + url.split('.')[-1])
|
| 21 |
if os.path.exists(dest):
|
|
@@ -32,14 +32,32 @@ else
|
|
| 32 |
echo "library.json introuvable, aucun média téléchargé automatiquement."
|
| 33 |
fi
|
| 34 |
|
| 35 |
-
# Ajustement des droits pour l'utilisateur jellyfin (UID
|
| 36 |
chown -R 1000:1000 /data
|
| 37 |
|
| 38 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
exec gosu 1000 /jellyfin/jellyfin \
|
| 40 |
--webdir=/jellyfin/jellyfin-web \
|
| 41 |
--ffmpeg=/usr/lib/jellyfin-ffmpeg/ffmpeg \
|
| 42 |
--datadir="$CONFIG_DIR" \
|
| 43 |
-
--cachedir=
|
| 44 |
-
--logdir=
|
| 45 |
-
--
|
|
|
|
| 5 |
MEDIA_DIR=/data/media/movies
|
| 6 |
TV_DIR=/data/media/tvshows
|
| 7 |
CONFIG_DIR=/data/config
|
| 8 |
+
CACHE_DIR=/data/cache
|
| 9 |
+
LOG_DIR=/data/log
|
| 10 |
|
| 11 |
+
mkdir -p "$MEDIA_DIR" "$TV_DIR" "$CONFIG_DIR" "$CACHE_DIR" "$LOG_DIR"
|
| 12 |
|
| 13 |
# Téléchargement des médias si absents
|
| 14 |
if [ -f "$LIBRARY_FILE" ]; then
|
| 15 |
python3 -c "
|
| 16 |
import json, os, subprocess
|
|
|
|
| 17 |
with open('$LIBRARY_FILE') as f:
|
| 18 |
data = json.load(f)
|
|
|
|
| 19 |
for name, url in data.items():
|
| 20 |
dest = os.path.join('$MEDIA_DIR', name + '.' + url.split('.')[-1])
|
| 21 |
if os.path.exists(dest):
|
|
|
|
| 32 |
echo "library.json introuvable, aucun média téléchargé automatiquement."
|
| 33 |
fi
|
| 34 |
|
| 35 |
+
# Ajustement des droits pour l'utilisateur jellyfin (UID 1000)
|
| 36 |
chown -R 1000:1000 /data
|
| 37 |
|
| 38 |
+
# Création du fichier de configuration Jellyfin si absent
|
| 39 |
+
CONFIG_FILE="$CONFIG_DIR/config/system.xml"
|
| 40 |
+
if [ ! -f "$CONFIG_FILE" ]; then
|
| 41 |
+
echo "Création du fichier de configuration Jellyfin avec le port 7860..."
|
| 42 |
+
mkdir -p "$(dirname "$CONFIG_FILE")"
|
| 43 |
+
cat > "$CONFIG_FILE" <<EOF
|
| 44 |
+
<?xml version="1.0" encoding="utf-8"?>
|
| 45 |
+
<ServerConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
| 46 |
+
<HttpServerPortNumber>7860</HttpServerPortNumber>
|
| 47 |
+
<HttpsPortNumber>8920</HttpsPortNumber>
|
| 48 |
+
<EnableHttps>false</EnableHttps>
|
| 49 |
+
<PublicPort>7860</PublicPort>
|
| 50 |
+
<IsPortAuthorized>true</IsPortAuthorized>
|
| 51 |
+
</ServerConfiguration>
|
| 52 |
+
EOF
|
| 53 |
+
chown 1000:1000 "$CONFIG_FILE"
|
| 54 |
+
fi
|
| 55 |
+
|
| 56 |
+
# Lancement de Jellyfin en mode service, sans argument de port
|
| 57 |
exec gosu 1000 /jellyfin/jellyfin \
|
| 58 |
--webdir=/jellyfin/jellyfin-web \
|
| 59 |
--ffmpeg=/usr/lib/jellyfin-ffmpeg/ffmpeg \
|
| 60 |
--datadir="$CONFIG_DIR" \
|
| 61 |
+
--cachedir="$CACHE_DIR" \
|
| 62 |
+
--logdir="$LOG_DIR" \
|
| 63 |
+
--service
|