SVDRP: Difference between revisions

From VDR Wiki
Jump to navigation Jump to search
m (Svdrp moved to SVDRP: Correct case)
(add not about sending svdrp cmds to plugins.)
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
==Introduction==
==Introduction==
The '''Simple VDR Protocol (SVDRP)''' allows simple commands to be sent to VDR over a plain TCP connection on port 2001. E.g. to send a message that gets displayed on TV.
The '''Simple VDR Protocol (SVDRP)''' allows simple commands to be sent to VDR over a plain TCP connection on port 6419 (before vdr 1.7.15 port 2001 was used). E.g. to send a message that gets displayed on TV.


It is possible to write a simple shell script to dump any text on the TV screen, for instance on an incoming phone call or when an email arrives:
It is possible to write a simple shell script to dump any text on the TV screen, for instance on an incoming phone call or when an email arrives:
Line 6: Line 6:
#!/bin/sh
#!/bin/sh


netcat -w 10 <HOSTNAME> 2001 <<eof
netcat -w 10 <HOSTNAME> 6419 <<eof
mesg $1
mesg $1
quit
quit
Line 12: Line 12:
</pre>
</pre>


<HOSTNAME> has to be replaced with the hostname of the computer VDR is running on. The script takes the text to be displayed as a parameter. Netcat also exists for Windows.
<HOSTNAME> has to be replaced with the hostname of the computer VDR is running on. (ie. localhost) The script takes the text to be displayed as a parameter. Netcat also exists for Windows. Depending on your netcat version the command may be nc as compared to netcat.

A direct command can also be achieved without creating a script:
<pre>
echo mesg 'Hello World!' | nc localhost 6419
</pre>


As an alternative you may use the special TCP redirection of GNU Bash:
As an alternative you may use the special TCP redirection of GNU Bash:
<pre>
<pre>
echo mesg 'Hello World!' >/dev/tcp/HOSTNAME/2001
echo mesg 'Hello World!' >/dev/tcp/HOSTNAME/6419
</pre>

There is a special perl script included in VDR sources you can use:
<pre>
svdrpsend <COMMAND> [<PARAMETER>]
</pre>

To send svdrp commands to plugins, you use similar syntax:
<pre>
svdrpsend plug <PLUGIN_NAME> <COMMAND> [<PARAMETER>]
</pre>
</pre>


Line 153: Line 168:
status:channel:day:start:stop:priority:lifetime:filename:
status:channel:day:start:stop:priority:lifetime:filename:


status 0 = inactive, 1 = active
* status 0 = inactive, 1 = active
channel channel number to record
* channel channel number to record
day day of month
* day day of month
start start time for recording hhmm
* start start time for recording hhmm
stop stop time for recording hhmm
* stop stop time for recording hhmm
priority (50 will do)
* priority (50 will do)
lifetime lifetime of the recording (99=indefinite)
* lifetime lifetime of the recording (99=indefinite)
filename
* filename




NEWT 1:440:30:1900:1905:50:99:testfile:
NEWT 1:440:30:1900:1905:50:99:testfile:

==Example output==
'''("help" command)'''
<pre>
214-This is VDR version 1.3.11
214-Topics:
214- CHAN CLRE DELC DELR DELT
214- GRAB HELP HITK LSTC LSTE
214- LSTR LSTT MESG MODC MODT
214- MOVC MOVT NEWC NEWT NEXT
214- PUTE SCAN STAT UPDT VOLU
214- QUIT
214-To report bugs in the implementation send email to
214- vdr-bugs@cadsoft.de
214 End of HELP info
</pre>

'''("stat" command)'''
<pre>
localhost ~ # echo stat 'disk' | nc localhost 6419
220 localhost SVDRP VideoDiskRecorder 1.6.0-2; Tue Mar 30 16:28:16 2010; UTF-8
250 1336342MB 643644MB 51%
</pre>



==SVDRP reply codes==
==SVDRP reply codes==
Line 186: Line 225:
<Reply code><-|Space><Text><Newline>
<Reply code><-|Space><Text><Newline>
</pre>
</pre>
In the last line the "-" is replace be a space.


