enigmamachine 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/lib/enigmamachine.rb CHANGED
@@ -56,6 +56,7 @@ class EnigmaMachine < Sinatra::Base
56
56
  # main Sinatra/thin thread once the periodic timer is added.
57
57
  #
58
58
  configure do
59
+ Video.reset_encoding_videos
59
60
  Thread.new do
60
61
  until EM.reactor_running?
61
62
  sleep 1
@@ -222,17 +223,5 @@ class EnigmaMachine < Sinatra::Base
222
223
  end
223
224
  end
224
225
 
225
-
226
- # If any videos are marked as "encoding" when the application starts,
227
- # presumably due to an encoding interruption in the last session, they
228
- # should be reset.
229
- #
230
- def reset_encoding_videos
231
- Video.encoding.each do |video|
232
- video.state = "unencoded"
233
- video.save!
234
- end
235
- end
236
-
237
226
  end
238
227
 
@@ -9,7 +9,6 @@ class EncodingQueue
9
9
  EM.add_periodic_timer(5) {
10
10
  encode_next_video
11
11
  }
12
- encode_next_video
13
12
  end
14
13
 
15
14
 
@@ -21,9 +20,7 @@ class EncodingQueue
21
20
  begin
22
21
  video.encoder.encode(video)
23
22
  rescue Exception => ex
24
- File.open('/home/dave/test.txt', 'w') do |f|
25
- f.puts ex
26
- end
23
+ # don't do anything just yet, until we set up logging properly.
27
24
  end
28
25
  end
29
26
  end
@@ -33,5 +33,19 @@ class Video
33
33
  all(:state => 'complete', :order => [:updated_at.desc])
34
34
  end
35
35
 
36
+ # Resets all videos currently marked as "encoding" to state "unencoded"
37
+ # which is the initial state.
38
+ #
39
+ # If any videos are marked as "encoding" when the application starts,
40
+ # presumably due to an encoding interruption in the last session, they
41
+ # should be reset.
42
+ #
43
+ def self.reset_encoding_videos
44
+ Video.encoding.each do |video|
45
+ video.state = "unencoded"
46
+ video.save!
47
+ end
48
+ end
49
+
36
50
  end
37
51
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enigmamachine
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - dave