Class: CineSync::EventHandler
- Inherits:
-
Object
- Object
- CineSync::EventHandler
- Defined in:
- lib/cinesync/event_handler.rb
Instance Attribute Summary collapse
-
#save_ext ⇒ Object
readonly
Returns the value of attribute save_ext.
-
#save_format ⇒ Object
readonly
Returns the value of attribute save_format.
-
#save_parent ⇒ Object
readonly
Returns the value of attribute save_parent.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
-
#session_key ⇒ Object
readonly
Returns the value of attribute session_key.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(argv, session) ⇒ EventHandler
constructor
A new instance of EventHandler.
- #offline? ⇒ Boolean
- #saved_frame_path(media_file, frame) ⇒ Object
Constructor Details
#initialize(argv, session) ⇒ EventHandler
Returns a new instance of EventHandler.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cinesync/event_handler.rb', line 8 def initialize(argv, session) @save_format = arg_value(argv, :save_fmt).downcase.to_sym @save_ext = { :jpeg => 'jpg', :png => 'png' }[@save_format] sp = arg_value(argv, :save_path, false) @save_parent = Pathname.new(sp) if sp @url = arg_value(argv, :url, false) key_val = arg_value(argv, :key) @session_key = key_val if key_val != OfflineKey @session = session end |
Instance Attribute Details
#save_ext ⇒ Object (readonly)
Returns the value of attribute save_ext.
6 7 8 |
# File 'lib/cinesync/event_handler.rb', line 6 def save_ext @save_ext end |
#save_format ⇒ Object (readonly)
Returns the value of attribute save_format.
6 7 8 |
# File 'lib/cinesync/event_handler.rb', line 6 def save_format @save_format end |
#save_parent ⇒ Object (readonly)
Returns the value of attribute save_parent.
6 7 8 |
# File 'lib/cinesync/event_handler.rb', line 6 def save_parent @save_parent end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
6 7 8 |
# File 'lib/cinesync/event_handler.rb', line 6 def session @session end |
#session_key ⇒ Object (readonly)
Returns the value of attribute session_key.
6 7 8 |
# File 'lib/cinesync/event_handler.rb', line 6 def session_key @session_key end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
6 7 8 |
# File 'lib/cinesync/event_handler.rb', line 6 def url @url end |
Instance Method Details
#offline? ⇒ Boolean
22 23 24 |
# File 'lib/cinesync/event_handler.rb', line 22 def offline? @session_key.nil? end |
#saved_frame_path(media_file, frame) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cinesync/event_handler.rb', line 26 def saved_frame_path(media_file, frame) return nil unless save_parent return nil if media_file.annotations[frame].drawing_objects.empty? base = ('%s-%05d' % [media_file.name, frame]) i = 1; p2 = nil begin p = p2 p2, i = saved_frame_ver_path(base, i) end while p2.exist? p end |