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.
23 24 25 |
# File 'lib/vidibus/recording/part.rb', line 23 def data_file @data_file ||= "#{basename}.f4v" end |
#has_data? ⇒ Boolean
32 33 34 |
# File 'lib/vidibus/recording/part.rb', line 32 def has_data? size.to_i >= SIZE_THRESHOLD end |
#postprocess ⇒ Object
57 58 59 60 61 62 |
# File 'lib/vidibus/recording/part.rb', line 57 def postprocess process_yml_file track_progress self.stopped_at = Time.now # save! end |
#reset ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/vidibus/recording/part.rb', line 40 def reset remove_files blanks = {} [ :info, :size, :duration, :started_at ].map {|a| blanks[a] = nil } update_attributes(blanks) end |
#start ⇒ Object
64 65 66 67 |
# File 'lib/vidibus/recording/part.rb', line 64 def start self.started_at = Time.now self.stopped_at = nil end |
#stopped? ⇒ Boolean
36 37 38 |
# File 'lib/vidibus/recording/part.rb', line 36 def stopped? !!stopped_at end |
#track_progress ⇒ Object
52 53 54 55 |
# File 'lib/vidibus/recording/part.rb', line 52 def track_progress set_size set_duration end |
#yml_file ⇒ Object
Returns the YAML file path of this part.
28 29 30 |
# File 'lib/vidibus/recording/part.rb', line 28 def yml_file @yml_file ||= "#{basename}.yml" end |