1234567891011121314151617181920212223242526 |
- #!/bin/bash
- exec >> /home/dietpi/mount.log 2>&1
- export LC_ALL=en_GB.utf-8
- export LANG=en_GB.utf-8
- echo "$(date) Start."
- echo "$(date) Media change detected on device $1"
- device=${1##*/}
- lsblk | grep $device
- if [ $? -eq 0 ]; then
- echo "$(date) Device exists on machine."
- echo "$(date) Mounting device $1 to /mnt/floppy."
- /usr/bin/systemd-mount --umount /mnt/floppy
- echo "$(date) Floppy unmounted"
- /usr/bin/systemd-mount $1 /mnt/floppy
- echo "$(date) Floppy mounted"
- var=$(cat /mnt/floppy/diskplayer.contents)
- echo python3 /home/pi/pythonDiskPlayer/player.py \"$var\"
- runuser -l dietpi -c "python3 /home/dietpi/floppy-ytube-player/main.py \"$var\""
- else
- echo "$(date) Device does not exist on machine."
- runuser -l dietpi -c "python3 /home/dietpi/floppy-ytube-player/main.py stop"
- fi
- echo "$(date) End."
|