#!/bin/bash - #=============================================================================== # # FILE: show_queue # # USAGE: ./show_queue # # DESCRIPTION: Show the pending queue, expanding each album's details from # the database. # # / This version calls sqlite3 once and feeds it queries in a loop / # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: Dave Morriss (djm), Dave.Morriss@gmail.com # VERSION: 0.2.1 # CREATED: 2020-09-15 12:38:03 # REVISION: 2021-08-05 16:39:05 # #=============================================================================== set -o nounset # Treat unset variables as an error SCRIPT=${0##*/} #DIR=${0%/*} VERSION='0.2.1' # # Files and directories # BASEDIR="$HOME/MusicDownloads" DATADIR="$BASEDIR/Magnatune_Data" SCRIPTDIR="$BASEDIR/magnatune-downloader" QUEUE="$SCRIPTDIR/pending" DB="$DATADIR/sqlite_normalized.db" # # Sanity checks # [ -e "$QUEUE" ] || { echo "$QUEUE not found"; exit 1; } # # Check the queue contains data # if [[ ! -s $QUEUE ]]; then echo "$SCRIPT($VERSION): there is nothing in the queue" exit fi RE='^http://magnatune.com/artists/albums/([A-Za-z0-9-]+)/?$' # # Template SQL for printf # SQLtemplate=$(cat <&"${dbproc[1]}" done < "$QUEUE" # # Close the input pipe (a file descriptor move documented as '[n]>&digit-' # which "moves the file descriptor digit to file descriptor n, or the standard # output (file descriptor 1) if n is not specified". There is no digit here, # so presumably /nothing/ is being moved to the file descriptor in dbproc[1]. # exec {dbproc[1]}>&- # # Collect everything from the coprocess # cat <&"${dbproc[0]}" # vim: syntax=sh:ts=8:sw=4:ai:et:tw=78:fo=tcrqn21