Class: Vidibus::Recording::Part
- Inherits:
-
Object
- Object
- Vidibus::Recording::Part
- Includes:
- Mongoid::Document, Mongoid::Timestamps, Helpers
- Defined in:
- lib/vidibus/recording/part.rb
Constant Summary collapse
- SIZE_THRESHOLD =
2000
Instance Method Summary collapse
-
#data_file ⇒ Object
Returns the file path of this part.
- #has_data? ⇒ Boolean
- #postprocess ⇒ Object
- #reset ⇒ Object
- #start ⇒ Object
- #stopped? ⇒ Boolean
- #track_progress ⇒ Object
-
#yml_file ⇒ Object
Returns the YAML file path of this part.
Methods included from Helpers
Instance Method Details
#data_file ⇒ Object
Returns the file path of this part.
27 28 29 |
# File 'lib/vidibus/recording/part.rb', line 27 def data_file @data_file ||= "#{basename}.f4v" end |
#has_data? ⇒ Boolean
36 37 38 |
# File 'lib/vidibus/recording/part.rb', line 36 def has_data? size.to_i >= SIZE_THRESHOLD end |
#postprocess ⇒ Object
61 62 63 64 65 |
# File 'lib/vidibus/recording/part.rb', line 61 def postprocess process_yml_file track_progress self.stopped_at = Time.now end |
#reset ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/vidibus/recording/part.rb', line 44 def reset remove_files blanks = {} [ :info, :size, :duration, :started_at ].map {|a| blanks[a] = nil } update_attributes(blanks) end |
#start ⇒ Object
67 68 69 70 |
# File 'lib/vidibus/recording/part.rb', line 67 def start self.started_at = Time.now self.stopped_at = nil end |
#stopped? ⇒ Boolean
40 41 42 |
# File 'lib/vidibus/recording/part.rb', line 40 def stopped? !!stopped_at end |
#track_progress ⇒ Object
56 57 58 59 |
# File 'lib/vidibus/recording/part.rb', line 56 def track_progress set_size set_duration end |
#yml_file ⇒ Object
Returns the YAML file path of this part.
32 33 34 |
# File 'lib/vidibus/recording/part.rb', line 32 def yml_file @yml_file ||= "#{basename}.yml" end |