Compare commits

1 Commits
main ... GUI

Author SHA1 Message Date
4d122ee379 Update whit_install.sh 2025-06-03 23:03:35 +00:00
3 changed files with 109 additions and 133 deletions

View File

@@ -1,33 +1,15 @@
# WHIT
Web Hosted Image Technology
Terminal version:
git clone https://git.thefinaldreams.com/Kewitt/WHIT.git
80%
#This is for WHIT 2025.06.04
#---------------------------------------------------------------------------------------------------------------
#Config setting
#supported image formats are jpeg, jpg, png, bmp, other formats can be add but need to modify base code.
#supported Video anything that VLC supports.
#Images are resized to 1080p with black bars on sides or top and bottom.
#Videos work best if they are all the same 1080p videos.
#setup SMB/CIFS share settings.
#Protocal 1 for Windows share, 2 for FTP which using home folder.
#smb SERVER FORMAT //192.168.1.21/share/path
#ftp 192.168.1.21 Broken update coming shortly
protocal=1
Server="//192.168.88.210/whit/tv1"
USERNAME=local.admin
PASSWORD=whitwhit
#how long each picture will be turned into a video for.
time=10
#Use if URL to Image is being used.
#Set content 1 = Video and/or images 2 = Just images 3 = URL and IMAGES info below 4 = Debug
content=1
#If you are setting url you need to add to crontab -e to update the image every 15 mins, and enable urlchrome setting
#Change localhost to the
#sudo crontab -e
#0/15 * * * * "chromium-browser --headless --window-size=1920x1080 --virtual-time-budget=25000 --screenshot=/home/$USER/WHIT/working/calander.png http://localhost"
#urlchrome="chromium-browser --headless --window-size=1920x1080 --virtual-time-budget=25000 --screenshot=/home/$USER/WHIT/working/calander.png http://localhost"
Web Hosted Image Technology
Terminal version:
git clone https://git.thefinaldreams.com/Kewitt/WHIT.git
80%
GUI version:
git clone -b GUI https://git.thefinaldreams.com/Kewitt/WHIT.git ; chmod +x ./WHIT/whit_install.sh ; ./WHIT/whit_install.sh
10%

View File

