From 536287c8cbd77c9eaec9c3a433c09fc1564c5b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Mon, 8 Sep 2008 10:39:59 +0200 Subject: - More detailed instructions in README --- README | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README b/README index 964d337..7fa0dc8 100755 --- a/README +++ b/README @@ -12,11 +12,18 @@ Usage $ make -2. Make the initial configuration with the provided script, and follow - the instructions: +2. Make the initial configuration with the provided script $ bash initialize.sh +3. Start musicfs + +$ ./musicfs + +4. Add your music path(s) to /.config + +$ echo "/storage/music" >> /.config + Screenshot ~~~~~~~~~~ -- cgit v1.2.3 From 27959559262b0d76eb803c15ec642bf2787dc785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Mon, 8 Sep 2008 10:57:57 +0200 Subject: - More TODO for v0.1 --- TODO | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/TODO b/TODO index c130faa..dd2acf4 100644 --- a/TODO +++ b/TODO @@ -2,26 +2,10 @@ v. 0.1 ~~~~~~ -* [FIXED] Better interface (the new .config is pretty good, but needs - improvement) - * 2008-09-08: Added complete support for removing paths from .config - (not very useful, but it feels consistent) +* Fix track numbers in /Albums -* [FIXED] We should implement flush and similar calls we don't currently implement. - Under some circumstances, high load can force the closing of files or - something in a similar manner, and we should handle this properly, or else the - media player will probably stop playback. - * flush and fsync have been implemented, but is not required to do anything - since we have reading only currently, so we will have to extend them later. +* Fix /Genres -- [FIXED] BUG: what to do with songs without tags? - * This has been improved to check if the string is actually empty, - instead of just dying. Good enough for v0.1. - -- [FIXED] BUG: something is wrong with the offset when reading media files. - "Ogg : Page out not synced, we skip some bytes" from mplayer. - - UPDATE: I think this is fixed now. v. 0.2(?) ~~~~~~~~~ -- cgit v1.2.3 From 62fee797bab835ce7bc9a1b901228cc0cdf93d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Mon, 8 Sep 2008 10:59:47 +0200 Subject: - Discovered a bug. Added to TODO --- TODO | 1 + 1 file changed, 1 insertion(+) diff --git a/TODO b/TODO index dd2acf4..e35370c 100644 --- a/TODO +++ b/TODO @@ -6,6 +6,7 @@ v. 0.1 * Fix /Genres +* BUG: fsync errors with /.config v. 0.2(?) ~~~~~~~~~ -- cgit v1.2.3 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/* --- TODO | 2 -- src/mfs_subr.c | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index e35370c..950f2fd 100644 --- a/TODO +++ b/TODO @@ -2,8 +2,6 @@ v. 0.1 ~~~~~~ -* Fix track numbers in /Albums - * Fix /Genres * BUG: fsync errors with /.config 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/*/* --- TODO | 2 -- src/mfs_subr.c | 39 +++++++++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 950f2fd..2f8f610 100644 --- a/TODO +++ b/TODO @@ -2,8 +2,6 @@ v. 0.1 ~~~~~~ -* Fix /Genres - * BUG: fsync errors with /.config v. 0.2(?) 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 :) --- TODO | 2 +- src/mfs_vnops.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index 2f8f610..5bfaa85 100644 --- a/TODO +++ b/TODO @@ -2,7 +2,7 @@ v. 0.1 ~~~~~~ -* BUG: fsync errors with /.config +* Done? :-) v. 0.2(?) ~~~~~~~~~ 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