Jump to content

Recording Service API


brutus

Recommended Posts

A updated Version of the API documentation is in the Wiki

http://en.DVBViewer.tv/wiki/Recording_Service_API


 

 

 

Is it possible to make the recordingservice API public ? or a part of it ?

 

I saw that the interface is running via http-interface ( via http:\\192.168.1.200/api/ .... ).

 

For example I would like to know how to get/set epg data, to set timers.

Edited by Tjod
  • Like 1
Link to comment

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.

 

the basic url is:

http://[user:password@]IP[:port]/api

I assume if you going to mess with a web api you know what this means and which parameters are needed or not. :lol:

if I refer to URL in the examples I mean the above construct.

 

All answers are xml "files"

To get the timerlist:

url/timerlist.html[?utf8=]

Parameter utf8 the answer will be UTF8 encoded, not used before .55 [updated]

 

The version of the service:

url/version.html

 

The Status of the service:

url/status.html

 

recordings list:

url/recordings.html[?utf8=]

Parameter utf8 the answer will be UTF8 encoded, not used before .55 [updated]

 

EPG

url/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.

 

To be continued... I have to document the epg format first. :(

Link to comment
  • 2 weeks later...

How to add a timer:

 

A http Get request to

 

url/timeradd.html

 

With the following Params:

 

ch= The ChannelID (see wiki) - mandatory

 

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). 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

 

 

To edit a timer:

 

url/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!

Link to comment

Clear EPG:

 

url/index.html?epg_clear=true

 

Just the presence of the parameter will clear the EPG. Use at your own risk.

 

To add epg:

 

a POST request to

 

url/cgi-bin/EPGimport

 

with valid EPG XML (same format like the api epg.html function) (description still pending :) )

Link to comment

I want to translate the epg data to my native language (via google-translate).

 

But I get some encoding issues.

 

Below you can see an example of a word:

 

language = CES

 

Záznam ==> showed in web-interface/DVBViewer-client

 

Záznam ==> raw data retrieved via web-api command

 

Záznam ==> encoded via <?xml version="1.0" encoding="iso-8859-1"?>

 

From UTF8 table:

U+00C3 Ã c3 83 LATIN CAPITAL LETTER A WITH TILDE

U+00E1 á c3 a1 LATIN SMALL LETTER A WITH ACUTE

 

I see clearly that C3 A1 is in the raw data (Záznam), but Firefox/browser shows á.

What special trick/encoding do I need to do to the have á iso Ã...

Link to comment

Hi,

 

many thanks for the documentation.

 

I think it would be useful if status.html in adddition to the recordcount also contained a "NextRecordingTime" node, similar to ITimerCollection.

Link to comment

I have some troubles importing epg as UTF-8 as well.

 

Here some simple D2009 code:

 

procedure TForm1.Button1Click(Sender: TObject);
var
 I: integer;
 s: string; // UTF-16 encoded in D2009
 sANSI: AnsiString;
 sUTF8: RawByteString;
begin
 s := 'æøå';
 sANSI := s;
 sUTF8 := UTF8Encode(s);
 With Memo1.Lines do
 begin
Clear;
s := '';
for I := 1 to Length(sANSI) do
  s := s + IntToStr(Integer(sANSI[I])) + ',';
Add(s);
s := '';
for I := 1 to Length(sUTF8) do
  s := s + IntToStr(Integer(sUTF8[I])) + ',';
Add(s);
 end;
end;

 

The output in Memo1 is:

230,248,229,
195,166,195,184,195,165,

 

In real life the string s is ofcourse the xml data file as a string.

 

If I ship the bytes from sANSI characters display well.

If I ship the bytes from sUTF8 I get 6 garbage characters.

 

Am I doing anything wrong?

 

EDIT: using DVBViewer Pro (not the beta) and Rec. Serv. .55 test. Problem the same with previous versions.

Edited by Delphi
Link to comment

If you are using UTF-8 as input you have to set the charset to 255 in the EPG. Otherwise the recordingservice/DVBViewer will assume its ansi.

 

<programme start="20091129183000" stop="20091129190000" channel="826837046447986">
 <eventid>1598</eventid> 
 <charset>255</charset> 
[...]

Link to comment

Thanks, works great :blush:

 

I know, that Charset=255 uses the codepage of OS. Does this mean that say chinese XMLTV can be imported into the Recording Service?

 

I can now remove the ansi option if I generally import as UTF-8. A simplification of the user interface is always a good thing.

 

A bit off topic:

 

