* abcde.conf, abcde, abcde.1
authordata <data@a0fa61bc-5347-0410-a1a9-7f54aa4e1825>
Fri, 30 Jul 2004 15:26:47 +0000 (15:26 +0000)
committerdata <data@a0fa61bc-5347-0410-a1a9-7f54aa4e1825>
Fri, 30 Jul 2004 15:26:47 +0000 (15:26 +0000)
  - 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

Makefile
README
abcde
abcde.1
abcde.conf
debian/changelog
debian/rules
examples/abcde.init [new file with mode: 0644]
examples/abcded [new file with mode: 0644]

index 71d79cd..a4fc2a2 100644 (file)
--- 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 (file)
--- 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 (executable)
--- 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 (file)
--- 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.
index 16da18e..ecd5cd1 100644 (file)
 # * 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.
 #      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:
index a0d1810..51e0ec7 100644 (file)
@@ -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 <jesus.climent@hispalinux.es>  Sat, 10 Jul 2004 10:42:12 -0300
+ -- Jesus Climent <jesus.climent@hispalinux.es>  Fri, 30 Jul 2004 15:14:18 +0300
 
 abcde (2.1.19-1) unstable; urgency=low
 
index 3f517c1..1d96e48 100755 (executable)
@@ -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 (file)
index 0000000..b10fb05
--- /dev/null
@@ -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 (file)
index 0000000..d0ac4bd
--- /dev/null
@@ -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
+