@@ -17,64 +17,115 @@ Server="//192.168.88.210/whit/tv1"
USERNAME=local.admin
PASSWORD=whitwhit
#how long each picture will be turned into a video for.
time=20
time=10
#Use if URL to Image is being used.
#Set content 1 = Video and/or images 4 = Debug
content=1
#Set content 1 = Video and/or images 2 = Just images 3 = URL and image 4 = Debug
content=2
#
#Update network
export wifiupdate=false
export essid=whit
export wifipassword=whitwhit
export updatehost=whit1
#If you want to control the IP address please use dhcp reservation.
#or manually set it up
#
#
#If you are setting url you need to add to crontab -e to update the image every 15 mins, and enable urlchrome setting
#Change localhost to the
#sudo crontab -e
#0/15 * * * * "chromium-browser --headless --window-size=1920x1080 --virtual-time-budget=25000 --screenshot=/home/$USER/WHIT/working/calander.png http://localhost"
#urlchrome="chromium-browser --headless --window-size=1920x1080 --virtual-time-budget=25000 --screenshot=/home/$USER/WHIT/working/calander.png http://localhost"
#when do you want the reboot to happen, 24 hour clock 0 = midnight
export reboottime=01:50
export overscan=1
export rotation=0
#####PROGRAM DO NOT EDIT########
echo
echo Starting UHI
echo $(date):Starting log file. > /home/$USER/WHIT/config/boot.log
echo $(date): >> /home/$USER/WHIT/config/boot.log
echo
# Function to find the default gateway
find_gateway() {
ip route | awk '/default/ {print $3}'
}
program="cvlc --no-osd --width 1920 --height 1080 --quiet --nooverlay -L /home/$USER/WHIT/config/playlist.xspf"
# Set retry count and interval
MAX_ATTEMPTS=6
INTERVAL=10
attempt=1
echo $program >> /home/$USER/WHIT/config/boot.log
while [ $attempt -le $MAX_ATTEMPTS ]; do
GATEWAY=$(find_gateway)
echo ""
if [ -n "$GATEWAY" ]; then
echo "Detected gateway: $GATEWAY" >> /home/$USER/WHIT/config/boot.log
break
fi
echo "No gateway detected, retrying in $INTERVAL seconds..." >> /home/$USER/WHIT/config/boot.log
sleep $INTERVAL
((attempt++))
done
echo $(date):Starting log file. > /home/$USER/WHIT/config/boot.log
echo $(date):>> /home/$USER/WHIT/config/boot.log
if [ $content = "2" ]; then
program="fbi -noverbose -a -t $time -l /home/$USER/WHIT/config/images"
elif [ $content = "3" ]; then
program="fbi -noverbose --cachemem 1 -a -t $time -l /home/$USER/WHIT/config/images"
elif [ $content = "4" ]; then
program="echo DEBUG"
else
program=kodi
fi
echo >> /home/$USER/WHIT/config/boot.log
echo $(date):Setting up wifi. >> /home/$USER/WHIT/config/boot.log
if $wifiupdate; then
/home/$USER/WHIT/config/wifi.sh
exit
fi
echo
hostname -s
hostname -I
echo ""
echo
echo >> /home/$USER/WHIT/config/boot.log
echo "CHECK protocal: $protocal" >> /home/$USER/WHIT/config/boot.log
if [ $protocal = 1 ]; then
echo $(date):Connecting to cifs share "$Server" to mounting point /mnt/whit >> /home/$USER/WHIT/config/boot.log
sudo mount -t cifs -o username=$USERNAME,password=$PASSWORD $Server /mnt/whit
else
echo $(date):Connecting to ftp share "$Server" to mounting point /mnt/whit >> /home/$USER/WHIT/config/boot.log
sudo curlftpfs -o allow_other $USERNAME:$PASSWORD@$Server /mnt/whit/
echo $(date):Connecting to cifs share "$Server" to mounting point /mnt/whit >> /home/$USER/WHIT/config/boot.log
sudo mount -t cifs -o username=$USERNAME,password=$PASSWORD $Server /mnt/whit
else
echo $(date):Connecting to ftp share $Server to mounting point /mnt/whit >> /home/$USER/WHIT/config/boot.log
sudo curlftpfs -o allow_other $USERNAME:$PASSWORD@$Server /mnt/whit/
fi
echo "====CHECK MOUNT===" >> /home/$USER/WHIT/config/boot.log
sleep 5
if grep -qs '/mnt/whit ' /proc/mounts; then
echo $(date): /mnt/whit mounted correctly. >> /home/$USER/WHIT/config/boot.log
echo $(date): /mnt/whit mounted correctly. >> /home/$USER/WHIT/config/boot.log
else
echo $(date):did not mount /mnt/whit correctly. >> /home/$USER/WHIT/config/boot.log
echo $(date):Starting no mount point. >> /home/$USER/WHIT/config/boot.log
echo $(date):Starting $program >> /home/$USER/WHIT/config/boot.log
clear
$program
exit
echo $(date):Starting no mount point. >> /home/$USER/WHIT/config/boot.log
echo $(date):Starting $program >> /home/$USER/WHIT/config/boot.log
$program
exit
fi
echo "====CHECK DIFFERENCE===" >> /home/$USER/WHIT/config/boot.log
if [ -z "$(diff -q -r /mnt/whit /home/$USER/WHIT/tv)" ]; then
echo >> /home/$USER/WHIT/config/boot.log
echo $(date):No changes found between local copy and network share. >> /home/$USER/WHIT/config/boot.log
echo $(date):Starting $program >>/home/$USER/WHIT/config/boot.log
echo $(date) No difference found. >> /home/$USER/WHIT/config/boot.log
echo Starting $program >> /home/$USER/WHIT/config/boot.log
sudo umount /mnt/whit
clear
$program
exit
echo >> /home/$USER/WHIT/config/boot.log
echo $(date):No changes found between local copy and network share. >> /home/$USER/WHIT/config/boot.log
echo $(date):Starting $program >>/home/$USER/WHIT/config/boot.log
echo $(date) No difference found. >> /home/$USER/WHIT/config/boot.log
echo Starting $program >> /home/$USER/WHIT/config/boot.log
sudo umount /mnt/whit
$program
exit
fi
echo >> /home/$USER/WHIT/config/boot.log
@@ -84,21 +135,20 @@ echo $(date):Coping data from file share to local working folder.>> /home/$USER/
if [ -n "$(ls /mnt/whit/)" ]; then
echo Files found. >> /home/$USER/WHIT/config/boot.log
rsync -avu --delete "/mnt/whit/" "/home/$USER/WHIT/tv/" >> /home/$USER/WHIT/config/boot.log
echo Files found. >> /home/$USER/WHIT/config/boot.log
rsync -avu --delete "/mnt/whit/" "/home/$USER/WHIT/tv/" >> /home/$USER/WHIT/config/boot.log
else
echo $(date):No files found in "'//mnt/whit/'" >> /home/$USER/WHIT/config/boot.log
echo $(date):Starting $program >> /home/$USER/WHIT/config/boot.log
sudo umount /mnt/whit
clear
$program
exit
echo $(date):No files found in "'//mnt/whit/'" >> /home/$USER/WHIT/config/boot.log
echo $(date):Starting $program >> /home/$USER/WHIT/config/boot.log
sudo umount /mnt/whit
$program
exit
fi
echo "====CHECK CLEANUP===" >> /home/$USER/WHIT/config/boot.log
echo >> /home/$USER/WHIT/config/boot.log
echo $(date):Cleaning up working path. >> /home/$USER/WHIT/config/boot.log
rm -v /home/$USER/WHIT/working/* >> /home/$USER/WHIT/config/boot.log
rm -v ~/working/* >> /home/$USER/WHIT/config/boot.log
echo "====COPY CHECK===" >> /home/$USER/WHIT/config/boot.log
echo >> /home/$USER/WHIT/config/boot.log
@@ -115,33 +165,6 @@ find /home/$USER/WHIT/working/ -iname "*.bmp*" >> /home/$USER/WHIT/config/list
cat /home/$USER/WHIT/config/list >> /home/$USER/WHIT/config/boot.log
sort /home/$USER/WHIT/config/list > /home/$USER/WHIT/config/images
echo "====resize imagers with padding===" >> /home/$USER/WHIT/config/boot.log
# Directory containing images
input_dir="/home/$USER/WHIT/tv"
output_dir="/home/$USER/WHIT/working"
# Ensure output directory exists
mkdir -p "$output_dir"
# Loop through all image files in the input directory
for image in "$input_dir"/*.{jpg,jpeg,png,bmp}; do
[ -f "$image" ] || continue # Skip if not a file
filename=$(basename "$image")
output_file="$output_dir/$filename"
# Resize image with padding to fit 1920x1080
convert "$image" -resize 1920x1080^ -gravity center -background black -extent 1920x1080 "$output_file"
echo "Resized: $filename -> $output_file"
done
echo "====ALL IMAGES resize imagers with padding===" >> /home/$USER/WHIT/config/boot.log
echo "CONTENT CHECK:$content" >> /home/$USER/WHIT/config/boot.log
if [ $content = "1" ]; then
echo Processing images ......
@@ -159,36 +182,6 @@ if [ $content = "1" ]; then
done
fi
# Set the folder containing your video files
MEDIA_DIR="/home/$USER/WHIT/working"
PLAYLIST_FILE="/home/$USER/WHIT/config/playlist.xspf"
# Start the playlist XML structure
echo '<?xml version="1.0" encoding="UTF-8"?>' > "$PLAYLIST_FILE"
echo '<playlist version="1" xmlns="http://xspf.org/ns/0/">' >> "$PLAYLIST_FILE"
echo ' <trackList>' >> "$PLAYLIST_FILE"
# Loop through all files and filter for video formats dynamically
for FILE in "$MEDIA_DIR"/*; do
if [ -f "$FILE" ]; then
MIME_TYPE=$(file --mime-type -b "$FILE")
# Check if the MIME type starts with "video/"
if [[ $MIME_TYPE == video/* ]]; then
echo " <track>" >> "$PLAYLIST_FILE"
echo " <location>file://$FILE</location>" >> "$PLAYLIST_FILE"
echo " <title>$(basename "$FILE")</title>" >> "$PLAYLIST_FILE"
echo " </track>" >> "$PLAYLIST_FILE"
fi
fi
done
# Close the playlist XML structure
echo ' </trackList>' >> "$PLAYLIST_FILE"
echo '</playlist>' >> "$PLAYLIST_FILE"
echo "Playlist created: $PLAYLIST_FILE"
if [ $content = "3" ]; then
echo "CONTENT CHECK:$content" >> /home/$USER/WHIT/config/boot.log
$urlchrome

View File

@@ -2,7 +2,7 @@
#install requirements
sudo apt update -y
sudo apt upgrade -y
sudo apt install lftp fbi ffmpeg cifs-utils samba apache2 php libapache2-mod-php vlc imagemagick -y
sudo apt install kodi lftp fbi ffmpeg cifs-utils samba apache2 php libapache2-mod-php -y
current_date=$(date +%Y_%m_%d_%H_%M_%S)
@@ -38,3 +38,4 @@ sed -i "s/#alias l='ls -CF'/alias ll='ls -CFl'/g" /home/$USER/.bashrc
#add configure and run to .bashrc
cat /home/$USER/WHIT/install/bashrcinfo >> /home/$USER/.bashrc