From b63c0b5b1adaec6a4b0ab172faa880c537b2603b Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Thu, 29 Feb 2024 21:42:08 +0000 Subject: [PATCH] add more scripts --- scripts/getvid | 8 ++++++++ scripts/tone | 3 +++ scripts/tones | 3 +++ scripts/usedisk | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ scripts/vplay | 3 +++ scripts/vradio | 3 +++ 6 files changed, 74 insertions(+) create mode 100755 scripts/getvid create mode 100755 scripts/tone create mode 100755 scripts/tones create mode 100755 scripts/usedisk create mode 100755 scripts/vplay create mode 100755 scripts/vradio diff --git a/scripts/getvid b/scripts/getvid new file mode 100755 index 0000000..3b67c79 --- /dev/null +++ b/scripts/getvid @@ -0,0 +1,8 @@ +#!/usr/bin/env zsh + +export URL=$1 +export RES=$2 + +yt-dlp -f 'bv*[height='"$RES"']+ba' "$URL" -o '%(id)s.%(ext)s' +#yt-dlp "$URL" --list-formats + diff --git a/scripts/tone b/scripts/tone new file mode 100755 index 0000000..bf25b09 --- /dev/null +++ b/scripts/tone @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +ffmpeg -f lavfi -i "sine=frequency=$1:duration=$2" $1hz.wav diff --git a/scripts/tones b/scripts/tones new file mode 100755 index 0000000..0d521fd --- /dev/null +++ b/scripts/tones @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +ffmpeg -f lavfi -i "sine=frequency=$1:duration=$2" -ac 2 $1hz-stereo.wav diff --git a/scripts/usedisk b/scripts/usedisk new file mode 100755 index 0000000..7f02532 --- /dev/null +++ b/scripts/usedisk @@ -0,0 +1,54 @@ +#/usr/bin/env bash + +MEDIADIR="/media/gmgauthier" +format=0 # Don't format disk images that already exist + +# get name of freshly created blank disk, or create one +if [ $# -eq 0 ]; then + echo ">>> NEW DISK IS BEING CREATED..." + PREFIX="floppy" + RANDO=$(od -An -N4 -i < /dev/urandom|sed 's/[ -]//g') + DISK="$PREFIX$RANDO" + dd if=/dev/zero of=$DISK.img bs=1k count=1440 + format=1 +else + DISK=$1 + if ! [ -f $DISK.img ]; then + dd if=/dev/zero of=$DISK.img bs=1k count=1440 + format=1 + fi +fi + +# Find the next available loop device on the system +echo ">>> LOOP DEVICE IS BEING IDENTIFIED..." +list=$(losetup -O name|sed 's/\/dev\/loop//g'|sed 's/NAME//g'|sort - --sort=human-numeric) +### listarr=(${(@s: :)list}) # zsh version of the array generator +listarr=($(echo $list | tr " " "\n")) #bash version of array generator +lastdev=${listarr[-1]} +lastdevnum=$((lastdev)) +nextdev=$((lastdevnum+1)) + +# allocate the next available loop device, format the disk, and mount it. +nextdevname="/dev/loop$nextdev" +echo ">>> LOOP DEVICE $nextdevname RESERVED FOR DISK: $DISK.img" + +sudo losetup $nextdevname $DISK.img + +if [ $format -eq 1 ]; then + echo ">>> DISK IMAGE IS RAW AND WILL BE FORMATTED" + sudo mkfs -t vfat $nextdevname +fi + +if ! [ -d $MEDIADIR/$DISK ]; then + echo ">>> MOUNT DIRECTORY NOT FOUND. CREATING DIRECTORY NOW." + sudo mkdir $MEDIADIR/$DISK +fi + +echo ">>> DISK $DISK.img MOUNTING AT LOCATION: $MEDIADIR/$DISK" +sudo mount $DISK.img $MEDIADIR/$DISK + +if [ $format -eq 1 ]; then + echo ">>> DISK INFORMATION BEING COPIED TO $DISK.img" + sudo fdisk -l $nextdevname >> $DISK-fdisk.txt + sudo cp $DISK-fdisk.txt $MEDIADIR/$DISK/$DISK.txt && rm $DISK-fdisk.txt +fi diff --git a/scripts/vplay b/scripts/vplay new file mode 100755 index 0000000..8aa8130 --- /dev/null +++ b/scripts/vplay @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +vlc -Z -L -I ncurses --no-video --recursive expand ~/Music diff --git a/scripts/vradio b/scripts/vradio new file mode 100755 index 0000000..b731979 --- /dev/null +++ b/scripts/vradio @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +vlc -Z -L -I ncurses --no-video --recursive expand ~/Documents/stations.xspf