It would be nice to have a similar simplication for importing directly into DVBViewer using COM.

 

Here the xml is a WideString (UTF-16). Can I simply allways set Charset=255 here as well?

Edited by Delphi
Link to comment

I forgot to change this. :blush: Now COM sets the charset automatically and converts all new EPG into utf-8.

 

Does this mean that say chinese XMLTV can be imported into the Recording Service?

As long as you send it UTF-8 encoded, yes. Charset = 255 simply means: the string are all utf-8 encoded.

Link to comment
Now COM sets the charset automatically and converts all new EPG into utf-8.

 

Great!

 

1) For COM, should I then have the following processing instruction for the xml data?

 

<?xml version="1.0" encoding="UTF-16"?>

 

This would simplify the user interface further, and if I simply always can set Charset to 255, then option number 3 disappears from the user interface. :blush:

 

I am currently working on a new major version of Xepg (maybe a Christmas present), so one question more:

 

2) When I read the DVBViewer channel list from COM, is this unicode?

Edited by Delphi
Link to comment
For COM, should I then have the following processing instruction for the xml data?

If you consistently save the whole stuff as unicode and set the charset = 255 it will should work...

Link to comment

Is it possible to clear the epg only for one channel iso of all channels ? If it is not yet available is it possible to add this feature ?

 

url/index.html?epg_clear=true

 

The reason, it is difficult to work with the eventid's when I'm updating/adding the epg for a channel, if all epg data is cleared for that channel then I don't need to take the eventid into account, right ?

Link to comment
  • 1 month later...

Hi :)

 

I find it quite difficult to understand how one would import EPG through the web-api. help. please :)

 

1) Commit to POST http://127.0.0.1/cgi-bin/EPGimport

.. ok, thats the easy part

 

2) Format

... just out of the blue I guess:

<?xml version="1.0" encoding="UTF-8"?>
<programme start="20100115010000" stop="20100115023000" channel="562954320571850">
<charset>255</charset>
<title lang="en">Mystery!</title>
<sub-title lang="en">Foyle's War, Series IV: Bleak Midwinter</sub-title>
<desc lang="en">Foyle investigates an explosion at a munitions factory, which he comes to believe may have been premeditated.</desc>
<date>20100115</date>
<category lang="en">Anthology</category>
<category lang="en">Mystery</category>
<category lang="en">Series</category>
</programme>

should do as a complete request, shouldn't it?

 

3) Channel.ID

EPGChannelID = (TunerType + 1)*2^48 + NID*2^32 + TID*2^16 + SID

 

Lets say I have DVB-S (1), Network 1, TID 1101, SID 28106 (ARD).

 

[(1+1)*2^48] + (1*2^32) + (1101*2^16) + 28106

-> 562949953421312 + 4294967296 + 72155136 + 28106

-> 562954320571850=channelid

ack?

 

Is that ID readable via COM?

 

 

.. its a bit hard to test as the upload always returns success (or maybe iam too tired).

 

Any guidance appreciated :)

Link to comment

Hrm! Stupid me. But I'll answer my questions for the world :)

 

correct!

 

 

 

2) Format

According to here and a bit of guessing its:

<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE tv SYSTEM "xmltv.dtd">
<tv source-info-name="clickfinder" generator-info-name="EPGImporter_0.7">
<programme start="20100115010000" stop="20100115023000" channel="72183242">
<charset>255</charset>
<title lang="de">Mystery!55</title>
		<description lang="de">Foyle investigates an explosion at a munitions factory...</description>
</programme>
</tv>

works.

 

 

 

3) Channel.ID

I was a bit confused by all the reading

int ePGChannelID = Int32.Parse(dvbvChannelList[i, 26].ToString()) + Int32.Parse(dvbvChannelList[i, 23].ToString()) * 65536;

will do :) .. Thats EPG-channelID: SID + TID * 65536

 

 

Remaining Questions:

- How to import Images?

- Is there something like genres? <genre> & <category> seems to fail.

