gnump3d-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnump3d-users] Handling the random selection options


From: Stan Mulder
Subject: Re: [Gnump3d-users] Handling the random selection options
Date: Mon, 21 Feb 2005 13:51:02 -0500
User-agent: Mozilla Thunderbird 0.9 (X11/20041127)

Steve Kemp wrote:

On Mon, Feb 21, 2005 at 11:03:30AM -0500, Stuffed Crust wrote:

Honestly the simple solution would be along the lines of:

random_exclude_regexp = (private|trashyPop|demos)

Or we could go fancier and have, say, a tab delimited list of regexps to apply.

 I can't help thinking that this is going to get messy, thinking
of doing this for my personal archive I'd have:

random_exclude = (Spoken/The Hobbit|TV Stuff/Samples/Wav's| .. )

 I find it easier to just reload when this happens although I guess
that I'm alone here!

 How about this?

--- random.pm   2005-02-06 14:07:27.000000000 +0000
+++ random.pm.orig      2005-02-21 17:51:34.000000000 +0000
@@ -380,10 +380,27 @@
    close( FILY );

    # Pick a random line from the database.
-    my $random = $lines[ rand @lines ];
-    if ( $random =~ /([^\t]+)\t(.*)/ )
+    my $random = "";
+
+    #
+    #  Continue choosing a random directory until we find one
+    # that hasn't been explicitly disallowed.
+    #
+    my $excluded = getConfig( "random_exclude_dirs", "" );
+
+    while ( ! length( $random ) )
    {
-       $random = $1;
+        $random = $lines[ rand @lines ];
+       if ( $random =~ /([^\t]+)\t(.*)/ )
+       {
+           $random = $1;
+       }
+
+       #
+       #  If it matches the ignored list then loop to choose
+       # again.
+       #
+       $random = "" if ( $excluded =~ /$random/ ) ;
    }

    #

That patch didn't work for me. It didn't select any directory at all. I'm new to patching though. I applied it to the latest CVS. Is that correct? Then I added a random_exclude_dirs value to /etc/gnump3d/gnump3d.conf. Correct? Then I killed and reloaded gnump3d and tested.

Stan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]