0

Attachments

Does anybody know if it's possible to find out through the API the URL or (even better) the filesystem path of "attachment" entities (the actual attachments, rather than their thumbnail image)? We have various Quicktime movies attached to shots as reference material, and I'm trying to get at this information, but couldn't figure out how to do it! I tried accessing the "this_file" attribute of an attachment, but the important fields are showing up as "None" rather than the expected values.

3 comments

  • 0
    Avatar
    KP

    Hey Andy,

    We've just added a download_attachment() method to API3 which takes the Attachment id and will return the binary data. Does that sound like it will give you what you're after? Attachments are a little tricky as we have to authenticate the script since Attachments are protected within Shotgun.

    We haven't posted the changes just yet. They need to be QA'd and if all is well, they'll go out in 1.8.3 and I'll see if we can't backport the same to API2 for you as well.

    I'd assume returning the binary data would be the most useful but we could also return a handle to the file. Is there any reason why you might rather have that instead?

     

    cheers,
    kp

  • 0
    Avatar
    Andy Geers

    Sounds good! Ultimately what I need is a filesystem path, since we've got some reference Quicktimes that the client sent us attached to shots, and I want to pass them into a script that generates thumbnail JPEGs. It seems a little wasteful to download a potentially large file to disk which is already on disk somewhere, but on the other hand your way will let me run it on from a machine other than the Shotgun server (which probably isn't the best place in the world to be running scripts like this!)

  • 0
    Avatar
    KP

    A problem with just providing a path is that the file could then potentially be accessible without authorization to someone. We provide the path and then someone who doesn't have permissions could just copy it off the server and bypass Shotgun completely. Hmmm... I guess if the server's permissions were setup the way they should be, I wonder if we controlled returning the url via the permissions framework whether that would be enough protection but we can't always guarantee that so we like controlling the file serving of the Attachment for that reason. It's definitely an ongoing discussion worth having.

    Anyone else have thoughts about this?

Please sign in to leave a comment.