nofxx-subtitle_it 0.7.1 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -9,6 +9,8 @@ bin/subtitle_it
9
9
  config/hoe.rb
10
10
  config/requirements.rb
11
11
  lib/subtitle_it.rb
12
+ lib/subtitle_it/bin.rb
13
+ lib/subtitle_it/fixes.rb
12
14
  lib/subtitle_it/formats/ass.rb
13
15
  lib/subtitle_it/formats/mpl.rb
14
16
  lib/subtitle_it/formats/rsb.rb
@@ -16,6 +18,7 @@ lib/subtitle_it/formats/srt.rb
16
18
  lib/subtitle_it/formats/sub.rb
17
19
  lib/subtitle_it/formats/xml.rb
18
20
  lib/subtitle_it/formats/yml.rb
21
+ lib/subtitle_it/generator.rb
19
22
  lib/subtitle_it/movie.rb
20
23
  lib/subtitle_it/movie_hasher.rb
21
24
  lib/subtitle_it/subdown.rb
@@ -39,6 +42,8 @@ spec/fixtures/puplfiction.mpl
39
42
  spec/fixtures/sincity.yml
40
43
  spec/spec.opts
41
44
  spec/spec_helper.rb
45
+ spec/subtitle_it/bin_spec.rb
46
+ spec/subtitle_it/fixes_spec.rb
42
47
  spec/subtitle_it/formats/ass_spec.rb
43
48
  spec/subtitle_it/formats/mpl_spec.rb
44
49
  spec/subtitle_it/formats/rsb_spec.rb
@@ -46,6 +51,7 @@ spec/subtitle_it/formats/srt_spec.rb
46
51
  spec/subtitle_it/formats/sub_spec.rb
47
52
  spec/subtitle_it/formats/xml_spec.rb
48
53
  spec/subtitle_it/formats/yml_spec.rb
54
+ spec/subtitle_it/generator_spec.rb
49
55
  spec/subtitle_it/movie_hasher_spec.rb
50
56
  spec/subtitle_it/movie_spec.rb
51
57
  spec/subtitle_it/subdown_spec.rb
data/README.txt CHANGED
@@ -70,12 +70,12 @@ Jubler: http://www.jubler.org/
70
70
  Aegisub: http://www.malakith.net/aegiwiki/Main_Page
71
71
 
72
72
 
73
-
74
73
  == LICENSE:
75
74
 
76
75
  (The MIT License)
77
76
 
78
- Copyright (c) 2008 Warlley Rezende, Marcos Piccinini
77
+ Copyright (c) 2008 Marcos Piccinini, Johanlunds, Warlley Rezende
78
+
79
79
 
80
80
  Permission is hereby granted, free of charge, to any person obtaining
