X-Git-Url: http://erislabs.net/gitweb/?p=id3fs.git;a=blobdiff_plain;f=lib%2FID3FS%2FPath.pm;h=cd8b5ac0d061fc78f47158242c6ea65fe2a6b9fc;hp=0455375d406350c4e215a6b9e2de0cb0850cf5d1;hb=a88823c2e87634d9fdad780b4923a839ba7e2d04;hpb=74a215841ddeb33dda27da5bdc3e1981e6b780d7 diff --git a/lib/ID3FS/Path.pm b/lib/ID3FS/Path.pm index 0455375..cd8b5ac 100644 --- a/lib/ID3FS/Path.pm +++ b/lib/ID3FS/Path.pm @@ -31,6 +31,8 @@ sub new $self->{db}=shift; $self->{path}=shift; $self->{verbose}=shift; + $self->{maxtagdepth}=shift; + $self->{curtagdepth}=0; $self->{path} =~ s/\/\//\//g; # drop doubled slashes $self->parse(); @@ -95,7 +97,11 @@ sub dirents } else { - @dents=(qw(AND OR), $PATH_ALLTRACKS, $PATH_NOARTIST, $self->artists()); + if($self->{maxtagdepth} && ($self->{curtagdepth} < $self->{maxtagdepth})) + { + @dents=qw(AND OR); + } + push(@dents, $PATH_ALLTRACKS, $PATH_NOARTIST, $self->artists()); } } elsif($state==$STATE_BOOLEAN) @@ -372,7 +378,11 @@ sub parse sub state { my($self, $newstate)=@_; - $self->{state}=$newstate if(defined($newstate)); + if(defined($newstate)) + { + $self->{state}=$newstate; + $self->{curtagdepth}++ if($newstate == $STATE_TAG); + } return $self->{state}; } @@ -863,7 +873,7 @@ sub empty my($self, $dir, $maxdepth)=@_; return 0 unless($maxdepth); # print "testing($maxdepth): $dir\n"; - my $path=ID3FS::Path->new($self->{db}, $dir, $self->{verbose}); + my $path=ID3FS::Path->new($self->{db}, $dir, $self->{verbose}, $self->{tagdepth}); # print "PATH INVALID\n" unless($path->isvalid()); return 1 unless($path->isvalid()); my($subdirs,$subfiles)=$path->dirents();