summaryrefslogtreecommitdiffstats
path: root/wwwdir/mp.html
blob: 93f55975bd3fb4721b1dc987675dfadc80cd3b69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	<title>Media Zapper</title>

	<script type="text/javascript" src="/synapse/synapse.js"></script>

	<script type="text/javascript">

	/// SYNAPSE EVENT HANDLERS


	synapse_register("error",function(errortxt)
	{
		$('#error').html(errortxt);
	});	

			
	synapse_register("module_SessionStart",function(msg_src, msg_dst, msg_event, msg)
	{
        send(1, "core_Login", { 
            username: "admin",
            password: "as"
        });

	});

    synapse_register("module_Login",function(msg_src, msg_dst, msg_event, msg)
    {
        //get status from player
        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() 
        {
            send(0,$(this).attr("event"));
        });

        //volume slider
        $(".time").slider({ 
            min: 0,
            slide: function (event, ui)
            {
                send(0,"play_SetTime", { 'time': ui.value } );
            }
        });



    });


    synapse_register("pl_Entry",function(msg_src, msg_dst, msg_event, 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)
        {
            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)
    {
        $(".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>

	<style>


 	</style>
</head>


<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>
<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_ExitPath">&lt;</button>
            <td><button class="send" event="pl_PreviousPath">^</button>  
            <td rowspan=2><button class="send" event="pl_EnterPath">&gt;</button>     
    </tr>

    <tr>
            <td><button class="send" event="pl_NextPath">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 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>