#!/bin/bash # ----------------------- # CONFIGURATION # ----------------------- HLS_DIR="/var/www/videos/hls" TOKENS_DIR="/var/www/videos/hls_tokens" OUTPUT_FILE="/var/www/html/iframes_embed.txt" BASE_URL="https://videos.xslug.com" # Crée le dossier tokens s'il n'existe pas mkdir -p "$TOKENS_DIR" # Fichier temporaire TMP_FILE=$(mktemp) # Fonction pour générer un iframe fixe par vidéo generate_iframe_fixed() { local key="$1" # On prend un hash MD5 du token ou du nom du dossier local hash hash=$(echo -n "$key" | md5sum | awk '{print $1}') echo "" } # ----------------------- # PARCOURS DES DOSSIERS HLS # ----------------------- for dir in "$HLS_DIR"/*; do [ -d "$dir" ] || continue folder=$(basename "$dir") # Vérifie fichiers requis if [[ ! -f "$dir/index.m3u8" || ! -f "$dir/trailer.mp4" || ! -f "$dir/thumbnail.jpg" ]]; then echo "⚠️ Ignoré (fichiers manquants) : $folder" continue fi # Cherche un token existant token="" for link in "$TOKENS_DIR"/*; do [ -L "$link" ] || continue target=$(readlink "$link") if [[ "$target" == "$dir" ]]; then token=$(basename "$link") break fi done # Si aucun token, en créer un if [[ -z "$token" ]]; then token=$(openssl rand -hex 32) ln -s "$dir" "$TOKENS_DIR/$token" echo "✅ Nouveau token créé pour $folder : $token" fi # Génère un iframe fixe basé sur le token iframe=$(generate_iframe_fixed "$token") # Écrit dans le fichier temporaire echo "$folder" >> "$TMP_FILE" echo "$BASE_URL/hls_tokens/$token/trailer.mp4" >> "$TMP_FILE" echo "$BASE_URL/hls_tokens/$token/thumbnail.jpg" >> "$TMP_FILE" echo "$BASE_URL/hls_tokens/$token/index.m3u8" >> "$TMP_FILE" echo "$iframe" >> "$TMP_FILE" echo "" >> "$TMP_FILE" done # Remplace l'ancien fichier et fixe permissions + propriétaire mv "$TMP_FILE" "$OUTPUT_FILE" chown videosftp:videosftp "$OUTPUT_FILE" chmod 644 "$OUTPUT_FILE" echo "🎉 Fichier généré et permissions fixées : $OUTPUT_FILE"
Warning: Cannot modify header information - headers already sent by (output started at /home/xslugcom/public_html/wp-content/plugins/import-videos-html-2.php:1) in /home/xslugcom/public_html/wp-includes/pluggable.php on line 1450

Warning: Cannot modify header information - headers already sent by (output started at /home/xslugcom/public_html/wp-content/plugins/import-videos-html-2.php:1) in /home/xslugcom/public_html/wp-includes/pluggable.php on line 1453