From: Ian Beckwith Date: Sat, 2 Oct 2010 18:55:45 +0000 (+0100) Subject: artists_albums: use tag constraints X-Git-Tag: debian/1.0-1~140 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;ds=sidebyside;h=7b83646ad21f31d79b33b91a26958f9e4ede10d6;p=id3fs.git artists_albums: use tag constraints --- 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" .