==Example output ("help" command)==
<pre>
214-This is VDR version 1.3.11
214-Topics:
214- CHAN CLRE DELC DELR DELT
214- GRAB HELP HITK LSTC LSTE
214- LSTR LSTT MESG MODC MODT
214- MOVC MOVT NEWC NEWT NEXT
214- PUTE SCAN STAT UPDT VOLU
214- QUIT
214-To report bugs in the implementation send email to
214- vdr-bugs@cadsoft.de
214 End of HELP info
</pre>


{{i18n|SVDRP}}
{{i18n|SVDRP}}

Latest revision as of 18:47, 18 August 2011

Introduction

The Simple VDR Protocol (SVDRP) allows simple commands to be sent to VDR over a plain TCP connection on port 6419 (before vdr 1.7.15 port 2001 was used). E.g. to send a message that gets displayed on TV.

It is possible to write a simple shell script to dump any text on the TV screen, for instance on an incoming phone call or when an email arrives:

#!/bin/sh

netcat -w 10 <HOSTNAME> 6419 <<eof
mesg $1
quit
eof

<HOSTNAME> has to be replaced with the hostname of the computer VDR is running on. (ie. localhost) The script takes the text to be displayed as a parameter. Netcat also exists for Windows. Depending on your netcat version the command may be nc as compared to netcat.

A direct command can also be achieved without creating a script:

echo mesg 'Hello World!' | nc localhost 6419

As an alternative you may use the special TCP redirection of GNU Bash:

echo mesg 'Hello World!' >/dev/tcp/HOSTNAME/6419

There is a special perl script included in VDR sources you can use:

svdrpsend <COMMAND> [<PARAMETER>]

To send svdrp commands to plugins, you use similar syntax:

svdrpsend plug <PLUGIN_NAME> <COMMAND> [<PARAMETER>]

By default only localhost is allowed to connect to VDR. To alter this one has to change the file svdrphosts.conf in the configuration directory /etc/vdr of VDR. The build up of this file is really simple.

IP-Adresse[/Netmask]

Just enter line by line the allowed host IPs, or whole networks. For networks you need the network mask (e.g. /24). For examples see the sample svdrphosts.conf that comes with VDR.

The commands

Overview

CHAN  CLRE  DELC  DELR  DELT
GRAB  HELP  HITK  LSTC  LSTE
LSTR  LSTT  MESG  MODC  MODT
MOVC  MOVT  NEWC  NEWT  NEXT
PUTE  STAT  UPDT  VOLU  QUIT

Description

