From 204731c0a69136c9cebcb54f1afecf5145e26bbe Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Thu, 23 May 2024 13:26:22 +0200 Subject: refactor(pkgs): Categorize into `by-name` shards This might not be the perfect way to organize a package set -- especially if the set is not nearly the size of nixpkgs -- but it is _at_ least a way of organization. --- pkgs/sources/scripts/source/wrappers/battery.sh | 11 -------- pkgs/sources/scripts/source/wrappers/hibernate.sh | 15 ---------- pkgs/sources/scripts/source/wrappers/ll.sh | 14 ---------- pkgs/sources/scripts/source/wrappers/lock.sh | 18 ------------ pkgs/sources/scripts/source/wrappers/lyrics.sh | 11 -------- pkgs/sources/scripts/source/wrappers/mpc-fav.sh | 16 ----------- pkgs/sources/scripts/source/wrappers/mpc-rm.sh | 10 ------- pkgs/sources/scripts/source/wrappers/mpc.sh | 20 ------------- pkgs/sources/scripts/source/wrappers/show.sh | 9 ------ pkgs/sources/scripts/source/wrappers/sort_song.sh | 34 ----------------------- pkgs/sources/scripts/source/wrappers/virsh-del.sh | 10 ------- pkgs/sources/scripts/source/wrappers/yti.sh | 33 ---------------------- 12 files changed, 201 deletions(-) delete mode 100755 pkgs/sources/scripts/source/wrappers/battery.sh delete mode 100755 pkgs/sources/scripts/source/wrappers/hibernate.sh delete mode 100755 pkgs/sources/scripts/source/wrappers/ll.sh delete mode 100755 pkgs/sources/scripts/source/wrappers/lock.sh delete mode 100755 pkgs/sources/scripts/source/wrappers/lyrics.sh delete mode 100755 pkgs/sources/scripts/source/wrappers/mpc-fav.sh delete mode 100755 pkgs/sources/scripts/source/wrappers/mpc-rm.sh delete mode 100755 pkgs/sources/scripts/source/wrappers/mpc.sh delete mode 100755 pkgs/sources/scripts/source/wrappers/show.sh delete mode 100755 pkgs/sources/scripts/source/wrappers/sort_song.sh delete mode 100755 pkgs/sources/scripts/source/wrappers/virsh-del.sh delete mode 100755 pkgs/sources/scripts/source/wrappers/yti.sh (limited to 'pkgs/sources/scripts/source/wrappers') diff --git a/pkgs/sources/scripts/source/wrappers/battery.sh b/pkgs/sources/scripts/source/wrappers/battery.sh deleted file mode 100755 index e650ba5d..00000000 --- a/pkgs/sources/scripts/source/wrappers/battery.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -capacity="$(cat /sys/class/power_supply/BAT0/capacity)" -status="$(cat /sys/class/power_supply/BAT0/status)" - -printf "%s%% (%s)\n" "$capacity" "$status" - -# vim: ft=sh diff --git a/pkgs/sources/scripts/source/wrappers/hibernate.sh b/pkgs/sources/scripts/source/wrappers/hibernate.sh deleted file mode 100755 index 30868fd1..00000000 --- a/pkgs/sources/scripts/source/wrappers/hibernate.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -context="$(task _get rc.context)" -[ "$context" ] && task context none - -# We have ensured that only one task is active -active="$(task +ACTIVE _ids)" -[ "$active" ] && task stop "$active" - -systemctl hibernate "$@" - -# vim: ft=sh diff --git a/pkgs/sources/scripts/source/wrappers/ll.sh b/pkgs/sources/scripts/source/wrappers/ll.sh deleted file mode 100755 index f689ba44..00000000 --- a/pkgs/sources/scripts/source/wrappers/ll.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -last_directory="$(mktemp)" - -command lf -last-dir-path="$last_directory" "$@" - -dir="$(cat "$last_directory")" -cd "$dir" || die "$dir does not exist!" -rm "$last_directory" - -# vim: ft=sh diff --git a/pkgs/sources/scripts/source/wrappers/lock.sh b/pkgs/sources/scripts/source/wrappers/lock.sh deleted file mode 100755 index 3101ef9a..00000000 --- a/pkgs/sources/scripts/source/wrappers/lock.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -context="$(task _get rc.context)" -[ "$context" ] && task context none - -# We have ensured that only one task is active -active="$(task +ACTIVE _ids)" -[ "$active" ] && task stop "$active" - -swaylock - -[ "$active" ] && task start "$active" - -[ "$context" ] && task context "$context" -# vim: ft=sh diff --git a/pkgs/sources/scripts/source/wrappers/lyrics.sh b/pkgs/sources/scripts/source/wrappers/lyrics.sh deleted file mode 100755 index 02a147c8..00000000 --- a/pkgs/sources/scripts/source/wrappers/lyrics.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -( - cd "$XDG_MUSIC_DIR" || die "No music dir!" - exiftool "$(mpc --format '%file%' current)" -json | jq '.[0].Lyrics' -r | less -) - -# vim: ft=sh diff --git a/pkgs/sources/scripts/source/wrappers/mpc-fav.sh b/pkgs/sources/scripts/source/wrappers/mpc-fav.sh deleted file mode 100755 index 795a4875..00000000 --- a/pkgs/sources/scripts/source/wrappers/mpc-fav.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -FAV_DIR="$XDG_MUSIC_DIR/playlists/favourites" - -cd "$XDG_MUSIC_DIR" || die "No music dir!" - -[ -d "$FAV_DIR" ] || mkdir --parents "$FAV_DIR" - -ln -sr "$(mpc --format '%file%' current)" "$FAV_DIR/" || die "Link failed!" - -mpc update - -# vim: ft=sh diff --git a/pkgs/sources/scripts/source/wrappers/mpc-rm.sh b/pkgs/sources/scripts/source/wrappers/mpc-rm.sh deleted file mode 100755 index 94e0634b..00000000 --- a/pkgs/sources/scripts/source/wrappers/mpc-rm.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -cd "$XDG_MUSIC_DIR" || die "No music dir!" -trash-put "$(mpc --format '%file%' current)" -mpc del 0 - -# vim: ft=sh diff --git a/pkgs/sources/scripts/source/wrappers/mpc.sh b/pkgs/sources/scripts/source/wrappers/mpc.sh deleted file mode 100755 index 5aae5cdb..00000000 --- a/pkgs/sources/scripts/source/wrappers/mpc.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -case "$1" in -"rm") - shift 1 - mpc-rm "$@" - ;; -"fav") - shift 1 - mpc-fav "$@" - ;; -*) - mpc "$@" - ;; -esac - -# vim: ft=sh diff --git a/pkgs/sources/scripts/source/wrappers/show.sh b/pkgs/sources/scripts/source/wrappers/show.sh deleted file mode 100755 index ae2bdb13..00000000 --- a/pkgs/sources/scripts/source/wrappers/show.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# Maybe add `--quit-if-one-screen` -less --redraw-on-quit "$@" - -# vim: ft=sh diff --git a/pkgs/sources/scripts/source/wrappers/sort_song.sh b/pkgs/sources/scripts/source/wrappers/sort_song.sh deleted file mode 100755 index e2978507..00000000 --- a/pkgs/sources/scripts/source/wrappers/sort_song.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -case "$("$1" | tr '[:upper:]' '[:lower:]')" in -"lyrics") - filter="LYRICS" - directory="lyrics" - ;; -"instrumental") - filter="INSTRUMENTAL" - directory="instrumental" - ;; -*) - die "Expected 'instrumental|lyrics' but got '$1'" - ;; -esac - -process() { - mediainfo --Output=JSON "$1" | jq '.media.track | map(.Lyrics) | join("")' -} - -mkdir "../$directory" - -fd . --extension=opus | while read -r file; do - if [ "$(process "$file")" = '""' ] || [ "$(process "$file")" = '"Instrumental"' ] || [ "$(process "$file")" = '"instrumental"' ]; then - echo "INSTRUMENTAL::$file" - else - echo "LYRICS::$file" - fi -done | grep "$filter" | awk 'BEGIN {FS="::"}{print $2}' | while read -r file; do ln -s "../all/$file" "../$directory/$file"; done - -# vim: ft=sh diff --git a/pkgs/sources/scripts/source/wrappers/virsh-del.sh b/pkgs/sources/scripts/source/wrappers/virsh-del.sh deleted file mode 100755 index c3de5484..00000000 --- a/pkgs/sources/scripts/source/wrappers/virsh-del.sh +++ /dev/null @@ -1,10 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -virsh destroy "$1" -virsh undefine "$1" --nvram -virsh vol-delete --pool default "$1".qcow2 - -# vim: ft=sh diff --git a/pkgs/sources/scripts/source/wrappers/yti.sh b/pkgs/sources/scripts/source/wrappers/yti.sh deleted file mode 100755 index a69ffa74..00000000 --- a/pkgs/sources/scripts/source/wrappers/yti.sh +++ /dev/null @@ -1,33 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -DOWN_DIR=/home/soispha/media/music/down/youtube - -tmp=$(mktmp) -config=$(mktmp) - -for e in "$DOWN_DIR"/*.opus; do echo "$e" >>"$tmp"; done -[ "$(wc -l "$tmp" | awk '{print $1}')" -gt 2 ] && die "something is already downloaded" - -cat <"$config" ---paths home:"$DOWN_DIR" -#--output %(fulltitle) ---restrict-filenames ---no-overwrites ---no-write-info-json ---clean-info-json ---prefer-free-formats -#--format mp3 ---extract-audio ---audio-quality 0 ---audio-format best -EO - -rm "$DOWN_DIR/yt-dlp.log" -cd "$DOWN_DIR" || die "BUG: no $DOWN_DIR" - -unbuffer yt-dlp --config-location "$config" "$1" | tee "$DOWN_DIR/yt-dlp.log" - -# vim: ft=sh -- cgit 1.4.1