Discussion:
Modified info functions (for searching)
dean blackketter
2002-02-25 16:23:09 UTC
Permalink
The lookups aren't case sensitive anymore (there's a /i on the regexp).
This really only comes in on genres. Even though I have a "Rock" and a
"rock" genre in the genre list, they both return the exact same thing.
Maybe sortuniq should throw out same case items too, so it'll only be listed
once?
Yes, it should be made case insensitive.

-dean

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Sponsored by VeriSign - The Value of Trust
Do you need to encrypt all your online transactions? Find
the perfect solution in this FREE Guide from VeriSign.
http://us.click.yahoo.com/vCuuSA/UdiDAA/yigFAA/rIp0lB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
slimp3-dev-unsubscribe-***@public.gmane.org



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
dean blackketter
2003-02-22 12:54:10 UTC
Permalink
<!doctype html public "-//W3C//DTD W3 HTML//EN">
<head><style type="text/css"><!--
blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 }
--></style><title>Re: [slimp3-dev] Modified info functions (for
searchin</title></head><body>
<blockquote type="cite" cite>One other slight thing (real this
time!):<br>
<br>
The lookups aren't case sensitive anymore (there's a /i on the
regexp).<br>
This really only comes in on genres.&nbsp; Even though I have a
&quot;Rock&quot; and a<br>
&quot;rock&quot; genre in the genre list, they both return the exact
same thing.<br>
Maybe sortuniq should throw out same case items too, so it'll only be
listed</blockquote>
<blockquote type="cite" cite>once?</blockquote>
<div><br></div>
<div>Yes, it should be made case insensitive.</div>
<div><br></div>
<div>-dean</div>
</body>
</html>
Robert Moser II
2002-02-25 05:10:35 UTC
Permalink
It may also not have been done building the genre cache. Although I would
have thought it would have added all the songs from an album at the same time.

