#!/bin/sh # # This is an example of a pre-conversion hook. This script is always invoked # with /bin/sh (shebang ignored). # # The first parameter is the full path where the video will be converted. # # The second parameter is the full path to the source file. # # The third argument is the name of the HandBrake preset that will be used to # convert the video. # CONVERTED_FILE="$1" SOURCE_FILE="$2" PRESET="$3" echo "★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ PRE CONVERSION >>>" echo "pre-conversion: Output File = $CONVERTED_FILE" echo "pre-conversion: Source File = $SOURCE_FILE" echo "pre-conversion: Preset = $PRESET" # Get server hostname HOST=$(echo "$HOST") # Get instance name INSTANCE=$(echo "$INSTANCE") # Get public IP address CONTAINER=$(hostname) # Get current time in ISO format CURRENT_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") # Extract filename from SOURCE_FILE FILENAME=$(basename "$SOURCE_FILE") # Extract preset name from PRESET PRESET_NAME=$(basename "$PRESET") # Extract source size in MB and append ' MB' SOURCE_SIZE_MB="$(expr $(stat -c %s "$SOURCE_FILE") / 1024 / 1024)" # Write CSV line to 'stat' file (do not print size) echo -e "$HOST\n$INSTANCE\n$CONTAINER\n$CURRENT_TIME\n$FILENAME\n$PRESET_NAME\n$SOURCE_SIZE_MB" > /config/stat echo "★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ <<< PRE CONVERSION"