Edited by jErk`
Link to comment
The genre is the Content field. Only the (numeric) DVB content values are supported (see etsi en_300468 sect. 6.2.9 table 28).

 

I see. Thanks. Just to give others a chance, thats realy simple stuff even if looks strange.

See this PDF. Page 39 states:

0x1 0x4 comedy
0x1 0x5 soap/melodrama/folkloric
0x1 0x6 romance

 

Translated this means:

GenreID, GenreName

20, "Comedy"

21, "Serie"

22, "Liebesfilm"

 

 

Images are not supported.

Can you make it be supported? (; ... Spass beiseite. Do you intend to support this? I guess it might be a lovely feature.

 

 

/jrk

Link to comment
Can you make it be supported?

In the long run: Yes. As soon as I kick the old epg.dat and replace it with a sql solution. But this might take some time and will not be compatible with the (native) DVBViewer EPG anymore...

Link to comment
In the long run: Yes. As soon as I kick the old epg.dat and replace it with a sql solution. But this might take some time and will not be compatible with the (native) DVBViewer EPG anymore...

 

Lars,

 

thanks for your reply. What comes to my mind reading your answer is- an "interim" or maybe a "general binary free" solution. Assuming images are stored local anyways, .. why not just storing the path (only) in the EPG.dat?

 

 

What i mean is:

Client upload: <xml[...]<mediacontent type="image" localpath="c:\superbigmonster.jpg" />[...]

Server in its html will use: <image src="pseudoimage.php?id=superbigmonster" />

Server pseudoimage.php: <headers...> print fpassthrough(fopen($_GET(id));

 

type image/movie/flash remotepath="" you be a URL to youtube trailer or so... while the implemntation remains the same (except for some headers) ....

 

 

Just my two cent. Don't get me wrong I am not trying to push you. I even maybe did not completly understand all the different usage szenarios... if thats all crap just disregard it.

 

Its ready when its done! (:

 

 

/Jan

Link to comment

Hi,

 

I have a utf-8 problem on adding a new timer entry to the service.

 

Following URL is sent to the service:

 

http://localhost/API/timeradd.html?ch=570442845%7CProSieben&dor=40208&encoding=255&enable=1&start=675&stop=750&title=Bully+%26+Rick+-+Der+%C3%9Cberfallunfall

 

Afterward I get following entry in the timer list:

<Timer Type="1" Enabled="-1" Priority="50" Charset="0" Date="30.01.2010" Start="11:15:00" End="12:30:00" Action="0">
<Descr>Bully & Rick - Der ?erfallunfall</Descr>
<Options AdjustPAT="-1"/>
<Format>2</Format>
<Folder>Auto</Folder>
<NameScheme>%name_%date_%time</NameScheme>
<Log Enabled="-1" Extended="-1"/>
<Channel ID="570442845|ProSieben"/>
<Executeable>-1</Executeable>
<Recording>0</Recording>
<ID>61</ID>
</Timer>

 

The title "Bully & Rick - Der ?erfallunfall" was seit in a wrong way, but it seems to be that the url is ok.

 

If I'm using "dvbv_tvg.exe" in following way, the entry is ok:

C:\Programme\AudioVideo\DVBViewer\dvbv_tvg.exe -xsvc "admin:admin@localhost" -a0 -t0 -d "Bully & Rick - Der Überfallunfall" -c "570442845|ProSieben" -e 30.01.2010 -s 11:15 -p 12:30

 

<Timer Type="1" Enabled="-1" Priority="-1" Charset="0" Date="30.01.2010" Start="11:15:00" End="12:30:00" Action="0">
<Descr>Bully & Rick - Der Überfallunfall</Descr>
<Options AdjustPAT="-1"/>
<Format>2</Format>
<Folder>Auto</Folder>
<NameScheme>%name_%date_%time</NameScheme>
<Log Enabled="-1" Extended="-1"/>
<Channel ID="570442845|ProSieben"/>
<Executeable>-1</Executeable>
<Recording>0</Recording>
<ID>105</ID>
</Timer>

 

 

Lars, could you help me, what am I doing wrong?

 

Regards

Prinz

Edited by Prinz
Link to comment
  • 1 month later...

Hi,

You do nothing wrong. The problem is in the server code. :bye: I fixed it.

 

 

thanks, the bug is fixed in the newer versions.

 

Now I have another problem. If I try to add a recording, without the parameter "endact", no action is done after recording.

 

I think a better way would be to use the default settings of the service, if the parameter "endact" is not given. Otherwise the default settings must be placed in the configuration of my tool and the configuration of the service.

 

Other possibility would be that the configuration can be read from the API.

 

Which way would be the best?

 

Regards

Prinz

Link to comment
  • 3 weeks later...

Lars,

 

does RS support the "subtitle" field? People seem to use that for Episode Names. Currently I only know about title, content & description.

 

 

Regards & frohe Ostern,

Jan

Link to comment

Hi Lars,

 

The best is: build your own http get request and enter it in a webbrowser, then you can see the xml and examine it. :)

 

Uhm. Call me stupid but I don't get that.

 

Currently I "post" commit things to http://127.0.0.1/cgi-bin/EPGimport

[..]
<programme start="20100415161000" stop="20100415170000" channel="72183242">
 <content />
 <title lang="de">Seehund, Puma & Co.</title>
 <subtitle>Geparden auf Erkundungstour</subtitle>
 <description lang="de">Premiere im Jaderpark: Die Junggeparden dürfen [...]</description>
</programme>

 

(where obviously subtitle seems to be my problem :))

How would I be able to read all available Tags in XML?

 

 

Regards,

Jan

Link to comment
Ähm sorry? What exactly do you mean?

 

I try to upload XML(EPG) direct to the recordservice, .. but I am failing to import "subtitle"s :)

 

edit: typo

Edited by jErk`
Link to comment