Oh well, at least it fixed itself.
Nevermind, it fixed itself. Stupid database must have got corrupted.
Scott
----- Original Message -----
Sent: Sunday, February 24, 2002 11:53 PM
Subject: Re: [slimp3-dev] Modified info functions (for searching)
(Damn, not fast enough.)
I think it breaks something. :(
I put this on my system, and I navigated thru the web interface to an
album.
Well, the actual results I get back are incomplete. For instance, I only
have 4 tracks listed on a 10 item CD. Robert, can you check this case on
yours?
Scott
----- Original Message -----
Sent: Sunday, February 24, 2002 11:43 PM
Subject: Re: [slimp3-dev] Modified info functions (for searching)
Sounds good to me, as long as it doesn't break anything.
With respect to performance, we'll have to see how fast it is. Even
if it's in memory, I want to search progressively as you enter
characters, so the search for, say, a particular song through _all_
songs should complete nearly instantaneously.
-dean
That wasn't too hard to fix. Should I go ahead and check the filter
stuff in?
So the only character that would need to be escaped would be *,
right?
Duh, I just realized you meant a literal * would need to be escaped.
Well,
I'd have to make a little change there. As it is now, I believe that
if
you sent in an escaped * you would end up matching 0 or more .s
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Tiny Wireless Camera under $80!
Order Now! FREE VCR Commander!
Click Here - Only 1 Day Left!
http://us.click.yahoo.com/nuyOHD/7.PDAA/yigFAA/rIp0lB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
slimp3-dev-unsubscribe-***@public.gmane.org



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Robert Moser II
2002-02-25 05:06:51 UTC
Permalink
What path did you use to get there? (browse by genre, bb artist, or bb album)
The exact text of the steps, plus all the titles of the songs (and which
are missing and which not) would be helpful.

I haven't seen any missing songs yet. (I even get all the albums for
"Babes In Toyland" and "Babes in Toyland" appearing in both locations and
working from either.
(Damn, not fast enough.)
I think it breaks something. :(
I put this on my system, and I navigated thru the web interface to an album.
Well, the actual results I get back are incomplete. For instance, I only
have 4 tracks listed on a 10 item CD. Robert, can you check this case on
yours?
Scott
----- Original Message -----
Sent: Sunday, February 24, 2002 11:43 PM
Subject: Re: [slimp3-dev] Modified info functions (for searching)
Sounds good to me, as long as it doesn't break anything.
With respect to performance, we'll have to see how fast it is. Even
if it's in memory, I want to search progressively as you enter
characters, so the search for, say, a particular song through _all_
songs should complete nearly instantaneously.
-dean
That wasn't too hard to fix. Should I go ahead and check the filter
stuff in?
So the only character that would need to be escaped would be *,
right?
Duh, I just realized you meant a literal * would need to be escaped.
Well,
I'd have to make a little change there. As it is now, I believe that if
you sent in an escaped * you would end up matching 0 or more .s
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Sponsored by VeriSign - The Value of Trust
When building an e-commerce site, you want to start with a
secure foundation. Learn how with VeriSign's FREE Guide.
http://us.click.yahoo.com/oCuuSA/XdiDAA/yigFAA/rIp0lB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
slimp3-dev-unsubscribe-***@public.gmane.org



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Scott McIntyre
2002-02-25 05:01:12 UTC
Permalink
One other slight thing (real this time!):

The lookups aren't case sensitive anymore (there's a /i on the regexp).
This really only comes in on genres. Even though I have a "Rock" and a
"rock" genre in the genre list, they both return the exact same thing.
Maybe sortuniq should throw out same case items too, so it'll only be listed
once?

Scott


----- Original Message -----
From: "Robert Moser II" <rlmoser-***@public.gmane.org>
To: <slimp3-dev-***@public.gmane.org>
Sent: Sunday, February 24, 2002 6:10 PM
Subject: Re: [slimp3-dev] Modified info functions (for searching)
I did some testing, and the songs() function wasn't working as desired
(mainly due to me not looking at what the genreCache structure was like)
Here is an additional function and a corrected songs() which do work. I'd
like some comments before I check it in.
sub filterHashByValue {
if (!defined($hashref)) {
return;
}
if (!defined($pattern) || $pattern eq '*') {
return keys %{$hashref};
}
#the following transformations assume that the pattern provided uses * to
indicate
#matching any character 0 or more times, and that . ^ and $ are not
escaped
$pattern =~ s/\(\?\{.*\}\)//g; #strip executables from $pattern
$pattern =~ s/(\.|\^|\$)/\\$1/g; #escape ., ^ and $ in $pattern
$pattern =~ s/^(.*)$/\^$1\$/; #add beginning and end of string
requirements
$pattern =~ s/\*/\.\*/g; #use the regex for matching any character 0 or
more times
my $regexpattern = qr/$pattern/i; #compiles the regex for multiple uses
(case insensitive)
my ($k,$v);
while (($k,$v) = each %{$hashref}) {
if ($v =~ $regexpattern) {
}
}
}
sub songs {
my $genre = shift;
my $artist = shift;
my $album = shift;
my $track = shift;
$::d_f && print "songs: $genre - $artist - $album - $track\n" ;
foreach my $g (filter($genre,keys %genreCache)) {
foreach my $art (filter($artist,keys %{$genreCache{$g}})) {
foreach my $alb (filter($album,keys %{$genreCache{$g}{$art}})) {
my %songs = ();
foreach my $trk (values %{$genreCache{$g}{$art}{$alb}}) {
$songs{$trk} = title($trk);
}
}
}
}
}
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Sponsored by VeriSign - The Value of Trust
Do you need to encrypt all your online transactions? Find
the perfect solution in this FREE Guide from VeriSign.
http://us.click.yahoo.com/jWSNbC/UdiDAA/yigFAA/rIp0lB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
slimp3-dev-unsubscribe-***@public.gmane.org



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Scott McIntyre
2002-02-25 04:57:56 UTC
Permalink
Nevermind, it fixed itself. Stupid database must have got corrupted.

Scott

----- Original Message -----
From: "Scott McIntyre" <scott-***@public.gmane.org>
To: <slimp3-dev-***@public.gmane.org>
Sent: Sunday, February 24, 2002 11:53 PM
Subject: Re: [slimp3-dev] Modified info functions (for searching)
(Damn, not fast enough.)
I think it breaks something. :(
I put this on my system, and I navigated thru the web interface to an
album.
Well, the actual results I get back are incomplete. For instance, I only
have 4 tracks listed on a 10 item CD. Robert, can you check this case on
yours?
Scott
----- Original Message -----
Sent: Sunday, February 24, 2002 11:43 PM
Subject: Re: [slimp3-dev] Modified info functions (for searching)
Sounds good to me, as long as it doesn't break anything.
With respect to performance, we'll have to see how fast it is. Even
if it's in memory, I want to search progressively as you enter
characters, so the search for, say, a particular song through _all_
songs should complete nearly instantaneously.
-dean
That wasn't too hard to fix. Should I go ahead and check the filter
stuff in?
So the only character that would need to be escaped would be *,
right?
Duh, I just realized you meant a literal * would need to be escaped.
Well,
I'd have to make a little change there. As it is now, I believe that
if
you sent in an escaped * you would end up matching 0 or more .s
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Sponsored by VeriSign - The Value of Trust
When building an e-commerce site, you want to start with a
secure foundation. Learn how with VeriSign's FREE Guide.
http://us.click.yahoo.com/kWSNbC/XdiDAA/yigFAA/rIp0lB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
slimp3-dev-unsubscribe-***@public.gmane.org



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Scott McIntyre
2002-02-25 04:53:10 UTC
Permalink
(Damn, not fast enough.)

I think it breaks something. :(

I put this on my system, and I navigated thru the web interface to an album.
Well, the actual results I get back are incomplete. For instance, I only
have 4 tracks listed on a 10 item CD. Robert, can you check this case on
yours?

Scott

----- Original Message -----
From: "dean blackketter" <dean-qV/***@public.gmane.org>
To: <slimp3-dev-***@public.gmane.org>
Sent: Sunday, February 24, 2002 11:43 PM
Subject: Re: [slimp3-dev] Modified info functions (for searching)
Sounds good to me, as long as it doesn't break anything.
With respect to performance, we'll have to see how fast it is. Even
if it's in memory, I want to search progressively as you enter
characters, so the search for, say, a particular song through _all_
songs should complete nearly instantaneously.
-dean
That wasn't too hard to fix. Should I go ahead and check the filter
stuff in?
So the only character that would need to be escaped would be *,
right?
Duh, I just realized you meant a literal * would need to be escaped.
Well,
I'd have to make a little change there. As it is now, I believe that if
you sent in an escaped * you would end up matching 0 or more .s
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Sponsored by VeriSign - The Value of Trust
When building an e-commerce site, you want to start with a
secure foundation. Learn how with VeriSign's FREE Guide.
http://us.click.yahoo.com/kWSNbC/XdiDAA/yigFAA/rIp0lB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
slimp3-dev-unsubscribe-***@public.gmane.org



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
dean blackketter
2002-02-25 04:43:41 UTC
Permalink
Sounds good to me, as long as it doesn't break anything.

With respect to performance, we'll have to see how fast it is. Even
if it's in memory, I want to search progressively as you enter
characters, so the search for, say, a particular song through _all_
songs should complete nearly instantaneously.

-dean
That wasn't too hard to fix. Should I go ahead and check the filter stuff in?
So the only character that would need to be escaped would be *, right?
Duh, I just realized you meant a literal * would need to be escaped. Well,
I'd have to make a little change there. As it is now, I believe that if
you sent in an escaped * you would end up matching 0 or more .s
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Sponsored by VeriSign - The Value of Trust
When building an e-commerce site, you want to start with a
secure foundation. Learn how with VeriSign's FREE Guide.
http://us.click.yahoo.com/oCuuSA/XdiDAA/yigFAA/rIp0lB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
slimp3-dev-unsubscribe-***@public.gmane.org



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Robert Moser II
2002-02-25 04:33:31 UTC
Permalink
That wasn't too hard to fix. Should I go ahead and check the filter stuff in?
So the only character that would need to be escaped would be *, right?
Duh, I just realized you meant a literal * would need to be escaped. Well,
I'd have to make a little change there. As it is now, I believe that if
you sent in an escaped * you would end up matching 0 or more .s
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Sponsored by VeriSign - The Value of Trust
Pinpoint the right security solution for your company - FREE
Guide from industry leader VeriSign gives you all the facts.
http://us.click.yahoo.com/lWSNbC/WdiDAA/yigFAA/rIp0lB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
slimp3-dev-unsubscribe-***@public.gmane.org



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
dean blackketter
2003-02-22 12:54:18 UTC
Permalink
<!doctype html public "-//W3C//DTD W3 HTML//EN">
<head><style type="text/css"><!--
blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 }
--></style><title>Re: [slimp3-dev] Modified info functions (for
searchin</title></head><body>
<div>Sounds good to me, as long as it doesn't break anything.</div>
<div><br></div>
<div>With respect to performance, we'll have to see how fast it is.&nbsp;
Even if it's in memory, I want to search progressively as you enter
characters, so the search for, say, a particular song through _all_
songs should complete nearly instantaneously.</div>
<div><br></div>
<div>-dean</div>
<div><br></div>
<div><br></div>
<blockquote type="cite" cite>That wasn't too hard to fix.&nbsp; Should
I go ahead and check the filter stuff in?<br>
At 07:51 PM 2/24/02 -0800, you wrote:<br>
<br>
&gt; &gt; &gt;So the only character that would need to be escaped
would be *, right?<br>
&gt;<br>
&gt;Duh, I just realized you meant a literal * would need to be
escaped.&nbsp; Well,<br>
&gt;I'd have to make a little change there.&nbsp; As it is now, I
believe that if<br>
&gt;you sent in an escaped * you would end up matching 0 or more
.s<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;To unsubscribe from this group, send an email to:<br>
&gt;slimp3-dev-unsubscribe-***@public.gmane.org<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/<br>
<br>
<br>
------------------------ Yahoo! Groups Sponsor
---------------------~--&gt;<br>
Sponsored by VeriSign - The Value of Trust<br>
Pinpoint the right security solution for your company - FREE<br>
Guide from industry leader VeriSign gives you all the facts.<br>
http://us.click.yahoo.com/lWSNbC/WdiDAA/yigFAA/rIp0lB/TM<br>
---------------------------------------------------------------------<span </span>~-&gt;<br>
<br>
To unsubscribe from this group, send an email to:<br>
slimp3-dev-unsubscribe-***@public.gmane.org</blockquote>
<blockquote type="cite" cite><br></blockquote>
<blockquote type="cite" cite>&nbsp;</blockquote>
<blockquote type="cite" cite><br></blockquote>
<blockquote type="cite" cite>Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/ </blockquote>
<div><br></div>
</body>
</html>
Robert Moser II
2002-02-25 03:51:56 UTC
Permalink
So the only character that would need to be escaped would be *, right?
Duh, I just realized you meant a literal * would need to be escaped. Well,
I'd have to make a little change there. As it is now, I believe that if
you sent in an escaped * you would end up matching 0 or more .s



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Sponsored by VeriSign - The Value of Trust
When building an e-commerce site, you want to start with a
secure foundation. Learn how with VeriSign's FREE Guide.
http://us.click.yahoo.com/kWSNbC/XdiDAA/yigFAA/rIp0lB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
slimp3-dev-unsubscribe-***@public.gmane.org



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Robert Moser II
2002-02-25 03:39:49 UTC
Permalink
Looks good, if it works as advertised. Glad to have somebody else
attack the regexp stuff.
So the only character that would need to be escaped would be *, right?
Nothing needs to be escaped going into the filter. ie you would simply use
"*ROCKS*" (or "*rocks*" as it is case insensitive). The first thing the
function does is translate the input filter into a perl regex. It
currently removes any executable blocks, escapes . ^ and $, adds a ^ to the
beginning and a $ to the end, then replaces * with .*

If the standard single character wildcards were desired (ie ? or
_ depending on operating system), those could be added as well.
I'm also interested in the performance, but rumor has it that the
perl rexexp engine is quite fast. We'll probably need
backgroundability anyways.
Since it is just looking at in-memory data structures, it should be really
fast. Probably the slowest part would be the unique sort.


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Sponsored by VeriSign - The Value of Trust
Do you need to encrypt all your online transactions? Find
the perfect solution in this FREE Guide from VeriSign.
http://us.click.yahoo.com/jWSNbC/UdiDAA/yigFAA/rIp0lB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
slimp3-dev-unsubscribe-***@public.gmane.org



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
dean blackketter
2002-02-25 03:17:39 UTC
Permalink
Looks good, if it works as advertised. Glad to have somebody else
attack the regexp stuff.

So the only character that would need to be escaped would be *, right?

I'm also interested in the performance, but rumor has it that the
perl rexexp engine is quite fast. We'll probably need
backgroundability anyways.

-dean
I did some testing, and the songs() function wasn't working as desired
(mainly due to me not looking at what the genreCache structure was like)
Here is an additional function and a corrected songs() which do work. I'd
like some comments before I check it in.
sub filterHashByValue {
if (!defined($hashref)) {
return;
}
if (!defined($pattern) || $pattern eq '*') {
return keys %{$hashref};
}
#the following transformations assume that the pattern
provided uses * to
indicate
#matching any character 0 or more times, and that . ^ and $
are not escaped
$pattern =~ s/\(\?\{.*\}\)//g; #strip executables from $pattern
$pattern =~ s/(\.|\^|\$)/\\$1/g; #escape ., ^ and $ in $pattern
$pattern =~ s/^(.*)$/\^$1\$/; #add beginning and end of
string requirements
$pattern =~ s/\*/\.\*/g; #use the regex for matching any character 0 or
more times
my $regexpattern = qr/$pattern/i; #compiles the regex for multiple uses
(case insensitive)
my ($k,$v);
while (($k,$v) = each %{$hashref}) {
if ($v =~ $regexpattern) {
}
}
}
sub songs {
my $genre = shift;
my $artist = shift;
my $album = shift;
my $track = shift;
$::d_f && print "songs: $genre - $artist - $album - $track\n" ;
foreach my $g (filter($genre,keys %genreCache)) {
foreach my $art (filter($artist,keys %{$genreCache{$g}})) {
foreach my $alb (filter($album,keys
%{$genreCache{$g}{$art}})) {
my %songs = ();
foreach my $trk (values
%{$genreCache{$g}{$art}{$alb}}) {
$songs{$trk} = title($trk);
}
filterHashByValue($track,\%songs);
}
}
}
}
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Attachment converted: firebook:Info.pm 1 (PMpm/GKON) (000B80A1)
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Sponsored by VeriSign - The Value of Trust
Do you need to encrypt all your online transactions? Find
the perfect solution in this FREE Guide from VeriSign.
http://us.click.yahoo.com/jWSNbC/UdiDAA/yigFAA/rIp0lB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
slimp3-dev-unsubscribe-***@public.gmane.org



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
dean blackketter
2003-02-22 12:54:23 UTC
Permalink
<!doctype html public "-//W3C//DTD W3 HTML//EN">
<head><style type="text/css"><!--
blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 }
--></style><title>Re: [slimp3-dev] Modified info functions (for
searchin</title></head><body>
<div>Looks good, if it works as advertised.&nbsp; Glad to have
somebody else attack the regexp stuff.</div>
<div><br></div>
<div>So the only character that would need to be escaped would be *,
right?</div>
<div><br></div>
<div>I'm also interested in the performance, but rumor has it that the
perl rexexp engine is quite fast.&nbsp; We'll probably need
backgroundability anyways.</div>
<div><br></div>
<div>-dean</div>
<div><br></div>
<div><br></div>
<blockquote type="cite" cite>I did some testing, and the songs()
function wasn't working as desired <br>
(mainly due to me not looking at what the genreCache structure was
like)<br>
<br>
Here is an additional function and a corrected songs() which do work.&nbsp;
I'd <br>
like some comments before I check it in.<br>
<br>
sub filterHashByValue {<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>my ($pattern,
$hashref) = @_;<br>
<x-tab>&nbsp;&nbsp; </x-tab>if (!defined($hashref)) {<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab>return;<br>
<x-tab> </x-tab>}<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>if
(!defined($pattern) || $pattern eq '*') {<br>
<x-tab>&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab>return keys %{$hashref};<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>}<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>my
@filtereditems;<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>#the following
transformations assume that the pattern provided uses * to <br>
indicate<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>#matching any character
0 or more times, and that . ^ and $ are not escaped<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>$pattern =~ s/\(\?\{.*\}\)//g;
#strip executables from $pattern<br>
<x-tab> </x-tab>$pattern =~ s/(\.|\^|\$)/\\$1/g; #escape ., ^ and $ in
$pattern<br>
<x-tab> </x-tab>$pattern =~ s/^(.*)$/\^$1\$/; #add beginning and end
of string requirements<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>$pattern =~ s/\*/\.\*/g; #use
the regex for matching any character 0 or <br>
more times<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>my $regexpattern =
qr/$pattern/i; #compiles the regex for multiple uses <br>
(case insensitive)<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>my ($k,$v);<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>while (($k,$v) = each
%{$hashref}) {<br>
<x-tab>&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>if
($v =~ $regexpattern) {<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>push
@filtereditems, $k;<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab>}<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>}<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab><br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>return
@filtereditems;<br>
}<br>
<br>
sub songs {<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>my $genre = shift;<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>my $artist = shift;<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>my $album = shift;<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>my $track = shift;<br>
<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>my @alltracks = ();<br>
<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>$::d_f &amp;&amp; print
&quot;songs: $genre - $artist - $album - $track\n&quot;<x-tab>&nbsp;&nbsp;
</x-tab>;<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab><br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>foreach my
$g (filter($genre,keys %genreCache)) {<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab>foreach my $art (filter($artist,keys %{$genreCache{$g}}))
{<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab>foreach my $alb (filter($album,keys %{$genreCache{$g}{$art}}))
{<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>my
%songs = ();<br>
<x-tab> </x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab>foreach my $trk (values %{$genreCache{$g}{$art}{$alb}}) {<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab>$songs{$trk} = title($trk);<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab>}<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>push
@alltracks, filterHashByValue($track,\%songs);<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab>}<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab>}<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>}<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>return
sortTrackUniq(@alltracks);<br>
}<br>
------------------------ Yahoo! Groups Sponsor
---------------------~--&gt;<br>
Sponsored by VeriSign - The Value of Trust<br>
Do you need to encrypt all your online transactions? Find<br>
the perfect solution in this FREE Guide from VeriSign.<br>
http://us.click.yahoo.com/vCuuSA/UdiDAA/yigFAA/rIp0lB/TM<br>
---------------------------------------------------------------------<span </span>~-&gt;<br>
<br>
To unsubscribe from this group, send an email to:<br>
slimp3-dev-unsubscribe-***@public.gmane.org<br>
<br>
&nbsp;<br>
<br>
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/ </blockquote>
<blockquote type="cite" cite><br></blockquote>
<blockquote type="cite" cite><br></blockquote>
<blockquote type="cite" cite>Attachment converted: firebook:Info.pm 1
(PMpm/GKON) (000B80A1)</blockquote>
<div><br></div>
</body>
</html>
Robert Moser II
2002-02-24 23:10:37 UTC
Permalink
I did some testing, and the songs() function wasn't working as desired
(mainly due to me not looking at what the genreCache structure was like)

Here is an additional function and a corrected songs() which do work. I'd
like some comments before I check it in.

sub filterHashByValue {
my ($pattern, $hashref) = @_;
if (!defined($hashref)) {
return;
}
if (!defined($pattern) || $pattern eq '*') {
return keys %{$hashref};
}
my @filtereditems;
#the following transformations assume that the pattern provided uses * to
indicate
#matching any character 0 or more times, and that . ^ and $ are not escaped
$pattern =~ s/\(\?\{.*\}\)//g; #strip executables from $pattern
$pattern =~ s/(\.|\^|\$)/\\$1/g; #escape ., ^ and $ in $pattern
$pattern =~ s/^(.*)$/\^$1\$/; #add beginning and end of string requirements
$pattern =~ s/\*/\.\*/g; #use the regex for matching any character 0 or
more times
my $regexpattern = qr/$pattern/i; #compiles the regex for multiple uses
(case insensitive)
my ($k,$v);
while (($k,$v) = each %{$hashref}) {
if ($v =~ $regexpattern) {
push @filtereditems, $k;
}
}

return @filtereditems;
}

sub songs {
my $genre = shift;
my $artist = shift;
my $album = shift;
my $track = shift;

my @alltracks = ();

$::d_f && print "songs: $genre - $artist - $album - $track\n" ;

foreach my $g (filter($genre,keys %genreCache)) {
foreach my $art (filter($artist,keys %{$genreCache{$g}})) {
foreach my $alb (filter($album,keys %{$genreCache{$g}{$art}})) {
my %songs = ();
foreach my $trk (values %{$genreCache{$g}{$art}{$alb}}) {
$songs{$trk} = title($trk);
}
push @alltracks, filterHashByValue($track,\%songs);
}
}
}
return sortTrackUniq(@alltracks);
}
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Sponsored by VeriSign - The Value of Trust
Do you need to encrypt all your online transactions? Find
the perfect solution in this FREE Guide from VeriSign.
http://us.click.yahoo.com/vCuuSA/UdiDAA/yigFAA/rIp0lB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
slimp3-dev-unsubscribe-***@public.gmane.org



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
dean blackketter
2002-02-24 22:12:58 UTC
Permalink
I didn't want to throw this in the mix without having someone look
at it first.
I know it compiles and I know the filter() function works, I don't know if
the whole thing works well and I'm unsure exactly how to test it.
Well, can you explain what it does?

-dean


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Sponsored by VeriSign - The Value of Trust
Secure all your Web servers now - with a proven 5-part
strategy. The FREE Server Security Guide shows you how.
http://us.click.yahoo.com/uCuuSA/VdiDAA/yigFAA/rIp0lB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
slimp3-dev-unsubscribe-***@public.gmane.org



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Robert Moser II
2002-02-24 21:52:55 UTC
Permalink
Here are the added/changed functions in Info.pm, my current version of
whoops, forgot the attachment


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Sponsored by VeriSign - The Value of Trust
Secure all your Web servers now - with a proven 5-part
strategy. The FREE Server Security Guide shows you how.
http://us.click.yahoo.com/uCuuSA/VdiDAA/yigFAA/rIp0lB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
slimp3-dev-unsubscribe-***@public.gmane.org



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Robert Moser II
2002-02-24 21:47:00 UTC
Permalink
I didn't want to throw this in the mix without having someone look at it first.

I know it compiles and I know the filter() function works, I don't know if
the whole thing works well and I'm unsure exactly how to test it.

Here are the added/changed functions in Info.pm, my current version of
Info.pm is also attached:

sub filter {
my ($pattern, @items) = @_;
if (!defined($pattern) || $pattern eq '*') {
return @items;
}
my @filtereditems;
#the following transformations assume that the pattern provided uses * to
indicate
#matching any character 0 or more times, and that . ^ and $ are not escaped
$pattern =~ s/\(\?\{.*\}\)//g; #strip executables from $pattern
$pattern =~ s/(\.|\^|\$)/\\$1/g; #escape ., ^ and $ in $pattern
$pattern =~ s/^(.*)$/\^$1\$/; #add beginning and end of string requirements
$pattern =~ s/\*/\.\*/g; #use the regex for matching any character 0 or
more times
my $regexpattern = qr/$pattern/i; #compiles the regex for multiple uses
(case insensitive)
foreach my $item (@items) {
if ($item =~ $regexpattern) {
push @filtereditems, $item;
}
}

return @filtereditems;
}

sub genres {
my $genre = shift;
my $artist = shift;
my $album = shift;
my $song = shift;
return sortuniq(filter($genre,keys %genreCache));
}

sub artists {
my $genre = shift;
my $artist = shift;
my $album = shift;
my $song = shift;
my @artists = ();

foreach my $g (filter($genre,keys %genreCache)) {
push @artists, filter($artist,keys %{$genreCache{$g}});
}
return sortuniq(@artists);
}

sub albums {
my $genre = shift;
my $artist = shift;
my $album = shift;
my $song = shift;
my @albums = ();

foreach my $g (filter($genre,keys %genreCache)) {
foreach my $art (filter($artist,keys %{$genreCache{$g}})) {
push @albums, filter($album,keys %{$genreCache{$g}{$art}});
}
}

return sortuniq(@albums);
}

# return all songs for a given genre, artist, and album
sub songs {
my $genre = shift;
my $artist = shift;
my $album = shift;
my $track = shift;

my @alltracks = ();

$::d_f && print "songs: $genre - $artist - $album - $track\n" ;

foreach my $g (filter($genre,keys %genreCache)) {
foreach my $art (filter($artist,keys %{$genreCache{$g}})) {
foreach my $alb (filter($album,keys %{$genreCache{$g}{$art}})) {
push @alltracks , filter($track,keys %{$genreCache{$g}{$art}{$alb}});
}
}
}
return sortTrackUniq(@alltracks);
}
sub sortTrackUniq {
my %seen = ();
my @uniq = ();

foreach my $item (@_) {
push(@uniq, $item) unless $seen{$item}++ || $item eq '';
}

return sort sortTrack @uniq ;
}

sub sortTrack {
my $av = trackNumberInt($a);
my $bv = trackNumberInt($b);
my $anum = defined($av);
my $bnum = defined($bv);
if ($anum && $bnum) {
if ($av == $bv) {
uc(title($a)) cmp uc(title($b));
} else {
$av <=> $bv;
}
} elsif (!$anum && !$bnum) {
uc(title($a)) cmp uc(title($b));
} elsif ($anum) {
-1;
} else {
1;
}
}


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Sponsored by VeriSign - The Value of Trust
Do you need to encrypt all your online transactions? Find
the perfect solution in this FREE Guide from VeriSign.
http://us.click.yahoo.com/vCuuSA/UdiDAA/yigFAA/rIp0lB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
slimp3-dev-unsubscribe-***@public.gmane.org



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
dean blackketter
2003-02-22 12:54:30 UTC
Permalink
<!doctype html public "-//W3C//DTD W3 HTML//EN">
<head><style type="text/css"><!--
blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 }
--></style><title>Re: [slimp3-dev] Modified info functions (for
searchin</title></head><body>
<blockquote type="cite" cite>I didn't want to throw this in the mix
without having someone look at it first.</blockquote>
<blockquote type="cite" cite><br>
I know it compiles and I know the filter() function works, I don't
know if <br>
the whole thing works well and I'm unsure exactly how to test
it.</blockquote>
<div><br></div>
<div>Well, can you explain what it does?</div>
<div><br></div>
<div>-dean</div>
<div><br></div>
</body>
</html>

Loading...