From 7b83646ad21f31d79b33b91a26958f9e4ede10d6 Mon Sep 17 00:00:00 2001 From: Ian Beckwith Date: Sat, 2 Oct 2010 19:55:45 +0100 Subject: [PATCH] artists_albums: 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 0ed658c..f0ec02a 100644 --- a/lib/ID3FS/DB.pm +++ b/lib/ID3FS/DB.pm @@ -258,7 +258,7 @@ sub albums # FIXME: rework PathElements if(ref($constraints[$#constraints]) eq "ID3FS::PathElement::Artist") { - return $self->artist_albums($constraints[$#constraints]->{id}); + return $self->artist_albums($constraints[$#constraints]->{id}, @constraints); } my $sql=("SELECT albums.name\n" . "\tFROM (\n" . @@ -275,8 +275,11 @@ sub albums sub artist_albums { - my($self, $artist_id)=@_; - my $sql=("SELECT albums.name FROM files\n\t" . + my($self, $artist_id, @constraints)=@_; + my $sql=("SELECT albums.name FROM (\n" . + $self->tags_subselect(@constraints) . + "\t) AS subselect\n" . + "INNER JOIN files ON subselect.files_id=files.id\n" . "INNER JOIN albums ON albums.id=files.albums_id\n\t" . "INNER JOIN artists ON artists.id=files.artists_id\n\t" . "WHERE artists.id=? and albums.name <> ''\n\t" . -- 2.11.0