summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdwin Eefting <edwin@datux.nl>2013-01-23 19:09:36 (GMT)
committer Edwin Eefting <edwin@datux.nl>2013-01-23 19:09:36 (GMT)
commit48ef5358b1197ac4364fc36256ba3dfda4f80d99 (patch)
tree6e306c83d77c97efff4d61fc78120a07e0582618
parentf257682f52b4f92319b4243aa9a1ad4cdd7ed811 (diff)
working on more webgui now
-rw-r--r--modules/mp.module/module.cpp9
-rw-r--r--modules/pl_dir.module/module.cpp33
-rw-r--r--wwwdir/mp.html41
3 files changed, 73 insertions, 10 deletions
diff --git a/modules/mp.module/module.cpp b/modules/mp.module/module.cpp
index efada2c..721768e 100644
--- a/modules/mp.module/module.cpp
+++ b/modules/mp.module/module.cpp
@@ -119,19 +119,26 @@ namespace mp
}
//playlist switched to different path/file
+
SYNAPSE_REGISTER(pl_Entry)
{
+ static string currentFile;
+
//for now we just support one playlist
if (!plId)
plId=msg.src;
+ if (currentFile==msg["currentFile"].str())
+ return;
+
+ currentFile=msg["currentFile"].str();
if (msg.src==plId)
{
//lets play it
Cmsg out;
out.event="play_Open";
- out["url"]="file://"+msg["currentFile"].str();
+ out["url"]="file://"+currentFile;
out.dst=playerId;
out.send();
}
diff --git a/modules/pl_dir.module/module.cpp b/modules/pl_dir.module/module.cpp
index 4bbdb3d..6578dfe 100644
--- a/modules/pl_dir.module/module.cpp
+++ b/modules/pl_dir.module/module.cpp
@@ -401,11 +401,16 @@ namespace pl
mNextFiles.clear();
mPrevFiles.clear();
- //find first file
- mCurrentFile=movePath(mCurrentPath, mCurrentPath, "filename", NEXT, RECURSE, CsortedDir::ALL);
+ //current file doesnt belong to current path?
+ if (!isSubdir(mCurrentPath, mCurrentFile))
+ {
+ //find the first valid file
+ mCurrentFile=movePath(mCurrentPath, mCurrentPath, "filename", NEXT, RECURSE, CsortedDir::ALL);
+ }
+
+ //fill the lists
+ updateLists();
- //fill the lists
- updateLists();
}
//reload path and file data, call this after you exited or entered a path so that the previous/next paths need to be reloaded
@@ -459,11 +464,25 @@ namespace pl
}
}
+
+ //go one directory deeper, using the currentFile as reference
void enterPath()
{
- //find the first directory in that directory, and dont go higher:
- mCurrentPath=movePath(mCurrentPath, mCurrentPath, "filename", NEXT, DONT_RECURSE, CsortedDir::DIR);
- reloadPaths();
+ path p;
+ p=mCurrentFile;
+ while (!p.empty())
+ {
+ if (p.parent_path()==mCurrentPath)
+ {
+ if (is_directory(p))
+ {
+ mCurrentPath=p;
+ reloadPaths();
+ return;
+ }
+ }
+ p=p.parent_path();
+ }
}
diff --git a/wwwdir/mp.html b/wwwdir/mp.html
index 7198958..93f5597 100644
--- a/wwwdir/mp.html
+++ b/wwwdir/mp.html
@@ -60,10 +60,38 @@
synapse_register("pl_Entry",function(msg_src, msg_dst, msg_event, msg)
{
- for (key in msg)
+ var stripIndex=msg.currentPath.length;
+
+ $('.entry[key="rootPath"]').text(msg.rootPath);
+ $('.entry[key="currentPath"]').text(msg.currentPath);
+ $('.entry[key="currentFile"]').text(msg.currentFile.substr(stripIndex));
+
+ //some dom magic going on here...for more of it and a better way to do it look at my kmur2 project
+
+ //delete old clones
+ $(".entry.cloned").remove();
+
+
+ //next files
+ var src=$('.entry[key="nextFiles"]');
+ for (nr=msg['nextFiles'].length; nr--; nr>0)
+ {
+ var element=$(src).clone();
+ src.after(element);
+ element.addClass("cloned");
+ $('.entry[key=nextFile]', element).text(msg.nextFiles[nr].substr(stripIndex));
+ }
+
+ //prev files
+ var src=$('.entry[key="prevFiles"]');
+ for (nr=msg['prevFiles'].length; nr--; nr>0)
{
- $('.entry[key="'+key+'"]').text(msg[key]);
+ var element=$(src).clone();
+ src.before(element);
+ element.addClass("cloned");
+ $('.entry[key=prevFile]', element).text(msg['prevFiles'][nr].substr(stripIndex));
}
+
});
synapse_register("play_Time",function(msg_src, msg_dst, msg_event, msg)
@@ -97,6 +125,15 @@
<body>
+
+<table>
+<tr><th colspan=2>file navigator</tr>
+<tr class="entry" key="prevFiles"><td class="entry" key="prevFile"></tr>
+<tr><td style="background-color: #ccccff" class="entry" key="currentFile"></tr>
+<tr class="entry" key="nextFiles"> ><td class="entry" key="nextFile"></tr>
+</table>
+
+
<table>
<tr><th colspan=2>filesystem data </tr>
<tr><th>Root dir <td class="entry" key="rootPath"></tr>