0

Getting Thumbnail Attachment for a Shot

Hi,

Using the API I'm trying to get the ID of a thumbnail associated with an entity, in this case a shot, so I can download it and display it.

I've successfully managed to download the thumbnail using the download_attachment() function, by hard-coding the attachment ID, however when I try and find the ID Shotgun is returning nothing. I'm sure it's because Shotgun isn't storing the thumbnail in its attachment table, so where is it?

I know the Attachment ID is 65, which I found by choosing "View Image" from the thumbnail's context menu - this is what I use to successfully download the image using:

  sg.download_attachment(65)

But, if I try:

  sg.find_one("Attachment", [["id", "is", 65]])

of:

  sg.find_one("Attachment", [["attachment_links", "is", {"type": "Shot", "id": 860}]], ["id"])

Shotgun returns nothing. "Attachment" seems to be the only logical entity type for these I can see in the schema.

Any help here would be gratefully received!

Many thanks, Christian

1件のコメント

  • 1
    Avatar
    Chanon Vilaiyuk

    While waiting for support to give us a proper answer. I did some search and found out a work around with urllib from the following post

    https://support.shotgunsoftware.com/entries/22541288-Tip-Update-Entity-Thumbnail-with-a-Version-Thumbnail

     

    import urllib

    projName = 'Project Name'

    filePath = 'C:/thumbnail.jpg'

    shot = sg.find_one('Shot', filters = [['project.Project.name', 'is', projName], ['id', 'is', 12]], fields = ['image', 'entity'])

    urllib.urlretrieve(shot['image'], filePath)

     

    Hope this help. 

ログインしてコメントを残してください。