Command Parameter
Description
CHAN [ + | - | <number> | <name> | <id> ]
Switch channel up, down or to the given channel number, name or id. Without option (or after successfully switching to the channel) it returns the current channel number and name.
CLRE
Clear the entire EPG list.
DELC <number>
Delete channel.
DELR <number>
Delete the recording with the given number. Before a recording can be deleted, an LSTR command must have been executed in order to retrieve the recording numbers. The numbers don't change during subsequent DELR commands.
CAUTION: THERE IS NO CONFIRMATION PROMPT WHEN DELETING A RECORDING - BE SURE YOU KNOW WHAT YOU ARE DOING!
DELT <number>
Delete timer.
GRAB <filename> [ jpeg | pnm [ <quality> [ <sizex> <sizey> ] ] ]
Grab the current frame and save it to the given file. Images can be stored as JPEG (default) or PNM, at the given quality (default is 'maximum', only applies to JPEG) and size (default is full screen).
HELP [ <topic> ]
The HELP command gives help info.
HITK [ <key> ]
Hit the given remote control key. Without option a list of all valid key names is given.
LSTC [ <number> | <name> ]
List channels. Without option, all channels are listed. Otherwise only the given channel is listed. If a name is given, all channels containing the given string as part of their name are listed.
LSTE [ <channel> ] [ now | next | at
List EPG data. Without any parameters all data of all channels is listed. If a channel is given (either by number of by channel ID), only data for that channel is listed. now, next, or at restricts the returned data to present events, following events, or events at the given time (which must be in time_t form).
LSTR [ <number> ]
List recordings. Without option, all recordings are listed. Otherwise the summary for the given recording is listed.
LSTT [ <number> ]
List timers. Without option, all timers are listed. Otherwise only the given timer is listed.
MESG [ <message> ]
Displays the given message on the OSD. If message is omitted, the currently pending message (if any) will be returned. The message will be displayed for a few seconds as soon as the OSD has become idle. If a new MESG command is entered while the previous message has not yet been displayed, the old message will be overwritten.
MODC <number> <settings>
Modify a channel. Settings must be in the same format as returned by the LSTC command.
MODT <number> on | off | <settings>
Modify a timer. Settings must be in the same format as returned by the LSTT command. The special keywords 'on' and 'off' can be used to easily activate or deactivate a timer.
MOVC <number> <to>
Move a channel to a new position.
MOVT <number> <to>
Move a timer to a new position.
NEWC <settings>
Create a new channel. Settings must be in the same format as returned by the LSTC command.
NEWT <settings>
Create a new timer. Settings must be in the same format as returned by the LSTT command. It is an error if a timer with the same channel day, start and stop time already exists.
NEXT [ abs | rel ]
Show the next timer event. If no option is given, the output will be in human readable form. With option 'abs' the absolute time of the next event will be given as the number of seconds since the epoch (time_t format), while with option 'rel' the relative time will be given as the number of seconds from now until the event. If the absolute time given is smaller than the current time, or if the relative time is less than zero, this means that the timer is currently recording and has started at the given time. The first value in the resulting line is the number of the timer.
PUTE
Put data into the EPG list. The data entered has to strictly follow the format defined in vdr(5) for the 'epg.data' file. A '.' on a line by itself terminates the input and starts processing of the data (all entered data is buffered until the terminating '.' is seen).
SCAN
Forces an EPG scan. If this is a single DVB device system, the scan will be done on the primary device unless it is currently recording.
STAT disk
Return information about disk usage (total, free, percent).
UPDT <settings>
Updates a timer. Settings must be in the same format as returned by the LSTT command. If a timer with the same channel, day, start and stop time does not yet exists, it will be created.
VOLU [ <number> | + | - | mute ]
Set the audio volume to the given number (which is limited to the range 0...255). If the special options '+' or '-' are given, the volume will be turned up or down, respectively. The option 'mute' will toggle the audio muting. If no option is given, the current audio volume level will be returned.
QUIT
Exit vdr (SVDRP). You can also hit Ctrl-D to exit.

Editing Timers manually

status:channel:day:start:stop:priority:lifetime:filename:

  • status 0 = inactive, 1 = active
  • channel channel number to record
  • day day of month
  • start start time for recording hhmm
  • stop stop time for recording hhmm
  • priority (50 will do)
  • lifetime lifetime of the recording (99=indefinite)
  • filename


NEWT 1:440:30:1900:1905:50:99:testfile:

Example output

("help" command)

214-This is VDR version 1.3.11
214-Topics:
214-    CHAN    CLRE    DELC    DELR    DELT
214-    GRAB    HELP    HITK    LSTC    LSTE
214-    LSTR    LSTT    MESG    MODC    MODT
214-    MOVC    MOVT    NEWC    NEWT    NEXT
214-    PUTE    SCAN    STAT    UPDT    VOLU
214-    QUIT
214-To report bugs in the implementation send email to
214-    vdr-bugs@cadsoft.de
214 End of HELP info

("stat" command)

localhost ~ # echo stat 'disk' | nc localhost 6419
220 localhost SVDRP VideoDiskRecorder 1.6.0-2; Tue Mar 30 16:28:16 2010; UTF-8
250 1336342MB 643644MB 51%


SVDRP reply codes

214 Help message
215 EPG data record
220 VDR service ready
221 VDR service closing transmission channel
250 Requested VDR action okay, completed
354 Start sending EPG data
451 Requested action aborted: local error in processing
500 Syntax error, command unrecognized
501 Syntax error in parameters or arguments
502 Command not implemented
504 Command parameter not implemented
550 Requested action not taken
554 Transaction failed

Reply codes are in the format

<Reply code><-|Space><Text><Newline>