81
81
  a copy of this software and associated documentation files (the
data/bin/subtitle_it CHANGED
@@ -24,13 +24,14 @@ MANDATORY_OPTIONS = %w( )
24
24
 
25
25
  parser = OptionParser.new do |opts|
26
26
  opts.banner = <<BANNER
27
- SubtitleIt - Convert and create subtitles.
27
+ SubtitleIt - Download, convert and create subtitles.
28
28
 
29
- Usage: #{File.basename($0)} [options] file_in [file_out]
29
+ Usage: #{File.basename($0)} [options] movie or file_in [file_out]
30
30
 
31
31
  Options are:
32
- -c FORMAT --convert=FORMAT Format to convert to: yml, srt or sub.
33
- You don`t need to use this if fileout contains a extension.
32
+ -c FORMAT --convert=FORMAT Format to convert. Use this empty to
33
+ show all supported formats. You don`t need to use this if
34
+ fileout contains a extension.
34
35
 
35
36
  -f --force Force overwrite.
36
37
 
@@ -53,7 +54,6 @@ BANNER
53
54
  opts.on("-h", "--help",
54
55
  "Show this help message.") { puts opts; exit }
55
56
 
56
- #FIXME: I gave up... I cant acess the version var from here... missing something.
57
57
  opts.on("-v", "--version",
58
58
  "Show program version") { puts "SubtitleIt v#{SubtitleIt::VERSION::STRING}"; exit }
59
59
 
@@ -67,71 +67,7 @@ end
67
67
  if ARGV.empty?
68
68
  puts parser.banner
69
69
  exit
70
- end
71
-
72
-
73
- filein = ARGV[0].split('.')
74
- filein_ext = filein.delete_at(-1)
75
- filein = filein.join('')
76
- fileout, fileout_ext = ARGV[1] ? ARGV[1].split('.') : [filein, filein_ext]
77
-
78
- #time spent
79
- t = Time.now
80
-
81
- #FIXME: ugly
82
- if %w(3g2 3gp 3gp2 3gpp 60d ajp asf asx avchd avi bik bix box cam dat divx dmf dv dvr-ms evo flc fli flic flv flx gvi gvp h264 m1v m2p m2ts m2v m4e m4v mjp mjpeg mjpg mkv moov mov movhd movie movx mp4 mpe mpeg mpg mpv mpv2 mxf nsv nut ogg ogm omf ps qt ram rm rmvb swf ts vfw vid video viv vivo vob vro wm wmv wmx wrap wvx wx x264 xvid).include?(filein_ext)
83
- #we got a video!
84
- include SubtitleIt
85
- @down = Subdown.new
86
- @down.log_in!
87
- @movie = Movie.new(ARGV[0])
88
- res = @down.search_subtitles(@movie)#.inspect
89
- puts "Found #{res.length} result#{"s" if res.length > 1}. Choose one:\n"
90
- res.each_with_index do |r,i|
91
- puts "#{i+1}) #{r.info["MovieName"]} / #{r.info["MovieYear"]} - #{r.info["SubFileName"]} Dl count: #{r.info["SubDownloadsCnt"]} Rating: #{r.info["SubRating"]}"
92
- puts " Language: #{r.info["SubLanguageID"]} Movie rating: #{r.info["MovieImdbRating"]} CD Count: #{r.info["SubSumCD"]}"
93
- puts " Comments: #{r.info["SubAuthorComment"]} \n\n"
94
- end
95
- printf "Choose one: "
96
- choose = STDIN.gets.to_i
97
- choose = res[choose + 1]
98
- puts "Downloading #{choose.info}"
99
- out = @down.download_subtitle(choose)
100
- format = choose.format
101
- @down.log_out!
102
70
  else
103
- #we got files
104
- if File.exists?(ARGV[0]) && ( ARGV[1] || OPTIONS[:format] )
105
- content = File.open(ARGV[0], 'r')
106
- if OPTIONS[:delay]
107
- ARGV[1] ||= ARGV[0] + "_new"
108
- SubtitleIt.srt_delay(ARGV[0],ARGV[1])
109
- else
110
- puts "Working on file #{filein}..."
111
- sub = Subtitle.new(content, filein_ext)
112
- format = OPTIONS[:format]
113
- format ||= fileout_ext unless fileout_ext == filein_ext
114
- out = sub.send :"to_#{format}"
115
- #TODO: rescue format not found....
116
- end
117
- else
118
- format = 'rsb'
119
- out = <<GEN
120
- - title: #{ARGV[0]}
121
- - authors: FIXME
122
- - version: FIXME
123
- 00:05:26.500 => 00:05:28.500 == worth killing for...
124
- 00:06:00.400 => 00:06:03.400 == worth dying for...
125
- 00:07:00.300 => 00:07:03.300 == worth going to the hell for...
126
- GEN
127
- end
71
+ SubtitleIt::Bin.run! ARGV, OPTIONS[:format], OPTIONS[:force], OPTIONS[:delay]
128
72
  end
129
73
 
130
- fout = "#{fileout}.#{format}"
131
-
132
- if File.exists?(fout) && !OPTIONS[:force]
133
- puts "File exists. #{fout}"
134
- else
135
- File.open(fout, 'w') {|f| f.write(out) }
136
- puts "Done. Wrote: #{fout} in #{Time.now - t}s."
137
- end
@@ -0,0 +1,101 @@
1
+ # SubtitleIt
2
+ # Command line tool
3
+ module SubtitleIt
4
+
5
+ class Subwork
6
+ def run!(file,ext,format)
7
+ filename = file + ext
8
+ content = File.open(filename, 'r')
9
+ puts "Working on file #{filename}..."
10
+ sub = Subtitle.new(content, ext)
11
+ dump = sub.send :"to_#{format}"
12
+ Bin::write_out(file+format, dump)
13
+ end
14
+ end
15
+
16
+ class Subdownloader
17
+ def run!(movie)
18
+ @movie = Movie.new(movie)
19
+ @down = Subdown.new
20
+ @down.log_in!
21
+ res = @down.search_subtitles(@movie)
22
+ puts "Found #{res.length} result#{"s" if res.length > 1}. Choose one:\n"
23
+ res.each_with_index { |r,i| puts print_choice(r,i) }
24
+ puts "You can choose multiple ones, separated with spaces or a range separated with hifen."
25
+ printf "Choose: "
26
+ choose = parse_input(STDIN.gets.chomp)
27
+ choose = choose.map { |c| res[c.to_i-1] }
28
+ puts "Downloading #{choose.length} subtitles..."
29
+ choose.each do |sub|
30
+ puts "#{sub.inspect}"
31
+ down_a_sub(sub, sub.format)
32
+ end
33
+ @down.log_out!
34
+ end
35
+
36
+ def down_a_sub(sub, format)
37
+ dump = @down.download_subtitle(sub)
38
+ movie_name = Bin.parse_file(@movie.filename)[0]
39
+ Bin::write_out("#{movie_name}.#{format}", dump)
40
+ end
41
+
42
+ def print_choice(r, index)
43
+ c = "#{index+1}) #{r.info["MovieName"]} / #{r.info["MovieYear"]} | #{r.info["SubFileName"]} | Movie score: #{r.info["MovieImdbRating"]}\n"
44
+ c << " Lang: #{r.info["SubLanguageID"].capitalize} | Format: #{r.info["SubFormat"].upcase} | Downloads: #{r.info["SubDownloadsCnt"]} | Rating: #{r.info["SubRating"]} | CDs: #{r.info["SubSumCD"]}\n"
45
+ c << " Comments: #{r.info["SubAuthorComment"]} \n\n"
46
+ end
47
+
48
+ def parse_input(input)
49
+ choose = input.split(" ").map do |c|
50
+ if c =~ /-/
51
+ numbers = c.split("-").map { |d| d.to_i }
52
+ new_range = (numbers[0]..numbers[1]).to_a
53
+ else
54
+ c.to_i
55
+ end
56
+ end
57
+ choose.flatten.uniq
58
+ end
59
+ end
60
+
61
+ class Bin
62
+
63
+ def Bin.run! argv, format=nil, force=false, delay=nil
64
+ # SubtitleIt::Bin.new.run!(argv, format, force, delay)
65
+ raise unless argv
66
+ if File.exists?(argv[0]) # && ( argv[1] || format )
67
+ @file_in, @file_in_ext = Bin::parse_file(argv[0])
68
+ @file_out, @fileout_ext = argv[1] ? Bin::parse_file(argv[1]) : [@file_in, @file_in_ext]
69
+ if MOVIE_EXTS.include? @file_in_ext
70
+ Subdownloader.new.run!(argv[0])
71
+ elsif SUB_EXTS.include? @file_in_ext
72
+ Subwork.new.run!(@file_in, @file_in_ext, format)
73
+ else
74
+ raise "Unknown file."
75
+ end
76
+ else
77
+ # generate_rsb
78
+ end
79
+ rescue Exception => e
80
+ puts e.message
81
+ exit 1
82
+ end
83
+
84
+ def Bin.parse_file(file)
85
+ raise unless file =~ /\./
86
+ file = file.split('.')
87
+ ext = file.delete_at(-1)
88
+ file = file.join('.')
89
+ [file, ext]
90
+ end
91
+
92
+ def Bin.write_out(filename,dump,force=nil)
93
+ if File.exists?(filename) && !force
94
+ puts "File exists. #{filename}"
95
+ else
96
+ File.open(filename, 'w') {|f| f.write(dump) }
97
+ puts "Done. Wrote: #{filename}."
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,12 @@
1
+ module SubtitleIt
2
+ # class TimeFix
3
+ # def fix_delay
4
+ # argv[1] ||= argv[0] + "_new"
5
+ # SubtitleIt.srt_delay(argv[0],argv[1])
6
+ # end
7
+ # end
8
+ #
9
+ # class CdCountFix
10
+ #end
11
+
12
+ end
@@ -11,16 +11,16 @@ module SubtitleIt
11
11
  @raw.to_a.inject([]) do |i,l|
12
12
  line_data = l.scan(/^\[([0-9]{1,})\]\[([0-9]{1,})\](.+)$/)
13
13
  line_data = line_data.at 0
14
- text_on, text_off, text = line_data
15
- text_on, text_off = [text_on.to_i, text_off.to_i].map { |t| t.to_i * 1000 }
16
- i << Subline.new(text_on, text_off, text.chomp)
14
+ time_on, time_off, text = line_data
15
+ time_on, time_off = [time_on.to_i, time_off.to_i].map { |t| t.to_i * 1000 }
16
+ i << Subline.new(time_on, time_off, text.chomp)
17
17
  end
18
18
  end
19
19
 
20
20
  def to_mpl
21
21
  @lines.inject([]) do |i,l|
22
- start = l.text_on.to_i / 100
23
- stop = l.text_off.to_i / 100
22
+ start = l.time_on.to_i / 100
23
+ stop = l.time_off.to_i / 100
24
24
  i << "[%d][%d]%s" % [start, stop, l.text]
25
25
  end.join("\n")
26
26
  end
@@ -16,16 +16,16 @@ module SubtitleIt
16
16
  @authors = inn.delete_at(0).split(':')[1]
17
17
  @version = inn.delete_at(0).split(':')[1]
18
18
  inn.inject([]) do |final,line|
19
- text_on,text_off = line.split('=>').map { |t| t.strip }
19
+ time_on,time_off = line.split('=>').map { |t| t.strip }
20
20
  text = line.split('==')[1].strip
21
- final << Subline.new(text_on, text_off, text)
21
+ final << Subline.new(time_on, time_off, text)
22
22
  end
23
23
  end
24
24
 
25
25
  def to_rsb
26
26
  out = "- title: #{@title}\n- authors: #{@authors}\n- version: #{@version}\n"
27
27
  out << @lines.inject([]) do |i,l|
28
- i << "%s => %s == %s" % [l.text_on.to_s, l.text_off.to_s, l.text]
28
+ i << "%s => %s == %s" % [l.time_on.to_s, l.time_off.to_s, l.text]
29
29
  end.join("\n")
30
30
  end
31
31
  end
@@ -14,10 +14,10 @@ module SubtitleIt
14
14
  @raw.split(/\n\n/).inject([]) do |final,line|
15
15
  line = line.split(/\n/)
16
16
  line.delete_at(0)
17
- text_on,text_off = line[0].split('-->').map { |t| t.strip }
17
+ time_on,time_off = line[0].split('-->').map { |t| t.strip }
18
18
  line.delete_at(0)
19
19
  text = line.join("|")
20
- final << Subline.new(text_on, text_off, text)
20
+ final << Subline.new(time_on, time_off, text)
21
21
  end
22
22
  end
23
23
 
@@ -25,7 +25,7 @@ module SubtitleIt
25
25
  out = []
26
26
  @lines.each_with_index do |l,i|
27
27
  out << "#{i}"
28
- out << "%s --> %s" % [l.text_on.to_s, l.text_off.to_s]
28
+ out << "%s --> %s" % [l.time_on.to_s, l.time_off.to_s]
29
29
  out << l.text.gsub("|","\n")
30
30
  end
31
31
  out.join("\n")
@@ -28,16 +28,16 @@ module SubtitleIt
28
28
  @raw.to_a.inject([]) do |i,l|
29
29
  line_data = l.scan(/^\{([0-9]{1,})\}\{([0-9]{1,})\}(.+)$/)
30
30
  line_data = line_data.at 0
31
- text_on, text_off, text = line_data
32
- text_on, text_off = [text_on.to_i, text_off.to_i].map { |t| (t.to_i/@fps*1000).to_i }
33
- i << Subline.new(text_on, text_off, text.chomp)
31
+ time_on, time_off, text = line_data
32
+ time_on, time_off = [time_on.to_i, time_off.to_i].map { |t| (t.to_i/@fps*1000).to_i }
33
+ i << Subline.new(time_on, time_off, text.chomp)
34
34
  end
35
35
  end
36
36
 
37
37
  def to_sub
38
38
  @lines.inject([]) do |i,l|
39
- start = l.text_on.to_i / 1000 * @fps * ratio
40
- stop = l.text_off.to_i / 1000 * @fps * ratio
39
+ start = l.time_on.to_i / 1000 * @fps * ratio
40
+ stop = l.time_off.to_i / 1000 * @fps * ratio
41
41
  i << "{%d}{%d}%s" % [start, stop, l.text]
42
42
  end.join("\r\n")
43
43
  end
@@ -28,18 +28,18 @@ module SubtitleIt
28
28
  doc = Hpricot.XML(@raw)
29
29
  # p (doc/'tt'/'p').first[:dur]#inspect
30
30
  (doc/'tt'/'p').each do |line|
31
- text_on = line[:begin]
32
- text_off = line[:dur]
31
+ time_on = line[:begin]
32
+ time_off = line[:dur]
33
33
  text = line.innerHTML
34
- final << Subline.new(text_on,text_off,text)
34
+ final << Subline.new(time_on,time_off,text)
35
35
  end
36
36
  final
37
37
  end
38
38
 
39
39
  def xml_lines
40
40
  @lines.inject([]) do |i,l|
41
- toff = l.text_off - l.text_on
42
- i << " <p begin=\"#{l.text_on}\" dur=\"#{toff}\">#{l.text}</p>"
41
+ toff = l.time_off - l.time_on
42
+ i << " <p begin=\"#{l.time_on}\" dur=\"#{toff}\">#{l.text}</p>"
43
43
  end.join("\n")
44
44
  end
45
45
 
@@ -0,0 +1,15 @@
1
+ module SubtitleIt
2
+ # class Generate
3
+ # def generate_rsb(filename)
4
+ # dump = <<GEN
5
+ # - title: #{argv[0]}
6
+ # - authors: FIXME
7
+ # - version: FIXME
8
+ # 00:05:26.500 => 00:05:28.500 == worth killing for...
9
+ # 00:06:00.400 => 00:06:03.400 == worth dying for...
10
+ # 00:07:00.300 => 00:07:03.300 == worth going to the hell for...
11
+ # GEN
12
+ # write_out(filename, dump)
13
+ # end
14
+ # end
15
+ end
@@ -3,7 +3,6 @@ require 'subtitle_it/movie_hasher'
3
3
 
4
4
  module SubtitleIt
5
5
  class Movie
6
- EXTS = %w(3g2 3gp 3gp2 3gpp 60d ajp asf asx avchd avi bik bix box cam dat divx dmf dv dvr-ms evo flc fli flic flv flx gvi gvp h264 m1v m2p m2ts m2v m4e m4v mjp mjpeg mjpg mkv moov mov movhd movie movx mp4 mpe mpeg mpg mpv mpv2 mxf nsv nut ogg ogm omf ps qt ram rm rmvb swf ts vfw vid video viv vivo vob vro wm wmv wmx wrap wvx wx x264 xvid)
7
6
 
8
7
  attr_reader :filename
9
8
  attr_accessor :info
@@ -8,20 +8,20 @@ require 'subtitle_it/subtitle'
8
8
 
9
9
  module SubtitleIt
10
10
  class Subdown
11
- @@host = "http://www.opensubtitles.org/xml-rpc"
12
- @@host_dev = "http://dev.opensubtitles.org/xml-rpc"
11
+ HOST = "http://www.opensubtitles.org/xml-rpc"
12
+ HOST_DEV = "http://dev.opensubtitles.org/xml-rpc"
13
13
 
14
- @@user_agent = "SubtitleIt #{SubtitleIt::VERSION}"
14
+ USER_AGENT = "SubtitleIt #{SubtitleIt::VERSION::STRING}"
15
15
 
16
- @@no_token = %w(ServerInfo LogIn)
16
+ NO_TOKEN = %w(ServerInfo LogIn)
17
17
 
18
- def initialize(host = @@host)
18
+ def initialize(host = HOST)
19
19
  @client = XMLRPC::Client.new2(host)
20
20
  @token = nil
21
21
  end
22
22
 
23
23
  def log_in!
24
- result = call('LogIn', '', '', '', @@user_agent)
24
+ result = call('LogIn', '', '', '', USER_AGENT)
25
25
  @token = result['token'].to_s
26
26
  end
27
27
 
@@ -55,8 +55,7 @@ module SubtitleIt
55
55
 
56
56
  def download_subtitle(sub)
57
57
  result = call('DownloadSubtitles', [sub.id])
58
- sub.data = self.class.decode_and_unzip(result['data'][0]['data'])
59
-
58
+ sub.data = self.class.decode_and_unzip(result['data'][0]['data'])
60
59
  end
61
60
 
62
61
  def upload_subtitle(movie, subs)
@@ -73,7 +72,7 @@ module SubtitleIt
73
72
  private
74
73
 
75
74
  def call(method, *args)
76
- unless @@no_token.include? method
75
+ unless NO_TOKEN.include? method
77
76
  raise 'Need to be logged in for this.' unless logged_in?
78
77
  args = [@token, *args]
79
78
  end
@@ -2,17 +2,17 @@
2
2
  # Holds a subtitle`s line.
3
3
  module SubtitleIt
4
4
  class Subline
5
- attr_accessor :text_on, :text_off, :text
6
- # text_on/off may be:
5
+ attr_accessor :time_on, :time_off, :text
6
+ # time_on/off may be:
7
7
  # HH:MM:SS,MMM
8
8
  # MM:SS
9
9
  # S
10
10
  # text lines should be separated by |
11
- def initialize(text_on, text_off, text)
12
- @text_on, @text_off = filter(text_on, text_off)
13
- # ugly FIXME: when pseudo uses time => 3
14
- # need to add seconds from the first sub
15
- @text_off += @text_on if @text_off < @text_on
11
+ def initialize(time_on, time_off, text)
12
+ @time_on, @time_off = filter(time_on, time_off)
13
+ # ugly FIXME: when pseudo uses time => 3 or TT format
14
+ # need to add seconds on time_off to time_on
15
+ @time_off += @time_on if @time_off < @time_on
16
16
  @text = text
17
17
  end
18
18
 
@@ -0,0 +1,11 @@
1
+ module SubtitleIt
2
+ class Substyle
3
+ #TODO
4
+
5
+
6
+
7
+
8
+
9
+
10
+ end
11
+ end
@@ -8,16 +8,18 @@ require 'subtitle_it/formats/mpl'
8
8
  module SubtitleIt
9
9
  include Formats
10
10
 
11
+ MOVIE_EXTS = %w(3g2 3gp 3gp2 3gpp 60d ajp asf asx avchd avi bik bix box cam dat divx dmf dv dvr-ms evo flc fli flic flv flx gvi gvp h264 m1v m2p m2ts m2v m4e m4v mjp mjpeg mjpg mkv moov mov movhd movie movx mp4 mpe mpeg mpg mpv mpv2 mxf nsv nut ogg ogm omf ps qt ram rm rmvb swf ts vfw vid video viv vivo vob vro wm wmv wmx wrap wvx wx x264 xvid)
12
+ SUB_EXTS = %w(srt sub smi txt ssa ass mpl xml yml rsb)
13
+
11
14
  class Subtitle
12
15
  attr_reader :id, :raw, :format, :lines, :style, :info, :filename
13
16
 
14
- EXTS = %w(srt sub smi txt ssa ass mpl xml yml rsb)
15
-
16
17
  def initialize(dump=nil,format=nil,info=nil)
17
- @info = info
18
- @id = info['IDSubtitleFile'].to_i if info
19
- @filename = info['SubFileName'].to_s if info
20
- @format = info['SubFormat'].to_s if info
18
+ if @info = info
19
+ @id = info['IDSubtitleFile'].to_i
20
+ @filename = info['SubFileName'].to_s
21
+ @format = info['SubFormat'].to_s
22
+ end
21
23
  @fps=23.976
22
24
  parse_dump(dump,format) if dump
23
25
  end
@@ -41,7 +43,6 @@ module SubtitleIt
41
43
  @raw = data
42
44
  end
43
45
 
44
-
45
46
  private
46
47
 
47
48
  def parse!
@@ -2,7 +2,7 @@ module SubtitleIt
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 7
5
- TINY = 1
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/lib/subtitle_it.rb CHANGED
@@ -8,7 +8,7 @@ require 'subtitle_it/subtitle'
8
8
  require 'subtitle_it/subdown'
9
9
  require 'subtitle_it/substyle'
10
10
  require 'subtitle_it/movie'
11
-
11
+ require 'subtitle_it/bin'
12
12
 
13
13
  module SubtitleIt
14
14
  end
@@ -4,156 +4,156 @@ fps: 23.976
4
4
  lines:
5
5
  - !ruby/object:SubtitleIt::Subline
6
6
  text: I had just joined <span tts:fontSize="+2" tts:fontFamily="monospaceSansSerif,proportionalSerif,TheOther">Macromedia</span> in 1996,
7
- text_off: !ruby/object:SubtitleIt::Subtime
7
+ time_off: !ruby/object:SubtitleIt::Subtime
8
8
  hrs: 0
9
9
  min: 0
10
10
  ms: 700
11
11
  sec: 3
12
- text_on: !ruby/object:SubtitleIt::Subtime
12
+ time_on: !ruby/object:SubtitleIt::Subtime
13
13
  hrs: 0
14
14
  min: 0
15
15
  ms: 0
16
16
  sec: 0
17
17
  - !ruby/object:SubtitleIt::Subline
18
18
  text: and we were trying to figure out what to do about the internet.
19
- text_off: !ruby/object:SubtitleIt::Subtime
19
+ time_off: !ruby/object:SubtitleIt::Subtime
20
20
  hrs: 0
21
21
  min: 0
22
22
  ms: 50
23
23
  sec: 7
24
- text_on: !ruby/object:SubtitleIt::Subtime
24
+ time_on: !ruby/object:SubtitleIt::Subtime
25
25
  hrs: 0
26
26
  min: 0
27
27
  ms: 700
28
28
  sec: 3
29
29
  - !ruby/object:SubtitleIt::Subline
30
30
  text: And the company was in dire straights at the time.
31
- text_off: !ruby/object:SubtitleIt::Subtime
31
+ time_off: !ruby/object:SubtitleIt::Subtime
32
32
  hrs: 0
33
33
  min: 0
34
34
  ms: 570
35
35
  sec: 9
36
- text_on: !ruby/object:SubtitleIt::Subtime
36
+ time_on: !ruby/object:SubtitleIt::Subtime
37
37
  hrs: 0
38
38
  min: 0
39
39
  ms: 420
40
40
  sec: 6
41
41
  - !ruby/object:SubtitleIt::Subline
42
42
  text: We were a CD-ROM authoring company,
43
- text_off: !ruby/object:SubtitleIt::Subtime
43
+ time_off: !ruby/object:SubtitleIt::Subtime
44
44
  hrs: 0
45
45
  min: 0
46
46
  ms: 20
47
47
  sec: 11
48
- text_on: !ruby/object:SubtitleIt::Subtime
48
+ time_on: !ruby/object:SubtitleIt::Subtime
49
49
  hrs: 0
50
50
  min: 0
51
51
  ms: 570
52
52
  sec: 9
53
53
  - !ruby/object:SubtitleIt::Subline
54
54
  text: and the CD-ROM business was going away.
55
- text_off: !ruby/object:SubtitleIt::Subtime
55
+ time_off: !ruby/object:SubtitleIt::Subtime
56
56
  hrs: 0
57
57
  min: 0
58
58
  ms: 420
59
59
  sec: 13
60
- text_on: !ruby/object:SubtitleIt::Subtime
60
+ time_on: !ruby/object:SubtitleIt::Subtime
61
61
  hrs: 0
62
62
  min: 0
63
63
  ms: 420
64
64
  sec: 11
65
65
  - !ruby/object:SubtitleIt::Subline
66
66
  text: One of the technologies I remember seeing was Flash.
67
- text_off: !ruby/object:SubtitleIt::Subtime
67
+ time_off: !ruby/object:SubtitleIt::Subtime
68
68
  hrs: 0
69
69
  min: 0
70
70
  ms: 70
71
71
  sec: 16
72
- text_on: !ruby/object:SubtitleIt::Subtime
72
+ time_on: !ruby/object:SubtitleIt::Subtime
73
73
  hrs: 0
74
74
  min: 0
75
75
  ms: 570
76
76
  sec: 13
77
77
  - !ruby/object:SubtitleIt::Subline
78
78
  text: At the time, it was called <span tts:color="#ccc333" tts:fontWeight="bold">FutureSplash</span>.
79
- text_off: !ruby/object:SubtitleIt::Subtime
79
+ time_off: !ruby/object:SubtitleIt::Subtime
80
80
  hrs: 0
81
81
  min: 0
82
82
  ms: 470
83
83
  sec: 18
84
- text_on: !ruby/object:SubtitleIt::Subtime
84
+ time_on: !ruby/object:SubtitleIt::Subtime
85
85
  hrs: 0
86
86
  min: 0
87
87
  ms: 470
88
88
  sec: 16
89
89
  - !ruby/object:SubtitleIt::Subline
90
90
  text: So this is where Flash got its start.
91
- text_off: !ruby/object:SubtitleIt::Subtime
91
+ time_off: !ruby/object:SubtitleIt::Subtime
92
92
  hrs: 0
93
93
  min: 0
94
94
  ms: 700
95
95
  sec: 19
96
- text_on: !ruby/object:SubtitleIt::Subtime
96
+ time_on: !ruby/object:SubtitleIt::Subtime
97
97
  hrs: 0
98
98
  min: 0
99
99
  ms: 500
100
100
  sec: 18
101
101
  - !ruby/object:SubtitleIt::Subline
102
102
  text: This is smart sketch running on the <span tts:fontStyle="italic">EU-pin computer</span>,
103
- text_off: !ruby/object:SubtitleIt::Subtime
103
+ time_off: !ruby/object:SubtitleIt::Subtime
104
104
  hrs: 0
105
105
  min: 0
106
106
  ms: 100
107
107
  sec: 23
108
- text_on: !ruby/object:SubtitleIt::Subtime
108
+ time_on: !ruby/object:SubtitleIt::Subtime
109
109
  hrs: 0
110
110
  min: 0
111
111
  ms: 100
112
112
  sec: 20
113
113
  - !ruby/object:SubtitleIt::Subline
114
114
  text: which was the first product that FutureWave did.
115
- text_off: !ruby/object:SubtitleIt::Subtime
115
+ time_off: !ruby/object:SubtitleIt::Subtime
116
116
  hrs: 0
117
117
  min: 0
118
118
  ms: 520
119
119
  sec: 25
120
- text_on: !ruby/object:SubtitleIt::Subtime
120
+ time_on: !ruby/object:SubtitleIt::Subtime
121
121
  hrs: 0
122
122
  min: 0
123
123
  ms: 520
124
124
  sec: 23
125
125
  - !ruby/object:SubtitleIt::Subline
126
126
  text: So our vision for this product was to
127
- text_off: !ruby/object:SubtitleIt::Subtime
127
+ time_off: !ruby/object:SubtitleIt::Subtime
128
128
  hrs: 0
129
129
  min: 0
130
130
  ms: 520
131
131
  sec: 27
132
- text_on: !ruby/object:SubtitleIt::Subtime
132
+ time_on: !ruby/object:SubtitleIt::Subtime
133
133
  hrs: 0
134
134
  min: 0
135
135
  ms: 520
136
136
  sec: 25
137
137
  - !ruby/object:SubtitleIt::Subline
138
138
  text: make drawing on the computer
139
- text_off: !ruby/object:SubtitleIt::Subtime
139
+ time_off: !ruby/object:SubtitleIt::Subtime
140
140
  hrs: 0
141
141
  min: 0
142
142
  ms: 620
143
143
  sec: 28
144
- text_on: !ruby/object:SubtitleIt::Subtime
144
+ time_on: !ruby/object:SubtitleIt::Subtime
145
145
  hrs: 0
146
146
  min: 0
147
147
  ms: 520
148
148
  sec: 27
149
149
  - !ruby/object:SubtitleIt::Subline
150
150
  text: as <span tts:color="#ccc333">easy</span> as drawing on paper.
151
- text_off: !ruby/object:SubtitleIt::Subtime
151
+ time_off: !ruby/object:SubtitleIt::Subtime
152
152
  hrs: 0
153
153
  min: 0
154
154
  ms: 500
155
155
  sec: 30
156
- text_on: !ruby/object:SubtitleIt::Subtime
156
+ time_on: !ruby/object:SubtitleIt::Subtime
157
157
  hrs: 0
158
158
  min: 0
159
159
  ms: 200
@@ -0,0 +1,74 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ module BinspecHelper
4
+ def mock_xmlrpc(stubs={})
5
+ @mock_xmlrpc ||= mock(XMLRPC::Client, stubs)#, @auth=nil, @parser=nil, @user=nil, @timeout=30, @cookie=nil, @http=#<Net::HTTP www.opensubtitles.org:80 open=false>, @use_ssl=false, @http_last_response=nil, @port=80, @host="www.opensubtitles.org", @path="/xml-rpc", @http_header_extra=nil, @create=nil, @password=nil, @proxy_port=nil, @proxy_host=nil>
6
+ end
7
+ def mock_movie
8
+ @mock_movie = mock(Movie, :haxx => '09a2c497663259cb')
9
+ end
10
+ def mock_subdown
11
+ @mock_subdown = mock(Subdown)
12
+ end
13
+ end
14
+
15
+ describe Bin do
16
+ include BinspecHelper
17
+
18
+ it "should require ARGV" do
19
+ lambda { Bin::run!(nil) }.should raise_error
20
+ end
21
+
22
+ it "should call for movie" do
23
+ Subdownloader.should_receive(:new)
24
+ File.should_receive(:exists?).and_return(true)
25
+ SubtitleIt::Bin::run!(["movie.avi"])
26
+ end
27
+ end
28
+
29
+ describe Subdownloader do
30
+
31
+ it "should fetch subtitles" do
32
+ # Movie.should_receive(:new).and_return(mock_movie)
33
+ # File.should_receive(:exists?).and_return(true)
34
+ # File.should_receive(:size).with('file.avi').and_return(1020)
35
+ # File.should_receive(:open).with("file.avi", "rb")
36
+ # Subdown.should_receive(:new).and_return(mock_subdown)#mock(Subdown))
37
+ # @mock_subdown.should_receive(:log_in!)
38
+ # @mock_subdown.should_receive(:search_subtitles).and_return([])
39
+ #
40
+ #
41
+ # Subdownloader.new.run! "file.avi"
42
+
43
+
44
+ end
45
+
46
+ it "should parse files" do
47
+ Bin.parse_file("Lots.of.dots.happen").should eql(["Lots.of.dots", "happen"])
48
+ lambda { Bin.parse_file("Nodotstoo") }.should raise_error
49
+ end
50
+
51
+ it "should parse user input" do
52
+ @subd = Subdownloader.new
53
+ @subd.parse_input("1 2-5 7 8-10 15").should eql([1, 2, 3, 4, 5, 7, 8, 9, 10, 15])
54
+ end
55
+
56
+ it "should print choice" do
57
+ @sub = mock(Subtitle, :info => {
58
+ "SubLanguageID" => 'eng',
59
+ "MovieName" => 'Resevoir Dogs',
60
+ "MovieYear" => '1992',
61
+ "SubFileName" => 'Cool sub',
62
+ "MovieImdbRating" => '10.0',
63
+ "SubDownloadsCnt" => '310',
64
+ "SubRating" => '9.5',
65
+ "SubFormat" => 'srt',
66
+ "SubSumCD" => '2',
67
+ "SubAuthorComment" => 'Nice nice...'
68
+ })
69
+ @subd = Subdownloader.new
70
+ @subd.print_choice(@sub, 1).should eql("2) Resevoir Dogs / 1992 | Cool sub | Movie score: 10.0
71
+ Lang: Eng | Format: SRT | Downloads: 310 | Rating: 9.5 | CDs: 2
72
+ Comments: Nice nice... \n\n")
73
+ end
74
+ end
File without changes
@@ -17,11 +17,11 @@ describe Formats, ".mpl" do
17
17
  end
18
18
 
19
19
  it "should parse time of" do
20
- @mpl.lines[0].text_on.to_s.should eql("00:17:05.000")
20
+ @mpl.lines[0].time_on.to_s.should eql("00:17:05.000")
21
21
  end
22
22
 
23
23
  it "should parse time of" do
24
- @mpl.lines[0].text_off.to_s.should eql("00:18:35.000")
24
+ @mpl.lines[0].time_off.to_s.should eql("00:18:35.000")
25
25
  end
26
26
 
27
27
  it "should parse text" do
@@ -17,11 +17,11 @@ describe Formats, ".rsb" do
17
17
  end
18
18
 
19
19
  it "should parse time of" do
20
- @rsb.lines[0].text_on.to_s.should eql("00:05:26.500")
20
+ @rsb.lines[0].time_on.to_s.should eql("00:05:26.500")
21
21
  end
22
22
 
23
23
  it "should parse time of" do
24
- @rsb.lines[0].text_off.to_s.should eql("00:05:28.500")
24
+ @rsb.lines[0].time_off.to_s.should eql("00:05:28.500")
25
25
  end
26
26
 
27
27
  it "should parse text" do
@@ -17,11 +17,11 @@ describe Formats, ".srt" do
17
17
  end
18
18
 
19
19
  it "should parse time of" do
20
- @srt.lines[0].text_on.to_s.should eql("00:01:43.680")
20
+ @srt.lines[0].time_on.to_s.should eql("00:01:43.680")
21
21
  end
22
22
 
23
23
  it "should parse time of" do
24
- @srt.lines[0].text_off.to_s.should eql("00:01:45.557")
24
+ @srt.lines[0].time_off.to_s.should eql("00:01:45.557")
25
25
  end
26
26
 
27
27
  it "should parse text" do
@@ -17,11 +17,11 @@ describe Formats, ".sub" do
17
17
  end
18
18
 
19
19
  it "should have a nic text on" do
20
- @sub.lines[110].text_on.to_s.should eql('00:10:44.936')
20
+ @sub.lines[110].time_on.to_s.should eql('00:10:44.936')
21
21
  end
22
22
 
23
23
  it "should have a nice text out" do
24
- @sub.lines[110].text_off.to_s.should eql('00:10:49.941')
24
+ @sub.lines[110].time_off.to_s.should eql('00:10:49.941')
25
25
  end
26
26
 
27
27
  it "should parse the sentece correctly" do
@@ -16,13 +16,13 @@ describe Formats, ".xml" do
16
16
  end
17
17
 
18
18
  it "should parse time of" do
19
- @xml.lines[0].text_on.to_s.should eql("00:00:00.000")
20
- @xml.lines[10].text_on.to_s.should eql("00:00:25.520")
19
+ @xml.lines[0].time_on.to_s.should eql("00:00:00.000")
20
+ @xml.lines[10].time_on.to_s.should eql("00:00:25.520")
21
21
  end
22
22
 
23
23
  it "should parse time of" do
24
- @xml.lines[0].text_off.to_s.should eql("00:00:03.700")
25
- @xml.lines[10].text_off.to_s.should eql("00:00:27.520")
24
+ @xml.lines[0].time_off.to_s.should eql("00:00:03.700")
25
+ @xml.lines[10].time_off.to_s.should eql("00:00:27.520")
26
26
  end
27
27
 
28
28
  it "should parse text" do
File without changes
@@ -1 +1,13 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe MovieHasher do
4
+
5
+ it "should generate a beatiful hash for us" do
6
+ MovieHasher::CHUNK_SIZE.should eql(65536)
7
+
8
+ File.should_receive(:size).with('onefile').and_return(1020)
9
+ File.should_receive(:open).with("onefile", "rb")
10
+
11
+ MovieHasher.compute_haxx('onefile').should eql("00000000000003fc")
12
+ end
13
+ end
@@ -4,14 +4,22 @@ describe Movie do
4
4
  before(:each) do
5
5
  @movie = Movie.new('pulpfiction')
6
6
  end
7
-
8
-
9
-
10
7
 
11
- it "should get subtitle languages" do
12
- # @down.subtitle_languages.should be_nil
8
+ it "should initialize nicely" do
9
+ @movie.info.should be_instance_of(Hash)
10
+ @movie.filename.should eql("pulpfiction")
13
11
  end
14
12
 
15
-
13
+ it "should call for a hash" do
14
+ File.should_receive(:open).with("pulpfiction", "rb")
15
+ File.should_receive(:size).with('pulpfiction').and_return(13141)
16
+ #TODO.. how to mock this?
17
+ #MovieHasher.should_receive(:compute_hash)
18
+ @movie.haxx.should eql('0000000000003355')
19
+ end
16
20
 
21
+ it "should call for size" do
22
+ File.should_receive(:size).with('pulpfiction')
23
+ @movie.size
24
+ end
17
25
  end
@@ -1,46 +1,92 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
- describe Subdown do
4
- before(:each) do
5
- @down = Subdown.new
6
- @down.log_in!
7
- @movie = mock(Movie, :haxx => '09a2c497663259cb')
3
+ module SubdownHelper
4
+ def mock_xmlrpc(stubs={})
5
+ @mock_xmlrpc ||= mock(XMLRPC::Client, stubs)#, @auth=nil, @parser=nil, @user=nil, @timeout=30, @cookie=nil, @http=#<Net::HTTP www.opensubtitles.org:80 open=false>, @use_ssl=false, @http_last_response=nil, @port=80, @host="www.opensubtitles.org", @path="/xml-rpc", @http_header_extra=nil, @create=nil, @password=nil, @proxy_port=nil, @proxy_host=nil>
6
+ end
7
+ def mock_movie
8
+ @mock_movie = mock(Movie, :haxx => '09a2c497663259cb')
8
9
  end
10
+ end
9
11
 
12
+
13
+ describe Subdown do
14
+ include SubdownHelper
10
15
 
11
- it "should get imdb info" do
12
- @movie.should_receive('info=').with({"MovieYear"=>"2004",
13
- "MovieImdbID"=>"403358",
14
- "MovieName"=>"Nochnoy dozor",
15
- "MovieHash"=>"09a2c497663259cb"})
16
- @down.imdb_info(@movie)
16
+ before(:each) do
17
+ @sub = mock(Subtitle)
17
18
  end
18
19
 
19
- it "should search subs info" do
20
- @movie.stub!(:size).and_return(733589504)
21
- res = @down.search_subtitles(@movie)
22
- res.should be_instance_of(Array)
23
- res.each do |r|
24
- r.should be_instance_of(Subtitle)
25
- end
20
+ it "should initialize nicely" do
21
+ XMLRPC::Client.should_receive(:new2)
22
+ @down = Subdown.new
26
23
  end
27
24
 
28
-
29
-
30
- it "should get subtitle languages" do
31
- @down.subtitle_languages.should be_nil
25
+ it "should log in!" do
26
+ XMLRPC::Client.should_receive(:new2).with('http://www.opensubtitles.org/xml-rpc').and_return(mock_xmlrpc)
27
+ @mock_xmlrpc.should_receive(:call).with("LogIn", "", "", "", "SubtitleIt #{SubtitleIt::VERSION::STRING}").and_return({
28
+ "status"=>"200 OK",
29
+ "seconds"=>0.004,
30
+ "token"=>"shkuj98gcvu5gp1b5tlo8uq525"
31
+ })
32
+ @down = Subdown.new
33
+ @down.should_not be_logged_in
34
+ @down.log_in!
35
+ @down.should be_logged_in
32
36
  end
33
37
 
38
+ it "should raise if connection sux" do
39
+ XMLRPC::Client.should_receive(:new2).with('http://www.opensubtitles.org/xml-rpc').and_return(mock_xmlrpc)
40
+ @mock_xmlrpc.should_receive(:call).with("LogIn", "", "", "", "SubtitleIt #{SubtitleIt::VERSION::STRING}").and_return({
41
+ "status"=>"404 FAIL",
42
+ "seconds"=>0.004,
43
+ "token"=>""
44
+ })
45
+ @down = Subdown.new
46
+ lambda { @down.log_in! }.should raise_error
47
+ @down.should_not be_logged_in
48
+ end
34
49
 
35
-
36
- end
37
50
 
51
+ describe "Instantiate" do
52
+ before(:each) do
53
+ @down = Subdown.new
54
+ end
55
+
56
+ it "should get subtitle languages" do
57
+ @down.subtitle_languages.should be_nil
58
+ end
59
+
60
+
61
+ end
62
+ end
38
63
 
64
+ # REAL TESTS THAT USES THE INTERNET... DUNNO BETTER PRACTICE FOR THIS
65
+ # Mock is nice, but I would like to keep this here, who knows if
66
+ # Opensubtitle API changes.... any suggestions?
67
+ #
68
+ #describe Subdown, " - Wired tests" do
69
+ # before(:each) do
70
+ # @down = Subdown.new
71
+ # @movie = mock(Movie, :haxx => '09a2c497663259cb')
72
+ # end
39
73
 
40
- #
41
- # @client.log_in!
42
- # @movie = DownSub::Movie.new('/Users/lundan/Movies/21[2008]DvDrip-aXXo/21[2008]DvDrip-aXXo.avi') # ask_open_file
43
- # @client.imdb_info(@movie)
44
- #
45
- # puts @client.search_subtitles(@movie).inspect
46
- #
74
+ # it "should get imdb info" do
75
+ # @down.log_in!
76
+ # @movie.should_receive('info=').with({"MovieYear"=>"2004",
77
+ # "MovieImdbID"=>"403358",
78
+ # "MovieName"=>"Nochnoy dozor",
79
+ # "MovieHash"=>"09a2c497663259cb"})
80
+ # @down.imdb_info(@movie)
81
+ # end
82
+ #
83
+ # it "should search subs info" do
84
+ # @down.log_in!
85
+ # @movie.stub!(:size).and_return(733589504)
86
+ # res = @down.search_subtitles(@movie)
87
+ # res.should be_instance_of(Array)
88
+ # res.each do |r|
89
+ # r.should be_instance_of(Subtitle)
90
+ # end
91
+ # end
92
+ # end
@@ -10,13 +10,13 @@ describe Subline do
10
10
  end
11
11
 
12
12
  it "should have a nice date on" do
13
- @sub.text_on.sec.should eql(2)
14
- @sub.text_on.min.should eql(20)
15
- @sub.text_on.sec.should eql(2)
13
+ @sub.time_on.sec.should eql(2)
14
+ @sub.time_on.min.should eql(20)
15
+ @sub.time_on.sec.should eql(2)
16
16
  end
17
17
 
18
18
  it "should have the seconds added from the first time" do
19
- @sub.text_off.sec.should eql(6)
19
+ @sub.time_off.sec.should eql(6)
20
20
  end
21
21
  end
22
22
 
@@ -5,31 +5,22 @@ describe Subtime do
5
5
  @subtime = Subtime.new('01:02:03.400')
6
6
  end
7
7
 
8
- it "should convert the hour" do
8
+ it "should convert the hour, minutes and seconds" do
9
9
  @subtime.hrs.should eql(1)
10
- end
11
-
12
- it "should convert in minutes" do
13
10
  @subtime.min.should eql(2)
14
- end
15
-
16
- it "should convert in hours" do
17
11
  @subtime.sec.should eql(3)
12
+ @subtime.ms.should eql(400)
18
13
  end
19
14
 
20
15
  it "should reduce the deciseconds" do
21
16
  800.reduce.should eql(8)
22
17
  end
23
18
 
24
- it "should have ms" do
25
- @subtime.ms.should eql(400)
26
- end
27
-
28
- it "should print nicely" do
19
+ it "should print nicely as string" do
29
20
  @subtime.to_s.should eql("01:02:03.400")
30
21
  end
31
22
 
32
- it "should print nicely" do
23
+ it "should become a integer" do
33
24
  @subtime.to_i.should eql(3723400)
34
25
  end
35
26
  end
@@ -38,14 +29,10 @@ describe "and the other way around" do
38
29
  it "should print nicely" do
39
30
  @subtime = Subtime.new(3723400)
40
31
  @subtime.to_s.should eql('01:02:03.400')
41
- end
42
-
32
+ end
43
33
  end
44
34
 
45
-
46
-
47
-
48
- describe Subtime,"22" do
35
+ describe Subtime,"Stress Test (heh)" do
49
36
  it "should convert a big time" do
50
37
  @subtime = Subtime.new('11:22:33.742')
51
38
  @subtime.hrs.should eql(11)
@@ -58,30 +45,29 @@ describe Subtime,"22" do
58
45
  @subtime = Subtime.new('11:22:33.7')
59
46
  @subtime.to_s.should eql("11:22:33.700")
60
47
  end
61
- end
62
48
 
63
- describe Subtime, ".other formats" do
49
+ describe ".other formats" do
64
50
 
65
- it "should parse min:sec.ms" do
66
- @subtime = Subtime.new('01:03.4')
67
- end
51
+ it "should parse min:sec.ms" do
52
+ @subtime = Subtime.new('01:03.4')
53
+ end
68
54
 
69
- it "should parse min:sec,ms" do
70
- @subtime = Subtime.new('01:03,3')
71
- end
55
+ it "should parse min:sec,ms" do
56
+ @subtime = Subtime.new('01:03,3')
57
+ end
72
58
 
73
- it "should single as seconds hour should be nil" do
74
- @subtime = Subtime.new('3')
75
- @subtime.hrs.should eql(0)
76
- end
59
+ it "should single as seconds hour should be nil" do
60
+ @subtime = Subtime.new('3')
61
+ @subtime.hrs.should eql(0)
62
+ end
77
63
 
78
- it "should parse min:sec" do
79
- @subtime = Subtime.new('01:03')
80
- @subtime.min.should eql(1)
81
- end
64
+ it "should parse min:sec" do
65
+ @subtime = Subtime.new('01:03')
66
+ @subtime.min.should eql(1)
67
+ end
82
68
 
83
- after(:each) do
84
- @subtime.sec.should eql(3)
69
+ after(:each) do
70
+ @subtime.sec.should eql(3)
71
+ end
85
72
  end
86
-
87
73
  end
data/subtitle_it.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{subtitle_it}
3
- s.version = "0.7.1"
3
+ s.version = "0.7.3"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Marcos Piccinini", "Warlley Rezende"]
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.email = ["x@nofxx.com"]
11
11
  s.executables = ["subtitle_it"]
12
12
  s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "README.markdown"]
13
- s.files = [".autotest", "History.txt", "License.txt", "Manifest.txt", "README.markdown", "README.txt", "Rakefile", "bin/subtitle_it", "config/hoe.rb", "config/requirements.rb", "lib/subtitle_it.rb", "lib/subtitle_it/formats/ass.rb", "lib/subtitle_it/formats/mpl.rb", "lib/subtitle_it/formats/rsb.rb", "lib/subtitle_it/formats/srt.rb", "lib/subtitle_it/formats/sub.rb", "lib/subtitle_it/formats/xml.rb", "lib/subtitle_it/formats/yml.rb", "lib/subtitle_it/movie.rb", "lib/subtitle_it/movie_hasher.rb", "lib/subtitle_it/subdown.rb", "lib/subtitle_it/subline.rb", "lib/subtitle_it/substyle.rb", "lib/subtitle_it/subtime.rb", "lib/subtitle_it/subtitle.rb", "lib/subtitle_it/version.rb", "script/console", "script/destroy", "script/generate", "script/txt2html", "setup.rb", "spec/fixtures/godfather.srt", "spec/fixtures/huge.ass", "spec/fixtures/movie.xml", "spec/fixtures/movie.yml", "spec/fixtures/pseudo.rsb", "spec/fixtures/pulpfiction.sub", "spec/fixtures/puplfiction.mpl", "spec/fixtures/sincity.yml", "spec/spec.opts", "spec/spec_helper.rb", "spec/subtitle_it/formats/ass_spec.rb", "spec/subtitle_it/formats/mpl_spec.rb", "spec/subtitle_it/formats/rsb_spec.rb", "spec/subtitle_it/formats/srt_spec.rb", "spec/subtitle_it/formats/sub_spec.rb", "spec/subtitle_it/formats/xml_spec.rb", "spec/subtitle_it/formats/yml_spec.rb", "spec/subtitle_it/movie_hasher_spec.rb", "spec/subtitle_it/movie_spec.rb", "spec/subtitle_it/subdown_spec.rb", "spec/subtitle_it/subline_spec.rb", "spec/subtitle_it/substyle_spec.rb", "spec/subtitle_it/subtime_spec.rb", "spec/subtitle_it/subtitle_spec.rb", "spec/subtitle_it_spec.rb", "subtitle_it.gemspec", "tasks/deployment.rake", "tasks/environment.rake", "tasks/rspec.rake"]
13
+ s.files = [".autotest", "History.txt", "License.txt", "Manifest.txt", "README.markdown", "README.txt", "Rakefile", "bin/subtitle_it", "config/hoe.rb", "config/requirements.rb", "lib/subtitle_it.rb", "lib/subtitle_it/bin.rb", "lib/subtitle_it/fixes.rb", "lib/subtitle_it/formats/ass.rb", "lib/subtitle_it/formats/mpl.rb", "lib/subtitle_it/formats/rsb.rb", "lib/subtitle_it/formats/srt.rb", "lib/subtitle_it/formats/sub.rb", "lib/subtitle_it/formats/xml.rb", "lib/subtitle_it/formats/yml.rb", "lib/subtitle_it/generator.rb", "lib/subtitle_it/movie.rb", "lib/subtitle_it/movie_hasher.rb", "lib/subtitle_it/subdown.rb", "lib/subtitle_it/subline.rb", "lib/subtitle_it/substyle.rb", "lib/subtitle_it/subtime.rb", "lib/subtitle_it/subtitle.rb", "lib/subtitle_it/version.rb", "script/console", "script/destroy", "script/generate", "script/txt2html", "setup.rb", "spec/fixtures/godfather.srt", "spec/fixtures/huge.ass", "spec/fixtures/movie.xml", "spec/fixtures/movie.yml", "spec/fixtures/pseudo.rsb", "spec/fixtures/pulpfiction.sub", "spec/fixtures/puplfiction.mpl", "spec/fixtures/sincity.yml", "spec/spec.opts", "spec/spec_helper.rb", "spec/subtitle_it/bin_spec.rb", "spec/subtitle_it/fixes_spec.rb", "spec/subtitle_it/formats/ass_spec.rb", "spec/subtitle_it/formats/mpl_spec.rb", "spec/subtitle_it/formats/rsb_spec.rb", "spec/subtitle_it/formats/srt_spec.rb", "spec/subtitle_it/formats/sub_spec.rb", "spec/subtitle_it/formats/xml_spec.rb", "spec/subtitle_it/formats/yml_spec.rb", "spec/subtitle_it/generator_spec.rb", "spec/subtitle_it/movie_hasher_spec.rb", "spec/subtitle_it/movie_spec.rb", "spec/subtitle_it/subdown_spec.rb", "spec/subtitle_it/subline_spec.rb", "spec/subtitle_it/substyle_spec.rb", "spec/subtitle_it/subtime_spec.rb", "spec/subtitle_it/subtitle_spec.rb", "spec/subtitle_it_spec.rb", "subtitle_it.gemspec", "tasks/deployment.rake", "tasks/environment.rake", "tasks/rspec.rake"]
14
14
  s.has_rdoc = true
15
15
  s.homepage = %q{http://github.com/nofxx/subtitle_it}
16
16
  s.post_install_message = %q{
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nofxx-subtitle_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos Piccinini
@@ -56,6 +56,8 @@ files:
56
56
  - config/hoe.rb
57
57
  - config/requirements.rb
58
58
  - lib/subtitle_it.rb
59
+ - lib/subtitle_it/bin.rb
60
+ - lib/subtitle_it/fixes.rb
59
61
  - lib/subtitle_it/formats/ass.rb
60
62
  - lib/subtitle_it/formats/mpl.rb
61
63
  - lib/subtitle_it/formats/rsb.rb
@@ -63,6 +65,7 @@ files:
63
65
  - lib/subtitle_it/formats/sub.rb
64
66
  - lib/subtitle_it/formats/xml.rb
65
67
  - lib/subtitle_it/formats/yml.rb
68
+ - lib/subtitle_it/generator.rb
66
69
  - lib/subtitle_it/movie.rb
67
70
  - lib/subtitle_it/movie_hasher.rb
68
71
  - lib/subtitle_it/subdown.rb
@@ -86,6 +89,8 @@ files:
86
89
  - spec/fixtures/sincity.yml
87
90
  - spec/spec.opts
88
91
  - spec/spec_helper.rb
92
+ - spec/subtitle_it/bin_spec.rb
93
+ - spec/subtitle_it/fixes_spec.rb
89
94
  - spec/subtitle_it/formats/ass_spec.rb
90
95
  - spec/subtitle_it/formats/mpl_spec.rb
91
96
  - spec/subtitle_it/formats/rsb_spec.rb
@@ -93,6 +98,7 @@ files:
93
98
  - spec/subtitle_it/formats/sub_spec.rb
94
99
  - spec/subtitle_it/formats/xml_spec.rb
95
100
  - spec/subtitle_it/formats/yml_spec.rb
101
+ - spec/subtitle_it/generator_spec.rb
96
102
  - spec/subtitle_it/movie_hasher_spec.rb
97
103
  - spec/subtitle_it/movie_spec.rb
98
104
  - spec/subtitle_it/subdown_spec.rb