From: data Date: Fri, 30 Jul 2004 15:26:47 +0000 (+0000) Subject: * abcde.conf, abcde, abcde.1 X-Git-Url: https://git.hcoop.net/clinton/abcde.git/commitdiff_plain/7acef70b718082c76c122caae92aadb4bbb55ef1?hp=40c61684c009618f1180fc5e02b6d469a7d4bfb1;ds=sidebyside * abcde.conf, abcde, abcde.1 - Add the mungegenre function and related information - Stars converted to pluses with mungefile * examples/*, README, Makefile, debian/rules - a basic daemon-like shell script to rip automatically when a CD is inserted - a init.d/ script to start the daemon - install the examples inside the tarball - install the examples inside the /usr/share/doc dir in the debian package git-svn-id: http://abcde.googlecode.com/svn/trunk@7 a0fa61bc-5347-0410-a1a9-7f54aa4e1825 --- diff --git a/Makefile b/Makefile index 71d79cd..a4fc2a2 100644 --- a/Makefile +++ b/Makefile @@ -24,5 +24,5 @@ install: tarball: @cd .. && tar czvf abcde_$(VERSION).orig.tar.gz \ - abcde-$(VERSION)/{Makefile,COPYING,README,TODO,FAQ,abcde,abcde.1,abcde.conf,changelog,cddb-tool,cddb-tool.1} + abcde-$(VERSION)/{Makefile,COPYING,README,TODO,FAQ,abcde,abcde.1,abcde.conf,changelog,cddb-tool,cddb-tool.1,examples/} diff --git a/README b/README index 4341fa4..57e2a92 100644 --- a/README +++ b/README @@ -61,6 +61,13 @@ Changes in 2.2-pre2: * Support for keeping an existing playlist (and not add new entries to it), erase the existing one (overwrite) or append new entries to the existing one. +* Under ./examples you will find a very basic way to make abcde run in the + background and start a non-interactive rip of a CD, if it can find an + audio CD in the tray. + The abcded script depends on eject and cdparanoia being installed in your + system. +* New mungegenre function to switch off (or modify) the default behaviour of + transforming uppercase characters to lowercase. Changes in 2.2-pre1: diff --git a/abcde b/abcde index ea84e47..e233a6e 100755 --- a/abcde +++ b/abcde @@ -661,7 +661,7 @@ do_move () ALBUMFILE=$(mungefilename "$DALBUM") ARTISTFILE=$(mungefilename "$TRACKARTIST") TRACKFILE=$(mungefilename "$TRACKNAME") - GENRE=$(echo $CDGENRE | tr "[:upper:]" "[:lower:]") + GENRE=$(mungegenre "$GENRE") YEAR=$(echo $CDYEAR) # If we want to start the tracks with a given number, we need to modify the # TRACKNUM value before evaluation @@ -701,7 +701,7 @@ do_playlist () for LASTTRACK in $TRACKQUEUE; do :; done ALBUMFILE=$(mungefilename "$DALBUM") ARTISTFILE=$(mungefilename "$DARTIST") - GENRE=$(echo $CDGENRE | tr "[:upper:]" "[:lower:]") + GENRE=$(mungegenre "$GENRE") if [ "$VARIOUSARTISTS" = "y" ] ; then PLAYLISTFILE=$(eval echo $VAPLAYLISTFORMAT) else @@ -1767,6 +1767,12 @@ mungefilename () echo "$@" | sed s,:,\ -,g | tr \ /\* __+ | tr -d \'\"\?\[:cntrl:\] } +# Custom genre munging: +mungegenre () +{ + echo $CDGENRE | tr "[:upper:]" "[:lower:]" +} + # pre_read # Empty pre_read function, to be defined in the configuration file. pre_read () diff --git a/abcde.1 b/abcde.1 index 61b88b3..b163e0c 100644 --- a/abcde.1 +++ b/abcde.1 @@ -321,6 +321,17 @@ slash munging (UNIX cannot store a file with a '/' char in it) as well as the control character munging (NULs can't be in a filename either, and newlines and such in filenames are typically not desirable). .TP +.B mungegenre +mungegenre () is a shell function used to modify the $GENRE variable. As +a default action, it takes $GENRE as $1 and outputs the resulting value +to stdout converting all UPPERCASE characters to lowercase. +.TP +.B pre_read +pre_read () is a shell function which is executed before the CDROM is read +for the first time, during abcde execution. It can be used to close the CDROM +tray, to set its speed (via "setcd" or via "eject", if available) and other +preparation actions. The default function is empty. +.TP .B EJECTCD If set to "y", abcde will call eject(1) to eject the cdrom from the drive after all tracks have been read. diff --git a/abcde.conf b/abcde.conf index 16da18e..ecd5cd1 100644 --- a/abcde.conf +++ b/abcde.conf @@ -224,6 +224,7 @@ # * Translate colons to a space and a dash for Windows compatibility # * Eat control characters, single quotes, and question marks # * Translate spaces and forward slashes to underscores +# * Translate stars into pluses. # To change that, redefine the mungefilename function. # mungefilename recieves the CDDB data (artist, track, title, whatever) # as $1 and outputs it on stdout. @@ -232,6 +233,16 @@ # echo "$@" | sed s,:,\ -,g | tr \ /\* __+ | tr -d \'\"\?\[:cntrl:\] #} +# Custom genre munging: +# By default we just transform uppercase to lowercase. Not much of a fancy +# function, with not much use, but one can disable it ot just turn the first +# Uppercase. +#mungegenre () +#{ +# echo $CDGENRE | tr "[:upper:]" "[:lower:]" +#} + + # Custom pre-read function # By default it does nothing. # You can set some things to get abcde funtion in better ways: diff --git a/debian/changelog b/debian/changelog index a0d1810..51e0ec7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -abcde (2.1.20-2.2pre2-1) unstable; urgency=low +abcde (2.1.20-2.2pre2-1) experimental; urgency=low * Added support for MPP/MP+(Musepack) encoding. Although I am trying to get 2.2 for Debian Sarge release, mpc seems safe enough to introduce. See @@ -20,12 +20,14 @@ abcde (2.1.20-2.2pre2-1) unstable; urgency=low * New "0" choice for "None of the above" has been introduced. If selected, a template is created and the user encouraged to edit it (Closes: #147683). * New options for when the PLAYLIST already exists: erase, append or keep. - * Small bug fixes along the code: - - abcde.1 corrections + * Small bug fixes along the code: + - abcde.1 corrections and additions - abcde corrections - abcde.conf additions + * The GENRE is munged now in its own mungegenre function, so that no more + upper-to-lowercase is done (forced) except if the default is used. - -- Jesus Climent Sat, 10 Jul 2004 10:42:12 -0300 + -- Jesus Climent Fri, 30 Jul 2004 15:14:18 +0300 abcde (2.1.19-1) unstable; urgency=low diff --git a/debian/rules b/debian/rules index 3f517c1..1d96e48 100755 --- a/debian/rules +++ b/debian/rules @@ -35,6 +35,8 @@ install-stamp: build-stamp # Add here commands to install the package into debian/tmp. $(MAKE) install DESTDIR=`pwd`/debian/tmp + install -d `pwd`/debian/tmp/usr/share/doc/abcde/examples + install -m 644 examples/* `pwd`/debian/tmp/usr/share/doc/abcde/examples touch install-stamp diff --git a/examples/abcde.init b/examples/abcde.init new file mode 100644 index 0000000..b10fb05 --- /dev/null +++ b/examples/abcde.init @@ -0,0 +1,39 @@ +#!/bin/sh + +########## +# The first argument tells what to do. +########## + +RUNNING=`ps -ef|grep [a]bcded|awk '{ print $2 }'` + +state=$1 + +case $state in +start) + + if [ -n "$RUNNING" ]; then + echo "abcde daemon already running." + exit 0 + fi + + echo "Starting abcde daemon" + abcded & + echo "Done." + ;; +stop) + if [ -n "$RUNNING" ]; then + /bin/kill -9 $RUNNING > /dev/null + if [ $? = 0 ]; then + echo "abcde daemon killed" + fi + fi + ;; +restart) + $0 stop + $0 start + ;; +*) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + diff --git a/examples/abcded b/examples/abcded new file mode 100644 index 0000000..d0ac4bd --- /dev/null +++ b/examples/abcded @@ -0,0 +1,24 @@ +#!/bin/sh +# The first version of this script used a very linux-dependent aproach. +# Modified to use cdparanoia and check for audio files on the CD + +#NOTE! Change the CDROM variable to point to your device. +#CDROM=/proc/ide/hdh +DELAY=10 +DO_RIP="/usr/bin/abcde -x -b -N" +CDPARANOIA="cdparanoia -Q 2>&1 | grep 'audio only'" + +while true; do +# CAPACITY=`cat $CDROM/capacity` +# if [ $CAPACITY -gt 0 ]; then +# $RIP +# fi + + sleep $DELAY + GO=$CDPARANOIA + RET=$? + if [ $RET = "0" ] ; then + DO_RIP + fi +done +