goncalossilva_kaltura-ruby 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. data/.document +5 -0
  2. data/.gitignore +7 -0
  3. data/LICENSE +661 -0
  4. data/README.markdown +56 -0
  5. data/README.rdoc +54 -0
  6. data/Rakefile +61 -0
  7. data/VERSION +1 -0
  8. data/VERSION.yml +5 -0
  9. data/goncalossilva_kaltura-ruby.gemspec +179 -0
  10. data/lib/kaltura.rb +19 -0
  11. data/lib/kaltura/constants.rb +77 -0
  12. data/lib/kaltura/constants/access_control_order_by.rb +14 -0
  13. data/lib/kaltura/constants/audio_codec.rb +16 -0
  14. data/lib/kaltura/constants/base.rb +61 -0
  15. data/lib/kaltura/constants/batch_job.rb +87 -0
  16. data/lib/kaltura/constants/bit_rate_mode.rb +14 -0
  17. data/lib/kaltura/constants/category_order_by.rb +18 -0
  18. data/lib/kaltura/constants/commercial_use_type.rb +14 -0
  19. data/lib/kaltura/constants/container_format.rb +21 -0
  20. data/lib/kaltura/constants/control_panel_command.rb +49 -0
  21. data/lib/kaltura/constants/conversion_profile_order_by.rb +14 -0
  22. data/lib/kaltura/constants/country_restriction_type.rb +16 -0
  23. data/lib/kaltura/constants/data_entry_order_by.rb +20 -0
  24. data/lib/kaltura/constants/directory_restriction_type.rb +14 -0
  25. data/lib/kaltura/constants/document.rb +39 -0
  26. data/lib/kaltura/constants/duration_type.rb +16 -0
  27. data/lib/kaltura/constants/editor_type.rb +14 -0
  28. data/lib/kaltura/constants/email_ingestion_profile_status.rb +14 -0
  29. data/lib/kaltura/constants/entry.rb +59 -0
  30. data/lib/kaltura/constants/file_sync.rb +67 -0
  31. data/lib/kaltura/constants/flavor_asset_status.rb +18 -0
  32. data/lib/kaltura/constants/gender.rb +15 -0
  33. data/lib/kaltura/constants/google_syndication_feed.rb +39 -0
  34. data/lib/kaltura/constants/i_tunes_syndication_feed.rb +42 -0
  35. data/lib/kaltura/constants/i_tunes_syndication_feed/categories.rb +82 -0
  36. data/lib/kaltura/constants/license_type.rb +29 -0
  37. data/lib/kaltura/constants/live_stream_admin_entry_order_by.rb +31 -0
  38. data/lib/kaltura/constants/mail_job_order_by.rb +16 -0
  39. data/lib/kaltura/constants/media.rb +55 -0
  40. data/lib/kaltura/constants/mix_entry_order_by.rb +28 -0
  41. data/lib/kaltura/constants/moderation.rb +34 -0
  42. data/lib/kaltura/constants/notification.rb +43 -0
  43. data/lib/kaltura/constants/nullable_boolean.rb +14 -0
  44. data/lib/kaltura/constants/partner.rb +64 -0
  45. data/lib/kaltura/constants/playable_entry_order_by.rb +28 -0
  46. data/lib/kaltura/constants/playlist.rb +35 -0
  47. data/lib/kaltura/constants/report_type.rb +24 -0
  48. data/lib/kaltura/constants/search_provider_type.rb +29 -0
  49. data/lib/kaltura/constants/session_type.rb +14 -0
  50. data/lib/kaltura/constants/site_restriction_type.rb +14 -0
  51. data/lib/kaltura/constants/source_type.rb +17 -0
  52. data/lib/kaltura/constants/stats.rb +49 -0
  53. data/lib/kaltura/constants/stats/kmc_event_type.rb +77 -0
  54. data/lib/kaltura/constants/syndication_feed.rb +37 -0
  55. data/lib/kaltura/constants/system_user.rb +17 -0
  56. data/lib/kaltura/constants/tube_mogul_syndication_feed.rb +34 -0
  57. data/lib/kaltura/constants/ui_conf.rb +26 -0
  58. data/lib/kaltura/constants/upload_error_code.rb +9 -0
  59. data/lib/kaltura/constants/user.rb +16 -0
  60. data/lib/kaltura/constants/video_codec.rb +16 -0
  61. data/lib/kaltura/constants/widget.rb +15 -0
  62. data/lib/kaltura/constants/yahoo_syndication_feed.rb +44 -0
  63. data/lib/kaltura/filter.rb +75 -0
  64. data/lib/kaltura/filter/access_control_filter.rb +20 -0
  65. data/lib/kaltura/filter/base_entry_filter.rb +115 -0
  66. data/lib/kaltura/filter/base_filter.rb +7 -0
  67. data/lib/kaltura/filter/base_job_filter.rb +28 -0
  68. data/lib/kaltura/filter/batch_job_filter.rb +54 -0
  69. data/lib/kaltura/filter/category_filter.rb +23 -0
  70. data/lib/kaltura/filter/control_panel_command_filter.rb +39 -0
  71. data/lib/kaltura/filter/conversion_profile_filter.rb +12 -0
  72. data/lib/kaltura/filter/document_entry_filter.rb +12 -0
  73. data/lib/kaltura/filter/file_sync_filter.rb +93 -0
  74. data/lib/kaltura/filter/flavor_params_filter.rb +11 -0
  75. data/lib/kaltura/filter/flavor_params_output_filter.rb +14 -0
  76. data/lib/kaltura/filter/media_entry_filter.rb +22 -0
  77. data/lib/kaltura/filter/media_entry_filter_for_playlist.rb +11 -0
  78. data/lib/kaltura/filter/partner_filter.rb +22 -0
  79. data/lib/kaltura/filter/playable_entry_filter.rb +40 -0
  80. data/lib/kaltura/filter/report_input_filter.rb +25 -0
  81. data/lib/kaltura/filter/system_partner_usage_filter.rb +15 -0
  82. data/lib/kaltura/filter/ui_conf_filter.rb +40 -0
  83. data/lib/kaltura/filter/user_filter.rb +27 -0
  84. data/lib/kaltura/filter/widget_filter.rb +37 -0
  85. data/lib/kaltura/kaltura_client.rb +1762 -0
  86. data/lib/kaltura/kaltura_client_base.rb +300 -0
  87. data/lib/kaltura/response.rb +112 -0
  88. data/lib/kaltura/service.rb +142 -0
  89. data/lib/kaltura/service/access_control_service.rb +110 -0
  90. data/lib/kaltura/service/admin_user_service.rb +69 -0
  91. data/lib/kaltura/service/base_entry_service.rb +331 -0
  92. data/lib/kaltura/service/base_service.rb +42 -0
  93. data/lib/kaltura/service/bulk_upload_service.rb +75 -0
  94. data/lib/kaltura/service/category_service.rb +112 -0
  95. data/lib/kaltura/service/conversion_profile_service.rb +116 -0
  96. data/lib/kaltura/service/data_service.rb +116 -0
  97. data/lib/kaltura/service/email_ingestion_profile_service.rb +122 -0
  98. data/lib/kaltura/service/flavor_asset_service.rb +155 -0
  99. data/lib/kaltura/service/flavor_params_service.rb +111 -0
  100. data/lib/kaltura/service/live_stream_service.rb +140 -0
  101. data/lib/kaltura/service/media_service.rb +546 -0
  102. data/lib/kaltura/service/mixing_service.rb +86 -0
  103. data/lib/kaltura/service/notification_service.rb +13 -0
  104. data/lib/kaltura/service/partner_service.rb +41 -0
  105. data/lib/kaltura/service/playlist_service.rb +73 -0
  106. data/lib/kaltura/service/report_service.rb +47 -0
  107. data/lib/kaltura/service/search_service.rb +34 -0
  108. data/lib/kaltura/service/session_service.rb +24 -0
  109. data/lib/kaltura/service/stats_service.rb +24 -0
  110. data/lib/kaltura/service/syndication_feed_service.rb +50 -0
  111. data/lib/kaltura/service/system_partner_service.rb +58 -0
  112. data/lib/kaltura/service/system_service.rb +11 -0
  113. data/lib/kaltura/service/system_user_service.rb +63 -0
  114. data/lib/kaltura/service/ui_conf_service.rb +51 -0
  115. data/lib/kaltura/service/upload_service.rb +18 -0
  116. data/lib/kaltura/service/user_service.rb +44 -0
  117. data/lib/kaltura/service/widget_service.rb +38 -0
  118. data/lib/kaltura/service/x_internal_service.rb +13 -0
  119. data/test/kaltura-ruby_test.rb +7 -0
  120. data/test/test.rb +23 -0
  121. data/test/test_2.rb +26 -0
  122. data/test/test_error.rb +14 -0
  123. data/test/test_helper.rb +10 -0
  124. metadata +222 -0
