AMI failing if page holds too many entities

Hi,

I just spent three hours trying to debug a custom AMI on OSX that downloads playlist versions. The playlist page was holding about 70 entities and was set to display 50 at a time. When right clicking on one of the playlists on that page, the terminal opened and tried to print the command it had received via the protocol handler. Then it stops half way through the url bit and freezes. The Mac then produced four error sounds.

When I filter the playlist page to ony show a hand full of entities the AMI works without trouble.

Has anybody else come across this?
Maybe it’s a buffer overflow in the Terminal app or something along those lines!? Below is a screenshot of the Terminal prefs.

Any ideas would be much appreciated.

Cheers,
frank

3 Likes

Hey Frank,

There may be some sort of overflow issue at play here. That can sometimes happen when you have a lot of entities selected since it has to send metadata for each item. Have you explored using the “Light Payload” option?

This will return an Event ID whose metadata contains the full selection set. This way your payload is small, and your script can do the heavy lifting. Let me know if that works for you.

3 Likes

Last night it occurred to me that the light payload feature might be a solution. I always wondered when it would come in handy but then forgot it was there.
Will give it a crack, thanks Brandon!

2 Likes

Just to conclude for posterity:
Brandon’s suggestion did the trick, though I had to update the ami handler template which bails when keys aren’t found in the light payload params (I just switched all dicitonary lookups to use get() instead of the shorthand lookup).

I then adjusted my python code to query the event log id received via a light payload AMI like this:

selected_playlist_ids = CONNECTION.find_one('EventLogEntry',
                        [['id', 'is', int(sa.params['event_log_entry_id'])]],
                        ['meta'])['meta']['ami_payload']['selected_ids']

The rest stayed the same in my case.
It might be nice to update the template to handle light payloads seeing the docs recommended it?!

Cheers,
frank

5 Likes

Awesome, glad to hear that did the trick!

2 Likes