* Better promps and https in weather-fetch

This commit is contained in:
shockrah 2022-04-13 21:16:03 -07:00
parent 5f4ad1f388
commit 0f392dec09
2 changed files with 14 additions and 11 deletions

23
usm
View File

@ -1,11 +1,13 @@
#!/bin/sh
mntpnt="/mnt"
mntpnt="/media"
# pick out the drive but not sda because thats the main drive
choice=`lsblk -lp | \
grep -e 'part $' -e "part /mnt/*"| \
awk '{print $1, $4}' | \
dmenu -i -p 'Drive to (un)mount'`
dmenu -i -l 10 -p 'Drive to (un)mount'`
# Ignore empty choices and back out
if [ -z "$choice" ]; then exit; fi
dev=`echo $choice | awk '{print $1}'`
@ -13,19 +15,20 @@ name="`basename $dev`"
if [ -z "$dev" ]; then exit; fi
# Check if it's already mounted / something was even picked
if grep -qs "$dev" /proc/mounts;
then
if grep -qs "$dev" /proc/mounts; then
echo "Unmounting mounted device $dev"
# unmount the drive
umount "$HOME/.mounts/$name"
rm -d "$HOME/.mounts/$name"
# check if we still need the .mounts directory or nah
if [ "`ls ~/.mounts/`" ]
then
rm -d ~/.mounts/
umount "$mntpnt/$name"
rm -d "$mntpnt/$name"
# Cleanup the old mount points directory
if [ "`ls $mntpnt`" ]; then
rm -d "$mntpnt"
fi
umount $dev
rm -d "$mntpnt/$name"
else
echo "Mounting unmounted device $dev"
mkdir -p "$mntpnt/$name"
mount "$dev" "$mntpnt/$name"
fi

View File

@ -38,7 +38,7 @@ class Report:
if __name__ == '__main__':
response = requests.get('http://wttr.in/?format=j1')
response = requests.get('https://wttr.in/?format=j1')
if response.status_code == 200:
try: