Sha256: a1cd03d4ee5733ccdcdab3d1807d8aa5a87fa561d8d6c8c96dad52dcdb650972
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
require 'kaltura' require 'kaltura_box/client' require 'active_record' module KalturaBox module Entry module ClassMethods def upload(upload_object, options={}) client = KalturaBox::Client.update_session media_entry = Kaltura::KalturaMediaEntry.new options.each do |key, value| media_entry.send("#{key}=", value) if valid_entry_attribute?(key) end media_entry.media_type = Kaltura::KalturaMediaType::VIDEO unless options[:media_type] if options[:source] == :file upload_token = client.media_service.upload(upload_object) client.media_service.add_from_uploaded_file(media_entry,upload_token).id end end def video_list(keyword = nil) client = KalturaBox::Client.update_session media = Kaltura::KalturaMediaService.new(client) if keyword filter = Kaltura::KalturaBaseEntryFilter.new filter.free_text = keyword media_list = media.list(filter) else media_list = media.list end return nil unless media_list.objects media_list.objects.reject { |v| v.media_type != 1 } end def update_all_videos! video_list.each do |v| self.create( entry_id: v.id, title: v.name, description: v.description, thumbnail_url: v.thumbnail_url, data_url: v.data_url, download_url: v.download_url, ms_duration: v.ms_duration, tags: v.tags, plays: v.plays, views: v.views ) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kaltura_box-0.0.2 | lib/kaltura_box/entry/class_methods.rb |