Class: YoukuVideoUtility
- Inherits:
-
Object
- Object
- YoukuVideoUtility
- Defined in:
- lib/youku_video_utility.rb
Constant Summary collapse
- CONTENT_TYPE_VIDEO =
'video'
- CONTENT_TYPE_SHOW =
'show'
- HOST =
'10.103.88.54'
Class Method Summary collapse
- .get_encoded_show_id_from_integer(integer) ⇒ Object
- .get_encoded_video_id_from_integer(integer) ⇒ Object
- .update_extra_information(video_object, options = {}) ⇒ Object
Class Method Details
.get_encoded_show_id_from_integer(integer) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/youku_video_utility.rb', line 20 def self.get_encoded_show_id_from_integer integer shifted_integer = Integer(integer) << 2 rescue '' encoded_show_id = Base64.encode64 "#{shifted_integer}" if encoded_show_id != '' result = encoded_show_id.chomp else result = "INVALID: #{integer}" end result end |
.get_encoded_video_id_from_integer(integer) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/youku_video_utility.rb', line 10 def self.get_encoded_video_id_from_integer integer shifted_integer = Integer(integer) << 2 rescue '' encoded_video_id = Base64.encode64 "#{shifted_integer}" if encoded_video_id != '' result = "X#{encoded_video_id}".chomp else result = "INVALID: #{integer}" end result end |
.update_extra_information(video_object, options = {}) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/youku_video_utility.rb', line 31 def self.update_extra_information(video_object, = {}) = {:content_id_attribute => :show_id}.merge() content_id = video_object.send [:content_id_attribute] content_type = get_content_type_from_content_id content_id json = send "get_extra_information_for_#{content_type}", content_id send "set_extra_information_for_#{content_type}", json, video_object.extra_information video_object.extra_information.save end |