Replace PowerPoint Issue

Hi,

I have a region with 1 video and 2 different PowerPoint slide shows. The order is as follow.

Video_1
PPS_1
PPS_2

These powerpoint shows cannot be combined, because they are editted by different users, so I have created two seprate replace scripts to update these PowerPoint slide shows. The issue I am having now is that both scripts always try to replace the last PPS in the order. How can this be easily changed in the script?

Is it also possible to change the order of media in a specific region through a script?

Please let me know if you need additional information or if something is not clear.

The tutorial show you how to enumerate media items in a region.

You can therefore select to delete a specific media item not just the last one in the region, and then add the new one.

You would need to make an additional API call to reorder the media items in the region (LayoutRegionMediaReorder described here: http://xibo.org.uk/manual/en/api_layouts.html

You pass in an array of media items in order (reordered from the LayoutRegionMediaList result.

Alternatively you could break the layout in to three different layouts and then schedule them to run one after another, in which case you’d only have one item in the region timeline to deal with on each layout.

Thanks Alex,

Forgive me if this is a dumb question, but besides the media elements “MediaID”, “MediaType” and “MediaDuration” which are enumerated by the tutorial, which other elements can be enumerated. Is there an overview available?

It would be great if this could be done by Name of File Name of the media item, but for some reason I can’t enumerate these?

You work with media IDs once files are uploaded in to the CMS. You enumerate the media ID of the items in the layout and then you get given the new media id of whatever you upload at the end of that process.

You can’t use filenames because they’re non-unique.

Thanks, I will try a few things.

1 Like

Could I possibly bother you to show an example of what the mediaList array should look like in the LayoutRegionMediaReorder call? I’m using node.js to interact with the API and I’m having a hard time understanding how to represent this from the documentation:
mediaList (array(‘mediaid’ => , ‘lkid’ => 0))

Is this what the style of the array should be:
[{“mediaid”:“100”,“lkid”:“255”},{“mediaid”:“99”,“lkid”:“256”}]

I’ve been able to successfully complete all of the integration calls except for this one, have been stuck on it for a while and I’m worried that I’m on the wrong track on the basic organization of the array. If I understand the array structure, I think I can figure out how to encode it properly for the API call.

Sorry, I couldn’t find any examples online of someone using this call. I appreciate any help you might have.

I’ve asked @dan and he says the format you have there looks correct to him.

You get the media id and lkid from the existing items in the region (ie they have to already be there for you to reorder them). It must be a complete list of all mediaid/lkid pairs for all the items in that region timeline, in the order you want them to appear.

Thanks for your reply. I was sure I was going nail it tonight, but alas no luck. If I can, I wanted to just post what I am doing and see if anything jumps out at you as obviously wrong:

I’m taking the results from the LayoutRegionTimelineList call (in this case 79 results), I’m resorting them and then I’m creating the following parameters:

{ method: 'LayoutRegionMediaReorder',
  layoutId: 12,
  regionId: '56dcce73950e2',
  mediaList: '[{"mediaid":53,"lkid":263},{"mediaid":53,"lkid":262},{"mediaid":53,"lkid":261},{"mediaid":53,"lkid":260},{"mediaid":53,"lkid":259},{"mediaid":53,"lkid":258},{"mediaid":53,"lkid":257},{"mediaid":53,"lkid":216},{"mediaid":54,"lkid":264},{"mediaid":54,"lkid":217},{"mediaid":55,"lkid":265},{"mediaid":55,"lkid":218},{"mediaid":56,"lkid":266},{"mediaid":56,"lkid":219},{"mediaid":92,"lkid":267},{"mediaid":92,"lkid":220},{"mediaid":58,"lkid":268},{"mediaid":58,"lkid":221},{"mediaid":88,"lkid":269},{"mediaid":88,"lkid":222},{"mediaid":93,"lkid":270},{"mediaid":93,"lkid":223},{"mediaid":94,"lkid":271},{"mediaid":94,"lkid":224},{"mediaid":95,"lkid":272},{"mediaid":95,"lkid":225},{"mediaid":62,"lkid":273},{"mediaid":62,"lkid":226},{"mediaid":91,"lkid":274},{"mediaid":91,"lkid":227},{"mediaid":96,"lkid":275},{"mediaid":96,"lkid":228},{"mediaid":97,"lkid":276},{"mediaid":97,"lkid":229},{"mediaid":64,"lkid":277},{"mediaid":64,"lkid":230},{"mediaid":65,"lkid":278},{"mediaid":65,"lkid":231},{"mediaid":66,"lkid":279},{"mediaid":66,"lkid":232},{"mediaid":67,"lkid":280},{"mediaid":67,"lkid":233},{"mediaid":68,"lkid":281},{"mediaid":68,"lkid":234},{"mediaid":70,"lkid":282},{"mediaid":70,"lkid":235},{"mediaid":72,"lkid":283},{"mediaid":72,"lkid":236},{"mediaid":74,"lkid":284},{"mediaid":74,"lkid":237},{"mediaid":75,"lkid":238},{"mediaid":98,"lkid":285},{"mediaid":98,"lkid":239},{"mediaid":76,"lkid":286},{"mediaid":76,"lkid":240},{"mediaid":78,"lkid":241},{"mediaid":114,"lkid":287},{"mediaid":114,"lkid":242},{"mediaid":79,"lkid":288},{"mediaid":79,"lkid":243},{"mediaid":80,"lkid":289},{"mediaid":80,"lkid":244},{"mediaid":82,"lkid":290},{"mediaid":82,"lkid":245},{"mediaid":83,"lkid":291},{"mediaid":83,"lkid":246},{"mediaid":84,"lkid":292},{"mediaid":84,"lkid":247},{"mediaid":113,"lkid":293},{"mediaid":113,"lkid":248},{"mediaid":111,"lkid":294},{"mediaid":111,"lkid":249},{"mediaid":59,"lkid":250},{"mediaid":69,"lkid":251},{"mediaid":85,"lkid":252},{"mediaid":86,"lkid":253},{"mediaid":101,"lkid":254},{"mediaid":100,"lkid":255},{"mediaid":99,"lkid":256}]',
  response: 'xml' }

Then I am using a POST method with the header ‘content-type’: ‘application/x-www-form-urlencoded’ and sending the encoded parameters in the body. I use this same post to upload the MD5 encoded video and it works fine, so I don’t think it’s the POST.

I checked the encoded URL by decoding it and the array comes through as above, but I consistently get the 500 error. Tried no quotes around mediaid and lkid, etc.

Are you expecting a JSON array like that or are you expecting the array to look differently after it is decoded? This is probably totally my fault and I’m passing the array like a bonehead, but this is the last piece of the integration and I’m desperate.

If you read down this far, you’re a hero and I’ll let the world know how cool Xibo is.

Thanks a ton.

Can you confirm that you don’t have mediaList: '<<yourcontent>>' and that you have mediaList: [] - i.e. what you have but without the single quotes…

You are sending a string in media list - it should look like:

{ method: 'LayoutRegionMediaReorder',
  layoutId: 12,
  regionId: '56dcce73950e2',
  mediaList: [{"mediaid":53,"lkid":263},{"mediaid":53,"lkid":262},{"mediaid":53,"lkid":261},{"mediaid":53,"lkid":260},{"mediaid":53,"lkid":259},{"mediaid":53,"lkid":258},{"mediaid":53,"lkid":257},{"mediaid":53,"lkid":216},{"mediaid":54,"lkid":264},{"mediaid":54,"lkid":217},{"mediaid":55,"lkid":265},{"mediaid":55,"lkid":218},{"mediaid":56,"lkid":266},{"mediaid":56,"lkid":219},{"mediaid":92,"lkid":267},{"mediaid":92,"lkid":220},{"mediaid":58,"lkid":268},{"mediaid":58,"lkid":221},{"mediaid":88,"lkid":269},{"mediaid":88,"lkid":222},{"mediaid":93,"lkid":270},{"mediaid":93,"lkid":223},{"mediaid":94,"lkid":271},{"mediaid":94,"lkid":224},{"mediaid":95,"lkid":272},{"mediaid":95,"lkid":225},{"mediaid":62,"lkid":273},{"mediaid":62,"lkid":226},{"mediaid":91,"lkid":274},{"mediaid":91,"lkid":227},{"mediaid":96,"lkid":275},{"mediaid":96,"lkid":228},{"mediaid":97,"lkid":276},{"mediaid":97,"lkid":229},{"mediaid":64,"lkid":277},{"mediaid":64,"lkid":230},{"mediaid":65,"lkid":278},{"mediaid":65,"lkid":231},{"mediaid":66,"lkid":279},{"mediaid":66,"lkid":232},{"mediaid":67,"lkid":280},{"mediaid":67,"lkid":233},{"mediaid":68,"lkid":281},{"mediaid":68,"lkid":234},{"mediaid":70,"lkid":282},{"mediaid":70,"lkid":235},{"mediaid":72,"lkid":283},{"mediaid":72,"lkid":236},{"mediaid":74,"lkid":284},{"mediaid":74,"lkid":237},{"mediaid":75,"lkid":238},{"mediaid":98,"lkid":285},{"mediaid":98,"lkid":239},{"mediaid":76,"lkid":286},{"mediaid":76,"lkid":240},{"mediaid":78,"lkid":241},{"mediaid":114,"lkid":287},{"mediaid":114,"lkid":242},{"mediaid":79,"lkid":288},{"mediaid":79,"lkid":243},{"mediaid":80,"lkid":289},{"mediaid":80,"lkid":244},{"mediaid":82,"lkid":290},{"mediaid":82,"lkid":245},{"mediaid":83,"lkid":291},{"mediaid":83,"lkid":246},{"mediaid":84,"lkid":292},{"mediaid":84,"lkid":247},{"mediaid":113,"lkid":293},{"mediaid":113,"lkid":248},{"mediaid":111,"lkid":294},{"mediaid":111,"lkid":249},{"mediaid":59,"lkid":250},{"mediaid":69,"lkid":251},{"mediaid":85,"lkid":252},{"mediaid":86,"lkid":253},{"mediaid":101,"lkid":254},{"mediaid":100,"lkid":255},{"mediaid":99,"lkid":256}],
  response: 'xml' 
}

Hate to report that I still haven’t had any luck. If you prefer, I’m happy to take this off this forum and contact you directly - just let me know.

In the meantime, maybe it’s easiest to send the whole thing to you:

I am sending the following in the body of the POST with the header ‘content-type’: ‘application/x-www-form-urlencoded’:

layoutId=12&mediaList=%5B%7B%22mediaid%22%3A53%2C%22lkid%22%3A263%7D%2C%7B%22mediaid%22%3A53%2C%22lkid%22%3A262%7D%2C%7B%22mediaid%22%3A53%2C%22lkid%22%3A261%7D%2C%7B%22mediaid%22%3A53%2C%22lkid%22%3A260%7D%2C%7B%22mediaid%22%3A53%2C%22lkid%22%3A259%7D%2C%7B%22mediaid%22%3A53%2C%22lkid%22%3A258%7D%2C%7B%22mediaid%22%3A53%2C%22lkid%22%3A257%7D%2C%7B%22mediaid%22%3A53%2C%22lkid%22%3A216%7D%2C%7B%22mediaid%22%3A54%2C%22lkid%22%3A264%7D%2C%7B%22mediaid%22%3A54%2C%22lkid%22%3A217%7D%2C%7B%22mediaid%22%3A55%2C%22lkid%22%3A265%7D%2C%7B%22mediaid%22%3A55%2C%22lkid%22%3A218%7D%2C%7B%22mediaid%22%3A56%2C%22lkid%22%3A266%7D%2C%7B%22mediaid%22%3A56%2C%22lkid%22%3A219%7D%2C%7B%22mediaid%22%3A92%2C%22lkid%22%3A267%7D%2C%7B%22mediaid%22%3A92%2C%22lkid%22%3A220%7D%2C%7B%22mediaid%22%3A58%2C%22lkid%22%3A268%7D%2C%7B%22mediaid%22%3A58%2C%22lkid%22%3A221%7D%2C%7B%22mediaid%22%3A93%2C%22lkid%22%3A270%7D%2C%7B%22mediaid%22%3A93%2C%22lkid%22%3A223%7D%2C%7B%22mediaid%22%3A62%2C%22lkid%22%3A273%7D%2C%7B%22mediaid%22%3A62%2C%22lkid%22%3A226%7D%2C%7B%22mediaid%22%3A91%2C%22lkid%22%3A274%7D%2C%7B%22mediaid%22%3A91%2C%22lkid%22%3A227%7D%2C%7B%22mediaid%22%3A96%2C%22lkid%22%3A275%7D%2C%7B%22mediaid%22%3A96%2C%22lkid%22%3A228%7D%2C%7B%22mediaid%22%3A64%2C%22lkid%22%3A277%7D%2C%7B%22mediaid%22%3A64%2C%22lkid%22%3A230%7D%2C%7B%22mediaid%22%3A65%2C%22lkid%22%3A278%7D%2C%7B%22mediaid%22%3A65%2C%22lkid%22%3A231%7D%2C%7B%22mediaid%22%3A66%2C%22lkid%22%3A279%7D%2C%7B%22mediaid%22%3A66%2C%22lkid%22%3A232%7D%2C%7B%22mediaid%22%3A67%2C%22lkid%22%3A280%7D%2C%7B%22mediaid%22%3A67%2C%22lkid%22%3A233%7D%2C%7B%22mediaid%22%3A68%2C%22lkid%22%3A281%7D%2C%7B%22mediaid%22%3A68%2C%22lkid%22%3A234%7D%2C%7B%22mediaid%22%3A70%2C%22lkid%22%3A282%7D%2C%7B%22mediaid%22%3A70%2C%22lkid%22%3A235%7D%2C%7B%22mediaid%22%3A72%2C%22lkid%22%3A283%7D%2C%7B%22mediaid%22%3A72%2C%22lkid%22%3A236%7D%2C%7B%22mediaid%22%3A74%2C%22lkid%22%3A284%7D%2C%7B%22mediaid%22%3A74%2C%22lkid%22%3A237%7D%2C%7B%22mediaid%22%3A75%2C%22lkid%22%3A238%7D%2C%7B%22mediaid%22%3A76%2C%22lkid%22%3A286%7D%2C%7B%22mediaid%22%3A76%2C%22lkid%22%3A240%7D%2C%7B%22mediaid%22%3A78%2C%22lkid%22%3A241%7D%2C%7B%22mediaid%22%3A114%2C%22lkid%22%3A287%7D%2C%7B%22mediaid%22%3A114%2C%22lkid%22%3A242%7D%2C%7B%22mediaid%22%3A79%2C%22lkid%22%3A288%7D%2C%7B%22mediaid%22%3A79%2C%22lkid%22%3A243%7D%2C%7B%22mediaid%22%3A80%2C%22lkid%22%3A289%7D%2C%7B%22mediaid%22%3A80%2C%22lkid%22%3A244%7D%2C%7B%22mediaid%22%3A82%2C%22lkid%22%3A290%7D%2C%7B%22mediaid%22%3A82%2C%22lkid%22%3A245%7D%2C%7B%22mediaid%22%3A83%2C%22lkid%22%3A291%7D%2C%7B%22mediaid%22%3A83%2C%22lkid%22%3A246%7D%2C%7B%22mediaid%22%3A84%2C%22lkid%22%3A292%7D%2C%7B%22mediaid%22%3A84%2C%22lkid%22%3A247%7D%2C%7B%22mediaid%22%3A113%2C%22lkid%22%3A293%7D%2C%7B%22mediaid%22%3A113%2C%22lkid%22%3A248%7D%2C%7B%22mediaid%22%3A111%2C%22lkid%22%3A294%7D%2C%7B%22mediaid%22%3A111%2C%22lkid%22%3A249%7D%2C%7B%22mediaid%22%3A59%2C%22lkid%22%3A250%7D%2C%7B%22mediaid%22%3A69%2C%22lkid%22%3A251%7D%2C%7B%22mediaid%22%3A85%2C%22lkid%22%3A252%7D%2C%7B%22mediaid%22%3A86%2C%22lkid%22%3A253%7D%2C%7B%22mediaid%22%3A100%2C%22lkid%22%3A255%7D%2C%7B%22mediaid%22%3A99%2C%22lkid%22%3A256%7D%5D&method=LayoutRegionMediaReorder&oauth_consumer_key=XXXXX&oauth_nonce=jmvV7&oauth_signature=XXXXX&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1457984583&oauth_token=XXXXX&regionId=56dcce73950e2&response=xml

When I decode it on https://www.urldec.org, I get the following final string (I X’d out the tokens, etc) , it looks like the data is passed as you have it above.

layoutId=12&mediaList=[{“mediaid”:53,“lkid”:263},{“mediaid”:53,“lkid”:262},{“mediaid”:53,“lkid”:261},{“mediaid”:53,“lkid”:260},{“mediaid”:53,“lkid”:259},{“mediaid”:53,“lkid”:258},{“mediaid”:53,“lkid”:257},{“mediaid”:53,“lkid”:216},{“mediaid”:54,“lkid”:264},{“mediaid”:54,“lkid”:217},{“mediaid”:55,“lkid”:265},{“mediaid”:55,“lkid”:218},{“mediaid”:56,“lkid”:266},{“mediaid”:56,“lkid”:219},{“mediaid”:92,“lkid”:267},{“mediaid”:92,“lkid”:220},{“mediaid”:58,“lkid”:268},{“mediaid”:58,“lkid”:221},{“mediaid”:93,“lkid”:270},{“mediaid”:93,“lkid”:223},{“mediaid”:62,“lkid”:273},{“mediaid”:62,“lkid”:226},{“mediaid”:91,“lkid”:274},{“mediaid”:91,“lkid”:227},{“mediaid”:96,“lkid”:275},{“mediaid”:96,“lkid”:228},{“mediaid”:64,“lkid”:277},{“mediaid”:64,“lkid”:230},{“mediaid”:65,“lkid”:278},{“mediaid”:65,“lkid”:231},{“mediaid”:66,“lkid”:279},{“mediaid”:66,“lkid”:232},{“mediaid”:67,“lkid”:280},{“mediaid”:67,“lkid”:233},{“mediaid”:68,“lkid”:281},{“mediaid”:68,“lkid”:234},{“mediaid”:70,“lkid”:282},{“mediaid”:70,“lkid”:235},{“mediaid”:72,“lkid”:283},{“mediaid”:72,“lkid”:236},{“mediaid”:74,“lkid”:284},{“mediaid”:74,“lkid”:237},{“mediaid”:75,“lkid”:238},{“mediaid”:76,“lkid”:286},{“mediaid”:76,“lkid”:240},{“mediaid”:78,“lkid”:241},{“mediaid”:114,“lkid”:287},{“mediaid”:114,“lkid”:242},{“mediaid”:79,“lkid”:288},{“mediaid”:79,“lkid”:243},{“mediaid”:80,“lkid”:289},{“mediaid”:80,“lkid”:244},{“mediaid”:82,“lkid”:290},{“mediaid”:82,“lkid”:245},{“mediaid”:83,“lkid”:291},{“mediaid”:83,“lkid”:246},{“mediaid”:84,“lkid”:292},{“mediaid”:84,“lkid”:247},{“mediaid”:113,“lkid”:293},{“mediaid”:113,“lkid”:248},{“mediaid”:111,“lkid”:294},{“mediaid”:111,“lkid”:249},{“mediaid”:59,“lkid”:250},{“mediaid”:69,“lkid”:251},{“mediaid”:85,“lkid”:252},{“mediaid”:86,“lkid”:253},{“mediaid”:100,“lkid”:255},{“mediaid”:99,“lkid”:256}]&method=LayoutRegionMediaReorder&oauth_consumer_key=XXXXX&oauth_nonce=jmvV7&oauth_signature=XXXXX&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1457984583&oauth_token=XXXXX&regionId=56dcce73950e2&response=xml

Returns 500 error

I tried as GET method and I’ve tried adding quotes around the ids, but it all returns the 500 error.

Any additional ideas you have would be hugely appreciated. Thanks again for taking the time.