Class: OneScreen::Player

Inherits:
Base
  • Object
show all
Defined in:
lib/resources/player.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

headers, read_only, #remove_read_only, set_authentication_cookie, #set_authentication_cookie

Instance Attribute Details

#settings_hashObject (readonly)

Returns the value of attribute settings_hash.



4
5
6
# File 'lib/resources/player.rb', line 4

def settings_hash
  @settings_hash
end

Instance Method Details

#get_height_vertical(ply) ⇒ Object



82
83
84
# File 'lib/resources/player.rb', line 82

def get_height_vertical(ply)
  "selected" if settings and settings.include?("ds_ply=#{ply}")
end

#get_horizontal_playlistObject



70
71
72
# File 'lib/resources/player.rb', line 70

def get_horizontal_playlist
  "selected" if settings and settings.include?("ds_plx=") and settings_hash[:ds_plx].to_i > 0
end

#get_no_playlistObject



62
63
64
# File 'lib/resources/player.rb', line 62

def get_no_playlist   
  "selected" if settings and not settings.include?("ds_plx=")
end

#get_size_codeObject



51
52
53
54
55
56
57
58
59
60
# File 'lib/resources/player.rb', line 51

def get_size_code
  ds_w = settings_hash[:ds_w] || 0
  ds_h = settings_hash[:ds_h] || 0
  ds_plx = settings_hash[:ds_plx] || 0
  ds_ply = settings_hash[:ds_ply] || 0
  
  width = ds_w.to_i + ds_plx.to_i
  height = ds_h.to_i + ds_ply.to_i
  width.to_s + "x" + height.to_s
end

#get_skin_codeObject



47
48
49
# File 'lib/resources/player.rb', line 47

def get_skin_code
  skin_mapping[settings_hash[:ds_skin]] if settings_hash[:ds_skin]
end

#get_vertical_playlistObject



66
67
68
# File 'lib/resources/player.rb', line 66

def get_vertical_playlist
  "selected" if settings and settings.include?("ds_plx=") and settings_hash[:ds_plx].to_i == 0
end

#get_width_height(w, h) ⇒ Object



74
75
76
# File 'lib/resources/player.rb', line 74

def get_width_height(w,h)
  "selected" if settings and settings.include?("ds_w=#{w}") and settings.include?("ds_h=#{h}")
end

#get_width_horizontal(plx) ⇒ Object



78
79
80
# File 'lib/resources/player.rb', line 78

def get_width_horizontal(plx)
  "selected" if settings and settings.include?("ds_plx=#{plx}")
end

#is_player_skin(value) ⇒ Object



41
42
43
44
45
# File 'lib/resources/player.rb', line 41

def is_player_skin(value)
  if settings_hash[:ds_skin] and skin_mapping[settings_hash[:ds_skin]] == value
    return "color_selected"
  end
end

#set_settings_hashObject



86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/resources/player.rb', line 86

def set_settings_hash
  @settings_hash = {}    
  unless settings.blank?           
    settings.split(/&/).each do |setting|
      unless setting.blank?
        key,value = setting.split(/=/)
        @settings_hash[key.to_sym] = value
      end
    end    
  end
  @settings_hash 
end

#skin_mappingObject



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/resources/player.rb', line 22

def skin_mapping
  { 
    "http://cdn.onescreen.net/os/mp/osmp/iframeAds/skins/white.xml" => "FFFFFF",
    "http://cdn.onescreen.net/os/mp/osmp/iframeAds/skins/embeddableSkin.xml" => "666666",
    "http://cdn.onescreen.net/os/mp/osmp/iframeAds/skins/blueSkin.xml" => "4E6395",
    "http://cdn.onescreen.net/os/mp/osmp/iframeAds/skins/realblueSkin.xml" => "097BBD",
    "http://cdn.onescreen.net/os/mp/osmp/iframeAds/skins/lightblueSkin.xml" => "8290D1",
    "http://cdn.onescreen.net/os/mp/osmp/iframeAds/skins/pinkSkin.xml" => "9F639E",
    "http://cdn.onescreen.net/os/mp/osmp/iframeAds/skins/redSkin.xml" => "8F201A",
    "http://cdn.onescreen.net/os/mp/osmp/iframeAds/skins/skin_hollyscoop.xml" => "CD3300",
    "http://cdn.onescreen.net/os/mp/osmp/iframeAds/skins/greenSkin.xml" => "6B8429"      
  } 
end

#volumeObject



36
37
38
39
# File 'lib/resources/player.rb', line 36

def volume()
  val = settings_hash[:rs_vol]
  (val.to_f * 100).to_i if val
end