I have a series of videos that I’m importing from an existing system. They are all housed in Amazon S3. I’d like to upload them into Kaltura using the API without having to download them first.
In the python client lib, there is an upload_video method that I’m duplicating to modify for this purpose. I’ve already found where I THINK I should modify it, but I’m not sure HOW to modify it.
I did find the KalturaUrlResource() type that I believe I’ll have to use instead of the KalturaUploadedFileTokenResource type. It’s description certainly sounds right. It also sounds more correct than KalturaRemoteStorageResource since I don’t want to serve from the original location.
I’m not sure how to use the uploadToken service to pass over the URL, so that I can continue. Can anybody give me a push how to wipe out the code below opening a local file and supply the URL instead?
Thanks a ton,
with open(media_file_path) as file: print("uploadToken.upload(" + media_url + ")") upload_token = client.uploadToken.add() upload_result = client.uploadToken.upload(upload_token.id, file) client.uploadToken.upload() print("completed uploadToken.upload(" + media_url + ")") # 4. Attach the Media Entry to the File: content_result = None if upload_result: #media_resource = KalturaUploadedFileTokenResource() media_resource = KalturaUrlResource() media_resource.token = upload_token.id # http://www.kaltura.com/api_v3/testmeDoc/index.php?service=media&action=addcontent print("kaltura media content add...") content_result = client.media.addContent(media_entry_result.id, media_resource) print("kaltura media content add completed. content_result.id: " + content_result.id) media_entry_id = media_entry_result.id
I used the testme console to find the addContent action on the media service. I quickly created a media entry to use with that action and a KalturaUrlResource pointing at my video in S3. When using the kmc console to view the video entry, it’s popping up a dialog “Entry is processing, please try again in a few minutes.” but I can see a thumbnail from the original video. I think I’ve found the path! Let me know if I’m wrong.
Now the question I have is: how do I tell it not to transcode and do only the source flavor when uploading like this?