Note attachment with frame number - Python API

Hi!

Does anyone know how to create attachments for notes with a frame number through the python API? Like the ones you get when taking notes with screening room.

image

All best,
Jonas

2 Likes

Hi Jonas, you might want to try the following. WARNING: This gets hacky, fast.

I’m assuming you have a Note already linked to your Version. Then you’ll need:

  • Your image will need to be called annot_version_<version_id>.<frame_number>.png
  • You’ll create a File entity (script name: Attachment) and upload the file to that.
  • You’ll need to link the File to your note above.

This being said, File entities can’t be created directly through the API, they are a result of uploading to a File field on another entity. Here’s where it gets a bit hacky…

When in production I used to create a version per project that would be a placeholder. I’d upload something to that version which would then create a File record. At this point, I wouldn’t care about the version but the File would become a useful tool/placeholder. If I needed to create a File entity, I’d upload to the this_file field of my placeholder. This creates a new File record without triggering the transcoder (like when uploading to sg_uploaded_movie on a version). Once the File record was uploaded I’d change it’s attributes with an update call.

Like I said… hacky.

5 Likes

Hey @bouchep , that’s a neat trick! Does the <frame_number> happen to obey RV-like multi-frame syntax i.e. Image Sequence Notation, e.g. #.png, or 2-8#.png, etc? Like if you had some text you wanted to “appear” for the whole Version?

2 Likes

:thinking:

I haven’t tested but I’m 99% certain it has to be a single frame.

Also… This will make the frame number appear on the thumbnail in the sidebar like in the screenshot of the original post but I haven’t tested, and am very doubtful that it will display the frame in the player.

Thanks a lot!!

It seems to do what I want without the version id, it’s the annot_version prefix and the frame number that seems to do the trick.

All best,
Jonas

3 Likes

Thanks for the feedback @jonas.lindfors

1 Like

Digging up an old thread here… Is there a cleaner way to accomplish this nowadays by any chance?