summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdwin Eefting <edwin@datux.nl>2013-01-21 02:06:05 (GMT)
committer Edwin Eefting <edwin@datux.nl>2013-01-21 02:06:05 (GMT)
commitbb2b02cc26f2a810378e75ba656e01974943f14f (patch)
tree5d104c5b93fb09550f07905dd9c29c2b21dcfabe
parentda381722f921a2d1fb5ec3e5c5a1965040edfe35 (diff)
dir entering and exiting working, except for rootpath bug
-rw-r--r--modules/mp.module/module.cpp21
-rw-r--r--modules/pl_dir.module/module.cpp11
-rw-r--r--wwwdir/mp.html70
3 files changed, 93 insertions, 9 deletions
diff --git a/modules/mp.module/module.cpp b/modules/mp.module/module.cpp
index 4946771..efada2c 100644
--- a/modules/mp.module/module.cpp
+++ b/modules/mp.module/module.cpp
@@ -97,6 +97,27 @@ namespace mp
playerId=msg.src;
}
+ SYNAPSE_REGISTER(play_State)
+ {
+ static int lastTime=0;
+
+
+ if (msg["state"]=="ended" || msg["state"]=="error")
+ {
+ if (time(NULL)-lastTime<=2)
+ {
+ sleep(1);
+ }
+ lastTime=time(NULL);
+
+ Cmsg out;
+ out.dst=plId;
+ out.event="pl_Next";
+ out.send();
+
+ }
+ }
+
//playlist switched to different path/file
SYNAPSE_REGISTER(pl_Entry)
{
diff --git a/modules/pl_dir.module/module.cpp b/modules/pl_dir.module/module.cpp
index 4a0282b..d588780 100644
--- a/modules/pl_dir.module/module.cpp
+++ b/modules/pl_dir.module/module.cpp
@@ -181,9 +181,10 @@ namespace pl
//rootPath is the highest path, it can never be escaped.
path movePath(path rootPath, path currentPath, string sortField, Edirection direction, Erecursion recursion, CsortedDir::Efiletype filetype)
{
-// DEB("rootpath:" << rootPath);
-// DEB("currentpath:" << currentPath);
-
+ DEB("rootpath:" << rootPath);
+ DEB("currentpath:" << currentPath);
+ DEB("gelijko?" << ( currentPath==rootPath));
+
//determine the path we should get the initial listing of:
path listPath;
if (currentPath==rootPath)
@@ -245,7 +246,7 @@ namespace pl
{
//yes, so go one dir higher and continue the loop
currentPath=listPath;
- listPath=currentPath.parent_path();
+ listPath=listPath.parent_path();
}
else
{
@@ -278,7 +279,7 @@ namespace pl
{
//go one dir higher and continue the loop
currentPath=listPath;
- listPath=currentPath.parent_path();
+ listPath=listPath.parent_path();
}
}
diff --git a/wwwdir/mp.html b/wwwdir/mp.html
index 87ef1f5..026ab36 100644
--- a/wwwdir/mp.html
+++ b/wwwdir/mp.html
@@ -34,6 +34,10 @@
send(0, "play_GetStatus", {
});
+ //get status from playlist
+ send(0, "pl_GetStatus", {
+ });
+
//translate clicks on elements that have the send-class to a synapse event:
$(".send").click(function()
{
@@ -53,13 +57,33 @@
});
+
+ synapse_register("pl_Entry",function(msg_src, msg_dst, msg_event, msg)
+ {
+ for (key in msg)
+ {
+ $('.entry[key="'+key+'"]').text(msg[key]);
+ }
+ });
+
synapse_register("play_Time",function(msg_src, msg_dst, msg_event, msg)
{
$(".time").slider("value", msg['time']);
$(".time").slider("option", "max", msg['length']);
});
+ synapse_register("play_State",function(msg_src, msg_dst, msg_event, msg)
+ {
+ $(".state").text(msg['state']);
+ });
+ synapse_register("play_InfoMeta",function(msg_src, msg_dst, msg_event, msg)
+ {
+ for (key in msg)
+ {
+ $('.meta[key="'+key+'"]').text(msg[key]);
+ }
+ });
</script>
@@ -70,13 +94,51 @@
</head>
-<body>
-<button class="send" event="pl_Previous">Previous</button>
+<body>
+
+
+<table>
+<tr><th colspan=2>filesystem data </tr>
+<tr><th>Root dir <td class="entry" key="rootPath"></tr>
+<tr><th>Selected dir <td class="entry" key="currentPath"></tr>
+<tr><th>File <td class="entry" key="currentFile"></tr>
+</table>
+
+<table>
+ <tr>
+ <td rowspan=2><button class="send" event="pl_ExitDir">&lt;</button>
+ <td><button class="send" event="pl_PreviousDir">^</button>
+ <td rowspan=2><button class="send" event="pl_EnterDir">&gt;</button>
+ </tr>
+
+ <tr>
+ <td><button class="send" event="pl_NextDir">v</button>
+ </tr>
+</table>
+
+
+
+
+
+<p>
+<button class="send" event="pl_Previous">&lt; &lt; Previous song</button>
<button class="send" event="play_Pause">Pause</button>
<button class="send" event="play_Stop">Stop</button>
-<button class="send" event="pl_Next">Next</button>
-<div class="time"></div>
+<button class="send" event="pl_Next">Next song &gt; &gt; </button>
+<b class="state"></b>
+
+<p>
+<div class="time"></div>
+
+<p>
+<table>
+<tr><th colspan=2>player metadata </tr>
+<tr><th>Title <td class="meta" key="title"></tr>
+<tr><th>url <td class="meta" key="url"></tr>
+<tr><th>mrl <td class="meta" key="mrl"></tr>
+<tr><th>artist <td class="meta" key="artist"></tr>
+</table>
</body>
</html>