summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimmy Keller <tjk@tjkeller.xyz>2022-02-10 15:06:51 -0600
committerTimmy Keller <tjk@tjkeller.xyz>2022-02-10 15:06:51 -0600
commitf010f9b4ef11d3d974ba8d7b8b4b1364e5955d9a (patch)
treef405f8a072735f54777cb36ca67d816cc6492888
parent1ffe58f3ee6eeb2d81729eb7c458a8979eb2df68 (diff)
downloadscripts-f010f9b4ef11d3d974ba8d7b8b4b1364e5955d9a.tar.xz
scripts-f010f9b4ef11d3d974ba8d7b8b4b1364e5955d9a.zip
add music and shows script
-rwxr-xr-xinit/g610bl2
-rwxr-xr-xkeyboard/mounter7
-rwxr-xr-xlaunch/emu21
-rwxr-xr-xlaunch/music28
-rwxr-xr-xlaunch/shows26
5 files changed, 74 insertions, 10 deletions
diff --git a/init/g610bl b/init/g610bl
index 973e31b..9cf38b4 100755
--- a/init/g610bl
+++ b/init/g610bl
@@ -1,2 +1,2 @@
#!/bin/sh
-#g610-led -fx color keys 20 && g610-led -k logo 00
+g610-led -fx color keys 20 && g610-led -k logo 00
diff --git a/keyboard/mounter b/keyboard/mounter
index d45e0b9..49d0b76 100755
--- a/keyboard/mounter
+++ b/keyboard/mounter
@@ -35,6 +35,9 @@ mnt() {
mountout="`$sudo mount $part "$mp" $opts 2>&1`" \
&& $notify "Device Successfully Mounted" "Mounted \"$part\" to \"$mp\"" \
|| $notify "Error Mounting Device \"$part\" to \"$mp\"" "$mountout"
+
+ # Change permissions
+ user=$(whoami) && $doas chown -R $user:$user "$mp"
}
umnt() {
@@ -44,7 +47,7 @@ umnt() {
# Select a partition to unmount
awk_mpname='$2 &&'"!/$excludere/"'{ print $1 " on " substr($0, index($0, $2)) }'
- selpart="$(lsblk -no KNAME,MOUNTPOINT | awk "$awk_mpname" | dmenu -p 'Unmount Partition: ')"
+ selpart="$(lsblk -no KNAME,MOUNTPOINT | awk "$awk_mpname" | dmenu -p 'Unmount Partition: ')" || exit 1
devexist ${part=$(echo "$selpart" | sed 's/^/\/dev\//; s/ .*//')}
mp="$(echo "$selpart" | cut -d' ' -f3-)"
@@ -54,7 +57,7 @@ umnt() {
|| $notify "Error Unmounting Device \"$part\" from \"$mp\"" "$umountout"
# Remove mp directory if it is in mps
- [ "$(echo "$mp" | cut -c1-$(expr `echo $mps | wc -m` - 1))" = $mps ] && rm -rf "$mp"
+ [ "$(dirname "$mp")" = $mps ] && rm -rf "$mp"
}
case $1 in
diff --git a/launch/emu b/launch/emu
index fe17ed7..87c0e2a 100755
--- a/launch/emu
+++ b/launch/emu
@@ -5,37 +5,44 @@ dmenuprompt="dmenu -l 25"
resolution() { cat /sys/class/drm/*/modes | head -1; }
case "$1" in
2600)
- dmenucolors="-nb #111 -nf #e4963c -sb #6c3b17 -sf #fff -nhb #121212 -nhf #fc5231 -shb #804f2d -shf #fc5231"
+ #dmenucolors="-nb #111 -nf #e4963c -sb #6c3b17 -sf #fff -nhb #121212 -nhf #fc5231 -shb #804f2d -shf #fc5231"
+ dmenucolors="-nb #111 -nf #e4963c -sb #6c3b17 -sf #fff"
emulator="stella"
ext=bin
;;
3ds)
- dmenucolors="-nb #111 -nf #888 -sb #999 -sf #F00 -nhb #111 -nhf #fff -shb #999"
+ #dmenucolors="-nb #111 -nf #888 -sb #999 -sf #F00 -nhb #111 -nhf #fff -shb #999"
+ dmenucolors="-nb #111 -nf #888 -sb #999 -sf #F00"
emulator="citra"
ext=3ds
;;
nes)
- dmenucolors="-nb #6d6a6d -nf #fff -sb #dfdcdd -sf #c1121c -nhb #222 -nhf #dc444d -shb #a29fa3 -shf #dc444d"
+ #dmenucolors="-nb #6d6a6d -nf #fff -sb #dfdcdd -sf #c1121c -nhb #222 -nhf #dc444d -shb #a29fa3 -shf #dc444d"
+ dmenucolors="-nb #6d6a6d -nf #fff -sb #dfdcdd -sf #c1121c"
emulator="fceux"
ext=nes
;;
snes)
- dmenucolors="-nb #b2b4b2 -nf #000 -sb #514689 -sf #fff -nhb #707372 -nhf #fff -shb #a7a4e0 -shf #000"
+ #dmenucolors="-nb #b2b4b2 -nf #000 -sb #514689 -sf #fff -nhb #707372 -nhf #fff -shb #a7a4e0 -shf #000"
+ dmenucolors="-nb #b2b4b2 -nf #000 -sb #514689 -sf #fff"
emulator="launch snes"
ext=sfc
;;
n64)
- dmenucolors="-nb #223 -nf #fff -sb #069330 -sf #fff -nhb #c20d02 -nhf #ffc001 -shb #011da9 -shf #ffc001"
+ #dmenucolors="-nb #223 -nf #fff -sb #069330 -sf #fff -nhb #c20d02 -nhf #ffc001 -shb #011da9 -shf #ffc001"
+ dmenucolors="-nb #223 -nf #fff -sb #069330 -sf #fff"
emulator="mupen64plus --fullscreen --gfx mupen64plus-video-glide64mk2 --resolution $(resolution)"
ext=z64
;;
gcn)
- dmenucolors="-nb #4d3b7c -nf #ddd -sb #000 -sf #fff -nhb #4d3b7c -nhf #eba982 -shb #000 -shf #eba982"
+ #dmenucolors="-nb #4d3b7c -nf #ddd -sb #000 -sf #fff -nhb #4d3b7c -nhf #eba982 -shb #000 -shf #eba982"
+ dmenucolors="-nb #4d3b7c -nf #ddd -sb #000 -sf #fff"
emulator="dolphin-emu -b"
ext=iso
;;
nds)
- dmenucolors="-nb #ccc -nf #000 -sb #52398d -sf #fff -nhb #888 -nhf #fff -shb #52398d"
+ #dmenucolors="-nb #ccc -nf #000 -sb #52398d -sf #fff -nhb #888 -nhf #fff -shb #52398d"
+ dmenucolors="-nb #ccc -nf #000 -sb #52398d -sf #fff"
emulator="desmume --3d-engine 2"
ext=nds
;;
diff --git a/launch/music b/launch/music
new file mode 100755
index 0000000..cb78257
--- /dev/null
+++ b/launch/music
@@ -0,0 +1,28 @@
+#!/bin/sh
+albumsdir=/media/4tbhdd/Music
+dmenucolors="-l 25"
+
+playsong() {
+ list="`find $albumsdir -type f -name '*mka' | sort | sed 's/.*\/\(.*\) - \(.*\)\/[0-9]*: \(.*\).mka$/\3\t\1\t\2/' | awk -F '\t' '{ printf "%-120s %-60s %s\n", $1, $2, $3 }'`"
+ selection="`echo "$list" | dmenu $dmenucolors -p 'Song:'`"
+ selection="`echo "$selection" | sed 's/\(.*\) *\(.*\) *\(.*\)/\2 - \3\/[0-9]*: \1-/'`"
+ echo "$selection"
+}
+
+playalbum() {
+ list="`find $albumsdir -type d -mindepth 1 -maxdepth 1 | sort`"
+}
+
+playartist() {
+ list="`find $albumsdir -type d -mindepth 1 -maxdepth 1 | sed 's/ - .*//' | sort | uniq`"
+ artist=
+ list="`find $albumsdir -type d -name "$artist*" | sort`"
+}
+
+playshuffle() {
+ list="`find $albumsdir -type f -name "*mka" | sort -R`"
+}
+
+playsong
+#play="`echo "$list" | grep "$selection"`"
+#echo "$play"
diff --git a/launch/shows b/launch/shows
new file mode 100755
index 0000000..2d964a7
--- /dev/null
+++ b/launch/shows
@@ -0,0 +1,26 @@
+#!/bin/sh
+showsdir=/media/4tbhdd/Videos/Shows
+dmenucolors="-l 25"
+
+playvid() { [ -e "$1" ] && mpv --fullscreen "$1" || exit 1; }
+
+# Select show
+show="`ls "$showsdir" | dmenu $dmenucolors -p "Show:"`" || exit 1
+
+# Select season or special option
+allep="Show All Episodes"
+randep="Play Random Episode"
+season="`echo "$allep\n$randep\n$(ls "$showsdir/$show")" | dmenu $dmenucolors -p "Season:"`" || exit 1
+
+# Select episode
+case "$season" in
+ $allep)
+ ep="$(find "$showsdir/$show" -type f | sort | sed 's/.* \([0-9]*\)\/\(.*\)\.mkv$/S\1E\2/' | dmenu $dmenucolors -p "Episode:")"
+ playvid "$showsdir/$show/$(echo "$ep" | sed 's/^S\([0-9]*\)E/Season \1\//').mkv"
+ ;;
+ $randep) playvid "$(find "$showsdir/$show" -type f | sort -R | head -1)" ;;
+ *)
+ ep="$(ls "$showsdir/$show/$season" | sed 's/\.mkv$//' | dmenu $dmenucolors -p "Episode:")"
+ playvid "$showsdir/$show/$season/$ep.mkv"
+ ;;
+esac