summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Ørbekk <orbekk@pvv.ntnu.no>2008-08-13 14:42:04 +0200
committerKjetil Ørbekk <orbekk@pvv.ntnu.no>2008-08-13 14:42:04 +0200
commit7478ea2df55f3793da76386e1c56701ad36eea00 (patch)
treea0ce38956e3b3958281cea5b4223ab690ee38218
parentb73281d49e7352592e0a9bf0bbaa1ade6668e891 (diff)
- Added extensions to all files via sql queries
-rw-r--r--src/mp3_subr.c15
-rwxr-xr-xsrc/mp3_vnops.c2
2 files changed, 10 insertions, 7 deletions
diff --git a/src/mp3_subr.c b/src/mp3_subr.c
index 546bbdd..0e16caf 100644
--- a/src/mp3_subr.c
+++ b/src/mp3_subr.c
@@ -378,7 +378,8 @@ mp3_file_data_for_path(const char *path, void *data) {
if (title == NULL)
break;
lh = mp3_lookup_start(0, fd, mp3_lookup_open,
- "SELECT filepath FROM song WHERE title LIKE ?");
+ "SELECT filepath FROM song "
+ "WHERE (title||'.'||extension) LIKE ?");
if (lh == NULL)
return (-EIO);
mp3_lookup_insert(lh, title, LIST_DATATYPE_STRING);
@@ -396,7 +397,8 @@ mp3_file_data_for_path(const char *path, void *data) {
if (title == NULL)
break;
lh = mp3_lookup_start(0, fd, mp3_lookup_open,
- "SELECT filepath FROM song WHERE title LIKE ? AND "
+ "SELECT filepath FROM song "
+ "WHERE (title||'.'||extension) LIKE ? AND "
"album LIKE ?");
if (lh == NULL)
return (-EIO);
@@ -418,7 +420,7 @@ mp3_file_data_for_path(const char *path, void *data) {
}
lh = mp3_lookup_start(0, fd, mp3_lookup_open,
"SELECT filepath FROM song WHERE artistname LIKE ? AND "
- "album LIKE ? AND title LIKE ?");
+ "album LIKE ? AND (title||'.'||extension) LIKE ?");
if (lh == NULL)
return (-EIO);
mp3_lookup_insert(lh, artist, LIST_DATATYPE_STRING);
@@ -528,7 +530,8 @@ mp3_lookup_album(const char *path, struct filler_data *fd)
if (album == NULL)
break;
lh = mp3_lookup_start(0, fd, mp3_lookup_list,
- "SELECT DISTINCT title FROM song WHERE album LIKE ?");
+ "SELECT DISTINCT title||'.'||extension FROM song "
+ "WHERE album LIKE ?");
mp3_lookup_insert(lh, album, LIST_DATATYPE_STRING);
break;
}
@@ -569,7 +572,7 @@ mp3_lookup_artist(const char *path, struct filler_data *fd)
if (album == NULL)
break;
lh = mp3_lookup_start(0, fd, mp3_lookup_list,
- "SELECT title FROM song, artist "
+ "SELECT title ||'.'|| extension FROM song, artist "
"WHERE song.artistname = artist.name AND artist.name "
"LIKE ? AND song.album LIKE ?");
mp3_lookup_insert(lh, name, LIST_DATATYPE_STRING);
@@ -611,7 +614,7 @@ mp3_lookup_genre(const char *path, struct filler_data *fd)
if (album == NULL)
break;
lh = mp3_lookup_start(0, fd, mp3_lookup_list,
- "SELECT title FROM song, genre WHERE"
+ "SELECT title||'.'||extension FROM song, genre WHERE"
" song.genrename = genre.name AND genre.name LIKE ? "
" AND song.album LIKE ?");
mp3_lookup_insert(lh, genre, LIST_DATATYPE_STRING);
diff --git a/src/mp3_vnops.c b/src/mp3_vnops.c
index 3260550..d1ddf90 100755
--- a/src/mp3_vnops.c
+++ b/src/mp3_vnops.c
@@ -97,7 +97,7 @@ static int mp3_readdir (const char *path, void *buf, fuse_fill_dir_t filler,
return (0);
} else if (strcmp(path, "/Tracks") == 0) {
lh = mp3_lookup_start(0, &fd, mp3_lookup_list,
- "SELECT DISTINCT title FROM song");
+ "SELECT DISTINCT title ||'.'|| extension FROM song");
mp3_lookup_finish(lh);
return (0);
} else if (strncmp(path, "/Albums", 7) == 0) {