Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Plugin for controlling vdr via DBus as an alternative to SVDRP
C C++ Makefile Other
Failed to load latest commit information.
bin remove useless import in
etc systemd unit: remove %H from ExecStartPre
patches add patch description to extra-video-dir patch
po adjust Makefile to vdr 1.7.36
.gitignore add gitignore file
COPYING initial commit, generated with 'newplugin'
HISTORY add support for vdr 2.3.1
Makefile create the directories before copy
Makefile-1.7.33 adjust Makefile to vdr 1.7.36
Makefile-1.7.34 adjust Makefile to vdr 1.7.33, add new Makefile for vdr 1.7.34
README add method NextWakeupTime to shutdown interface
avahi-helper.h add own SysLogLevel commandline parameter
channel.c readjust some parts for vdr < 2.3.1
channel.h moved channel interface to GDBus
common.h add two new SVDRP commands
connection.c add own SysLogLevel commandline parameter
connection.h keep track of watchers added before connection is established
dbus2vdr.c add support for vdr 2.3.1
epg.c copied cPUTEHandler from vdr's svdrp.c
epg.h removed a lot of old code, port to GDBus is nearly done
helper.c add own SysLogLevel commandline parameter
helper.h got NetworkHandler running finally
libvdr-exitpipe.c shutdown-wrapper is a wrapper which tests the shutdown-hooks
libvdr-exitpipe.h shutdown-wrapper is a wrapper which tests the shutdown-hooks
libvdr-i18n.c shutdown-wrapper is a wrapper which tests the shutdown-hooks
libvdr-i18n.h shutdown-wrapper is a wrapper which tests the shutdown-hooks
libvdr-thread.c shutdown-wrapper is a wrapper which tests the shutdown-hooks
libvdr-thread.h shutdown-wrapper is a wrapper which tests the shutdown-hooks
libvdr-tools.c shutdown-wrapper is a wrapper which tests the shutdown-hooks
libvdr-tools.h shutdown-wrapper is a wrapper which tests the shutdown-hooks
libvdr.h shutdown-wrapper is a wrapper which tests the shutdown-hooks
mainloop.c remove unneeded g_thread_unref (thanks to Gaurav Kalra <gvkalra@gmail…
mainloop.h move mainloop to own file, rename some members
network.c add own SysLogLevel commandline parameter
network.h move avahi browser to network clients
object.c remove some compiler warnings
object.h add thread pool for handling method calls
osd.c fix cPixmap handling for older vdr versions
osd.h port osd interface to GDBus
plugin.c change parameter name so gdbus-codegen has no problems
plugin.h removed a lot of old code, port to GDBus is nearly done
recording.c readjust some parts for vdr < 2.3.1
recording.h removed a lot of old code, port to GDBus is nearly done
remote.c readjust some parts for vdr < 2.3.1
remote.h removed a lot of old code, port to GDBus is nearly done
sd-daemon.c add systemd support via sd_notify
sd-daemon.h add systemd support via sd_notify
setup.c add support for vdr 2.3.1
setup.h removed a lot of old code, port to GDBus is nearly done
shutdown-wrapper.c shutdown-wrapper is a wrapper which tests the shutdown-hooks
shutdown-wrapper.h shutdown-wrapper is a wrapper which tests the shutdown-hooks
shutdown.c readjust some parts for vdr < 2.3.1
shutdown.h removed a lot of old code, port to GDBus is nearly done
skin.c removed a lot of old code, port to GDBus is nearly done
skin.h removed a lot of old code, port to GDBus is nearly done
status.c add new status call ChannelChange
status.h add method IsReplaying to status interface
timer.c readjust some parts for vdr < 2.3.1
timer.h removed a lot of old code, port to GDBus is nearly done
vdr.c get TimerChange signal from remote dbus2vdr
vdr.h removed a lot of old code, port to GDBus is nearly done


This is a "plugin" for the Video Disk Recorder (VDR).

Written by:                  Lars Hanisch <>

Project's homepage:

Latest version available at: 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.

This plugin will expose some methods via DBus to control the vdr.

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: /Plugins/<pluginname> plugin.SVDRPCommand string:'command' string:'parameter'

Debian/Ubuntu packages:
libdbus-1-dev, libglib2.0-dev, pkg-config, libjpeg-dev, libpng++-dev

Objectpaths and interface names are restricted to some naming conventions. Only letters, numbers
and the underscore are allowed. DBus doesn't provide any official escaping, so dbus2vdr won't do it.
The only part of the names, which could contain other symbols are name of plugins. But "officially"
there are also no other characters than letters and numbers allowed. And I only knew about
streamdev-server/-client which break this rule. I think they should get fixed...

Multi Instance Support
The default destination address is "de.tvdr.vdr". In case of a vdr version above 1.7.4 and an
instance id (vdr parameter -i) greater than 0, this instance id is appended to this address,
e.g. "de.tvdr.vdr1". If you use this feature you have to clone the dbus-policy file and change
the address. Also is not ready for this - use dbus-send or whatever you use to
communicate with dbus2vdr...

Commandline Arguments
-s, --shutdown-hooks=/path/to/shutdown-hooks
        uses all files in the given directory as shutdown-hooks
        usually it's /usr/share/vdr/shutdown-hooks
-w, --shutdown-hooks-wrapper=/path/to/shutdown-hooks-wrapper
        path to a program that will call the shutdown-hooks with suid
-o, --osd
        creates an OSD-provider which will save the OSD as PNG files
        (see comments below at section "OSD")
        use sd_notify to notify systemd
-u, --upstart
        enable Upstart started/stopped events
-n, --network
        enable network support
        (see comments below at section "Network")
        connect to the session D-Bus daemon
        don't connect to the system D-Bus daemon
        don't start GMainLoop
        (don't use this option if you don't understand)

Interface "channel"
- get count of channels /Channels channel.Count

- get channels between from_index and to_index /Channels channel.GetFromTo int32:from_index int32:to_index

- list channels like SVDRP command CHAN /Channels channel.List string:'[ :groups | <number> | <name> | <id> ]'

  The returned array contains the channel number and the string from the channels.conf.

Interface "epg"
- disable EIT scanner with timeout (default: 3600) /EPG epg.DisableScanner int32:3600

- enable EIT scanner /EPG epg.EnableScanner

- clear EPG data with a value for inactivity timeout of eit-scanner (default: 10) /EPG epg.ClearEPG string:'channel' int32:10

- add EPG entry /EPG epg.PutEntry array:string:'C ...','E ...',...

  The end marker argument '.' will be added if not provided.

- read EPG data from file /EPG epg.PutFile string:'/path/to/epg/data'

- get current or next event of given or all channels if string is empty /EPG epg.Now string:'channel' /EPG epg.Next string:'channel' /EPG epg.At string:'channel' uint64:time

  The events are returned as an array of structs.
  Each struct contains a string as a key and a variant as its value.
  Possible keys and their variant type are:
  ChannelID      string
  EventID        uint32
  Title          string
  ShortText      string
  Description    string
  StartTime      uint64
  EndTime        uint64
  Duration       uint64
  Vps            uint64
  RunningStatus  int32
  ParentalRating int32
  ContentID[i]   int32  (0 <= i <= MaxEventContents)
  Content[i]     string (0 <= i <= MaxEventContents)

Interface "plugin"
If a plugin's name contains a hyphen, it will be replaced with an underscore in its
object-path, e.g. streamdev-server will be found at /Plugins/streamdev_server.

- send SVDRP commands to plugins /Plugins/<pluginname> plugin.SVDRPCommand string:'command' string:'parameter'

If the SVDRP command doesn't take a parameter you must pass an empty string.

- call Service method of plugins /Plugins/<pluginname> plugin.Service string:'id' string:'data'

Interface "pluginmanager"
- list all loaded plugins /Plugins pluginmanager.List
  You'll get an array of structs containing two strings, the name and the version of the plugins.

Interface "recording"
- trigger an update of the list of recordings /Recordings recording.Update

- get info about one recording /Recordings recording.Get [ variant:int32:number | variant:string:'path' ]

  The following is returned:
  struct of
    int32  number of recording
    array of
      string   key
      variant  value

  possible keys: Path, Name, Title, Start, Deleted, Priority, Lifetime,
  HierarchyLevels, FramesPerSecond, NumFrames, LengthInSeconds, FileSizeMB,
  IsPesRecording, IsNew, IsEdited
  If an cRecordingInfo object exists there can also be:
  Info/ChannelID, Info/ChannelName, Info/Title, Info/ShortText, Info/Description,
  Info/Aux, Info/FramesPerSecond
  If the info object has components there might be:
  Info/Component/<nr>/stream, Info/Component/<nr>/type, Info/Component/<nr>/language,

- list recordings /Recordings recording.List

  returned is an array of the same structs as with "Get".
- play recording given by path or number /Recordings recording.Play [ variant:int32:number | variant:string:'path' ] [ variant:string:'hh:mm:ss.f' | variant:int32:framenumber ]
  If framenumber is -1, playing is resumed at the last saved position.

If your vdr is patched with the "extra video directories" patch there are also the following methods.

- add extra video directory /Recordings recording.AddExtraVideoDirectory string:directory

  Don't forget to manually update your recordings after adding all directories.

- clear extra video directories list /Recordings recording.ClearExtraVideoDirectories

- delete an extra video directory /Recordings recording.DeleteExtraVideoDirectory string:directory

- list all extra video directories /Recordings recording.ListExtraVideoDirectories

  Besides the usual reply-code and -message you get an array of strings with the
  currently present video directories.

Interface "remote"
- enable/disable the remote /Remote remote.Enable /Remote remote.Disable /Remote remote.Status

- hit a key, you may specify more than one key /Remote remote.HitKey string:'Menu' /Remote remote.HitKeys array:string:'Menu','Down','Down','Ok',...

- display list of strings on the osd and let the user select one /Remote remote.AskUser string:'title' array:string:'item 1','item 2',...

  The zero-based index of the selected item will be returned with the signal "AskUserSelect",
  the first parameter is the title-string, the second the index.
  An index of -1 means, no item is selected (or osd closed because of a timeout).

- open the main menu entry of a plugin /Remote remote.CallPlugin string:'name-of-plugin'

- switch channel like SVDRP command CHAN /Remote remote.SwitchChannel string:'[ + | - | <number> | <name> | <id> ]'

- get/set volume like SVDRP command VOLU /Remote remote.GetVolume /Remote remote.SetVolume variant:string:'[ <number> | + | - | mute ]' /Remote remote.SetVolume variant:int32:<number>

  return type:
  - int32   with the current volume
  - bool    with the current mute status
  additional return values at SetVolume:
  - int32   reply code
  - string  reply message

Interface "setup"
- list all parameters from setup.conf /Setup setup.List

  return type is an array of structs containing a string and a variant.
  The string contains the key of the line from the setup.conf.
  The variant can be:
  - struct of three integers "(iii)":
    value of the option and its min and max values
  - struct of string and integer "(si)":
    value of the option and its max length (-1 for unknown)
  - 64bit integer "x":
    value of the option (timestamp)

- get parameters from setup.conf /Setup setup.Get string:'MinUserInactivity'

- set parameters to setup.conf /Setup setup.Set string:'MinUserInactivity' variant:int32:0
  Some parameters are known to be integers (look at setup.c) with a valid
  range. All others are handled as strings.
  WARNING: Be careful to set values unknown to dbus2vdr. It will trigger a reload
  of the whole setup.conf including calls to SetupParse of every plugin.
  This might have unexpected side effects!

- delete parameters from setup.conf /Setup setup.Del string:'PrimaryLimit'

You may also get/set/delete parameters for plugins with /Setup setup.Get string:'pluginname.parameter' /Setup setup.Set string:'pluginname.parameter' variant:string:'value' /Setup setup.Del string:'pluginname.parameter'
but it is not guaranteed that it will work and that changes will affect the plugin's
behaviour immediately.
dbus2vdr will call the plugin's "SetupParse" function. If it returns true the value
is stored in the setup.conf. You may need to restart vdr.

- delete all settings of one plugin /Setup setup.Del string:'pluginname.*'

Interface "shutdown"
- ask vdr if it is ready for shutdown /Shutdown shutdown.ConfirmShutdown boolean:true
  possible reply codes:
    250: vdr is ready for shutdown
    550: vdr is not ready for shutdown (unknown reason)
    901: user is active
    902: cutter is active
    903: recording is active
    904: recording is active in the near future
    905: some plugin is active
    906: some plugin will wakeup vdr in the near future
    990: (reply message contains SHUTDOWNCMD)
    991: (reply message contains TRY_AGAIN of the shutdown-hooks)
    992: (reply message contains ABORT_MESSAGE of the shutdown-hooks)
    999: shutdown-hook returned a non-zero exit code

  You may shutdown vdr on reply codes 250 and 990.
  If SHUTDOWNCMD is given use this command for shutdown.
  'shutdown-wrapper' is a tool which calls the shutdown-hooks.
  If the hooks need elevated privileges set the SUID bit of the wrapper accordingly.
  The boolean argument "ignoreuser" will ignore user activity. This may be
  useful for external frontends like XBMC etc..

- ask if vdr was started manually /Shutdown shutdown.ManualStart
  Actually it compares the startup time of vdr with the current set NextWakeupTime.
  If the startup time is around the NextWakeupTime (600 seconds) "true" will be returned.
  Remember that NextWakeupTime may change while vdr is running.

- get timestamp of next wakeup /Shutdown shutdown.NextWakeupTime
  Returns the starttime of the next timer or the next plugin.
  Remember that NextWakeupTime may change while vdr is running.

- set vdr to non-interactive mode /Shutdown shutdown.SetUserInactive

Interface "skin"
- display a message at the OSD /Skin skin.QueueMessage string:'message text'

- get information about available skins /Skin skin.ListSkins
  You will get an array of index, name and description.

- get information about current skin /Skin skin.CurrentSkin
  You will get the index, name and description.

- set the current skin /Skin skin.SetSkin string:'name'

Interface "status"
Via the status interface the signals from vdr's cStatus class will be emitted.
See <vdr/status.h> for more information about the parameters.

- "ChannelSwitch"
    int32  DeviceNumber
    int32  ChannelNumber
    bool   LiveView

- "Recording"
    int32  DeviceNumber
    string Name
    string FileName
    bool   On

- "Replaying"
    string Name
    string FileName
    bool   On

- "SetAudioChannel"
    int32  AudioChannel

- "SetAudioTrack"
    int32  Index
    array:string Tracks

- "SetSubtitleTrack"
    int32  Index
    array:string Tracks

- "SetVolume"
    int32   Volume
    boolean Absolute

- "TimerChange"
    string Timer
    string Change (may be "tcMod", "tcAdd" or "tcDel")

And there are the following methods on the status interface.
- is vdr replaying a recording /Status status.IsReplaying
  It returns the name, filename and a boolean value like the signal "Replaying".

Interface "timer"
- list all timers /Timers timer.List

- get infos about the next timer /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

- add new timer /Timers timer.New string:'timer'

- delete a timer /Timers timer.Delete int32:number

Interface "vdr"
- get status of vdr /vdr vdr.Status

  The following is returned:
    string  "Start", "Ready", "Stop" or "Unknown"

  Through the lifetime of dbus2vdr there are three signals which are sent
  via this interface. The instance-id of the vdr is sent as the first
  argument, type is int32.

  "Start": is sent when cPlugin::Start is called
  "Ready": is sent when cPlugin::MainThreadHook is called the first time
  "Stop" : is sent when cPlugin::Stop is called

Plugin-Service calls
Right after the start of the default GMainLoop all plugins are called with
Just before the main loop quits, all plugins are called with

If started with the parameter "--network" dbus2vdr expects a file
"network-address.conf" in its plugin config directory. Its contents
should contain a string representing a dbus-address like printed
of "dbus-daemon --print-address". There must be only one connection
string with the method "tcp".
A sample configuration for this special dbus-daemon can be found at
etc/network.conf. There's also a sample Upstart job at etc/dbus2vdr.conf.
This job should run as a user job, not as a system job, since it's
reachable from the net.
Interfaces must explicitly be enabled to listen on the network monitor.
For now a subset of the status, timer and recording interface is implemented.
(work in progress, must be documented...)

If started with the parameter "--osd" dbus2vdr will create an OSD-provider.
If you have another output plugin running, this is not recommended since it may
override its OSD-provider. For now it's just for fun (or a headless vdr).
If the vdr opens an OSD, dbus2vdr will dump the pixmap to a PNG file and signals this.
Every change at the OSD will generate another PNG and signal. If the OSD closes all
files will be deleted.
Every image between "Open" and "Close" has to be displayed on top of its predecessors.

- create the DBus-OSD-provider on the fly /OSD osd.CreateProvider

- delete the DBus-OSD-provider and reinstantiate the OSD-provider of the primary device /OSD osd.DeleteProvider

interface: de.tvdr.vdr.osd
path: /OSD

signal: Open
parameter: osd-id   (string, actually the path where the PNGs will be stored)
           left     (int32, left position of OSD)
           top      (int32, top position of OSD)

signal: Display
parameter: filename (string)
           left     (int32)
           top      (int32)
           vx       (int32, x-coordinate of dirty part relative to left)
           vy       (int32, y-coordinate of dirty part relative to top)

signal: Close
parameter: osd-id   (string)

You can watch the signals with (or write your own program):
  dbus-monitor --system "type='signal',sender='de.tvdr.vdr',interface='de.tvdr.vdr.osd'"

Since the DBus signals are not really "fast" the files may not exist anymore if you
receive them.

When all plugins are started and dbus2vdr enters the first time the "MainThreadHook"
it can notify systemd with a sd_notify call and "READY=1". systemd will then know that
vdr has been fully initialised and dependant services can be started.
You have to use "Type=notify" at the service definition file.

When all plugins are started and dbus2vdr enters the first time the "MainThreadHook"
it raises SIGSTOP so Upstart knows vdr has been fully initialized.

If you want to start vdr whenever a client tries to access de.tvdr.vdr on DBus
you can create a DBus service file like
with the following content:
[D-BUS Service]

Your vdr-upstart-job has to "start on dbus-activation de.tvdr.vdr".
If you don't use Upstart "Exec" has to point to your "runvdr" or whatever you use and
you can omit the "UpstartJob=true" line.

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 cDBusObject and pass the object path and introspection data
  to its base constructor
- call AddMethod for all supported methods
- add the object to the desired connections (system, session, network)

Notes to myself
to use dbus in a ssh-shell:
look at ~/.dbus/session-bus/`dbus-uuidgen-get`-... and export DBUS_SESSION_BUS_ADDRESS

Something went wrong with that request. Please try again.