Compare commits

14 Commits
GUI ... main

Author SHA1 Message Date
730cbd4cac Update config/autostart.sh 2025-07-12 20:09:15 +00:00
a9c7840b7c Update whit_install.sh 2025-07-12 18:54:10 +00:00
c9d496518a Update config/autostart.sh 2025-07-12 18:45:37 +00:00
b774ae72c1 Update config/autostart.sh 2025-07-12 18:41:44 +00:00
b16e7321bd Update README.md 2025-06-04 20:14:05 +00:00
944a7e3b30 Update README.md 2025-06-04 19:58:29 +00:00
12200fc47a Update README.md 2025-06-04 19:47:41 +00:00
b8b620147e Update README.md 2025-06-04 19:46:37 +00:00
17588461cf Update config/autostart.sh 2025-06-04 19:25:54 +00:00
4e0a02fbf5 Update README.md 2025-06-04 19:12:10 +00:00
72798bf62a Update config/autostart.sh 2025-06-04 19:08:15 +00:00
9f3d1ac2eb Update README.md 2025-06-04 19:06:12 +00:00
b215388cbc Merge pull request 'GUI' (#1) from GUI into main
Reviewed-on: #1
2025-06-03 23:01:47 +00:00
58f02132a8 Update whit_install.sh 2025-06-03 22:58:45 +00:00
3 changed files with 133 additions and 109 deletions

View File

@@ -1,15 +1,33 @@
# WHIT # WHIT
Web Hosted Image Technology Web Hosted Image Technology
Terminal version: Terminal version:
git clone https://git.thefinaldreams.com/Kewitt/WHIT.git git clone https://git.thefinaldreams.com/Kewitt/WHIT.git
80% 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.
GUI version: #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
git clone -b GUI https://git.thefinaldreams.com/Kewitt/WHIT.git ; chmod +x ./WHIT/whit_install.sh ; ./WHIT/whit_install.sh
10% #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"

View File

@@ -17,83 +17,29 @@ Server="//192.168.88.210/whit/tv1"
USERNAME=local.admin USERNAME=local.admin
PASSWORD=whitwhit PASSWORD=whitwhit
#how long each picture will be turned into a video for. #how long each picture will be turned into a video for.
time=10 time=20
#Use if URL to Image is being used. #Use if URL to Image is being used.
#Set content 1 = Video and/or images 2 = Just images 3 = URL and image 4 = Debug #Set content 1 = Video and/or images 4 = Debug
content=2 content=1
#
#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######## #####PROGRAM DO NOT EDIT########
echo
echo Starting UHI echo Starting UHI
echo $(date):Starting log file. > /home/$USER/WHIT/config/boot.log
echo
# Function to find the default gateway
find_gateway() {
ip route | awk '/default/ {print $3}'
}
# Set retry count and interval
MAX_ATTEMPTS=6
INTERVAL=10
attempt=1
while [ $attempt -le $MAX_ATTEMPTS ]; do
GATEWAY=$(find_gateway)
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):Starting log file. > /home/$USER/WHIT/config/boot.log
echo $(date): >> /home/$USER/WHIT/config/boot.log echo $(date): >> /home/$USER/WHIT/config/boot.log
if [ $content = "2" ]; then program="cvlc --no-osd --width 1920 --height 1080 --quiet --nooverlay -L /home/$USER/WHIT/config/playlist.xspf"
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 $program >> /home/$USER/WHIT/config/boot.log
echo $(date):Setting up wifi. >> /home/$USER/WHIT/config/boot.log
if $wifiupdate; then echo ""
/home/$USER/WHIT/config/wifi.sh
exit
fi
echo
hostname -s hostname -s
hostname -I hostname -I
echo echo ""
echo >> /home/$USER/WHIT/config/boot.log echo >> /home/$USER/WHIT/config/boot.log
echo "CHECK protocal: $protocal" >> /home/$USER/WHIT/config/boot.log echo "CHECK protocal: $protocal" >> /home/$USER/WHIT/config/boot.log
@@ -101,17 +47,19 @@ if [ $protocal = 1 ]; then
echo $(date):Connecting to cifs share "$Server" to mounting point /mnt/whit >> /home/$USER/WHIT/config/boot.log 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 sudo mount -t cifs -o username=$USERNAME,password=$PASSWORD $Server /mnt/whit
else else
echo $(date):Connecting to ftp share $Server to mounting point /mnt/whit >> /home/$USER/WHIT/config/boot.log 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/ sudo curlftpfs -o allow_other $USERNAME:$PASSWORD@$Server /mnt/whit/
fi fi
echo "====CHECK MOUNT===" >> /home/$USER/WHIT/config/boot.log echo "====CHECK MOUNT===" >> /home/$USER/WHIT/config/boot.log
sleep 5
if grep -qs '/mnt/whit ' /proc/mounts; then 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 else
echo $(date):did not mount /mnt/whit correctly. >> /home/$USER/WHIT/config/boot.log 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 no mount point. >> /home/$USER/WHIT/config/boot.log
echo $(date):Starting $program >> /home/$USER/WHIT/config/boot.log echo $(date):Starting $program >> /home/$USER/WHIT/config/boot.log
clear
$program $program
exit exit
fi fi
@@ -124,6 +72,7 @@ if [ -z "$(diff -q -r /mnt/whit /home/$USER/WHIT/tv)" ]; then
echo $(date) No difference found. >> /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 echo Starting $program >> /home/$USER/WHIT/config/boot.log
sudo umount /mnt/whit sudo umount /mnt/whit
clear
$program $program
exit exit
fi fi
@@ -141,6 +90,7 @@ else
echo $(date):No files found in "'//mnt/whit/'" >> /home/$USER/WHIT/config/boot.log echo $(date):No files found in "'//mnt/whit/'" >> /home/$USER/WHIT/config/boot.log
echo $(date):Starting $program >> /home/$USER/WHIT/config/boot.log echo $(date):Starting $program >> /home/$USER/WHIT/config/boot.log
sudo umount /mnt/whit sudo umount /mnt/whit
clear
$program $program
exit exit
fi fi
@@ -148,7 +98,7 @@ fi
echo "====CHECK CLEANUP===" >> /home/$USER/WHIT/config/boot.log echo "====CHECK CLEANUP===" >> /home/$USER/WHIT/config/boot.log
echo >> /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 echo $(date):Cleaning up working path. >> /home/$USER/WHIT/config/boot.log
rm -v ~/working/* >> /home/$USER/WHIT/config/boot.log rm -v /home/$USER/WHIT/working/* >> /home/$USER/WHIT/config/boot.log
echo "====COPY CHECK===" >> /home/$USER/WHIT/config/boot.log echo "====COPY CHECK===" >> /home/$USER/WHIT/config/boot.log
echo >> /home/$USER/WHIT/config/boot.log echo >> /home/$USER/WHIT/config/boot.log
@@ -165,6 +115,33 @@ find /home/$USER/WHIT/working/ -iname "*.bmp*" >> /home/$USER/WHIT/config/list
cat /home/$USER/WHIT/config/list >> /home/$USER/WHIT/config/boot.log cat /home/$USER/WHIT/config/list >> /home/$USER/WHIT/config/boot.log
sort /home/$USER/WHIT/config/list > /home/$USER/WHIT/config/images 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 echo "CONTENT CHECK:$content" >> /home/$USER/WHIT/config/boot.log
if [ $content = "1" ]; then if [ $content = "1" ]; then
echo Processing images ...... echo Processing images ......
@@ -182,6 +159,36 @@ if [ $content = "1" ]; then
done done
fi 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 if [ $content = "3" ]; then
echo "CONTENT CHECK:$content" >> /home/$USER/WHIT/config/boot.log echo "CONTENT CHECK:$content" >> /home/$USER/WHIT/config/boot.log
$urlchrome $urlchrome

View File

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