Jump to content
brutus

Recording Service API

Recommended Posts

mague

I'm struggling with converting time / date to the correct format. Could somebody please explain the procedure for converting for example 21:00 to the right format? I have seen the decimal*24*60.. But what is the decimal supposed to be? Can somebody do the whole conversion?

I think it is 2100*1440

Share this post


Link to post
VinoRosso

I struggled too and the explanations i read here were completely wrong or too complicated.

 

It took a while but i figured it out for myself, and now i dont know it anymore ;-)

 

If you are familiar with java you can take a look at https://code.google.com/p/DVBViewer-controller/source/browse/DVBViewerController/branches/1.0.7/DVBViewerController/src/org/DVBViewer/controller/utils/DateUtils.java there is a method getFloatDate() which should be understandable ;-)

Share this post


Link to post
majstang

Hi guys!

My EPG update task takes now up to 30 minutes from start to end and during the update system got hibernated in the middle of it. My hibernationscript usually calculates when next recording will take place and prevent hibernation within a certain timeframe. I took for granted processtimers was included when calling the timerlist through the RS API, but now see to my surprise they are not, hence the processtask was interrupted by hibernation when a recording finished in the middle. Sadly the API seem to parse/remove everything except type=1 timers (recordingtimers). The svctimerlist.xml on the other hand has all the timers including both process and internal task timers. So now I wonder why the RS API does that? Seems unnecessary to say at least. Maybe someone successfully retrieved other than recordingtimers from the API?

 

//majstang

Share this post


Link to post
VinoRosso

Nope the API is just far from being complete. No way to get internal timers.....

 

Obviosuly there are a lot of tasks with higher priority, as the situation is the same for years......

Share this post


Link to post
majstang

Nope the API is just far from being complete. No way to get internal timers.....

 

Obviosuly there are a lot of tasks with higher priority, as the situation is the same for years......

Thanks for the info VinoRosso. I will load the svctimers.xml in the config folder instead, despite the obvious drawbacks.

 

Yes, unfortunately i think the API will remain incomplete for many years ahead. Maybe by then some other substitute to RS rules the scene.

Share this post


Link to post
Tjod

Because there have been the question how to detect the RS in the local network, and I just stumbled upon it in the Sat>IP specification here a short explanation.

 

It is done via UPnP (Multicast UDP) the client sends a Request:

 

Request M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: 2
ST: urn:ses-com:device:SatIPServer:1
USER-AGENT: OS/version UPnP/1.1 product/version
<CRLF>

 

and the answer includes the URL to the description.xml

http://127.0.0.1:8089/description.xml

 

For more informations see "SAT>IP Protocol Specification Version 1.2.2" > 3.3.4 Client Search Requests (page 20)

http://www.satip.info/sites/satip/files/resource/satip_specification_version_1_2_2.pdf

Share this post


Link to post
Nanohcv

Gibt es ein Grund warum das API nicht über das Gastkonto erreichbar ist? Schließlich kann man über das API keine Änderungen an der Konfiguration vornehmen.

Share this post


Link to post
Griga

I would like to continue the discussion in English if possible.

 

I don't know why the RS API is disabled for the guest account, but the code tells me that is has been done purposely. Does somebody know or remember why? Why do you want it to be enabled? I would like to read other opinions about his matter, particularly Tjod's opinion, if he finds time for it.

Share this post


Link to post
Nanohcv

I want it to be enabled, because of security reasons. If someone monitor your connection, its better to loose the guest credentials than the admin credentials. The guest account works for the webinterface and the ios app. The android app and the wp app are using the api and there the guest account is not working.

 

Much better would be if the RS support SSL. :innocent:

Share this post


Link to post
Tjod

The guest account has no ability to create or delete recordings or delete the EPG or shutdown the PC.

That are only few examples of actions which are possible via the API but not for the guest account in the web interface.

So, you would have to apply the same restriction to the API for the guest account which apply to the web interface.

And someone using the API world have to determine which API functions can be used with the given user name and password.
So if guest access would be added. There should be a information e.g. on the status 2.html if the account accessing it has admin or guest rights.

In other words it needs a bit more then just allowing the guest access to the API.
And in the beginning Lars was planning to add real multi user account system to the RS with the ability to set rights. And the guest/admin thing was just what was there in the old http server. Which was the starting point of the web interface.

Share this post


Link to post
Griga

@Tjod: Thanks for providing an overview. That's exactly what I needed. :)

The android app and the wp app are using the api and there the guest account is not working.


Which API functions are used? Maybe it's possible to exclude them from the restrictions without changing the required access rights for the whole API. Eventually it would come down to splitting the API functions in two parts, one part being available for guests, the other one not.

Share this post


Link to post
Nanohcv

I use the following apis

 

/api/timerlist.html
/api/version.html
/api/getconfigfile.html
/api/getchannelsxml.html
/api/getfavourites.html
/api/epg.html
/api/timeradd.html
/api/timerdelete.html
/api/dvbcommand.html

/tasks.html

 

I think the task api could be problematic

Share this post


Link to post
Tjod

The guest account has no ability to add or remove timers. And timers can lead to a PC shut-down.
so /api/timeradd.html and /api/timerdelete.html would be admin only

/tasks.html allows to shut-down the PC > admin only

/api/dvbcommand.html allows to shut-down all PCs with DVBViewer clients via DVBViewer commands > admin only

