public
Description: Next Vista for Learning
Homepage: http://www.nextvista.org/
Clone URL: git://github.com/dustin/nextvista.git
Search Repo:
Show incoming videos for admins.
dustin (author)
Sat Mar 22 22:37:14 -0700 2008
commit  659c82a8e8dd94cfa26d940398ae4365d5868fe0
tree    b0fdb5557918e70b2c320f245556ae6e3a94c959
parent  7596303e8d2f9372b72a0e3bd866accebf906048
...
18
19
20
 
 
 
 
 
 
 
 
 
 
 
21
22
23
...
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
0
@@ -18,6 +18,17 @@ class AdminController < ApplicationController
0
     @comments=Comment.find :all, :limit => 50, :order => "created_at desc"
0
   end
0
 
0
+ def incoming
0
+ if params[:id]
0
+ @video = IncomingVideo.find params[:id]
0
+ render :action => :show_incoming
0
+ else
0
+ @incoming = IncomingVideo.find :all,
0
+ :conditions => { :state => IncomingVideo::STATE_COMPLETE },
0
+ :order => :created_at
0
+ end
0
+ end
0
+
0
   protected
0
 
0
   def authorized?
...
19
20
21
 
22
23
24
 
 
 
 
25
...
19
20
21
22
23
24
25
26
27
28
29
30
0
@@ -19,7 +19,12 @@ class IncomingVideoController < ApplicationController
0
           f.close
0
         end
0
       end
0
+ redirect_to :action => :uploaded
0
     end
0
   end
0
 
0
+ def uploaded
0
+ # render a template
0
+ end
0
+
0
 end
...
1
 
 
 
 
 
 
2
...
1
2
3
4
5
6
7
8
0
@@ -1,2 +1,8 @@
0
 module AdminHelper
0
+
0
+ def video_thumb(iv)
0
+ tag("img", {:src => "http://nvmedia.west.spy.net/thumb/#{iv.id}.jpg",
0
+ :alt => "[video #{iv.id}]"})
0
+ end
0
+
0
 end
...
25
26
27
 
28
29
30
...
56
57
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
...
25
26
27
28
29
30
31
...
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
0
@@ -25,6 +25,7 @@ class IncomingVideo < ActiveRecord::Base
0
   IncomingVideo::STATE_NEW = 0
0
   IncomingVideo::STATE_TRANSFERRED = 1
0
   IncomingVideo::STATE_ENCODED = 2
0
+ IncomingVideo::STATE_COMPLETE = 3
0
   IncomingVideo::STATE_ERROR = 255
0
 
0
   serialize :meta
0
@@ -56,4 +57,25 @@ class IncomingVideo < ActiveRecord::Base
0
     "http://media.west.spy.net/nextvista/incoming/#{self.id}.bin"
0
   end
0
 
0
+ def public_url
0
+ "http://nvmedia.west.spy.net/flv/#{self.id}/#{self.filename}"
0
+ end
0
+
0
+ def width
0
+ if self.meta
0
+ self.meta['specs']['video']['width']
0
+ else
0
+ 320
0
+ end
0
+ end
0
+
0
+ def height
0
+ if self.meta
0
+ self.meta['specs']['video']['height']
0
+ else
0
+ 320
0
+ end
0
+ end
0
+
0
+
0
 end
...
15
16
17
 
18
19
20
...
15
16
17
18
19
20
21
0
@@ -15,6 +15,7 @@
0
 
0
 <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.nextvista.org/xmlrpc.php?rsd" />
0
 <%= javascript_include_tag :defaults %>
0
+<script src="http://nvmedia.west.spy.net/ufo.js" type="text/javascript"></script>
0
 <body>
0
 <div id="wrapper">
0
     <h1 id="banner"><a href="http://www.nextvista.org/">Next Vista for Learning</a></h1>
...
56
57
58
 
59
60
61
...
56
57
58
59
60
61
62
0
@@ -56,6 +56,7 @@ class VideoConverter
0
 
0
     iv.filename = filename
0
     iv.meta = hv.attributes
0
+ iv.state = IncomingVideo::STATE_COMPLETE
0
     iv.save!
0
 
0
     RAILS_DEFAULT_LOGGER.info "...and this video is ready for action."
...
43
44
45
46
 
 
...
43
44
45
 
46
47
0
@@ -43,4 +43,5 @@ three:
0
   submitter_id: 1
0
   language_id: 1
0
   size: 82385
0
- state: 2
0
+ state: 3
0
+ filename: file.flv
...
62
63
64
 
 
 
 
 
 
65
...
62
63
64
65
66
67
68
69
70
71
0
@@ -62,4 +62,10 @@ class AdminControllerTest < Test::Unit::TestCase
0
     assert_equal [3, 2, 1], assigns['comments'].map(&:id)
0
   end
0
 
0
+ def test_incoming
0
+ login_as :quentin
0
+ get :incoming
0
+ assert_response :success
0
+ end
0
+
0
 end
...
34
35
36
37
 
38
39
40
41
 
 
 
 
 
 
42
43
44
...
34
35
36
 
37
38
39
40
41
42
43
44
45
46
47
48
49
50
0
@@ -34,11 +34,17 @@ class IncomingVideoControllerTest < ActionController::TestCase
0
           :title => 'a title', :descr => 'a description',
0
           :long_descr => 'a long description', :language_id => languages(:en)},
0
         :video_file => fixture_file_upload("incoming_videos.yml")
0
- assert_response :success
0
+ assert_redirected_to :action => :uploaded
0
       @filename = assigns['filename']
0
     end
0
   end
0
 
0
+ def test_uploaded
0
+ login_as :quentin
0
+ get :uploaded
0
+ assert_response :success
0
+ end
0
+
0
   # Sure would like to make this work.
0
   def broken_test_failed_upload
0
     login_as :quentin
...
13
14
15
16
 
17
18
19
...
13
14
15
 
16
17
18
19
0
@@ -13,7 +13,7 @@ class IncomingVideoTest < ActiveSupport::TestCase
0
   end
0
 
0
   def test_search_by_state_encoded
0
- assert_equal [incoming_videos(:three)], IncomingVideo.find_all_by_state(IncomingVideo::STATE_ENCODED)
0
+ assert_equal [incoming_videos(:three)], IncomingVideo.find_all_by_state(IncomingVideo::STATE_COMPLETE)
0
   end
0
 
0
   def test_create

Comments

    No one has commented yet.