Clarification on XLF format expected in API

Asked by Steve

When using the LayoutRegionMediaAdd API call, what is the proper data and format for the XLF? While testing this call, I copied the existing XLF string returned by LayoutRegionMediaDetails (after decoding) and passed that as the xlf parameter. That didn't work.

I noticed that there was an existing mediaid that got passed. My guess is that when using LayoutRegionMediaAdd it would create the new mediaid.

Question information

Language:
English Edit question
Status:
Solved
For:
Xibo Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Alex Harrington (alexharrington) said :
#1

The test suite is probably the best place to look

https://code.launchpad.net/~alexharrington/xibo/api-testsuite

Revision history for this message
Steve (stevem-s) said :
#2

I downloaded the tests that you recommended. I ran the RegionTimeLineTests.py as that is the area I am having issues. I encountered 2 errors, 1 of which I fixed (in XiboAPI.py, parseID was casting the value to int when trying to return a regionid).

The error that is of concern occurs in test_region_media_add - the response from self.api.callMethod('LayoutRegionMediaAdd', params) is invalid XLF.

Revision history for this message
Alex Harrington (alexharrington) said :
#3

Which of the test cases is it failing on for you?

The response back won't be XLF as far as I'm aware, it will be a success or failure as the test suite checks for.

LayoutRegionMediaAdd adds an XLF snippet for non-file based media types to a region timeline. The media identifier is generated automatically for you so it's ommited when you pass the media in.

Revision history for this message
Steve (stevem-s) said :
#4

The test case that is failing is RegionMediaAdd for text. Here is the output for api call to LayoutRegionMediaAdd.

self.tmpRegionID2: 52b3086f9f855

response= {'status': '200', 'content-length': '93', 'x-powered-by': 'PHP/5.4.7', 'server': 'Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7', 'date': 'Thu, 19 Dec 2013 14:53:35 GMT', 'content-type': 'text/xml; charset=utf8', 'x-xrds-location': 'http://signage/xibo/services.php/service.php?xrds'}
status= ERROR
code= -1
message= Invalid XLF
content= <?xml version="1.0"?>
<rsp status="error">
  <error code="-1" message="Invalid XLF"/>
</rsp>

Here are the parameters taken from the source code:

{ 'type': 'text',
                           'xlf': '<media type="text" duration="' + str(duration) + """" schemaVersion="1">
                                         <options><direction>none</direction><scrollSpeed>2</scrollSpeed><fitText>0</fitText></options>
                                         <raw><text><![CDATA[<p>
                                                          <strong style="font-family: roboto; font-size: 26px;">TEST TEXT!!</strong></p>
                                                      ]]></text></raw>
                                     </media>""",
                           'expectedFailure': False
                        }

Revision history for this message
Alex Harrington (alexharrington) said :
#5

Just checking this is against 1.5.2 CMS?

Revision history for this message
Dan Garner (dangarner) said :
#6

Hi Steve,

I've filed a bug for this and a patch to resolve.

Thanks,
Dan

Revision history for this message
Steve (stevem-s) said :
#7

@Alex - Yes this is 1.5.2
@Dan - Thanks, I'll try the patch and let you know.

Revision history for this message
Steve (stevem-s) said :
#8

The patch appears to have worked - however, the RegionTimelineTests.py does return a FAIL condition on RegionMeadiaAdd with the following message: "OK returned but should have been an error 0:" I tried my code with the patch in place and it appears to have worked successfully.

Thanks for all the help.

Revision history for this message
Dan Garner (dangarner) said :
#9

OP reports patched solved the issue