just do a

http://127.0.0.1/api/epg.html?lvl=2&channel=563521184137232

or which ever channelID you have. (that one is pro7 SAT I think).

And you're looking for "event", not "subtitle" :)

 

You can either use the (s) form which indicates a list of languages or the form without, which would be <title>, <event>, <description> like @delphi does with his xepg...

 

The "old" form would be:

http://127.0.0.1/api/epg.html?lvl=1&channel=563521184137232

 

Just remember: if you provide UTF8 encoded strings set the charset to 255. :)

Link to comment
just do a

http://127.0.0.1/api/epg.html?lvl=2&channel=563521184137232

And you're looking for "event", not "subtitle" :)

 

Ahhhrg .. this GET. Iam sorry.

 

Thank you! :)

Link to comment
  • 1 month later...

Hello,

 

I'm trying to add/delete timers via the RecordingService API, but I have some problems / questions (well all problems are based on the precondition, that the COM Interface of DVBV is not available).

 

1) I want to add a timer - how do I get the channel Id to add a timer ? The only solution I could think of is to get the whole channel list via the COM interface and save it to an internal list, from which I can get the channel Id if the COM interface is not available. But that's not a good solution...

 

2) How do I delete a timer ? I know, I can disable it, but I would like to delete it. May I use url/timerdel.html ?

 

3) I didn't investigate further in this issue yet : How do I get the whole list of timers via the API ? Or should I read the svctimers.xml instead ?

 

4) Could please someone let me know what I can do with this information. Is there an other type than DateTime I have to use in C#?

- integer, calculated by round(onlythetime * minsperday) - which information includes "onlythetime" ?

- the integer part of the floatdatetime value - which integer part ?

 

Thanks !

Georg

 

Remark ;)

Wouldn't it be great (and easier, so noone has to deal with the types) to have something similar to the COM interface for the Recording Service which offers some of the COM functions in e.g. a HttpChannel Interface ? All I would need are following functions - but I know, once you start providing these features you will end with the same functionality of the COM interface...

dvb.GetSetupValue

dvb.FavoritesManager.GetFavorites()

dvb.TimerManager.AddItem(...)

dvb.TimerManager.Remove(int)

dvb.ChannelManager.GetChannelname(int)

dvb.ChannelManager.GetChannelID(int)

DVBViewerServer.ITimerCollection tmrCol = dvb.TimerManager

DVBViewerServer.IChannelCollection chnCol = dvb.ChannelManager

 

EDIT: In the meantime I was able to solve 1-3

1) I save a list of channelIDs internal - not a good solution but it works

2) I use url/timer_list.html?aktion=timer_delete&id=x

3) I'm parsing url//timer_list.html?aktion=timer_list - hopefully it will not change so often ...

 

But I have no idea and solution for 4) :P

 

EDIT 2: My status about 4)

I'm trying to add a recording: ARD, Tagesschau, 19:55 - 20:25. This is my url string:

 

http://192.168.178.10:8089/timeradd.html?ch=28106&dor=40323&start=1194&stop=1225&title=Tageschau&encoding=255&enable=1&action=0&endaction=0

 

The response of the get request is:

"Template not prepared!"

 

So I guess something is wrong with the parameters dor,start and stop

Edited by Goersch
Link to comment

There is some kind of a limited DVBViewer API:

# Remove: COM Plugins are not supported anymore.

# Add: Limited DVBViewer Plugin support:

DVBViewer Plugins are NOT fully supported. Plugins, like the netstreaming plugin, using the dvb-stream can be used.

Plugins like epg Plus or other plugins wanting to write/change data or try to show windows are not supported.

 

http://www.DVBViewer.info/forum/index.php?...st&p=197983

Edited by SnoopyDog
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...