From 949d5232b8817ce9483b61c8a12f321e533d9b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Thu, 11 Sep 2008 14:14:57 +0200 Subject: - Fixed track numbers in /Albums/* --- src/mfs_subr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mfs_subr.c b/src/mfs_subr.c index 8db6d7a..cbf8f8d 100644 --- a/src/mfs_subr.c +++ b/src/mfs_subr.c @@ -661,9 +661,9 @@ mfs_realpath(const char *path, char **realpath) { break; error = 0; lh = mfs_lookup_start(0, realpath, mfs_lookup_path, - "SELECT filepath FROM song " - "WHERE (title||'.'||extension) LIKE ? AND " - "album LIKE ?"); + "SELECT filepath FROM song WHERE " + "LTRIM(track||' ')||title||'.'||extension LIKE ? " + "AND album LIKE ?"); if (lh == NULL) { error = -EIO; break; @@ -805,8 +805,8 @@ mfs_lookup_album(const char *path, struct filler_data *fd) if (album == NULL) break; lh = mfs_lookup_start(0, fd, mfs_lookup_list, - "SELECT DISTINCT title||'.'||extension FROM song " - "WHERE album LIKE ?"); + "SELECT DISTINCT LTRIM(track||' ')||title||'.'||extension " + "FROM song WHERE album LIKE ?"); mfs_lookup_insert(lh, album, LIST_DATATYPE_STRING); break; } -- cgit v1.2.3 From ecd61bb4ca8b5c3224dba994f1ead8f21c9794b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Thu, 11 Sep 2008 14:47:55 +0200 Subject: - Fixed /Genres - Added track number on songs in Genres/*/* --- src/mfs_subr.c | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mfs_subr.c b/src/mfs_subr.c index cbf8f8d..54269be 100644 --- a/src/mfs_subr.c +++ b/src/mfs_subr.c @@ -506,6 +506,8 @@ mfs_lookup_start(int field, void *data, lookup_fn_t *fn, const char *query) ret = sqlite3_prepare_v2(lh->handle, query, -1, &lh->st, NULL); if (ret != SQLITE_OK) { free(lh); + DEBUG("Error preparing statement: %s\n", + sqlite3_errmsg(handle)); return (NULL); } lh->query = query; @@ -621,7 +623,7 @@ int mfs_realpath(const char *path, char **realpath) { DEBUG("getting real path for %s\n", path); struct lookuphandle *lh; - char *artist, *album, *title; + char *genre, *artist, *album, *title; int error; lh = NULL; @@ -700,6 +702,34 @@ mfs_realpath(const char *path, char **realpath) { default: error = -ENOENT; } + } else if (strncmp(path, "/Genres", 7) == 0) { + switch (mfs_numtoken(path)) { + case 4: + genre = mfs_gettoken(path, 2); + album = mfs_gettoken(path, 3); + title = mfs_gettoken(path, 4); + DEBUG("genre(%s) album(%s) title(%s)\n", genre, album, + title); + if (!(genre && album && title)) { + error = -ENOENT; + break; + } + lh = mfs_lookup_start(0, realpath, mfs_lookup_path, + "SELECT filepath FROM song WHERE genrename LIKE ? " + "AND album LIKE ? AND " + "(LTRIM(track||' ')||title||'.'||extension) " + "LIKE ?"); + if (lh == NULL) { + error = -EIO; + break; + } + mfs_lookup_insert(lh, genre, LIST_DATATYPE_STRING); + mfs_lookup_insert(lh, album, LIST_DATATYPE_STRING); + mfs_lookup_insert(lh, title, LIST_DATATYPE_STRING); + break; + default: + error = -ENOENT; + } } if (lh) { @@ -890,9 +920,10 @@ mfs_lookup_genre(const char *path, struct filler_data *fd) if (album == NULL) break; lh = mfs_lookup_start(0, fd, mfs_lookup_list, - "SELECT title||'.'||extension FROM song, genre WHERE" - " song.genrename = genre.name AND genre.name LIKE ? " - " AND song.album LIKE ?"); + "SELECT LTRIM(track||' ')||title||'.'||extension FROM " + "song, genre WHERE " + "song.genrename = genre.name AND genre.name LIKE ? " + "AND song.album LIKE ?"); mfs_lookup_insert(lh, genre, LIST_DATATYPE_STRING); mfs_lookup_insert(lh, album, LIST_DATATYPE_STRING); break; -- cgit v1.2.3 From f8b57dc9a42599ec5bca136cfc75c59c7935322d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Thu, 11 Sep 2008 14:49:19 +0200 Subject: - Fixed fsync("/.config") - Done with TODO for v0.1 :) --- src/mfs_vnops.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mfs_vnops.c b/src/mfs_vnops.c index eeef2c6..a144576 100755 --- a/src/mfs_vnops.c +++ b/src/mfs_vnops.c @@ -257,8 +257,12 @@ static int mfs_fsync(const char *path, int datasync, struct fuse_file_info *fi) { int fd; - DEBUG("fsync path %s\n", path); + + if (strcmp(path, "/.config") == 0) { + return (0); + } + fd = (int)fi->fh; /* Fd is not valid, return fsync error. */ if (fd < 0) -- cgit v1.2.3