config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit 92bde96aebb733668c4a0d4bebbbd140b6259cfd
parent 4c162c961896b6920cf9696066c5b8eea916ad99
Author: Jacob R. Edwards <n/a>
Date:   Sun,  4 Dec 2022 21:25:30 -0600

Add ap module

This module contains scripts and configuration files for the ap
script. The scripts add an easy way to tag music (using tag), extend
the add and truncate commands to be filesystem aware, and provide
shortcuts to piping shuffling the queue.

Diffstat:
Mlocal/Makefile | 1+
Alocal/ap/config/ap/bin/add | 5+++++
Alocal/ap/config/ap/bin/fs | 21+++++++++++++++++++++
Alocal/ap/config/ap/bin/pipe | 5+++++
Alocal/ap/config/ap/bin/shuffle | 5+++++
Alocal/ap/config/ap/bin/tag | 21+++++++++++++++++++++
Alocal/ap/config/ap/bin/truncate | 4++++
Alocal/ap/config/ap/rc | 1+
8 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/local/Makefile b/local/Makefile @@ -1,6 +1,7 @@ lib = ../lib dest = ${HOME} mods =\ + ap\ awk\ bin\ buf\ diff --git a/local/ap/config/ap/bin/add b/local/ap/config/ap/bin/add @@ -0,0 +1,5 @@ +#!/bin/sh +# Copyright 2022 Jacob R. Edwards +# Shorthand to 'fs add' + +exec ap fs add "$@" diff --git a/local/ap/config/ap/bin/fs b/local/ap/config/ap/bin/fs @@ -0,0 +1,21 @@ +#!/bin/sh +# Copyright 2022 Jacob R. Edwards +# ap add & truncate wrapper +# +# - Directories are recursively searched for files and +# - Paths are made absolute +# +# One caveat is that if arguments are given along with ^, the +# arguments will not be processed. + +test $# -le 1 && + exec apc "${1:?fs requries command}" + +com="$1" +shift + +if test "$(eval echo \$$#)" = '^'; then + root | apc "$com" ^ +else + find "$@" -type f | root | apc "$com" ^ +fi diff --git a/local/ap/config/ap/bin/pipe b/local/ap/config/ap/bin/pipe @@ -0,0 +1,5 @@ +#!/bin/sh +# Copyright 2022 Jacob R. Edwards +# Pipe queue through a command. + +apc list | "$@" | apc truncate ^ diff --git a/local/ap/config/ap/bin/shuffle b/local/ap/config/ap/bin/shuffle @@ -0,0 +1,5 @@ +#!/bin/sh +# Copyright 2022 Jacob R. Edwards +# Shuffle ap queue + +ap pipe shf diff --git a/local/ap/config/ap/bin/tag b/local/ap/config/ap/bin/tag @@ -0,0 +1,21 @@ +#!/bin/sh +# Copyright 2022 Jacob R. Edwards +# Tagging interface + +tag() command tag -a -t "$tags" + +tags="$base"/tags + +com="${1:?No command}" +shift +case "$com" in +(cur|current) apc name | tag "$@" ;; +(show) tag -p "$@" ;; +(load) tag -p "$@" | revf | ap truncate ^ ;; +(*) + echo "usage: tag cur[rent] [tag ...] + tag show [tag ...] + tag load [tag ...] +$1: Unknown command" 1>&2 + exit 1 +esac diff --git a/local/ap/config/ap/bin/truncate b/local/ap/config/ap/bin/truncate @@ -0,0 +1,4 @@ +#!/bin/sh +# Shorthand to 'fs truncate' + +exec ap fs truncate "$@" diff --git a/local/ap/config/ap/rc b/local/ap/config/ap/rc @@ -0,0 +1 @@ +stop