fly_admin 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04a96b71887cfc1d39a76501710f129f0d13ccef
4
- data.tar.gz: 1d43ec3a9d1ad992fdcd36af89edb6daa07dd568
3
+ metadata.gz: 6087dde9982958faca55e330427a4db02fb5c4a2
4
+ data.tar.gz: 9a3cd30838ae399583702e3470cf573f13f9759a
5
5
  SHA512:
6
- metadata.gz: c9a69f55da46dcd568f96dbea5e4969c7d596d830c2bd95f56c8cf66fd88954442f0f32b84dbada2fa7f73c889686197e7f5b6f8e2ad20206ccdfb7ed282f7d0
7
- data.tar.gz: a8884e6b81f41b983251cc52aee2e1c0398e475846eac2fc603d6f0a4dffe02c5481bb282617ca3317076e9f9bb8265c78e4701f3f58954df92eca0b20f54988
6
+ metadata.gz: f45ac706a680e256f300808057deac09043666571606e4246ea2a3350f5279032dcd8e5b1a3d390ffb878795b623f0096b2393b8116db47ca826172b4b45fe95
7
+ data.tar.gz: 1bbe129e34de2041cc162a84fe1a67f83796fc28d774e8bec39f7b1684b0f2188b1a9edf40e69f7a1dd5a18002df1b5b6b4b38fecc46117e83a1ef54602fdedc
@@ -76,7 +76,7 @@ module FlyAdmin
76
76
  @seasons = @category.seasons.each {|s| s.json_title = JSON.parse(s.title)["ru"]}
77
77
 
78
78
  # needed for videos list
79
- @videos = @season.videos
79
+ @videos = @season.videos.order(created_at: :desc)
80
80
 
81
81
  end
82
82
 
@@ -84,4 +84,4 @@ module FlyAdmin
84
84
  params["after_upload"].present?
85
85
  end
86
86
  end
87
- end
87
+ end
@@ -24,7 +24,6 @@ module FlyAdmin
24
24
 
25
25
  folders.each do |node|
26
26
  node_path = node["li_attr"]["url"]
27
- node_name = node["name"]
28
27
  files = Dir["#{path + node_path.shellescape}/**/*.{mp4,mp3,aaf,3gp,gif,asf,avchd,avi,cam,dat,dsh,flv,mpeg,mpeg-1,mpeg-2,fla,flr,sol,m4v,mkv,wrap,mng,mov,mpg,mpe,mxf,nsv,ogg,svi,smi,wmv}"]
29
28
  files.each do |file|
30
29
  file_path = file.split(path).last # remove root from path
@@ -48,7 +47,7 @@ module FlyAdmin
48
47
  title, file_path, season_id = video[:title], video[:file_path], video[:season_id]
49
48
  filename = file_path.split("/").last.gsub(/[^0-9A-Za-z.\-]/, '_')
50
49
 
51
- v = Video.create!(:title => title, :content => filename, :state => Video::BEFORE_SPAWNLING, :source_path => file_path)
50
+ v = Video.create!(:title => title, :content => filename, :state => Video::BEFORE_SPAWNLING, :source_path => file_path, :uuid => SecureRandom.uuid)
52
51
  dir = File.dirname(v.content_path)
53
52
  FileUtils.mkdir_p(dir)
54
53
 
@@ -11,8 +11,6 @@ module FlyAdmin
11
11
  CONVERTATION_LOG.info "video_#{self.id}: start processing"
12
12
 
13
13
  begin
14
- movie = FFMPEG::Movie.new(self.full_source_path)
15
-
16
14
  create_dir(self.high_content_path)
17
15
  create_dir(self.low_content_path)
18
16
 
@@ -39,7 +37,6 @@ module FlyAdmin
39
37
  log_file = "#{Rails.root}/log/ffmpeg_convertation.log"
40
38
  pid_file = "#{Rails.root}/tmp/pids/ffmpeg_pids.pid"
41
39
  cmd = "ffmpeg -i #{full_source_path.shellescape} #{options} -threads 0 -y #{self.path + outfile}"# >> #{logfile} 2>&1"
42
- success_convert = 0
43
40
  fork do
44
41
  Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
45
42
  CONVERTATION_LOG.info "video_#{id} #{FORMAT[mask]} started"
@@ -96,15 +93,15 @@ module FlyAdmin
96
93
  end
97
94
 
98
95
  def path
99
- Rails.root.to_s + "/public/uploads/video/content/#{self.id}/"
96
+ "#{Rails.root}/public/uploads/video/content/#{self.uuid}/"
100
97
  end
101
98
 
102
99
  def content_path
103
- Rails.root.to_s + "/public/uploads/video/content/#{self.id}/#{self.content}"
100
+ path + self.content
104
101
  end
105
102
 
106
103
  def url
107
- "/uploads/video/content/#{self.id}/"
104
+ path.split("/public").last
108
105
  end
109
106
 
110
107
  def low_content_url
@@ -3,26 +3,25 @@ module FlyAdmin
3
3
  extend ::ActiveSupport::Concern
4
4
  module ClassMethods
5
5
  end
6
- # needed in categories/_video_desc.html.haml
6
+ # needed in videos#show
7
7
  def picture_url
8
- "/uploads/video/picture/#{self.id}/screenshot.jpg"
8
+ "/uploads/video/picture/#{self.uuid}/screenshot.jpg"
9
9
  end
10
10
 
11
11
  def create_thumbnail
12
12
  movie = FFMPEG::Movie.new(self.full_source_path)
13
- screenshot_path = "public/uploads/video/picture/#{self.id}/screenshot.jpg"
14
- dir = create_dir screenshot_path
13
+ screenshot_path = "public/uploads/video/picture/#{self.uuid}/screenshot.jpg"
14
+ create_dir screenshot_path
15
15
 
16
16
  seek_time = self.thumb_time.present? ? self.thumb_time : (movie.duration / 2).to_s
17
+ self.thumb_time = seek_time
17
18
 
18
19
  system("ffmpeg -ss #{seek_time} -y -i #{self.full_source_path.shellescape} -vframes 1 -f image2 #{screenshot_path}")
19
20
 
20
- self.thumb_time = seek_time
21
- self.picture = screenshot_path
22
21
  end
23
22
 
24
23
  def remove_picture
25
- FileUtils.rm_rf(Rails.root.to_s + "/public/uploads/video/picture/#{self.id}/")
24
+ FileUtils.rm(Rails.root.to_s + "/public" + picture_url)
26
25
  end
27
26
 
28
27
  end
@@ -40,7 +40,8 @@
40
40
  - @videos.each do |video|
41
41
  %tr
42
42
  %td
43
- = video.id
43
+ = link_to main_app.category_season_video_path(@category.try(:id), video.season_id, video.id) do
44
+ = video.id
44
45
  %td
45
46
  = video_title(video.title)
46
47
  %td
@@ -0,0 +1,5 @@
1
+ class AddUuidToVideo < ActiveRecord::Migration
2
+ def change
3
+ add_column :videos, :uuid, :string
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module FlyAdmin
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fly_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruslan Korolev
@@ -965,6 +965,7 @@ files:
965
965
  - db/migrate/20150417142656_create_fly_admin_paysites.rb
966
966
  - db/migrate/20150417142744_create_fly_admin_countries.rb
967
967
  - db/migrate/20150428102104_add_source_type_to_fly_admin_footers.rb
968
+ - db/migrate/20150514114816_add_uuid_to_video.rb
968
969
  - lib/fly_admin.rb
969
970
  - lib/fly_admin/connection_api.rb
970
971
  - lib/fly_admin/engine.rb