evideo 0.3.4 → 0.3.5

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
  SHA256:
3
- metadata.gz: 9f8ae06d07be97ed6d678bc47439e0d4f631243351eb2286f3d847b6f5634b16
4
- data.tar.gz: 57e79d419857ea67ca2b2da1739f38c81045d6e693290cff148be8316012cc9e
3
+ metadata.gz: 80e2757406d355ada861d1d14143a88a1c4eb976f1e61cab29a40cce80741f3d
4
+ data.tar.gz: 8e11636b98d5e9d0d502e9c4d94e1399a1b4ec4a8d2950a9320a35b21a80670b
5
5
  SHA512:
6
- metadata.gz: 866eedd399b2b0cb7f8b4fcbad71127442ab960175c957b5054cb27371ddddb24c300156016a8a88c420940ce262ef05aa1583e5b09b246218ec5eff113b009c
7
- data.tar.gz: 8f9f3d2a38a0be9a725704e71412c4eab6a15d6c4cc5d4003f767faa5e905599fcdc61098b21385bd779d66ca6fe21c96c1976edd7c664db0fd4a1cd927f20f5
6
+ metadata.gz: 5246a64a744003e52e015bce39726f1ed4f7f4969921a96f22d6d4ba3ed0202f11d1022534343a876b35abc74d2ae3a40598972b4b8533fbe6992cd6c6c80271
7
+ data.tar.gz: 3b7ff053f4d77497a917176d3837028c0aef062eb9bb06431864fe96004989375219775ddae11ad246b2c5c14fc81cb1b46a3d92aeb8b28c6231f3230e34f58c
data/.reek.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ detectors:
3
+ TooManyStatements:
4
+ exclude:
5
+ - initialize
6
+ max_statements: 10
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- evideo (0.3.4)
4
+ evideo (0.3.5)
5
5
  thor
6
6
 
7
7
  GEM
@@ -134,4 +134,4 @@ DEPENDENCIES
134
134
  yard
135
135
 
136
136
  BUNDLED WITH