/api/getconfigfile.html can be problematic e.g. if somebody is using UserMode 0. Then you can download the whole DVBViewer folder via this API.
(possible solution, reduce the accessible files to a white list)

Share this post


Link to post
Nanohcv

Is it possible to add the length of a recording to /api/recordings.html? Background is, that it is not possible to get the length of a recording when you start a transcoded playback. The webinterface has this feature but not the api.

Share this post


Link to post
Tjod

At least for me there is duration="021000" and the format is mostly hhmmss

Share this post


Link to post
Nanohcv

The duration attribute doesnt contain the length of the recording. It shows the length of the corresponding EPG entry

Share this post


Link to post
Griga

The whole API output is created from the recording database, and there is no other "duration" attribute, as far as I can see. The duration isn't flagged as "duration from EPG" or such, but it seems that you are right because the code that creates a new database entry uses an EPGRecord structure to retrieve the duration.

 

Retrieving the duration directly from the recording would require to open the file and to search and check time stamps (PTS or PCR) at the beginning and end, which is a bit lengthy altogether...

 

Unfortunately my knowledge about database handling is close to zero, and there is a lot of code involved, so its hard for me to track down how the whole thing is working, how and when information is created and updated... it would require substantial researches.

Share this post


Link to post
VinoRosso

Would it be possible to include the file size?

Share this post


Link to post
Griga

In contrast to the general video database there is no size field in the recording database. I've tried, but I got nothing but an exception in the SQLite wrapper.

 

I'm sure it can be added somehow, but that will be a longer story ;)

Share this post


Link to post
pünktchen

Can someone give me a list of all available "Flags" and their meaning from getchannelsxml please?

Share this post


Link to post
Griga

Customer Area (where you have downloaded the RS) -> Sources -> epg.dat/channels.dat structure for add-on developers -> ChannelFormat.txt

Share this post


Link to post
pünktchen

Customer Area (where you have downloaded the RS) -> Sources -> epg.dat/channels.dat structure for add-on developers -> ChannelFormat.txt

 

Thank you, but i have problems to understand it!

This is from ChannelFormat.txt:

 

Flags: Byte;

//Bit 0: 1 = encrypted channel
//Bit 1: reserved, set to 0
//Bit 2: 1 = channel broadcasts RDS data
//Bit 3: 1 = channel is a video service (even if the Video PID is temporarily = 0)
//Bit 4: 1 = channel is an audio service (even if the Audio PID is temporarily = 0)
//Bit 5: 1 = audio has a different samplerate than 48 KHz
//Bit 6: 1 = bandstacking, internally polarisation is always set to H
//Bit 7: 1 = channel entry is an additional audio track of the preceding

 

The xml from the api call returns:

17 or 20 for radio channels and 24 or 25 for video channels in my case. (I have DVB-C)

Do i get other numbers for DVB-S or DVB-T?

Share this post


Link to post
Griga

Please read the description above carefully. There is no bit in Flags that depends on the tuner type.

Share this post


Link to post
pünktchen
Please read the description above carefully. There is no bit in Flags that depends on the tuner type.

Okay, my fault. So 17, 20, 24 and 25 would be enough in every case to differentiate between radio and video channels?

Share this post


Link to post
Griga

No. Don't rely on the numbers. For distinguishing the channel types (TV, radio, data) you need to extract and check bit 3 and 4 in the Flags value, or with other words, regard Flags as binary value, apply a bit mask in order to clear all bits except 3 and 4 and check the result. How it is done depends on the programming language.

Share this post


Link to post
pünktchen

No. Don't rely on the numbers. For distinguishing the channel types (TV, radio, data) you need to extract and check bit 3 and 4 in the Flags value, or with other words, regard Flags as binary value, apply a bit mask in order to clear all bits except 3 and 4 and check the result. How it is done depends on the programming language.

 

Really? I don't want to download the channels.dat additional while the info is in the xml already. There must be an easier way.

What's the internal calculation from channels.dat Flags to getchannels.xml Flags?

 

It's just binary to decimal i guess?!

Edited by pünktchen

Share this post


Link to post
Griga
I don't want to download the channels.dat additional while the info is in the xml already.

 

You don't have to.

 

What's the internal calculation from channels.dat Flags to getchannels.xml Flags?

 

There is no calculation. What you see is just the decimal representation of a value that has to be interpreted bitwise, e.g.

 

25 (dec) = 0x19 (hex) = 0b00011001 (bin) -> Bit 0, 3 and 4 are set.

 

You can use the Windows calculator for conversion. If you need more information about this topic, please search the web for it. I have no time to write a tutorial about programming basics here.

Share this post


Link to post
pünktchen

 

You don't have to.

 

 

There is no calculation. What you see is just the decimal representation of a value that has to be interpreted bitwise, e.g.

 

25 (dec) = 0x19 (hex) = 0b00011001 (bin) -> Bit 0, 3 and 4 are set.

 

You can use the Windows calculator for conversion. If you need more information about this topic, please search the web for it. I have no time to write a tutorial about programming basics here.

 

Just keep calm! That's all i wanted to know. Thanks!

Share this post


Link to post
Tjod

The API documentation should be up-to-date for RS 1.33.1

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

 

deprecated functions:

/api/status.html
/tasks.html?task
/index.html?epg_clear=true
/api/getchannelsdat.html
/api/getdiseqcxml.html
/api/getfavourites.html

 

there is no time line for removing them. But if you change something switch to the new version.

Share this post


Link to post

Join the conversation

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

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