Skip to content

Commit d38993f

Browse files
committed
implemented OSD (via svdrposd plugin) and remote control
1 parent 9821282 commit d38993f

File tree

11 files changed

+295
-21
lines changed

11 files changed

+295
-21
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ xtend-gen
99
.settings
1010
build
1111
/external-jar/
12+
/svdrposd-src/

TODO

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
TODOs in no specific order:
22

33
- epg overview: implement alarm
4-
- OSD view is not implemented
5-
- channel configuration view: is it possible to update the channel list in live/running vdr?
6-
- automatically change epg-data (that search timers are able to filter) -> But how to prevent epgd to change the epg entry?
74
- epgsearch view: save and use templates
85
- more rights / better password configuration (use e.g. a hashed value)
96
- monitor open VDR connections (i'm not sure if everything is working as desired)
107
- wake on lan
118
- epg view: favourite channel list
129
- channel config view: save and load configuration
1310

14-
1511
TODOs which are not yet reasoned:
1612

1713
- implement SVDRP-only VDR plugin to get more information / do something useful
1814
e.g. - get list of deleted recordings / undelete recordings
1915
- implement svdrp server to show jonglisto OSD entries:
2016
e.g. - favourite channel list
2117
- epg suggestions (together with an epg search mechanism)
18+
- automatically change epg-data (that search timers are able to filter) -> But how to prevent epgd to change the epg entry?
19+
- channel configuration view: is it possible to update the channel list in live/running vdr?
2220

2321
finished TODOs:
2422

@@ -29,3 +27,4 @@ finished TODOs:
2927
- recording view: show free/used harddisk size
3028
- channel logos
3129
- play video in recording view
30+
- OSD view is not implemented
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package vdr.jonglisto.model
2+
3+
import java.util.ArrayList
4+
import java.util.List
5+
import org.eclipse.xtend.lib.annotations.Accessors
6+
import org.eclipse.xtend.lib.annotations.EqualsHashCode
7+
import org.eclipse.xtend.lib.annotations.ToString
8+
9+
@Accessors
10+
@EqualsHashCode
11+
@ToString
12+
class VDROsd {
13+
var String title
14+
var List<VDROsdMenuItem> menuItems = new ArrayList<VDROsdMenuItem>
15+
var String textBlock
16+
var String red
17+
var String green
18+
var String yellow
19+
var String blue
20+
var String statusMessage
21+
22+
var List<Integer> layout = new ArrayList<Integer>
23+
24+
def addMenuItem(String type, String menuItem) {
25+
menuItems.add(new VDROsdMenuItem(type, menuItem))
26+
}
27+
28+
def addLayout(Integer c) {
29+
layout.add(c)
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package vdr.jonglisto.model
2+
3+
import java.util.ArrayList
4+
import java.util.List
5+
import org.eclipse.xtend.lib.annotations.Accessors
6+
import org.eclipse.xtend.lib.annotations.EqualsHashCode
7+
import org.eclipse.xtend.lib.annotations.ToString
8+
9+
@Accessors
10+
@EqualsHashCode
11+
@ToString
12+
class VDROsdMenuItem {
13+
var boolean isSelected = false
14+
var List<String> items
15+
16+
new(String type, String line) {
17+
isSelected = type == 'S'
18+
items = line.split("\t").toList
19+
}
20+
}

samples/remote.xml

+12
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,16 @@
173173
<icon>VOLUME_UP</icon>
174174
</button>
175175

176+
<!-- Row 21 -->
177+
<button row="21" column="1">
178+
<key>Channel-</key>
179+
<label>Chan-</label>
180+
</button>
181+
182+
<button row="21" column="3">
183+
<key>Channel+</key>
184+
<label>Chan+</label>
185+
</button>
186+
187+
176188
</remote>

src/main/webapp/VAADIN/themes/jonglisto/jonglisto.scss

+42
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,46 @@ $v-focus-style: none;
5454
.v-button-red {
5555
@include valo-button-style($background-color: #FF0000, $unit-size: null);
5656
}
57+
58+
.v-label-yellow {
59+
background-color: #FFFF00;
60+
color: #000000;
61+
min-width: 80px;
62+
padding: 10px;
63+
font-weight: bold;
64+
}
65+
66+
.v-label-green {
67+
background-color: #008000;
68+
color: #000000;
69+
min-width: 80px;
70+
padding: 10px;
71+
font-weight: bold;
72+
}
73+
74+
.v-label-blue {
75+
background-color: #0000FF;
76+
color: #000000;
77+
min-width: 80px;
78+
padding: 10px;
79+
font-weight: bold;
80+
}
81+
82+
.v-label-red {
83+
background-color: #FF0000;
84+
color: #000000;
85+
min-width: 80px;
86+
padding: 10px;
87+
font-weight: bold;
88+
}
89+
90+
.v-label-osditem {
91+
padding-right: 20px;
92+
}
93+
94+
.v-label-selectedosditem {
95+
padding-right: 20px;
96+
background-color: #C35817;
97+
color: #FFFFFF;
98+
}
5799
}

svdrp/src/main/java/vdr/jonglisto/svdrp/client/Parser.xtend

+30-5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import vdr.jonglisto.model.EpgsearchSearchTimer
2020
import vdr.jonglisto.model.Recording
2121
import vdr.jonglisto.model.Timer
2222
import vdr.jonglisto.model.VDRDiskStat
23+
import vdr.jonglisto.model.VDROsd
2324
import vdr.jonglisto.model.VdrPlugin
2425
import vdr.jonglisto.util.DateTimeUtil
2526
import vdr.jonglisto.util.Utils
@@ -283,7 +284,7 @@ class Parser {
283284
return result
284285
}
285286

286-
def static parsePlugin(String line) {
287+
static def parsePlugin(String line) {
287288
val matcher = pluginPattern.matcher(line)
288289
if (matcher.matches) {
289290
return new VdrPlugin(matcher.group(1), matcher.group(2), matcher.group(3))
@@ -292,7 +293,7 @@ class Parser {
292293
return null
293294
}
294295

295-
def static parseStat(String line) {
296+
static def parseStat(String line) {
296297
val matcher = statPattern.matcher(line)
297298
if (matcher.matches) {
298299
return new VDRDiskStat(Long.parseLong(matcher.group(1)), Long.parseLong(matcher.group(2)))
@@ -301,7 +302,7 @@ class Parser {
301302
return new VDRDiskStat(0,0)
302303
}
303304

304-
def static parseEpgsearchList(String line) {
305+
static def parseEpgsearchList(String line) {
305306
val result = new EpgsearchSearchTimer
306307
val splitted = line.split(":")
307308

@@ -323,7 +324,7 @@ class Parser {
323324
return result
324325
}
325326

326-
def static parseEpgsearchCategory(String line) {
327+
static def parseEpgsearchCategory(String line) {
327328
val splitted = line.split("\\|")
328329
val result = new EpgsearchCategory
329330

@@ -342,7 +343,7 @@ class Parser {
342343
return result
343344
}
344345

345-
def static parseEpgsearchChannelGroup(String line) {
346+
static def parseEpgsearchChannelGroup(String line) {
346347
val splitted = line.split("\\|").stream.collect(Collectors.toList)
347348
val result = new EpgsearchChannelGroup
348349

@@ -352,6 +353,30 @@ class Parser {
352353
return result
353354
}
354355

356+
static def VDROsd parseRemoteOsd(List<String> input) {
357+
val osd = new VDROsd
358+
359+
input.forEach(s | {
360+
val type = String.valueOf(s.charAt(0))
361+
val line = s.substring(2)
362+
363+
switch(type) {
364+
case 'T': osd.title = line
365+
case 'C': osd.addLayout(Integer.valueOf(line))
366+
case 'I': osd.addMenuItem(type, line)
367+
case 'S': osd.addMenuItem(type, line)
368+
case 'X': osd.textBlock = line
369+
case 'R': osd.red = line
370+
case 'G': osd.green = line
371+
case 'Y': osd.yellow = line
372+
case 'B': osd.blue = line
373+
case 'M': osd.statusMessage = line
374+
}
375+
})
376+
377+
return osd
378+
}
379+
355380
/* helper methods */
356381
private static def extractChannel(String line) {
357382
return line.substring(0, line.indexOf(" "))

svdrp/src/main/java/vdr/jonglisto/svdrp/client/SvdrpClient.xtend

+10
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,16 @@ class SvdrpClient {
282282
}
283283
}
284284

285+
def getOsd(VDR vdr) {
286+
try {
287+
val response = vdr.command("PLUG svdrposd LSTO 30", 920)
288+
return Parser.parseRemoteOsd(response.lines)
289+
} catch (Exception e) {
290+
// no open OSD or host down
291+
return null
292+
}
293+
}
294+
285295
def processCommand(VDR vdr, Optional<String> command) {
286296
if (command.isPresent) {
287297
processCommand(vdr, command.get)
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package vdr.jonglisto.web.ui
22

3+
import com.vaadin.ui.HorizontalLayout
34
import vdr.jonglisto.configuration.Configuration
45
import vdr.jonglisto.model.VDR
6+
import vdr.jonglisto.svdrp.client.SvdrpClient
7+
import vdr.jonglisto.web.ui.component.OsdComponent
58
import vdr.jonglisto.web.ui.component.RemoteComponent
69
import vdr.jonglisto.xtend.annotation.Log
710

@@ -11,23 +14,34 @@ import static extension vdr.jonglisto.web.xtend.UIBuilder.*
1114
class OsdView extends BaseView {
1215

1316
val RemoteComponent remote
17+
var OsdComponent osd
18+
val HorizontalLayout layout
1419

1520
new() {
1621
super(BUTTON.OSD)
17-
remote = new RemoteComponent(null, Configuration.get.remoteConfig)
22+
remote = new RemoteComponent(this, selectedVdr, Configuration.get.remoteConfig)
23+
osd = new OsdComponent(selectedVdr, SvdrpClient.get.getOsd(selectedVdr))
1824

19-
val h = horizontalLayout[
25+
layout = horizontalLayout[
2026
setSizeFull
2127
addComponent(remote)
28+
addComponentsAndExpand(osd)
2229
]
2330

24-
addComponentsAndExpand(h)
31+
addComponentsAndExpand(layout)
32+
}
33+
34+
def updateOsd() {
35+
val oldOsd = osd
36+
osd = new OsdComponent(selectedVdr, SvdrpClient.get.getOsd(selectedVdr))
37+
layout.replaceComponent(oldOsd, osd)
2538
}
2639

2740
protected override createMainComponents() {
2841
}
2942

3043
override protected def void changeVdr(VDR vdr) {
3144
remote.changeVdr(vdr)
45+
osd.changeVdr(vdr)
3246
}
3347
}

0 commit comments

Comments
 (0)