- my @names=map { $_->[0]; } @$result;
- print "ALBUMS: ", join(', ', @names), "\n";
- return(@names);
-}
-
-sub artist_albums
-{
- 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" .
- "GROUP BY albums.name\n");
- print "ARTIST_ALBUMS SQL: $sql\n";
- my $result=$self->cmd_rows($sql, $artist_id);
- my @albums=map { $_->[0]; } @$result;
- print "ALBUMS: ", join(', ', @albums), "\n";
- return(@albums);
-}
-
-sub artist_tracks
-{
- my($self, $artist_id)=@_;
- my $sql=("SELECT files.name FROM files\n\t" .
- "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" .
- "GROUP BY files.name\n");
- print "ARTIST_TRACKS SQL: $sql\n";
- my $result=$self->cmd_rows($sql, $artist_id);
- my @names=map { $_->[0]; } @$result;
- print "ARTISTTRACKS: ", join(', ', @names), "\n";
- return(@names);
-}
-
-sub album_tracks
-{
- my($self, $artist_id, $album_id)=@_;
- my $sql=("SELECT files.name FROM files\n\t" .
- "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.id=?\n\t" .
- "GROUP BY files.name\n");
- print "ALBUM_TRACKS SQL($artist_id, $album_id): $sql\n";
- my $result=$self->cmd_rows($sql, $artist_id, $album_id);
- my @names=map { $_->[0]; } @$result;
- print "TRACKS: ", join(', ', @names), "\n";
- return(@names);
-}
-
-sub tracks
-{
- my($self, @constraints)=@_;
- # FIXME: rework PathElements
- if(ref($constraints[$#constraints]) eq "ID3FS::PathElement::Artist")
- {
- return $self->artist_tracks($constraints[$#constraints]->{id});
- }
- elsif(ref($constraints[$#constraints]) eq "ID3FS::PathElement::Album")