Autostart-plugin

From VDR Wiki
Revision as of 17:54, 25 November 2013 by Wirbel (talk | contribs) (Created page with "==Description== '''Author:''' Ulrich Eckhardt Automatic startup of plugins or generate keypress events when inserting removable media. ===Status=== Last Update 06/2013 ==Softw...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Description

Author: Ulrich Eckhardt

Automatic startup of plugins or generate keypress events when inserting removable media.

Status

Last Update 06/2013

Software Requirements

Configuration

Setup is done in file $VDRCONFIG/conf/plugins/autostart/autostart.conf, you can define actions between media and plugins to be called.

The file autostart.conf is similar to a Windows-like ini-file, a section is started by [name] and includes one or more key/value pairs, separated by a = sign.

The so-called media-tester is an instance, which allows for certain media to search. Within a section a line "TYPE =tester" needs to be specified. By using the keyword KEY the actions to be executed are specified, if the tester has detected an appropriate media.

Keywords for all Media Testers.

The following media testers have to be included in each section:

Keyword Description
TYPE Defines the instance of a media tester. Currently, the following media testers are available:
DVD detects Video DVDs using libdvdread.
CD detects Audio CDs using libcdio.
FILE Mounts Removable Media and tries to detect file type by it's file extension.
KEY Defines the plugin to be started and keypress events, on detect. the character @ at the beginning of the name identifies the plugin.

example: "keys = @externalplayer OK" translates to starting plugin "externalplayer" and send keypress "OK"

keywords for the FILE-Media Tester

Keyword Description
FILES File extensions to be checked
LINKPATH creates a symbolic Link from mounted media to a fixed directory. For example, in section [MP3] a link is created for a USB-Stick /media/USB-Stick to /video/mount/mp3.

GLOBAL section

The special keyword FILTERDEV contains root devices and all other devices not to be checked. Is defined as FILTERDEV = AUTO, the plugin tried to detect hard disks by /etc/fstab. Other devices not to be checked, can be appended after AUTO.

autostart.conf example

; The global section contains definitions global to all detectors                                                  
[GLOBAL]
; exclude the given devices from media detection, e.g. the root hard drives                                        
filterdev = sda sdb hda hdb                                                                                        
[DVD]
type = dvd   ; DVD Media tester
keys = @externalplayer OK                                                                                          
[CD]
type = cd           ; CD Media tester
keys = @cdplayer    ; Start CD-Player plug-in
[MP3]                                                                                                              
type = file             ; File Media tester
files = mp3             ; Suffix to match 
keys = @music YELLOW    ; If a file ending with .mp3 is found, start music plug-in
linkpath = /video/mount/mp3
[IMG]
type = file             ; File Media tester
files = jpg gif bmp     ; If a file ends with .jpg .gif or .bmp, start image plug-in
keys = @image YELLOW DOWN RED RED
linkpath = /video/mount/image

Example config for externalplayer plugin

In this Config there is just one menu item, therefore just an 'OK' keypress is enough.

# Externalplayer-plugin example configuration.
{
  Command          = "xine -L --stdctl -c /video/etc/xine.conf dvd://";
  MenuEntry        = "Xine DVD";
  OutputMode       = extern;
  InputMode        = slave;
  BlockMenu        = true; # This makes sense, because an invisible main menu would block all the keys.
  vdrKeyUp         = specialKeyPageUp; # See below for a full list of "special keys."
  vdrKeyDown       = specialKeyPageDown;
  vdrKeyLeft       = specialKeyLeft;
  vdrKeyRight      = specialKeyRight;
  vdrKeyOk         = specialKeyReturn;
  vdrKeyBack       = noKey;
  vdrKeyRed        = noKey;
  vdrKeyGreen      = "<"; 
  vdrkeyyellow     = ">";
         ....
}


SVDRP commands

svdrpsend.pl plug autostart DETECT

Triggers media detection.

PolicyKit configuration

If VDR is not run as root or under X, the VDR process doesnt have permissions for mounting. In syslog is the following error message: AutoMount DeviceKit Error dbusdevkit.cc dbus_connection_send_with_reply failed Not Authorized

Solution:

  • copy file "com.vdr.autostart.pkla" from plugins contrib folder to /var/lib/polkit-1/localauthority/10-vendor.d
  • if the user for the vdr process is other than 'vdr', the file needs to be modified.

com.vdr.autostart.pkla:

[Mounting, checking, etc. of internal drives]
Identity=unix-user:vdr
Action=org.freedesktop.udisks.filesystem-*
ResultActive=yes
ResultAny=auth_admin
ResultInactive=yes


Developer Version

hg clone http://hg.uli-eckhardt.de/autostart

Current Version

  1. Version 0.9.6

Links

  1. Plugins Homepage
  2. Mercurial Repository