echo "  ______  _______  _______  ______   _                              ";
echo " / _____)(_______)(_______)(_____ \ | | $(tr -d '\0' </proc/device-tree/model)";
echo "( (____   _  _  _  _   ___  _____) )| |  _____  _   _  _____   ____ ";
echo " \____ \ | ||_|| || | (_  ||  ____/ | | (____ || | | || ___ | / ___)";
echo " _____) )| |   | || |___) || |      | | / ___ || |_| || ____|| |    ";
echo "(______/ |_|   |_| \_____/ |_|       \_)\_____| \__  ||_____)|_|    ";
echo "                                               (____/               ";
echo " "
echo "           ----------- #Device Info# -----------"
echo "HW Model = $(tr -d '\0' </proc/device-tree/model)"
echo "ActiveIP = $(ip addres | grep "inet.*brd" | wc -l) / $(hostname -I)"
echo "MAC Addresses = $(ip -o link show | awk '/link\/ether/ {print $2 "=" $17}' | grep -E '^(eth|enp|eno|wlan)' | tr '\n' ' ')"
#echo " $(hostname -I)"
#echo "Teamviewer ID = $(sudo teamviewer info|grep "TeamViewer ID"|awk '{print $5}')"
echo "Zerotier = $(sudo zerotier-cli info)"
echo "Date Time = $(date)"
echo "HwClock = $(sudo hwclock -r)"
echo "Up time = $(uptime -p)"
#echo "Available Disk Size = $(df -h $rootpath |grep "/dev/mmcblk0p2"|awk '{print $4}')"
echo "$(df -h /)"
#echo "Disk Size = $(df -h | grep /dev/mmcblk1p2)"
playerpath=/home/smg/smgplayer
rootpath=/
echo " "
echo "           ----------- #Player Info# -----------"
playerpath=/home/smg/smgplayer
rootpath=/
echo "$(cat $playerpath/config.ini |grep "deviceID="|awk '{print $1}')"

t1=$(sqlite3 $playerpath/signage.db "select startTime,endTime from TimeExceptions where date('now')>=startDate and date('now')<=endDate;")
t2=$(sqlite3 $playerpath/signage.db "select strftime('%H:%M:%S',starttime),strftime('%H:%M:%S',endtime) from GlobalTimeExceptions where daynumber= strftime('%w',date('now'));")
toplam=$(echo $t1|wc -w)

if [ $toplam -gt 0 ]
then
 echo 'Time Exception = '$t1
else
 echo 'Global Exception = '$t2
fi

echo "Song Count in Files = $(ls -1 $playerpath/files/ |grep mp3 | wc -l)"
echo "Anounce Count in Files = $(ls -1 $playerpath/files/announces/ |grep mp3 | wc -l)"
echo "Downloaded Song Files in DB = $(sqlite3 $playerpath/signage.db "select count(*) from (select distinct Filename from schedules_details where isDownloaded=1)")"
echo "Not Downloaded Song Files in DB = $(sqlite3  $playerpath/signage.db "select count(*) from (select distinct Filename from schedules_details where isDownloaded=0)")"
echo "Downloaded Announce Files in DB = $(sqlite3  $playerpath/signage.db "select count(*) from (select distinct Filename from announces_details where isDownloaded=1)")"
echo "Not Downloaded Announce Files in DB = $(sqlite3  $playerpath/signage.db "select count(*) from (select distinct Filename from announces_details where isDownloaded=0)")"
echo "Last Song = $(sqlite3 $playerpath/logsDB.db "select OriginalName,FileName,PlayDate from logs where musicType=0 order by Playdate desc limit 1")"
echo "Last Announce = $(sqlite3 $playerpath/logsDB.db "select OriginalName,FileName,PlayDate from logs where musicType=1 order by Playdate desc limit 1")"