@@ -0,0 +1,546 @@
1
+ module Kaltura
2
+ module Service
3
+ ##
4
+ # The media service allows you to interact with video, image and audio files on the Kaltura system.
5
+ # This is the service you'll be performing the bulk of your actions on and becoming familiar with
6
+ # it would be beneficial for any application development you perform. The KMC and the two upload
7
+ # widgets (KCW and KSU) both use this API to upload content to the Kaltura database as well.
8
+ #
9
+ # @example Retrieve a media entry:
10
+ # client.media_service.get('1_qua324a')
11
+ #
12
+ # @example Upload a new entry:
13
+ # media_entry = Kaltura::MediaEntry.new
14
+ # media_entry.media_type = Kaltura::Constants::Media::Type::VIDEO
15
+ # video_file = File.open "/home/prob/video.mp4"
16
+ # begin
17
+ # video_token = client.media_service.upload(video_file)
18
+ # created_entry = client.media_service.add_from_uploaded_file(media_entry,video_token)
19
+ # rescue Kaltura::APIError => e
20
+ # end
21
+ #
22
+ # @example Update an existing entry:
23
+ # update_entry = Kaltura::MediaEntry.new
24
+ # update_entry.description = "Pancakes are lame yo."
25
+ # client.media_service.update('1_qua324a',update_entry)
26
+ #
27
+ # @example Delete an existing entry:
28
+ # client.media_service.delete('1_qua324a')
29
+ #
30
+ # @example Update an Entry thumbnail via file upload:
31
+ # thumbnail_file = File.open('/path/to/thumbnail_file')
32
+ # client.media_service.update_thumbnail_from_jpeg('1_qua324a',thumbnail_file)
33
+ #
34
+ # @example Update an entry thumbnail from a url:
35
+ # client.media_service.update_thumbnail_from_url('1_qua324a','http://twitter.com/waffles/waffletastic.jpg')
36
+ #
37
+ # @example Update an entry thumbnail from another entry:
38
+ # client.media_service.update_thumbnail_from_source_entry('1_qua324a','0_k24aj1b',5)
39
+ ##
40
+ class MediaService < BaseService
41
+
42
+ ##
43
+ # This method creates a new media entry from either a HTTP or FTP URL given a batch ID.
44
+ # The intention of this action is to import videos in large quantities from another
45
+ # service without overloading either the former service nor Kaltura. This is probably
46
+ # best handled from within the KMC with their batch importing wizard, even though this is
47
+ # exposed to anyone on API wrappers.
48
+ #
49
+ # @param [Kaltura::MediaEntry] media_entry A newly insantiated media entry with metadata
50
+ # filled out that will be later returned with the ID field as stored on the database.
51
+ # @param [String] url A HTTP or FTP URL. I would imagine the FTP cannot be password protected.
52
+ # @param [Integer] bulk_upload_id The ID of the bulk upload job.
53
+ #
54
+ # @return [Kaltura::MediaEntry] Returns a media entry object with the metadata fields filled
55
+ # out with the additional database fields the Kaltura service set. It would be a good idea
56
+ # to store the ID somewhere.
57
+ #
58
+ # @raise [Kaltura::APIError] Raises the default Kaltura errors plus 'PROPERTY_VALIDATION_MIN_LENGTH'
59
+ # when a specific attribute of the media entry doesn't have a long enough length and
60
+ # 'PROPERTY_VALIDATION_CANNOT_BE_NULL' when a specific attribute is not allowed to be null.
61
+ #
62
+ ##
63
+ def add_from_bulk(media_entry, url, bulk_upload_id)
64
+ kparams = {}
65
+ client.add_param(kparams, 'mediaEntry', media_entry)
66
+ client.add_param(kparams, 'url', url)
67
+ client.add_param(kparams, 'bulkUploadId', bulk_upload_id)
68
+ perform_request('media','addFromBulk',kparams,false)
69
+ end
70
+
71
+ ##
72
+ # Adds a new media entry for importing from a HTTP or FTP URL.
73
+ # The entry is first queued for uploading, then once that is complete it is queued for
74
+ # encoding. This gives you a long period between uploading and determining if the media entry
75
+ # is in a valid conversion format. A Kaltura player wil first raise the error 'Media clip not found' and
76
+ # eventually 'Media is currently converting, try again in a few minutes' if you expose the media entry
77
+ # to new users immediately.
78
+ #
79
+ # @param [Kaltura::MediaEntry] media_entry A newly insantiated media entry with metadata
80
+ # filled out that will be later returned with the ID field as stored on the database.
81
+ # @param [String] url A HTTP or FTP URL. I would imagine the FTP cannot be password protected.
82
+ # @param [Integer] bulk_upload_id The ID of the bulk upload job.
83
+ #
84
+ # @return [Kaltura::MediaEntry] Returns a media entry object with the metadata fields filled
85
+ # out with the additional database fields the Kaltura service set. It would be a good idea
86
+ # to store the ID somewhere.
87
+ #
88
+ # @raise [Kaltura::APIError] Raises the default Kaltura errors plus 'PROPERTY_VALIDATION_MIN_LENGTH'
89
+ # when a specific attribute of the media entry doesn't have a long enough length and
90
+ # 'PROPERTY_VALIDATION_CANNOT_BE_NULL' when a specific attribute is not allowed to be null.
91
+ #
92
+ ##
93
+ def add_from_url(media_entry, url)
94
+ kparams = {}
95
+ client.add_param(kparams, 'mediaEntry', media_entry)
96
+ client.add_param(kparams, 'url', url)
97
+ perform_request('media','addFromUrl',kparams,false)
98
+ end
99
+
100
+ ##
101
+ # Adds a new media entry from the results of a search.
102
+ # This action is used by the KCW on the third tab, finding videos from external sources.
103
+ # I wouldn't typically consider using this method as an external user of the Kaltura API.
104
+ #
105
+ # @param [Kaltura::MediaEntry] media_entry A newly insantiated media entry with metadata
106
+ # filled out that will be later returned with the ID field as stored on the database.
107
+ # @param [Kaltura::SearchResult] search_result A specific Kaltura entry provided from a search provided
108
+ # by Kaltura.
109
+ #
110
+ # @return [Kaltura::MediaEntry] Returns a media entry object with the metadata fields filled
111
+ # out with the additional database fields the Kaltura service set. It would be a good idea
112
+ # to store the ID somewhere.
113
+ #
114
+ # @raise [Kaltura::APIError] Raises the default Kaltura errors plus 'PROPERTY_VALIDATION_MIN_LENGTH'
115
+ # when a specific attribute of the media entry doesn't have a long enough length and
116
+ # 'PROPERTY_VALIDATION_CANNOT_BE_NULL' when a specific attribute is not allowed to be null.
117
+ #
118
+ ##
119
+ def add_from_search_result(media_entry=nil, search_result=nil)
120
+ kparams = {}
121
+ client.add_param(kparams, 'mediaEntry', media_entry)
122
+ client.add_param(kparams, 'searchResult', search_result)
123
+ perform_request('media','addFromSearchResult',kparams,false)
124
+ end
125
+
126
+ ##
127
+ # Adds a new media entry given a valid upload token.
128
+ # This method is the second step of the uploading process if you wish to upload local content
129
+ # into Kaltura. This skips the importing queue step, allowing you to have a better idea as to when
130
+ # you can expose the media entry to the end-user.
131
+ #
132
+ # @param [Kaltura::MediaEntry] media_entry A newly insantiated media entry with metadata
133
+ # filled out that will be later returned with the ID field as stored on the database.
134
+ # @param [String] upload_token_id An upload token returned from Kaltura::Service::MediaService#upload
135
+ #
136
+ # @return [Kaltura::MediaEntry] Returns a media entry object with the metadata fields filled
137
+ # out with the additional database fields the Kaltura service set. It would be a good idea
138
+ # to store the ID somewhere.
139
+ #
140
+ # @raise [Kaltura::APIError] Raises the default Kaltura errors plus 'PROPERTY_VALIDATION_MIN_LENGTH'
141
+ # when a specific attribute of the media entry doesn't have a long enough length and
142
+ # 'PROPERTY_VALIDATION_CANNOT_BE_NULL' when a specific attribute is not allowed to be null.
143
+ # Also raises 'UPLOADED_FILE_NOT_FOUND_BY_TOKEN' if the upload_token_id is invalid.
144
+ #
145
+ # @example This is how a full upload process looks like:
146
+ # media_entry = Kaltura::MediaEntry.new
147
+ # media_entry.media_type = Kaltura::Constants::Media::Type::VIDEO
148
+ # video_file = File.open "/home/prob/video.mp4"
149
+ # begin
150
+ # video_token = client.media_service.upload(video_file)
151
+ # created_entry = client.media_service.add_from_uploaded_file(media_entry,video_token)
152
+ # rescue Kaltura::APIError => e
153
+ # end
154
+ #
155
+ ##
156
+ def add_from_uploaded_file(media_entry, upload_token_id)
157
+ kparams = {}
158
+ client.add_param(kparams, 'mediaEntry', media_entry)
159
+ client.add_param(kparams, 'uploadTokenId', upload_token_id)
160
+ perform_request('media','addFromUploadedFile',kparams,false)
161
+ end
162
+
163
+ ##
164
+ # Adds a new media entry after the file was recorded on the server and the token ID exists.
165
+ # This is a method that the KCW uses to add recorded webcam files into the database. You can
166
+ # mimic this by using the exact same steps as Kaltura::Service::MediaService#add_from_uploaded_file
167
+ # but you then really wouldn't need to use this action at all.
168
+ #
169
+ # @param [Kaltura::MediaEntry] media_entry A newly insantiated media entry with metadata
170
+ # filled out that will be later returned with the ID field as stored on the database.
171
+ # @param [String] webcam_token_id An upload token returned from somewhere not documented by Kaltura.
172
+ #
173
+ # @return [Kaltura::MediaEntry] Returns a media entry object with the metadata fields filled
174
+ # out with the additional database fields the Kaltura service set. It would be a good idea
175
+ # to store the ID somewhere.
176
+ #
177
+ # @raise [Kaltura::APIError] Raises the default Kaltura errors plus 'PROPERTY_VALIDATION_MIN_LENGTH'
178
+ # when a specific attribute of the media entry doesn't have a long enough length and
179
+ # 'PROPERTY_VALIDATION_CANNOT_BE_NULL' when a specific attribute is not allowed to be null.
180
+ # Also raises 'RECORDED_WEBCAM_FILE_NOT_FOUND_BY_TOKEN' if the upload_token_id is invalid.
181
+ #
182
+ #
183
+ ##
184
+ def add_from_recorded_webcam(media_entry, webcam_token_id)
185
+ kparams = {}
186
+ client.add_param(kparams, 'mediaEntry', media_entry)
187
+ client.add_param(kparams, 'webcamTokenId', webcam_token_id)
188
+ perform_request('media','addFromRecordedWebcam',kparams,false)
189
+ end
190
+
191
+
192
+ ##
193
+ # Copies one entry into a new entry.
194
+ # If a specific encoding type is not specified for the new entries source, it will
195
+ # default to the old entries original flavor.
196
+ # This method was not in the original kaltura-ruby and was discovered from the
197
+ # API docs.
198
+ #
199
+ # @param [Kaltura::MediaEntry] media_entry A newly insantiated media entry with metadata
200
+ # filled out that will be later returned with the ID field as stored on the database.
201
+ # @param [String] source_entry_id The media entry to copy from.
202
+ # @param [Integer] source_flavor_params_id The encoding type to use as the original flavor for
203
+ # the new entry.
204
+ #
205
+ # @return [Kaltura::MediaEntry] Returns a media entry object with the metadata fields filled
206
+ # out with the additional database fields the Kaltura service set. It would be a good idea
207
+ # to store the ID somewhere.
208
+ #
209
+ # @raise [Kaltura::APIError] Raises the default Kaltura errors.
210
+ # @since 0.4.7
211
+ #
212
+ ##
213
+ def add_from_entry(media_entry, source_entry_id,source_flavor_params_id=nil)
214
+ kparams = {}
215
+ client.add_params(kparams,'mediaEntry',media_entry)
216
+ client.add_params(kparams,'sourceEntryId',source_entry_id)
217
+ client.add_params(kparams,'sourceFlavorParamsId',source_flavor_params_id)
218
+ perform_request('media','addFromEntry',kparams,false)
219
+ end
220
+
221
+ ##
222
+ # Copies a specific flavor into a new Media Entry.
223
+ #
224
+ # @param [Kaltura::MediaEntry] media_entry A newly insantiated media entry with metadata
225
+ # filled out that will be later returned with the ID field as stored on the database.
226
+ # @param [String] source_flavor_asset_id A specific flavor to use as the source of the copy.
227
+ #
228
+ # @return [Kaltura::MediaEntry] Returns a media entry object with the metadata fields filled
229
+ # out with the additional database fields the Kaltura service set. It would be a good idea
230
+ # to store the ID somewhere.
231
+ #
232
+ # @raise [Kaltura::APIError] Raises the default Kaltura errors.
233
+ # @since 0.4.7
234
+ #
235
+ ##
236
+ def add_from_flavor_asset(media_entry, source_flavor_asset_id)
237
+ kparams = {}
238
+ client.add_params(kparams,'mediaEntry',media_entry)
239
+ client.add_params(kparams,'sourceFlavorAssetId',source_flavor_asset_id)
240
+ perform_request('media','addFromFlavorAsset',kparams,false)
241
+ end
242
+
243
+ ##
244
+ # Converts a media entry.
245
+ # This method was not originallly in kaltura-ruby and was added after peruising the API
246
+ # docs. I wouldn't suggest using this method. Any upload action will already trigger a
247
+ # conversion, so instead use request conversion.
248
+ #
249
+ # @param [String] entry_id The media entry to convert.
250
+ # @param [Integer] conversion_profile_id The conversion profile to convert the entry with.
251
+ # @param [Array] dynamic_conversion_attributes An Array of Kaltura::ConversionAttribute .
252
+ # It would be helpful if that object type existed.
253
+ #
254
+ # @return [Integer] Returns the conversion profile that was converted on the entry_id.
255
+ #
256
+ # @raise [Kaltura::APIError] Raises the default Kaltura errors.
257
+ # @since 0.4.7
258
+ # @todo Add Kaltura::ConversionAttribute.
259
+ ##
260
+ def convert(entry_id,conversion_profile_id,dynamic_conversion_attributes=nil)
261
+ kparams = {}
262
+ client.add_params(kparams,'entryId',entry_id)
263
+ client.add_params(kparams,'conversionProfileId',conversion_profile_id)
264
+ client.add_params(kparams,'dynamicConversionAttributes',dynamic_conversion_attributes)
265
+ perform_request('media','convert',kparams,false)
266
+ end
267
+
268
+ ##
269
+ # Retrieves a media entry provided an ID. Will also return older versions if you know a specific number.
270
+ #
271
+ # @param [String] entry_id The Kaltura media entries ID.
272
+ # @param [Integer] version An optional version number. Defaults to the most recent version.
273
+ #
274
+ # @return [Kaltura::MediaEntry] Returns a media entry object with the metadata fields filled
275
+ # out with the additional database fields the Kaltura service set. It would be a good idea
276
+ # to store the ID somewhere.
277
+ #
278
+ # @raise [Kaltura::APIError] Raises the default Kaltura errors.
279
+ ##
280
+ def get(entry_id, version=-1)
281
+ kparams = {}
282
+ client.add_param(kparams, 'entryId', entry_id)
283
+ client.add_param(kparams, 'version', version)
284
+ perform_request('media','get',kparams,false)
285
+ end
286
+
287
+ ##
288
+ # Updates a specific media entries metadata.
289
+ # Like all other update actions on the Kaltura service, it is best to instantiate a
290
+ # new media entry object and add any fields you wish to change to the new media entry rather
291
+ # than using a Kaltura::Service::MediaService#get call and then updating that specific entry.
292
+ #
293
+ # @param [String] entry_id The media entry to update.
294
+ # @param [Kaltura:MediaEntry] A newly insantiated media entry with the updated metadata fields in place.
295
+ #
296
+ # @return [Kaltura::MediaEntry] Returns a media entry object with the metadata fields filled
297
+ # out with the additional database fields the Kaltura service set. It would be a good idea
298
+ # to store the ID somewhere.
299
+ #
300
+ # @raise [Kaltura::APIError] Raises the default Kaltura errors.
301
+ ##
302
+ def update(entry_id, media_entry)
303
+ kparams = {}
304
+ client.add_param(kparams, 'entryId', entry_id)
305
+ client.add_param(kparams, 'mediaEntry', media_entry)
306
+ perform_request('media','update',kparams,false)
307
+ end
308
+
309
+ ##
310
+ # Removes the specific entry from the Kaltura database.
311
+ #
312
+ # @param [String] entry_id The media entry to remove.
313
+ #
314
+ # @return [nil] Returns nothing.
315
+ #
316
+ # @raise [Kaltura::APIError] Raises the default Kaltura errors.
317
+ ##
318
+ def delete(entry_id)
319
+ kparams = {}
320
+ client.add_param(kparams, 'entryId', entry_id)
321
+ perform_request('media','delete',kparams,false)
322
+ end
323
+
324
+ ##
325
+ # Lists media entries given a filter and provides paging support for large lists.
326
+ #
327
+ # @param [Kaltura::Filter::MediaEntryFilter] The filter to list media entries by.
328
+ # @param [Kaltura::FilterPager] The default Kaltura pager.
329
+ #
330
+ # @return [Kaltura::Response::MediaListResponse] Returns a wrapper for Kaltura::Response::BaseResponse.
331
+ #
332
+ # @raise [Kaltura::APIError] Raises default Kaltura errors.
333
+ ##
334
+ def list(filter=nil, pager=nil)
335
+ kparams = {}
336
+ client.add_param(kparams, 'filter', filter)
337
+ client.add_param(kparams, 'pager', pager)
338
+ perform_request('media','list',kparams,false)
339
+ end
340
+
341
+ ##
342
+ # Counts the total number of media entries that meet the filter criteria.
343
+ #
344
+ # @param [Kaltura::Filter::MediaEntryFilter] The criteria in which the count will be gathered against.
345
+ #
346
+ # @return [Integer] Returns the total.
347
+ #
348
+ # @raise [Kaltura::APIError] Raises default Kaltura errors.
349
+ ##
350
+ def count(filter=nil)
351
+ kparams = {}
352
+ client.add_param(kparams, 'filter', filter)
353
+ perform_request('media','count',kparams,false)
354
+ end
355
+
356
+ ##
357
+ # Uploads a media file to Kaltura.
358
+ # This is the first step in creating a media entry from a local file.
359
+ #
360
+ # @param [File] file_data The file to upload.
361
+ #
362
+ # @return [String] Returns the upload token ID to be used for entry creation.
363
+ #
364
+ # @raise [Kalutra::APIError] Raises default Kaltura errors.
365
+ #
366
+ # @see Kaltura::Service::MediaService#add_from_uploaded_file
367
+ ##
368
+ def upload(file_data)
369
+ kparams = {}
370
+ client.add_param(kparams, 'fileData', file_data)
371
+ perform_request('media','upload',kparams,false)
372
+ end
373
+
374
+ ##
375
+ # Updates a specific media entries thumbnail by a specified time offset in seconds.
376
+ #
377
+ # @param [String] entry_id The Kaltura entry ID.
378
+ # @param [Integer] time_offset The offset in seconds to create the thumbnail.
379
+ #
380
+ # @return [Kaltura::MediaEntry] Returns a Kaltura media entry with the updated version.
381
+ #
382
+ # @raise [Kalutra::APIError] Raises default Kaltura errors.
383
+ ##
384
+ def update_thumbnail(entry_id, time_offset)
385
+ kparams = {}
386
+ client.add_param(kparams, 'entryId', entry_id)
387
+ client.add_param(kparams, 'timeOffset', time_offset)
388
+ perform_request('media','updateThumbnail',kparams,false)
389
+ end
390
+
391
+ ##
392
+ # Updates a media entries thumbnail from another media entry given a time offset.
393
+ #
394
+ # @param [String] entry_id The entry to be updated.
395
+ # @param [String] source_entry_id The entry to create the thumbnail from.
396
+ # @param [Integer] time_offset The offset in seconds to create the thumbnail.
397
+ #
398
+ # @return [Kaltura::MediaEntry] Returns a kaltura media entry with the updated version.
399
+ #
400
+ # @raise [Kaltura::APIError] Raises the default Kaltura errors.
401
+ ##
402
+ def update_thumbnail_from_source_entry(entry_id, source_entry_id, time_offset)
403
+ kparams = {}
404
+ client.add_param(kparams, 'entryId', entry_id)
405
+ client.add_param(kparams, 'sourceEntryId', source_entry_id)
406
+ client.add_param(kparams, 'timeOffset', time_offset)
407
+ perform_request('media','updateThumbnailFromSourceEntry',kparams,false)
408
+ end
409
+
410
+ ##
411
+ # Updates a media entries thumbnail from a JPEG file.
412
+ #
413
+ # @param [String] entry_id The entry to be updated.
414
+ # @param [File] file_data The JPEG file to use as the new thumbnail.
415
+ #
416
+ # @return [Kaltura::MediaEntry] Returns a kaltura media entry with the updated version.
417
+ #
418
+ # @raise [Kaltura::APIError] Raises the default Kaltura errors.
419
+ ##
420
+ def update_thumbnail_jpeg(entry_id, file_data)
421
+ kparams = {}
422
+ client.add_param(kparams, 'entryId', entry_id)
423
+ client.add_param(kparams, 'fileData', file_data)
424
+ perform_request('media','updateThumbnailJpeg',kparams,false)
425
+ end
426
+
427
+ ##
428
+ # Updates a media entries thumbnail given a URL.
429
+ #
430
+ # @param [String] entry_id The entry to be updated.
431
+ # @param [File] file_data The URL of a JPEG file to use as the new thumbnail.
432
+ #
433
+ # @return [Kaltura::MediaEntry] Returns a kaltura media entry with the updated version.
434
+ #
435
+ # @raise [Kaltura::APIError] Raises the default Kaltura errors.
436
+ ##
437
+ def update_thumbnail_from_url(entry_id, url)
438
+ kparams = {}
439
+ client.add_param(kparams, 'entryId', entry_id)
440
+ client.add_param(kparams, 'url', url)
441
+ perform_request('media','updateThumbnailFromUrl',kparams,false)
442
+ end
443
+
444
+ ##
445
+ # Requests a new conversion job.
446
+ # Use this over Kaltura::Service::MediaService#convert.
447
+ #
448
+ # @param [String] entry_id The entry to be updated.
449
+ # @param [String] file_format The format to convert to.
450
+ #
451
+ # @return [Integer] The Kalatura::FlavorParams ID converted.
452
+ #
453
+ # @raise [Kaltura::APIError] Raises default Kaltura errors.
454
+ ##
455
+ def request_conversion(entry_id, file_format)
456
+ kparams = {}
457
+ client.add_param(kparams, 'entryId', entry_id)
458
+ client.add_param(kparams, 'fileFormat', file_format)
459
+ perform_request('media','requestConversion',kparams,false)
460
+ end
461
+
462
+ ##
463
+ # Flags an inappropriate media entry for moderation.
464
+ #
465
+ # @param [Kaltura::ModerationFlag] moderation_flag The flag to apply.
466
+ #
467
+ # @return [nil] Returns nothing
468
+ #
469
+ # @raise [Kaltura::APIError] Raises default Kaltura errors.
470
+ ##
471
+ def flag(moderation_flag)
472
+ kparams = {}
473
+ client.add_param(kparams, 'moderationFlag', moderation_flag)
474
+ perform_request('media','flag',kparams,false)
475
+ end
476
+
477
+ ##
478
+ # Rejects the media entry and marks all pending flags as moderated.
479
+ # This makes the entry non-playable.
480
+ #
481
+ # @param [String] entry_id The Kaltura media entry to be updated.
482
+ #
483
+ # @return [nil] Returns nothing
484
+ #
485
+ # @raise [Kaltura::APIError] Raises default Kaltura errors.
486
+ ##
487
+ def reject(entry_id)
488
+ kparams = {}
489
+ client.add_param(kparams, 'entryId', entry_id)
490
+ perform_request('media','request',kparams,false)
491
+ end
492
+
493
+ ##
494
+ # Approves the media entry and marks all pending flags as moderated.
495
+ # This makes the entry playable.
496
+ #
497
+ # @param [String] entry_id The Kaltura media entry to be updated.
498
+ #
499
+ # @return [nil] Returns nothing
500
+ #
501
+ # @raise [Kaltura::APIError] Raises default Kaltura errors.
502
+ ##
503
+ def approve(entry_id)
504
+ kparams = {}
505
+ client.add_param(kparams, 'entryId', entry_id)
506
+ perform_request('media','approve',kparams,false)
507
+ end
508
+
509
+ ##
510
+ # Lists all pending moderation flags for the media entry with paging support for numerous flags.
511
+ #
512
+ # @param [String] entry_id The entry to locate moderation flags for.
513
+ # @param [Kaltura::FilterPager] The default Kaltura pager.
514
+ #
515
+ # @return [Kaltura::Response::ModerationFlagListResponse] A wrapper for Kaltura::Response::BaseResponse.
516
+ #
517
+ # @raise [Kaltura::APIError] Raises the defaault Kaltura errors.
518
+ ##
519
+ def list_flags(entry_id, pager=nil)
520
+ kparams = {}
521
+ client.add_param(kparams, 'entryId', entry_id)
522
+ client.add_param(kparams, 'pager', pager)
523
+ perform_request('media','listFlags',kparams,false)
524
+ end
525
+
526
+ ##
527
+ # Rank a media entry.
528
+ # This does no validation to prevent duplicate rankings. Fairly worthless. It is suggested you
529
+ # maintain rankings on your own application.
530
+ #
531
+ # @param [String] The Kaltura entry to be updated.
532
+ # @param [Integer] The rank to apply.
533
+ #
534
+ # @return [nil] Returns nothing.
535
+ #
536
+ # @raise [Kaltura::APIError] Raises default Kaltura errors.
537
+ ##
538
+ def anonymous_rank(entry_id, rank)
539
+ kparams = {}
540
+ client.add_param(kparams, 'entryId', entry_id)
541
+ client.add_param(kparams, 'rank', rank)
542
+ perform_request('media','anonymousRank',kparams,false)
543
+ end
544
+ end #class MediaService
545
+ end
546
+ end