mkv 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ v0.0.2
2
+ ------
3
+ * Added default value for some of track's properties
4
+
1
5
  v0.0.1
2
6
  ------
3
7
  * Mac OSX implementation
@@ -9,7 +9,7 @@ module MKV
9
9
 
10
10
  def initialize(path)
11
11
  raise Errno::ENOENT, "the file '#{path}' does not exist" unless File.exists?(path)
12
-
12
+
13
13
  @path = path
14
14
 
15
15
  # mkvinfo will output to stdout
@@ -25,12 +25,12 @@ module MKV
25
25
  @tracks = match_tracks.map do |track_data|
26
26
  MKV::Track.new track_data
27
27
  end
28
-
28
+
29
29
  @invalid = true if @tracks.any?
30
30
  @invalid = true if output.include?("is not supported")
31
31
  @invalid = true if output.include?("could not find codec parameters")
32
32
  end
33
-
33
+
34
34
  def valid?
35
35
  not @invalid
36
36
  end
@@ -44,6 +44,8 @@ module MKV
44
44
  destination_filename = File.basename(@path).gsub(/\.mkv$/i, %Q[.#{track.language}.srt])
45
45
  command = %Q[#{MKV.mkvextract_binary} tracks "#{@path}" #{track.mkv_info_id}:"#{File.join(destination_dir, destination_filename)}"]
46
46
 
47
+ MKV.logger.debug "Executing command: #{command}"
48
+
47
49
  output = ""
48
50
  Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
49
51
  begin
@@ -51,7 +53,7 @@ module MKV
51
53
  next_line = Proc.new do |line|
52
54
  output << line
53
55
  if line =~ /(\d+)%/
54
- progress = $1.to_i
56
+ progress = $1.to_i
55
57
 
56
58
  yield(progress) if block_given?
57
59
  end
@@ -61,13 +63,13 @@ module MKV
61
63
  raise "Failed encoding: #{line}"
62
64
  end
63
65
  end
64
-
66
+
65
67
  if @@timeout
66
68
  stdout.each_with_timeout(wait_thr.pid, @@timeout, "r", &next_line)
67
69
  else
68
70
  stdout.each("r", &next_line)
69
71
  end
70
-
72
+
71
73
  rescue Timeout::Error => e
72
74
  MKV.logger.error "Process hung...\nCommand\n#{command}\nOutput\n#{output}\n"
73
75
  raise MKV::Error, "Process hung. Full output: #{output}"
@@ -12,7 +12,7 @@ module MKV
12
12
  def initialize(data)
13
13
  (@number, @mkv_info_id) = data.match(/track number:\s(\d+)\s\(track ID for mkvmerge & mkvextract: (\d+)\)/i)[1..2]
14
14
  @uid = data.match(/track uid: (\d+)/i)[1]
15
- @lacing = data.match(/lacing flag: (\d+)/i)[1] != '0'
15
+ @lacing = (data.match(/lacing flag: (\d+)/i) || [0, 0])[1] != '0'
16
16
  @type = data.match(/track type: (\w+)/i)[1]
17
17
  @codec_id = data.match(/codec id: (.*)/i)[1]
18
18
 
@@ -28,9 +28,9 @@ module MKV
28
28
 
29
29
  if @type == 'audio' || @type == 'subtitles'
30
30
  @language = data.match(/language: (\w+)/i)[1]
31
- @enabled = data.match(/enabled: (\d+)/i)[1] != '0'
32
- @default = data.match(/default flag: (\d+)/i)[1] != '0'
33
- @forced = data.match(/forced flag: (\d+)/i)[1] != '0'
31
+ @enabled = (data.match(/enabled: (\d+)/i) || [0, 1])[1] != '0'
32
+ @default = (data.match(/default flag: (\d+)/i) || [0, 0])[1] != '0'
33
+ @forced = (data.match(/forced flag: (\d+)/i) || [0, 0])[1] != '0'
34
34
  end
35
35
  end
36
36
 
@@ -1,3 +1,3 @@
1
1
  module MKV
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mkv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-15 00:00:00.000000000 Z
12
+ date: 2012-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec