Fix environment variable handling.
authorSteve Youngs <steve@steveyoungs.com>
Wed, 22 Jun 2011 07:25:38 +0000 (17:25 +1000)
committerSteve Youngs <steve@steveyoungs.com>
Wed, 22 Jun 2011 07:25:38 +0000 (17:25 +1000)
* zcdrip.in (_album_to_dir): Take artist name from environment
variable ARTIST if it is set.

* zcdrip.in (prep): Use environment variables ALBUM, GENRE, and
YEAR if they are set.

Signed-off-by: Steve Youngs <steve@steveyoungs.com>
zcdrip.in

index f6897ec..b77e46d 100644 (file)
--- a/zcdrip.in
+++ b/zcdrip.in
@@ -5,7 +5,7 @@
 ## Author:        Steve Youngs <steve@steveyoungs.com>
 ## Maintainer:    Steve Youngs <steve@steveyoungs.com>
 ## Created:       <2006-08-08>
-## Time-stamp:    <Wednesday Jun 22, 2011 13:00:06 steve>
+## Time-stamp:    <Wednesday Jun 22, 2011 16:35:04 steve>
 
 ## Redistribution and use in source and binary forms, with or without
 ## modification, are permitted provided that the following conditions
@@ -553,7 +553,7 @@ cleanup ()
 _album_to_dir ()
 {
     local talbum=$album
-    local tart=$art
+    local tart=${ARTIST:-$art}
     local psub="[[:cntrl:],\`';/\\\\\"]"
     local prep=""
     local wsub="[[:space:][:blank:]]"
@@ -615,6 +615,7 @@ EOF
        $_zedit $rcfile
     fi
 
+    album=${ALBUM:-$album}
     if [[ -z $album ]]; then
        echo -n "Please enter the name of this album: "
        read album
@@ -630,12 +631,14 @@ EOF
        fi
     fi
 
+    year=${YEAR:-$year}
     if [[ -z $year ]]; then
        echo -n "Please enter the year this album was released: "
        read year
        echo
     fi
 
+    genre=${GENRE:-$genre}
     if [[ -z $genre ]]; then
        echo -n "Please enter the genre of this album: "
        read genre