Hi, I’m using a modified version of the API upload code created by @Alex but to auto upload a powerpoint rather than a video.
The problem comes when executing the line:
response, status, code, message, content = api.callMethod(‘LibraryMediaAdd’, params)
as I get the following xml
<rsp status="error">
<error code="20" message="No Module of this type found."/>
</rsp>
From what I can see, code 20 is not in the documentation . also, the parameter “permissionId” is not defined in the docs either.
For reference, the documentation url I’m looking at is: http://xibo.org.uk/manual/en/api_library.html
My code fragment with the params is below:
# Now the file is uploaded, and the old file is deleted,
# we need to add the newly uploaded file to the CMS Library
params = [('fileId', uploadId),
('type', 'ppt'),
('name', mediaName),
('duration', '0'),
# ('permissionId','1'),
('fileName',os.path.basename(fileToUpload))
]
print 'fileId : %s' % uploadId
print 'name : %s' % mediaName
print 'fileName : %s' % os.path.basename(fileToUpload)
response, status, code, message, content = api.callMethod('LibraryMediaAdd', params)
print 'content : %s' % content
# Get the ID of the file we just added
mediaId = api.parseID(content,'media')
# Now mediaID contains the library media ID of our freshly uploaded video
print "Adding new media with ID %s" % mediaId
Please excuse the formatting craziness. I’m note familiar with the editor
Could you please help with where this may be going wrong. The previous parts of Alex’s script of identifying old media and deleting is working correctly as confirmed when looking in the xibo cms. Also, the Oauth2 part is working and registered in the server. I am wondering if the “params” content is correct for a powerpoint file and if the extension pptx is accepted. Also, how do I determine if the foregoing upload has worked. It does return, a valid looking mediaId so I think that is ok.
Thanks
Simon