--- gnump3d-index.orig 2005-11-13 20:17:59.000000000 +0000 +++ gnump3d-index 2005-11-13 20:19:30.000000000 +0000 @@ -88,7 +88,6 @@ # Global variables. # my $root = "" ; -my $lockfile = "" ; my $cache = "" ; my %cache; @@ -96,13 +95,6 @@ # -# Make sure that signals cause our END segment to run -# so that our lockfile is removed on abnormal termination. -# -use sigtrap qw(die normal-signals error-signals); - - -# # Parse the command line arguments. # &parseArguments(); @@ -134,10 +126,6 @@ { $root = &getConfig( "root", "/home/mp3" ); } -if ( !length( $lockfile ) ) -{ - $lockfile = &getConfig( "lockfile", "/tmp/index.lok" ); -} if ( !length( $cache ) ) { $cache = &getConfig( "tag_cache", "/tmp/tags.cache" ); @@ -164,28 +152,11 @@ # -# Test for a lockfile indicating that we're already running. -# -if ( &lockPresent() ) -{ - print "gnump3d-index appears to be already running.\n"; - print "if this is in error remove the lockfile $lockfile\n"; - exit; -} - - -# -# Create our lock file. -&createLock(); - - -# # Sanity check the code. # if ( ! -e $root ) { print "The server root directory you are trying to index '$root' doesn't exist.\n"; - &removeLock(); exit; } @@ -372,13 +343,6 @@ foreach my $file ( sort @FOUND ) { - # - # Update our progress count every ten tracks. - if ( ( $count % 10 ) == 0 ) - { - &updateLock( $count, $total ); - } - # If we looked for an old cache file, and it existed, we can now # look to see if the mtime in the cache is the same as the mtime # of the file. If they are the same, trust the cache. @@ -475,45 +439,6 @@ close( OUT ); } -# -# Test to see if our lockfile is present. -sub lockPresent( ) -{ - return( -e $lockfile ); -} - -# -# Unconditionally remove our lock file. -sub removeLock( ) -{ - unlink( $lockfile ); -} - -# -# Update our lockfile with the current progress count. -sub updateLock( ) -{ - my ( $cur, $total ) = ( @_ ); - my $PER = ( ( $total - $cur ) / $total ) * 100.0; - if ( $PER =~ /([0-9]+)\.([0-9]+)/ ) - { - $PER = $1; - } - open( LOK, ">$lockfile" ); - print LOK "Processing file $cur of $total ( \%$PER remaining )\n"; - close( LOK ); - -} - -# -# Create our lockfile. -sub createLock( ) -{ - open( LOK, ">>$lockfile" ); - close( LOK ); -} - - # # Parse the command line options. @@ -523,7 +448,6 @@ "config=s", \$CONFIG_FILE, "debug", \$DEBUG, "help", \$SHOW_HELP, - "lock=s", \$lockfile, "output=s", \$cache, "root=s", \$root, "stats", \$SHOW_STATS, @@ -553,7 +477,6 @@ Options: --config file The configuration file to read. --help Show this help. - --lock file Use the given lockfile rather than the default. --output file Write the output to the given file. --root directory Start the indexing at the given directory. --stats Don't update the cache file, just display audio stats. @@ -610,12 +533,3 @@ } close( CACHE ); } - - -# -# This section of code always runs when the script terminates. -# -END -{ - &removeLock(); -}