Allow downloading of status icons via API

It would be quite handy to be able to download status icons to keep parity in external apps to the shotgun site.


  • 0
    Tony Aiello

    Looks like you *can* do this, but only for Statuses for which you've uploaded a custom icon.  You can access 'Status' entities with the API, which have an 'icon' field linking to an 'Icon' entity.  The 'Icon' entity has 'url' and 'image_data' fields populated with renderable data, for statuses with custom icons.  For the built-in status icons, those two fields are None and all you can get is the icon.Icon.image_map_key which is a string to some internal reference.  You can tell the difference using the icon.Icon.icon_type field, which will be "permanent_status" for the default icons or "custom_status" for custom uploads; similarly it looks like icon.Icon.display_type will be "image_map" for default icons or "image" for custom uploads.  So theoretically, if you uploaded a custom icon for every status about which you care, you would then be able to get the icon.Icon.image_data or .url for every one.  And then there's the 'icon.Icon.html' field, which stores just html text as an "icon" in which case .icon_type will also be "custom_status" but the .url and .image_data will be None.

    So assuming "sg" is a shotgun_api3.Shotgun connection object:

    status_map = dict((s['code'], s) for s in sgx.find('Status', filters=[], fields=['code', 'name', 'bg_color', 'icon', 'icon.Icon.image_map_key', 'icon.Icon.name', 'icon.Icon.url', 'icon.Icon.image_data', 'icon.Icon.icon_type', 'icon.Icon.display_type', 'icon.Icon.html']))

    Anyways -- the original request stands.  It would be nice to have icon.Icon.image_data and .url populated even for the default statuses / icons.


  • 0
    Michael Kessler

    Yeah, for the pack-mapped icons (built in ones) I built a little slicer script awhile back, I'd love to see that thing die.

Please sign in to leave a comment.