forked from flensrocker/vdr-plugin-dbus2vdr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
104 lines (80 loc) · 3.82 KB
/
README
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
This is a "plugin" for the Video Disk Recorder (VDR).
Written by: Lars Hanisch <[email protected]>
Project's homepage: https://github.com/flensrocker/vdr-plugin-dbus2vdr
Latest version available at: git://github.com/flensrocker/vdr-plugin-dbus2vdr.git
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
See the file COPYING for more information.
Description:
This plugin will expose some methods via DBus to control the vdr.
Installation
------------
dbus2vdr will use the system bus so your box has to be configured that the user
in which context your vdr is running is allowed to connect to it.
Copy the de.tvdr.vdr.conf file to /etc/dbus-1/system.d and adjust it to your needs.
It is prepared that only the user 'vdr' can own the used destination and every user
can call its methods.
In the bin-directory you find a helper script for sending dbus messages to the vdr.
Instead of calling:
dbus-send --system --type=method_call --dest=de.tvdr.vdr \
--print-reply /Plugins/<pluginname> \
de.tvdr.vdr.plugin.SVDRPCommand string:'command' string:'parameter'
you can call:
vdr-dbus-send.sh /Plugins/<pluginname> plugin.SVDRPCommand string:'command' string:'parameter'
Implemented features
--------------------
- send SVDRP commands to plugins
vdr-dbus-send.sh /Plugins/<pluginname> plugin.SVDRPCommand string:'command' string:'parameter'
If the SVDRP command doesn't take a parameter you can ommit it or pass an empty string.
- call Service method of plugins
vdr-dbus-send.sh /Plugins/<pluginname> plugin.Service string:'id' string:'data'
- read EPG data from file
vdr-dbus-send.sh /EPG epg.PutFile string:'/path/to/epg/data'
- get infos about the next timer
vdr-dbus-send.sh /Timers timer.Next
The following is returned:
int32 reply code (250 for success, 550 on error)
int32 timer id (-1 if there's no timer at all)
int32 'rel' seconds (see SVDRP NEXT REL)
uint64 starttime in seconds since epoch (time_t format)
uint64 stoptime in seconds since epoch (time_t format)
string title of the event
- enable/disable the remote
vdr-dbus-send.sh /Remote remote.Enable
vdr-dbus-send.sh /Remote remote.Disable
vdr-dbus-send.sh /Remote remote.Status
- hit a key
vdr-dbus-send.sh /Remote remote.HitKey string:'Menu'
- open the main menu entry of a plugin
vdr-dbus-send.sh /Remote remote.CallPlugin string:'name-of-plugin'
- trigger an update of the list of recordings
vdr-dbus-send.sh /Recording recording.Update
Using the Python binding
------------------------
First, I don't know Python at all, I just copy code fragments from the Python Binding Tutorial [1]
and replace the sample strings with dbus2vdr related ones. I hope everybody familiar with Python
will know what to do...
import dbus
bus = dbus.SystemBus()
Timers = bus.get_object('de.tvdr.vdr', '/Timers')
props = Timers.Next(dbus_interface = 'de.tvdr.vdr.timer')
# props is now a tuple with data like mentioned above
How to implement new interfaces
-------------------------------
- add the interface name to common.h
- create a subclass of cDBusMessageDispatcher and pass the interface name
to its base constructor
- return subclasses of cDBusMessage in its CreateMessage method depending
on object path, method name etc.
- return introspection data in OnIntrospect
- add your code to the Process method of your cDBusMessage classes
- add a 'new cDBusDispatcherYourName' to cPluginDbus2vdr::Start
Notes to myself
---------------
to use dbus in a ssh-shell:
look at ~/.dbus/session-bus/`dbus-uuidgen-get`-... and export DBUS_SESSION_BUS_ADDRESS
Links
-----
[1] http://dbus.freedesktop.org/doc/dbus-python/doc/tutorial.txt