Adding media package attachments

Skip to first unread message

Paul Gration

Aug 31, 2018, 7:14:28 AM8/31/18
Does anyone have an example of how this is done? Specifically I'm
looking at whether it's worth trying to add a security/xacml+episode (or
security/xacml+series) attachment to our adhoc recordings to be ingested
by Opencast.
Currently our adhoc recording plugin makes an API call to Opencast as
soon as the recording is started to create a series with the appropriate
ACL (Opencast accepts a simple JSON for this) which the recording then
inherits when it's processed in Opencast but I'd prefer the ACL to be an
attachment that is part of the media package and gets ingested with it.

I can see there are the following methods in

- Appears to only ever be called by tests (and I haven't tried them)
- Doesn't allow for specifying of mime type and various other attachment
- Has a FIXME line "#FIXME merge with add"
- I got a NoneType error when trying to use it:

media_package.addAttachmentAsString('test', 'securityxacml',
File "/usr/share/galicaster/galicaster/mediapackage/",
line 1478, in addAttachmentAsString
assert path.isdir(self.getURI())
File "/usr/lib/python2.7/", line 49, in isdir
st = os.stat(s)
TypeError: coercing to Unicode: need string or buffer, NoneType found

Looks like self.getURI() returned None here

- This seems to be more useful but it looks like you need to handle the
creation of the attachment file yourself (it doesn't seem to accept a
string and create the file for you..?).
- Seems to work when I tried with this (where security_file is an
absolute path to a file I manually created on disk):

media_package.add(security_file, 'Attachment', 'attachment/source',

Thought I'm assuming now I'd need to work out how to create this
security file per recording (to make it part of the recording in the
repository) and figure out what the content should be...xacml files look
pretty comprehensive/verbose.

Is there an easier way of doing this?



Paul Gration
Multimedia Software Developer
University of Sussex
+44 (0) 1273 873269
Reply all
Reply to author
0 new messages