From e2c7a9e7ae67306d31763b200ff94d5e2c145a31 Mon Sep 17 00:00:00 2001 From: Ian Beckwith Date: Sat, 2 Oct 2010 20:01:54 +0100 Subject: [PATCH] artist_tracks: use tag constraints --- lib/ID3FS/DB.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/ID3FS/DB.pm b/lib/ID3FS/DB.pm index f0ec02a..ef5ea05 100644 --- a/lib/ID3FS/DB.pm +++ b/lib/ID3FS/DB.pm @@ -293,8 +293,11 @@ sub artist_albums sub artist_tracks { - my($self, $artist_id)=@_; - my $sql=("SELECT files.name FROM files\n\t" . + my($self, $artist_id, @constraints)=@_; + my $sql=("SELECT files.name FROM (\n" . + $self->tags_subselect(@constraints) . + "\t) AS subselect\n" . + "INNER JOIN files ON subselect.files_id=files.id\n" . "INNER JOIN artists ON artists.id=files.artists_id\n\t" . "INNER JOIN albums ON albums.id=files.albums_id\n\t" . "WHERE artists.id=? AND albums.name=''\n\t" . @@ -327,7 +330,7 @@ sub tracks # FIXME: rework PathElements if(ref($constraints[$#constraints]) eq "ID3FS::PathElement::Artist") { - return $self->artist_tracks($constraints[$#constraints]->{id}); + return $self->artist_tracks($constraints[$#constraints]->{id}, @constraints); } elsif(ref($constraints[$#constraints]) eq "ID3FS::PathElement::Album") { -- 2.11.0