Class: Video
- Inherits:
-
Object
- Object
- Video
- Includes:
- DataMapper::Resource
- Defined in:
- lib/enigmamachine/models/video.rb
Overview
A video which we want to encode.
Class Method Summary collapse
-
.complete ⇒ Object
Named scope giving back all videos which have completed encoding.
-
.downloading ⇒ Object
Named scope returning all videos which currently downloading.
-
.encoding ⇒ Object
Named scope for all videos which are currently encoding.
- .reset_downloading_videos ⇒ Object
-
.reset_encoding_videos ⇒ Object
Resets all videos currently marked as “encoding” to state “unencoded” which is the initial state.
-
.unencoded ⇒ Object
Named scope for all videos which are waiting to start encoding.
-
.waiting_for_download ⇒ Object
Named scope returning all videos which are not yet downloaded.
-
.with_encode_errors ⇒ Object
Named scope giving back all videos with encoding errors.
Class Method Details
.complete ⇒ Object
Named scope giving back all videos which have completed encoding.
104 105 106 |
# File 'lib/enigmamachine/models/video.rb', line 104 def self.complete all(:state => 'complete', :order => [:updated_at.desc]) end |
.downloading ⇒ Object
Named scope returning all videos which currently downloading.
116 117 118 |
# File 'lib/enigmamachine/models/video.rb', line 116 def self.downloading all(:state => 'downloading') end |
.encoding ⇒ Object
Named scope for all videos which are currently encoding. Theoretically there should only ever be one.
92 93 94 |
# File 'lib/enigmamachine/models/video.rb', line 92 def self.encoding all(:state => 'encoding') end |
.reset_downloading_videos ⇒ Object
133 134 135 136 137 |
# File 'lib/enigmamachine/models/video.rb', line 133 def self.reset_downloading_videos Video.downloading.each do |video| video.reset_download! end end |
.reset_encoding_videos ⇒ Object
Resets all videos currently marked as “encoding” to state “unencoded” which is the initial state.
If any videos are marked as “encoding” when the application starts, presumably due to an encoding interruption in the last session, they should be reset.
127 128 129 130 131 |
# File 'lib/enigmamachine/models/video.rb', line 127 def self.reset_encoding_videos Video.encoding.each do |video| video.reset! end end |
.unencoded ⇒ Object
Named scope for all videos which are waiting to start encoding.
85 86 87 |
# File 'lib/enigmamachine/models/video.rb', line 85 def self.unencoded all(:state => 'unencoded') end |
.waiting_for_download ⇒ Object
Named scope returning all videos which are not yet downloaded.
110 111 112 |
# File 'lib/enigmamachine/models/video.rb', line 110 def self.waiting_for_download all(:state => 'waiting_for_download') end |
.with_encode_errors ⇒ Object
Named scope giving back all videos with encoding errors.
98 99 100 |
# File 'lib/enigmamachine/models/video.rb', line 98 def self.with_encode_errors all(:state => 'encode_error') end |