From 53d9feaab0d8e659c6dd8e5322f0b3086a0fa2a4 Mon Sep 17 00:00:00 2001 From: Botspot Date: Thu, 8 Oct 2020 01:44:13 -0500 Subject: [PATCH] add email checker app --- apps/Email Checker/description | 4 ++ apps/Email Checker/icon-24.png | Bin 0 -> 409 bytes apps/Email Checker/icon-64.png | Bin 0 -> 796 bytes apps/Email Checker/install | 65 +++++++++++++++++++++++++++++++++ apps/Email Checker/uninstall | 18 +++++++++ apps/Email Checker/website | 1 + 6 files changed, 88 insertions(+) create mode 100644 apps/Email Checker/description create mode 100644 apps/Email Checker/icon-24.png create mode 100644 apps/Email Checker/icon-64.png create mode 100755 apps/Email Checker/install create mode 100755 apps/Email Checker/uninstall create mode 100644 apps/Email Checker/website diff --git a/apps/Email Checker/description b/apps/Email Checker/description new file mode 100644 index 0000000..9bad426 --- /dev/null +++ b/apps/Email Checker/description @@ -0,0 +1,4 @@ +Continuously checks for new emails and display a notification if there are any. +When you click install, a window will appear for you to enter the email account's information and the time interval to check. +If you want to change the settings later, just click the Install button again. +Originally adapted from: https://learn.adafruit.com/raspberry-pi-e-mail-notifier-using-leds/python-script diff --git a/apps/Email Checker/icon-24.png b/apps/Email Checker/icon-24.png new file mode 100644 index 0000000000000000000000000000000000000000..ad3bae00254d27b659fa4c1c5c902174d5c0978c GIT binary patch literal 409 zcmV;K0cQS*P)5NXlN z>h%nOZDBG=l2l5a^&7yu8)?z2V|5LHJ!ewUJjs|p0*E}|&5pF_)$UjZz=5U!b!(mj z=<06)S<$Q2?ic{Kg-LCE&%B^LCn4?vnyt10a1~R4R5{W3dhkWM2GpA^1K^%B8Rsg_ zR9;y9ZF??&TBB(IJfiym`R5l@>kR|og`NR2uk28-23u791yHHg4S?tW>`N|Jss`}W zzlG<|3*`}U&$)`+77mm>XIoe~%|FW(yngvtJSV;Z@Fwm2!|SWf00000NkvXXu0mjf D>guyE literal 0 HcmV?d00001 diff --git a/apps/Email Checker/icon-64.png b/apps/Email Checker/icon-64.png new file mode 100644 index 0000000000000000000000000000000000000000..4b3209a6ab88c80a5f7e5af013f67b3d06581a6d GIT binary patch literal 796 zcmV+%1LOROP)3Mc-MWm`^iH!!Q;+|0$cEPu(8;|*XKhG7_nVHk#C7+1%@Gmgh25fK2u{UiAF zlu5HNg))~UFO$emA_Ri_BQGDP=jWhudiMHw{Yb`_=k;U#A3wZL#{7~`01@GEILOoW zpY!SdKFbp(AUt0#m#zlJyE_0wsw7GdAW&j-1W=OVz2PERX9>XDuRp5&`ts(c)Bs*o zYhD4F1;o>|-|ykv1PP@fLFF}i7JmKF$;JL^M)UzQr_-scBW?>kKReL?1q2Okr7Q%3!fC6dd+i*p*#cDy zX!R_g(KKSH6_p!M)%^bMMyF0NNAm$ZLz<;brnD~M$d@F&%7Ix(`H0u-gI=mGFC2t; zmC)&OgXLY$HwDo&535+Zr8*Bntzn0QzI^ug`l1o@!Pm5}G!UVh`GAbRFbE*ILf|Hq zy$BL$U~hlTMwG693Eg3k-sz&K|3Rn~5d;@7j$_&Dvj)1~ z|EE4JH4tey<^!@Eev}pPB5BwUcY>ujr*Q!dR=EdV7_7=CI0L7|PqqK&`W*8CSq?wN#S8<0L5Pmzi@U?VMlSxHVFle=pnPag zRmEbD=ktQDEvL%|^u7zI=R6YI?M6kdu;gv)*z(TVd_YFk2Z&V4dsbd0zv=4BVZH7H znpa}#rjtkQL~Z^~r11eAr=D^{09z&4<6>Spq{e&=?4?DOgzA-e^Z&}qSr7C!!QiPFbu;m au86+^8N_&7tT=lB0000/dev/null 2>&1 ; pwd -P )")")" + +function error { + echo -e "\\e[91m$1\\e[39m" + exit 1 +} + +#use the error function often! +#If a certain command is necessary for installation to continue, then add this to the end of it: +# || error 'reason' +#example below: + +# Get dependencies +#"${DIRECTORY}/pkg-install" "zenity python3-pip" "$(dirname "$0")" || exit 1 +#sudo pip3 install imapclient || error "Failed to install imapclient!" + +output="$(yad --form --center --width=400 --separator='\n' \ + --title="Email Checker Settings" --window-icon="$(dirname "$0")/icon-64.png" \ + --field='IMAP Server:' 'outlook.office365.com' \ + --field='Email:' 'j.allen.marchand@outlook.com' \ + --field='Password:' '' \ + --field='Folder:' 'Inbox' \ + --field='Check interval: (seconds)' '60' \ + --button=OK!${DIRECTORY}/icons/check.png:0)" +button=$? +[ $button -ne 0 ]&&error "User exited." + +echo "Output: ${output}EOO" + +if [ -d ~/raspi-email-checker ];then + gio trash ~/raspi-email-checker + echo -e "\\e[91mWARNING: Moved the raspi-email-checker folder to trash instead of deleting. +The checkmail.py script inside may contain a password!\\e[39m" +fi + +git clone https://github.com/Botspot/raspi-email-checker || error 'Failed to clone repository!' + +#hostname +sed -i "s/hostname2replace/$(echo "$output" | sed "1q;d")/g" ~/raspi-email-checker/checkmail.py + +#email +sed -i "s/email2replace/$(echo "$output" | sed "2q;d")/g" ~/raspi-email-checker/checkmail.py + +#password +sed -i "s/password2replace/$(echo "$output" | sed "3q;d")/g" ~/raspi-email-checker/checkmail.py + +#mailbox +sed -i "s/mailbox2replace/$(echo "$output" | sed "4q;d")/g" ~/raspi-email-checker/checkmail.py + +#checkinterval +sed -i "s/checkinterval2replace/$(echo "$output" | sed "5q;d")/g" ~/raspi-email-checker/checkmail.py + +#run on boot +mkdir -p ~/.config/autostart +echo "[Desktop Entry] +Name=Email Checker +Comment=Displays a pop-up window if your $(echo "$output" | sed "4q;d") folder contains any unread emails. +Exec=sudo python ${HOME}/raspi-email-checker/checkmail.py +X-GNOME-Autostart-enabled=true +Hidden=false +Icon=$(dirname "$0")/icon-64.png +NoDisplay=false" > ~/.config/autostart/checkmail.desktop + diff --git a/apps/Email Checker/uninstall b/apps/Email Checker/uninstall new file mode 100755 index 0000000..e57f67d --- /dev/null +++ b/apps/Email Checker/uninstall @@ -0,0 +1,18 @@ +#!/bin/bash + +DIRECTORY="$(dirname "$(dirname "$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )")")" + +function error { + echo -e "\\e[91m$1\\e[39m" + exit 1 +} + +if [ -d ~/raspi-email-checker ];then + gio trash ~/raspi-email-checker + echo -e "\\e[91mWARNING: Moved the raspi-email-checker folder to trash instead of deleting. +The checkmail.py script inside may contain a password!\\e[39m" +fi + +rm -f ~/.config/autostart/checkmail.desktop + +"${DIRECTORY}/purge-installed" "$(dirname "$0")" || exit 1 diff --git a/apps/Email Checker/website b/apps/Email Checker/website new file mode 100644 index 0000000..8f8138b --- /dev/null +++ b/apps/Email Checker/website @@ -0,0 +1 @@ +https://github.com/Botspot/raspi-email-checker