Recording Service API
From DVBViewer
|
One warning: This api is still in development and may change without warning (but most likely it will be backward compatible, because the dvbviewer uses it also).
Most api calls are simple http-get calls.
[edit] Answers
All answers are xml "files" To get the timerlist:
http://[user:password@]IP[:port]/api/timerlist.html[?utf8=]
Parameter utf8 the answer will be UTF8 encoded
[edit] Version
The version of the service:
http://[user:password@]IP[:port]/api/version.html
[edit] Status
The Status of the service:
http://[user:password@]IP[:port]/api/status.html
<status> <recordcount> 0 </recordcount> <clientcount> 1 </clientcount> <epgudate> 0 </epgudate> <epgbefore> 5 </epgbefore> <epgafter> 10 </epgafter> <timezone> 60 </timezone> <defafterrecord> 0 </defafterrecord> <recfolders> <folder size="1445946646528" free="15966986240"> E:\Recorded TV </folder> <folder size="57404289024" free="3202850816"> C:\Users\Public\Recorded TV </folder> </recfolders> </status>
[edit] Recordings list
recordings list:
http://[user:password@]IP[:port]/api/recordings.html[?utf8=]
Parameter utf8 the answer will be UTF8 encoded
[edit] EPG
EPG
http://[user:password@]IP[:port]/api/epg.html?lvl=2[&channel={epgchannelID}][&start={floatDateTime}][&end={floatDateTime}]
the parameters:
- lvl=2 is mandatory.
- ch={epgchannelID} is optional.
EPGChannelID = (TunerType + 1)*2^48 + NID*2^32 + TID*2^16 + SID
where:
SID = Service PID
TID = Stream ID
NID = Network ID
TunerType: 0=Cable 1=Satelite 2=Terrestial 3=ATSC
- start and end: floatdatetime values (both . and , are accepted as decimal seperator).
It's best to get the epg in several steps (one day at a time as example), because it can be several megabytes of data.
[edit] Add a timer
How to add a timer:
A http Get request to
http://[user:password@]IP[:port]/api/timeradd.html
With the following Params:
- ch= The ChannelID
- (ord(tunertype) + 1) shl 29 + APID shl 16 + SID;
- in other words
- (tunertype + 1) * 536870912 + APID * 65536 + SID
- tunertype =
- DVB-C = 0
- DVB-S = 1
- DVB-T = 2
- ATSC = 3
- DVB-IPTV = 4
- APID = Audio-PID
- SID = Service-ID
- dor= The date (the integer part of the floatdatetime value) - mandatory
- enable= 0/1 -> 1 = enabled - mandatory
- start= / stop= The start and the endtime (integer, calculated by round(onlythetime * minsperday)) - mandatory
- title= The name of the timer. see also "encoding".
- encoding= The encoding of the timer (255 = UTF8). works for title, series and folder. - not used before .55
- days= for repeating timers a 7 char string. Every char stands for a day of the week starting with monday. each char <> '-' means day is active. - optional
- series= The series the timer belongs to. see also "encoding". - optional - not used before .55
- action= The recording action 0 = Record, 1=tune. optional.
- endact= The action after recoding. 0=None, 1=PowerOff, 2=Standby, 3=Hilbernate - optional
- after= The name of the task to be executed after recording. caller is responsible that this internal/process task exists. - optional.
- prio= The priority of the timer (0-100) 0=Lowest, 100=Highest. optional.
- format= The recording format of the timer. 0=Audio only, 1=mpeg, 2=TS. - optional.
- folder= The recording folder. The caller is responsible it is a folder from the defined recordings folders. - optional
- audio= Record all Audiostreams of the channel. 0/1 - optional.
- subs= Record DVBSubtitles. 0/1 - optional. only valid for TS
- ttx= Record Teletext. 0/1 - optional. only valid for TS
[edit] Edit a timer
To edit a timer:
http://[user:password@]IP[:port]/api/timeredit.html
same parameters as adding a timer. Additional:
- id= The TimerID (see timerlist). mandatory.
IDs are only valid for the process runtime of the service. Make sure you get a current timerlist before editing.
remember all string values musst be url encoded!
[edit] Delete a timer
To delete a timer:
http://[user:password@]IP[:port]/api/timerdelete.html?id=xxxx[&delrecfile=x]
With the following Params:
- id= The TimerID (see timerlist). mandatory.
- IDs are only valid for the process runtime of the service. Make sure you get a current timerlist before editing.
- delrecfile : 1 delete the (running) recording file too, if exists. (optional)
remember all string values musst be url encoded!
[edit] Clear EPG
Clear EPG:
http://[user:password@]IP[:port]/api/index.html?epg_clear=true
Just the presence of the parameter will clear the EPG. Use at your own risk.
[edit] add epg
To add epg:
a POST request to
http://[user:password@]IP[:port]/cgi-bin/EPGimport
with valid EPG XML (same format like the api epg.html function).
Attention: returns a code 302 (Moved) when no file is posted, redirecting you to EPGimport/ which then returns a 404 (not found)
Attention: This call will set a a 30 sec. standby/hibernate block is if Block Standby/Hibernate... for Web interface actions is enabled.
[edit] start task
To start a task:
a POST request to
http://[user:password@]IP[:port]/tasks.html?task=[task name]&aktion=tasks
Attention: This call will set a a 30 sec. standby/hibernate block is if Block Standby/Hibernate... for Web interface actions is enabled.
e.g. for hibernate
http://[user:password@]IP[:port]/tasks.html?task=Hibernate&aktion=tasks
[edit] internal task names
EPGStart Start EPG Scan
EPGStop Stop EPG Scan
Hibernate Hibernate
Standby Standby
Shutdown Shutdown
AutoTimer AutoTimer
CleanupDB Cleanup Recording DB
RefreshDB Refresh Recording DB
CleanupRefreshDB Cleanup and Refresh Recording DB
UpdateVideoDB Update Medias library DB
RebuildVideoDB Rebuild Video library DB
RebuildAudioDB Rebuild Audio library DB
RebuildPhotoDB Rebuild Photo library DB
ClearAudioStats Clear Audio library Stats
ClearRecordingStats Clear Recording Stats
ClearVideoStats Clear Video library Stats
ClearPhotoStats Clear Photo library Stats