-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsonos-weblinks.xsl
234 lines (228 loc) · 10.5 KB
/
sonos-weblinks.xsl
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Latest compiled and minified Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous" />
<!-- Optional Bootstrap theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous" />
<!-- Latest compiled and minified Bootstrap JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<!-- script to reboot all Sonos devices -->
<script src="sonos-reboot-all.js"></script>
<title>Sonos Web Links</title>
</head>
<body>
<div class="container">
<h2>Sonos Web Links</h2>
<table class="table table-bordered table-striped table-hover table-condensed small">
<thead>
<tr>
<th>Zone Name</th>
<th>Model</th>
<th>Version</th>
<th>IP Address</th>
<th>MAC Address</th>
<th>STP</th>
<th>Status</th>
<th>Support Review</th>
<th>Device Description</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<xsl:variable name="STPSecondaryNodes" select="//table[@key='STPSecondaryNodes']"/>
<xsl:for-each select="//script[@id='sonos-info']">
<xsl:sort select="elem[@key='ZoneName']" />
<xsl:variable name="ZoneName" select="elem[@key='ZoneName']" />
<xsl:variable name="IPAddress" select="elem[@key='IPAddress']" />
<xsl:variable name="MACAddress" select="elem[@key='MACAddress']" />
<xsl:variable name="WiFiMACAddress" select="elem[@key='WiFiMACAddress']"/>
<xsl:variable name="STPRootBridge" select="elem[@key='STPRootBridge']" />
<xsl:variable name="STPSecondaryNode" select="$STPSecondaryNodes/elem[@key=$WiFiMACAddress or @key=$MACAddress]" />
<xsl:variable name="RebootOrder">
<xsl:call-template name="RebootOrderTemplate">
<xsl:with-param name="root" select="$STPRootBridge" />
<xsl:with-param name="secondary" select="$STPSecondaryNode" />
</xsl:call-template>
</xsl:variable>
<tr>
<td><xsl:copy-of select="$ZoneName"/></td>
<td><xsl:value-of select="elem[@key='modelName']"/></td>
<td><xsl:value-of select="elem[@key='displayVersion']"/></td>
<td><xsl:copy-of select="$IPAddress" /></td>
<td><xsl:copy-of select="$MACAddress"/> (Wired) <br /> <xsl:copy-of select="$WiFiMACAddress"/> (WiFi)</td>
<td>
<xsl:call-template name="StpDepthTemplate">
<xsl:with-param name="root" select="$STPRootBridge" />
<xsl:with-param name="secondary" select="$STPSecondaryNode" />
</xsl:call-template>
</td>
<td>
<a target="_blank">
<xsl:attribute name="href">
<xsl:text>http://</xsl:text>
<xsl:copy-of select="$IPAddress"/>
<xsl:text>:1400/status</xsl:text>
</xsl:attribute>
/status
</a>
</td>
<td>
<a target="_blank">
<xsl:attribute name="href">
<xsl:text>http://</xsl:text>
<xsl:copy-of select="$IPAddress"/>
<xsl:text>:1400/support/review</xsl:text>
</xsl:attribute>
/support/review
</a>
</td>
<td>
<a target="_blank">
<xsl:attribute name="href">
<xsl:text>http://</xsl:text>
<xsl:copy-of select="$IPAddress"/>
<xsl:text>:1400/xml/device_description.xml</xsl:text>
</xsl:attribute>
/xml/device_description.xml
</a>
</td>
<td>
<div class="btn-group btn-group-xs">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Action<span class="caret"></span></button>
<ul class="dropdown-menu dropdown-menu-right">
<li class="dropdown-header">Zone: <xsl:copy-of select="$ZoneName"/></li>
<li>
<a target="_blank">
<xsl:attribute name="class">
<xsl:text>SonosReboot </xsl:text>
<xsl:value-of select="$RebootOrder"/>
</xsl:attribute>
<xsl:attribute name="href">
<xsl:text>http://</xsl:text>
<xsl:copy-of select="$IPAddress"/>
<xsl:text>:1400/reboot</xsl:text>
</xsl:attribute>
Reboot
</a>
</li>
<li>
<a target="_blank">
<xsl:attribute name="href">
<xsl:text>http://</xsl:text>
<xsl:copy-of select="$IPAddress"/>
<xsl:text>:1400/tools.htm</xsl:text>
</xsl:attribute>
Tools
</a>
</li>
<li>
<a target="_blank">
<xsl:attribute name="href">
<xsl:text>http://</xsl:text>
<xsl:copy-of select="$IPAddress"/>
<xsl:text>:1400/region.htm</xsl:text>
</xsl:attribute>
Set WiFi Region
</a>
</li>
<li>
<a target="_blank">
<xsl:attribute name="href">
<xsl:text>http://</xsl:text>
<xsl:copy-of select="$IPAddress"/>
<xsl:text>:1400/advconfig.htm</xsl:text>
</xsl:attribute>
Advanced Config
</a>
</li>
<li role="separator" class="divider"></li>
<li class="dropdown-header">Wi-Fi Control</li>
<li>
<a target="_blank">
<xsl:attribute name="href">
<xsl:text>http://</xsl:text>
<xsl:copy-of select="$IPAddress"/>
<xsl:text>:1400/wifictrl?wifi=on</xsl:text>
</xsl:attribute>
On
</a>
</li>
<li>
<a target="_blank">
<xsl:attribute name="href">
<xsl:text>http://</xsl:text>
<xsl:copy-of select="$IPAddress"/>
<xsl:text>:1400/wifictrl?wifi=off</xsl:text>
</xsl:attribute>
Off
</a>
</li>
<li>
<a target="_blank">
<xsl:attribute name="href">
<xsl:text>http://</xsl:text>
<xsl:copy-of select="$IPAddress"/>
<xsl:text>:1400/wifictrl?wifi=persist-off</xsl:text>
</xsl:attribute>
Persist-Off
</a>
</li>
</ul> <!-- Dropdown-Menu -->
</div> <!-- Button-Group -->
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
<p class="small">XML generated at <mark><xsl:value-of select="//finished/@timestr"/></mark> with command <code><xsl:value-of select="//nmaprun/@args"/></code></p>
<h3>Sonos Web Interface References</h3>
<ul>
<li><a target="_blank" href="https://github.com/barcar/sonos-weblinks">Sonos-WebLinks on GitHub</a></li>
<li><a target="_blank" href="https://bsteiner.info/articles/hidden-sonos-interface">The Sonos Web Inferface</a></li>
<li><a target="_blank" href="http://phil.lavin.me.uk/2014/08/how-to-optimize-sonos-for-best-performance/">How to optimize Sonos for best performance</a></li>
<li><a target="_blank" href="https://bsteiner.info/articles/disabling-sonos-wifi">Disabling the WiFi Link on a Sonos Music Player</a></li>
<li><a target="_blank" href="https://github.com/SoCo/SoCo/wiki/Information-Adresses">Sonos Information Addresses</a></li>
</ul>
</div> <!-- Container -->
</body>
</html>
</xsl:template>
<xsl:template name="StpDepthTemplate">
<xsl:param name="root"/>
<xsl:param name="secondary"/>
<xsl:choose>
<xsl:when test="$root='Yes'">
<xsl:text>√</xsl:text>
</xsl:when>
<xsl:when test="$secondary='Yes'">
<xsl:text>2°</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>3°</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="RebootOrderTemplate">
<xsl:param name="root"/>
<xsl:param name="secondary"/>
<xsl:choose>
<xsl:when test="$root='Yes'">
<xsl:text>SonosReboot1st </xsl:text>
</xsl:when>
<xsl:when test="$secondary='Yes'">
<xsl:text>SonosReboot2nd </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>SonosReboot3rd </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>