137
- 2.5.3
137
+ 2.4.19
@@ -0,0 +1,169 @@
1
+ # frozen_string_literal: true
2
+
3
+ # (see Evideo)
4
+ module Evideo
5
+ # parametros video :tempo, :bitrate - Duration: 01:01:08.50, start: 0.000000, bitrate: 2228 kb/s
6
+ RE1 = /duration:\s+(\d\d:\d\d:\d\d).*bitrate:\s+(\d+)\s+kb/i
7
+ # parametros video :height, :fps -
8
+ # Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709, progressive), 1280x720
9
+ # [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 180k tbc (default)
10
+ RE2 = /stream.*video:.*x\s*(\d+).*\s+(\d+\.*\d*)\s+fps/i
11
+ # parametros video :ratio - display_aspect_ratio=16:9
12
+ RE3 = /display_aspect_ratio\s*=\s*(\d+:\d+)$/i
13
+ # parametros video :audio - Stream #0:1(eng): Audio: aac (LC), 48000 Hz, stereo, fltp (default)
14
+ RE4 = /stream.*audio:.*\s+(\d+)\s+hz/i
15
+
16
+ # permite analizar string output do comando sonda video
17
+ class Video
18
+ # @return [String] base ficheiro video
19
+ attr_reader :bas
20
+ # @return [String] extensao ficheiro video
21
+ attr_reader :ext
22
+ # @return [Thor::CoreExt::HashWithIndifferentAccess] opcoes trabalho
23
+ attr_reader :ops
24
+
25
+ # @param [String] ficheiro video a processar
26
+ # @param [Thor::CoreExt::HashWithIndifferentAccess] opcoes trabalho
27
+ # @option opcoes [Array<String>] :d (/home/eu/lust,/media/eu/hrv2,/media/eu/hrv2/lust) pastas onde procurar videos
28
+ # @option opcoes [String] :i (ftv) pasta inicial dos videos
29
+ # @option opcoes [String] :o (out) pasta final dos videos
30
+ # @option opcoes [Boolean] :s (false) 10 segundos cortados no inicio do video final
31
+ # @option opcoes [Integer] :t (0) segundos duracao video final 0=sem cortes
32
+ # @return [Video] videos processados para arquivo uniformizado
33
+ def initialize(ficheiro, opcoes)
34
+ @ext = File.extname(ficheiro)
35
+ @bas = File.basename(ficheiro, ext)
36
+ @ops = opcoes
37
+ @iopcao = {}
38
+ end
39
+
40
+ # @return [String] texto probe do video inicial
41
+ def iprobe
42
+ @iprobe ||= `#{cmd_prob(inome)}`
43
+ end
44
+
45
+ # @return [Array<String>] parametros video inicial [:tempo, :bitrate]
46
+ def i1scan
47
+ @i1scan ||= iprobe.scan(RE1).flatten
48
+ end
49
+
50
+ # @return [Array<String>] parametros video inicial [:height, :fps]
51
+ def i2scan
52
+ @i2scan ||= iprobe.scan(RE2).flatten
53
+ end
54
+
55
+ # @return [String] parametro video inicial :tempo hh:mm:ss
56
+ def itempo
57
+ @iopcao[:tempo] ||= i1scan[0] || '00:00:00'
58
+ end
59
+
60
+ # @return [Integer] parametro video inicial :bitrate kb/s
61
+ def ibitrate
62
+ @iopcao[:bitrate] ||= Integer(i1scan[1] || 0)
63
+ end
64
+
65
+ # @return [Integer] parametro video inicial :height
66
+ def iheight
67
+ @iopcao[:height] ||= Integer(i2scan[0] || 0)
68
+ end
69
+
70
+ # @return [Float] parametro video inicial :fps frame_rate
71
+ def ifps
72
+ @iopcao[:fps] ||= Float(i2scan[1] || 0)
73
+ end
74
+
75
+ # @return [String] parametro video inicial aspect :ratio 16:9
76
+ def iratio
77
+ @iopcao[:ratio] ||= iprobe.scan(RE3).flatten[0] || '0:1'
78
+ end
79
+
80
+ # @return [Integer] parametro video inicial :audio Hz
81
+ def iaudio
82
+ @iopcao[:audio] ||= Integer(iprobe.scan(RE4).flatten[0] || 0)
83
+ end
84
+
85
+ # @return [String] ficheiro inicial absoluto
86
+ def inome
87
+ "#{ops[:d][0]}/#{ops[:i]}/#{bas}#{ext}"
88
+ end
89
+
90
+ # @return [String] mostra dados do ficheiro video inicial
91
+ def ishow
92
+ "# r:#{ibitrate} h:#{iheight} #{iratio}"
93
+ end
94
+
95
+ # @return [Time] tempo no ruby standard library com precisao
96
+ def self.to_t(tempo, pre = 8)
97
+ Time.parse(tempo[0, pre])
98
+ end
99
+
100
+ # inicia variaveis do video final
101
+ def oinit
102
+ @oopcao = {}
103
+ @oprobe = nil
104
+ @o1scan = nil
105
+ @o2scan = nil
106
+ end
107
+
108
+ # @return [String] texto probe do video final
109
+ def oprobe
110
+ return '' unless File.exist?(onome)
111
+
112
+ @oprobe ||= `#{cmd_prob(onome)}`
113
+ end
114
+
115
+ # @return [Array<String>] parametros video final [:tempo, :bitrate]
116
+ def o1scan
117
+ @o1scan ||= oprobe.scan(RE1).flatten
118
+ end
119
+
120
+ # @return [Array<String>] parametros video final [:height, :fps]
121
+ def o2scan
122
+ @o2scan ||= oprobe.scan(RE2).flatten
123
+ end
124
+
125
+ # @return [String] parametro video final :tempo hh:mm:ss
126
+ def otempo
127
+ @oopcao[:tempo] ||= o1scan[0] || '00:00:00'
128
+ end
129
+
130
+ # @return [Integer] parametro video final :bitrate kb/s
131
+ def obitrate
132
+ @oopcao[:bitrate] ||= Integer(o1scan[1] || 0)
133
+ end
134
+
135
+ # @return [Integer] parametro video final :height
136
+ def oheight
137
+ @oopcao[:height] ||= Integer(o2scan[0] || 0)
138
+ end
139
+
140
+ # @return [Float] parametro video final :fps frame_rate
141
+ def ofps
142
+ @oopcao[:fps] ||= Float(o2scan[1] || 0)
143
+ end
144
+
145
+ # @return [String] parametro video final aspect :ratio 16:9
146
+ def oratio
147
+ @oopcao[:ratio] ||= oprobe.scan(RE3).flatten[0] || '0:1'
148
+ end
149
+
150
+ # @return [Integer] posicao array pastas onde procurar videos finais
151
+ def pos
152
+ # -1 #{ops[:d][0]}/#{ops[:i]}/#{ops[:o]}"
153
+ # 0 #{ops[:d][pos]}/#{ops[:o]}"
154
+ # 1 #{ops[:d][pos]}/#{ops[:o]}"
155
+ @pos ||= -1
156
+ end
157
+
158
+ # @return [String] video final absoluto
159
+ def onome
160
+ dir = ops[:d]
161
+ (pos == -1 ? "#{dir[0]}/#{ops[:i]}" : dir[pos]) + "/#{ops[:o]}/#{bas.downcase}.mp4"
162
+ end
163
+
164
+ # @return [String] mostra dados do ficheiro video final
165
+ def oshow
166
+ "# r:#{obitrate} h:#{oheight} #{oratio} #{ops[:d][pos]}/#{ops[:o]}"
167
+ end
168
+ end
169
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # analizar/processar videos para arquivo uniformizado
4
4
  module Evideo
5
- VERSION = '0.3.4'
5
+ VERSION = "0.3.5"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evideo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hernâni Rodrigues Vaz
@@ -133,6 +133,7 @@ extensions: []
133
133
  extra_rdoc_files: []
134
134
  files:
135
135
  - ".gitignore"
136
+ - ".reek.yml"
136
137
  - ".rubocop.yml"
137
138
  - ".travis.yml"
138
139
  - Gemfile
@@ -147,6 +148,7 @@ files:
147
148
  - exe/evideo
148
149
  - lib/evideo.rb
149
150
  - lib/evideo/processa.rb
151
+ - lib/evideo/vars.rb
150
152
  - lib/evideo/version.rb
151
153
  homepage: https://github.com/hernanilr/evideo
152
154
  licenses: