nofxx-subtitle_it 0.7.6 → 0.7.7
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -1
- data/Manifest.txt +2 -0
- data/bin/subtitle_it +5 -12
- data/lib/subtitle_it.rb +1 -0
- data/lib/subtitle_it/bin.rb +20 -6
- data/lib/subtitle_it/formats/xml.rb +3 -3
- data/lib/subtitle_it/languages.rb +60 -0
- data/lib/subtitle_it/subdown.rb +14 -5
- data/lib/subtitle_it/subtime.rb +1 -1
- data/lib/subtitle_it/subtitle.rb +19 -10
- data/lib/subtitle_it/version.rb +1 -1
- data/spec/subtitle_it/bin_spec.rb +13 -7
- data/spec/subtitle_it/formats/mpl_spec.rb +1 -1
- data/spec/subtitle_it/formats/rsb_spec.rb +1 -1
- data/spec/subtitle_it/formats/sub_spec.rb +4 -4
- data/spec/subtitle_it/formats/xml_spec.rb +2 -2
- data/spec/subtitle_it/subdown_spec.rb +30 -28
- data/spec/subtitle_it/subtitle_spec.rb +1 -6
- data/subtitle_it.gemspec +3 -3
- metadata +4 -3
data/History.txt
CHANGED
@@ -31,7 +31,7 @@
|
|
31
31
|
|
32
32
|
== 0.7.0 2008-09-10
|
33
33
|
|
34
|
-
*
|
34
|
+
* 3 major enhancements:
|
35
35
|
* Adds download opensubtitles support
|
36
36
|
* Fixes various bugs (and adds another ones)
|
37
37
|
* Adds MPL2 support
|
@@ -43,5 +43,11 @@
|
|
43
43
|
* subtitle_it worker code rewritten
|
44
44
|
|
45
45
|
== 0.7.6 2008-09-17
|
46
|
+
|
46
47
|
* 1 major enhancement:
|
47
48
|
* Fixes a bug (platform dependent end-of-line)
|
49
|
+
|
50
|
+
== 0.7.7 2008-09-20
|
51
|
+
|
52
|
+
* 1 major enhancement:
|
53
|
+
* Add language search (subtitle_it -l <code> <movie>)
|
data/Manifest.txt
CHANGED
@@ -19,8 +19,10 @@ lib/subtitle_it/formats/sub.rb
|
|
19
19
|
lib/subtitle_it/formats/xml.rb
|
20
20
|
lib/subtitle_it/formats/yml.rb
|
21
21
|
lib/subtitle_it/generator.rb
|
22
|
+
lib/subtitle_it/languages.rb
|
22
23
|
lib/subtitle_it/movie.rb
|
23
24
|
lib/subtitle_it/movie_hasher.rb
|
25
|
+
lib/subtitle_it/platform_endl.rb
|
24
26
|
lib/subtitle_it/subdown.rb
|
25
27
|
lib/subtitle_it/subline.rb
|
26
28
|
lib/subtitle_it/substyle.rb
|
data/bin/subtitle_it
CHANGED
@@ -29,19 +29,12 @@ SubtitleIt - Download, convert and create subtitles.
|
|
29
29
|
Usage: #{File.basename($0)} [options] movie or file_in [file_out]
|
30
30
|
|
31
31
|
Options are:
|
32
|
-
|
33
|
-
show all supported formats. You don`t need to use this if
|
34
|
-
fileout contains a extension.
|
35
|
-
|
36
|
-
-f --force Force overwrite.
|
37
|
-
|
38
|
-
-d DELAY --delay=DELAY Fix the delay of the file.
|
39
|
-
|
40
|
-
-h --help Show this.
|
41
|
-
|
42
|
-
-v --version Program version.
|
32
|
+
|
43
33
|
BANNER
|
44
34
|
opts.separator ""
|
35
|
+
|
36
|
+
opts.on("-l", "--language=LANGUAGE", String,
|
37
|
+
"Language to search subtitles for, try it empty to see the supported ones.") { |OPTIONS[:lang]| }
|
45
38
|
|
46
39
|
opts.on("-c", "--convert=FORMAT", String,
|
47
40
|
"Format to convert to") { |OPTIONS[:format]| }
|
@@ -68,6 +61,6 @@ if ARGV.empty?
|
|
68
61
|
puts parser.banner
|
69
62
|
exit
|
70
63
|
else
|
71
|
-
SubtitleIt::Bin.run! ARGV, OPTIONS[:format], OPTIONS[:force], OPTIONS[:delay]
|
64
|
+
SubtitleIt::Bin.run! ARGV, OPTIONS[:lang], OPTIONS[:format], OPTIONS[:force], OPTIONS[:delay]
|
72
65
|
end
|
73
66
|
|
data/lib/subtitle_it.rb
CHANGED
@@ -2,6 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
require 'rubygems'
|
4
4
|
require 'subtitle_it/version'
|
5
|
+
require 'subtitle_it/languages'
|
5
6
|
require 'subtitle_it/subtime'
|
6
7
|
require 'subtitle_it/subline'
|
7
8
|
require 'subtitle_it/platform_endl'
|
data/lib/subtitle_it/bin.rb
CHANGED
@@ -14,11 +14,15 @@ module SubtitleIt
|
|
14
14
|
end
|
15
15
|
|
16
16
|
class Subdownloader
|
17
|
-
def run!(movie)
|
17
|
+
def run!(movie,lang=nil)
|
18
18
|
@movie = Movie.new(movie)
|
19
19
|
@down = Subdown.new
|
20
20
|
@down.log_in!
|
21
|
-
res = @down.search_subtitles(@movie)
|
21
|
+
res = @down.search_subtitles(@movie, lang)
|
22
|
+
if res.length == 0
|
23
|
+
STDOUT.puts "No results found."
|
24
|
+
return
|
25
|
+
end
|
22
26
|
STDOUT.puts "Found #{res.length} result#{"s" if res.length > 1}. Choose one:\n"
|
23
27
|
res.sort.each_with_index { |r,i| STDOUT.puts print_option(r,i) }
|
24
28
|
STDOUT.puts "You can choose multiple ones, separated with spaces or a range separated with hifen."
|
@@ -57,17 +61,20 @@ module SubtitleIt
|
|
57
61
|
end
|
58
62
|
end
|
59
63
|
|
60
|
-
class Bin
|
61
|
-
|
64
|
+
class Bin
|
65
|
+
|
66
|
+
|
67
|
+
def Bin.run! argv, lang=nil, format=nil, force=false, delay=nil
|
62
68
|
raise unless argv
|
63
69
|
@force = force
|
64
70
|
@format = format
|
65
71
|
|
66
72
|
unless File.exists?(argv[0])
|
67
|
-
#
|
73
|
+
# TODO generate_rsb
|
68
74
|
return
|
69
75
|
end
|
70
76
|
|
77
|
+
|
71
78
|
@file_in = argv[0]
|
72
79
|
@file_in_ext = Bin.get_extension(@file_in)
|
73
80
|
if argv[1]
|
@@ -76,7 +83,7 @@ module SubtitleIt
|
|
76
83
|
@format = @file_out_ext
|
77
84
|
end
|
78
85
|
if MOVIE_EXTS.include? @file_in_ext
|
79
|
-
Subdownloader.new.run!(argv[0])
|
86
|
+
Subdownloader.new.run!(argv[0], lang)
|
80
87
|
elsif SUB_EXTS.include? @file_in_ext
|
81
88
|
Subwork.new.run!(@file_in, @format)
|
82
89
|
else
|
@@ -106,6 +113,13 @@ module SubtitleIt
|
|
106
113
|
f
|
107
114
|
end
|
108
115
|
|
116
|
+
def Bin.print_languages
|
117
|
+
STDOUT.puts "CODE | LANGUAGE"
|
118
|
+
LANGS.each do |l|
|
119
|
+
STDOUT.puts " #{l[0]} | #{l[1]}"
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
109
123
|
def Bin.write_out(filename,dump)
|
110
124
|
if File.exists?(filename) && !@force
|
111
125
|
STDOUT.puts "File exists. #{filename}"
|
@@ -41,7 +41,7 @@ module Formats
|
|
41
41
|
toff = l.time_off - l.time_on
|
42
42
|
line_ary << " <p begin=\"#{l.time_on}\" dur=\"#{toff}\">#{l.text}</p>"
|
43
43
|
end
|
44
|
-
return line_ary.join( endl )
|
44
|
+
return line_ary.join( endl )
|
45
45
|
end
|
46
46
|
|
47
47
|
def to_xml
|
@@ -55,11 +55,11 @@ module Formats
|
|
55
55
|
</head>
|
56
56
|
<body>
|
57
57
|
<div xml:lang="en">
|
58
|
-
#{xml_lines}
|
58
|
+
#{xml_lines}
|
59
59
|
</div>
|
60
60
|
</body>
|
61
61
|
</tt>
|
62
62
|
XML
|
63
63
|
out.chomp
|
64
|
-
end
|
64
|
+
end
|
65
65
|
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module SubtitleIt
|
2
|
+
#TODO: create a lang class?
|
3
|
+
# now I`m more lost.... opensubtitle uses a 3 chars like
|
4
|
+
# Por => Portuguese
|
5
|
+
# Cze => Czech ....
|
6
|
+
LANGS = {
|
7
|
+
:aa => 'Afar',
|
8
|
+
:ab => 'Abkhazian',
|
9
|
+
:af => 'Afrikaans',
|
10
|
+
:ak => 'Akan',
|
11
|
+
:sq => 'Albanian',
|
12
|
+
:am => 'Amharic',
|
13
|
+
:ar => 'Arabic',
|
14
|
+
:pb => 'Brazilian Portuguese',
|
15
|
+
:hy => 'Armenian',
|
16
|
+
:bs => 'Bosnian',
|
17
|
+
:bg => 'Bulgarian',
|
18
|
+
:ca => 'Catalan',
|
19
|
+
:zh => 'Chinese',
|
20
|
+
:cs => 'Czech',
|
21
|
+
:da => 'Danish',
|
22
|
+
:nl => 'Dutch',
|
23
|
+
:et => 'Estonian',
|
24
|
+
:fr => 'French',
|
25
|
+
:de => 'German',
|
26
|
+
:gl => 'Galician',
|
27
|
+
:el => 'Greek',
|
28
|
+
:he => 'Hebrew',
|
29
|
+
:hi => 'Hindi',
|
30
|
+
:hr => 'Croatian',
|
31
|
+
:hu => 'Hungarian',
|
32
|
+
:is => 'Icelandic',
|
33
|
+
:id => 'Indonesian',
|
34
|
+
:it => 'Italian',
|
35
|
+
:ja => 'Japanese',
|
36
|
+
:kk => 'Kazakh',
|
37
|
+
:ko => 'Korean',
|
38
|
+
:lv => 'Latvian',
|
39
|
+
:lt => 'Lithuanian',
|
40
|
+
:lb => 'Luxembourgish',
|
41
|
+
:mk => 'Macedonian',
|
42
|
+
:ms => 'Malay',
|
43
|
+
:no => 'Norwegian',
|
44
|
+
:pl => 'Polish',
|
45
|
+
:pt => 'Portuguese',
|
46
|
+
:ru => 'Russian',
|
47
|
+
:sr => 'Serbian',
|
48
|
+
:es => 'Spanish',
|
49
|
+
:sk => 'Slovak',
|
50
|
+
:sl => 'Slovenian',
|
51
|
+
:sv => 'Swedish',
|
52
|
+
:th => 'Thai',
|
53
|
+
:tr => 'Turkish',
|
54
|
+
:uk => 'Ukrainian',
|
55
|
+
:vi => 'Vietnamese',
|
56
|
+
:ro => 'Romanian',
|
57
|
+
:pb => 'Brazilian',
|
58
|
+
:ay => 'Assyrian'
|
59
|
+
}
|
60
|
+
end
|
data/lib/subtitle_it/subdown.rb
CHANGED
@@ -38,9 +38,11 @@ module SubtitleIt
|
|
38
38
|
call('ServerInfo')
|
39
39
|
end
|
40
40
|
|
41
|
-
def search_subtitles(movie)
|
41
|
+
def search_subtitles(movie, lang='')
|
42
|
+
lang ||= ""
|
43
|
+
puts la
|
42
44
|
args = {
|
43
|
-
'sublanguageid' =>
|
45
|
+
'sublanguageid' => lang,
|
44
46
|
'moviehash' => movie.haxx,
|
45
47
|
'moviebytesize' => movie.size
|
46
48
|
}
|
@@ -54,7 +56,7 @@ module SubtitleIt
|
|
54
56
|
end
|
55
57
|
|
56
58
|
def download_subtitle(sub)
|
57
|
-
result = call('DownloadSubtitles', [sub.
|
59
|
+
result = call('DownloadSubtitles', [sub.osdb_id])
|
58
60
|
sub.data = self.class.decode_and_unzip(result['data'][0]['data'])
|
59
61
|
end
|
60
62
|
|
@@ -67,6 +69,8 @@ module SubtitleIt
|
|
67
69
|
end
|
68
70
|
|
69
71
|
def subtitle_languages
|
72
|
+
LANGS.map { |l| l[0].to_s }
|
73
|
+
# TODO.. get the correct codes
|
70
74
|
end
|
71
75
|
|
72
76
|
private
|
@@ -80,12 +84,17 @@ module SubtitleIt
|
|
80
84
|
result = @client.call(method, *args)
|
81
85
|
# $LOG.debug "Client#call #{method}, #{args.inspect}: #{result.inspect}"
|
82
86
|
|
83
|
-
if
|
84
|
-
raise '
|
87
|
+
if !self.class.result_status_ok?(result)
|
88
|
+
raise XMLRPC::FaultException.new(result['status'].to_i, result['status'][4..-1]) # 'status' of the form 'XXX Message'
|
85
89
|
end
|
86
90
|
|
87
91
|
result
|
88
92
|
end
|
93
|
+
|
94
|
+
# Returns true if status is OK (ie. in range 200-299) or don't exists.
|
95
|
+
def self.result_status_ok?(result)
|
96
|
+
!result.key?('status') || (200...300) === result['status'].to_i
|
97
|
+
end
|
89
98
|
|
90
99
|
def prevent_session_expiration
|
91
100
|
call('NoOperation')
|
data/lib/subtitle_it/subtime.rb
CHANGED
@@ -20,7 +20,7 @@ module SubtitleIt
|
|
20
20
|
time, float = data.split(/\.|\,/)
|
21
21
|
time = time.split(/:/).map { |s| s.to_i }
|
22
22
|
@ms = (("0.%d" % float.to_i).to_f * 1000).to_i if float
|
23
|
-
|
23
|
+
@sec, @min, @hrs = time.reverse
|
24
24
|
else raise "Format unknown."
|
25
25
|
end
|
26
26
|
#FIXME: dunno what to do about this.. nil = problems with to_i
|
data/lib/subtitle_it/subtitle.rb
CHANGED
@@ -5,26 +5,35 @@ require 'subtitle_it/formats/rsb'
|
|
5
5
|
require 'subtitle_it/formats/xml'
|
6
6
|
require 'subtitle_it/formats/mpl'
|
7
7
|
|
8
|
+
# http://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
|
9
|
+
# http://www.opensubtitles.org/addons/export_languages.php
|
10
|
+
|
8
11
|
module SubtitleIt
|
9
12
|
|
10
13
|
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)
|
11
14
|
SUB_EXTS = %w(srt sub smi txt ssa ass mpl xml yml rsb)
|
12
|
-
|
13
|
-
LANGS = {
|
14
|
-
:pb => 'Brazilian Portuguese',
|
15
|
-
:en => 'English'
|
16
|
-
}
|
15
|
+
|
17
16
|
|
18
17
|
class Subtitle
|
19
18
|
include Formats
|
20
|
-
attr_reader :id, :raw, :format, :lines, :style, :info, :filename, :rating
|
19
|
+
attr_reader :id, :raw, :format, :lines, :style, :info, :filename, :rating, :language, :user, :release_name,
|
20
|
+
:osdb_id, :download_count, :download_url, :original_filename
|
21
21
|
|
22
22
|
def initialize(args = {})
|
23
|
+
# Looks like opensubtitle is the only provider around..
|
24
|
+
# If a second one comes need big refactor...
|
23
25
|
if @info = args[:info]
|
24
|
-
|
25
|
-
@
|
26
|
-
@
|
27
|
-
@
|
26
|
+
#@osdb_info = info
|
27
|
+
@osdb_id = @info['IDSubtitleFile'].to_s
|
28
|
+
@original_filename = @info['SubFileName'].to_s
|
29
|
+
@format = @info['SubFormat'].to_s
|
30
|
+
@user = @info['UserNickName'].to_s
|
31
|
+
@language = @info['LanguageName'].to_s
|
32
|
+
@release_name = @info['MovieReleaseName'].to_s
|
33
|
+
@download_count = @info['SubDownloadsCnt'].to_i
|
34
|
+
@rating = @info['SubRating'].to_f
|
35
|
+
@uploaded_at = @info['SubAddDate'].to_s # TODO: convert to time object?
|
36
|
+
@download_url = @info['SubDownloadLink'].to_s
|
28
37
|
end
|
29
38
|
@fps = args[:fps] || 23.976
|
30
39
|
parse_dump(args[:dump], args[:format]) if args[:dump]
|
data/lib/subtitle_it/version.rb
CHANGED
@@ -12,16 +12,16 @@ module BinspecHelper
|
|
12
12
|
|
13
13
|
def mock_subtitle
|
14
14
|
@mock_subtitle = mock(Subtitle, {
|
15
|
-
:info => sub_info, :format => 'srt'
|
15
|
+
:info => sub_info, :format => 'srt', :<=> => 1
|
16
16
|
})
|
17
17
|
end
|
18
18
|
|
19
19
|
def sub_info
|
20
20
|
{
|
21
|
-
"SubLanguageID"
|
22
|
-
"MovieName"
|
23
|
-
"MovieYear"
|
24
|
-
"SubFileName"
|
21
|
+
"SubLanguageID" => 'eng',
|
22
|
+
"MovieName" => 'Resevoir Dogs',
|
23
|
+
"MovieYear" => '1992',
|
24
|
+
"SubFileName" => 'Cool sub',
|
25
25
|
"MovieImdbRating" => '10.0',
|
26
26
|
"SubDownloadsCnt" => '310',
|
27
27
|
"SubRating" => '9.5',
|
@@ -60,24 +60,30 @@ end
|
|
60
60
|
|
61
61
|
describe Subdownloader do
|
62
62
|
include BinspecHelper
|
63
|
+
|
64
|
+
it "should print languages" do
|
65
|
+
STDOUT.should_receive(:puts).at_least(30).times
|
66
|
+
SubtitleIt::Bin.print_languages
|
67
|
+
end
|
63
68
|
|
64
69
|
it "should download a subtitle" do
|
65
70
|
Movie.should_receive(:new).and_return(mock_movie)
|
66
71
|
Subdown.should_receive(:new).and_return(mock_subdown)#mock(Subdown))
|
67
72
|
|
68
73
|
STDIN.should_receive(:gets).and_return("1")
|
69
|
-
STDOUT.should_receive(:puts).with("Found
|
74
|
+
STDOUT.should_receive(:puts).with("Found 2 results. Choose one:\n")
|
70
75
|
STDOUT.should_receive(:printf).with("Choose: ")
|
71
76
|
STDOUT.should_receive(:puts).with("You can choose multiple ones, separated with spaces or a range separated with hifen.")
|
72
77
|
STDOUT.should_receive(:puts).with("Downloading 1 subtitles...")
|
73
78
|
STDOUT.should_receive(:puts).with("1) Resevoir Dogs / 1992 | Cool sub | Movie score: 10.0\n Lang: Eng | Format: SRT | Downloads: 310 | Rating: 9.5 | CDs: 2\n Comments: Nice nice... \n\n")
|
79
|
+
STDOUT.should_receive(:puts).with("2) Resevoir Dogs / 1992 | Cool sub | Movie score: 10.0\n Lang: Eng | Format: SRT | Downloads: 310 | Rating: 9.5 | CDs: 2\n Comments: Nice nice... \n\n")
|
74
80
|
STDOUT.should_receive(:puts).with("Done. Wrote: Beavis Butthead Do America.srt.")
|
75
81
|
|
76
82
|
File.should_receive(:open).with("Beavis Butthead Do America.srt", "w").and_return(true)
|
77
83
|
|
78
84
|
@mock_subdown.should_receive(:log_in!).and_return(true)
|
79
85
|
@mock_subdown.should_receive(:download_subtitle).and_return(mock_subtitle)
|
80
|
-
@mock_subdown.should_receive(:search_subtitles).and_return([mock_subtitle])
|
86
|
+
@mock_subdown.should_receive(:search_subtitles).and_return([mock_subtitle, mock_subtitle])
|
81
87
|
@mock_subdown.should_receive(:log_out!).and_return(true)
|
82
88
|
|
83
89
|
Subdownloader.new.run! "file.avi"
|
@@ -39,7 +39,7 @@ describe Formats, ".mpl" do
|
|
39
39
|
@sub.to_mpl.should eql("[3265][3285]worth killing for...
|
40
40
|
[3604][3634]worth dying for...
|
41
41
|
[4203][4233]worth going to the hell for...
|
42
|
-
[4203][4233]worth going a | line
|
42
|
+
[4203][4233]worth going a | line...\n")
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -36,7 +36,7 @@ describe Formats, ".rsb" do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should dump the object to rsb" do
|
39
|
-
@sub.to_rsb.should eql("- title: sincity\n- authors: \n- version: 1.1\n00:05:26.500 => 00:05:28.500 == worth killing for...\n00:06:00.400 => 00:06:03.400 == worth dying for...\n00:07:00.300 => 00:07:03.300 == worth going to the hell for...\n00:07:00.300 => 00:07:03.300 == worth going a | line
|
39
|
+
@sub.to_rsb.should eql("- title: sincity\n- authors: \n- version: 1.1\n00:05:26.500 => 00:05:28.500 == worth killing for...\n00:06:00.400 => 00:06:03.400 == worth dying for...\n00:07:00.300 => 00:07:03.300 == worth going to the hell for...\n00:07:00.300 => 00:07:03.300 == worth going a | line...\n")
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -40,10 +40,10 @@ describe Formats, ".sub" do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should dump the object as a SUB" do
|
43
|
-
@sub.to_sub.should eql("{7816}{7864}worth killing for
|
44
|
-
{8631}{8703}worth dying for
|
45
|
-
{10069}{10141}worth going to the hell for
|
46
|
-
{10069}{10141}worth going a | line
|
43
|
+
@sub.to_sub.should eql("{7816}{7864}worth killing for...
|
44
|
+
{8631}{8703}worth dying for...
|
45
|
+
{10069}{10141}worth going to the hell for...
|
46
|
+
{10069}{10141}worth going a | line...\n")
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -38,7 +38,7 @@ describe Formats, ".xml" do
|
|
38
38
|
it "should parse the sub to an array" do
|
39
39
|
@sub.to_xml.should be_instance_of(String)
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
it "should equal..." do
|
43
43
|
@sub.to_xml.should eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
44
44
|
<tt xml:lang=\"en\" xmlns=\"http://www.w3.org/2006/04/ttaf1\" xmlns:tts=\"http://www.w3.org/2006/04/ttaf1#styling\">
|
@@ -51,7 +51,7 @@ describe Formats, ".xml" do
|
|
51
51
|
<p begin=\"00:05:26.500\" dur=\"00:00:02.000\">worth killing for...</p>
|
52
52
|
<p begin=\"00:06:00.400\" dur=\"00:00:03.000\">worth dying for...</p>
|
53
53
|
<p begin=\"00:07:00.300\" dur=\"00:00:03.000\">worth going to the hell for...</p>
|
54
|
-
<p begin=\"00:07:00.300\" dur=\"00:00:03.000\">worth going a | line...</p>
|
54
|
+
<p begin=\"00:07:00.300\" dur=\"00:00:03.000\">worth going a | line...</p>
|
55
55
|
</div>
|
56
56
|
</body>
|
57
57
|
</tt>")
|
@@ -54,39 +54,41 @@ describe Subdown do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should get subtitle languages" do
|
57
|
-
@down.subtitle_languages.should
|
57
|
+
@down.subtitle_languages.should be_instance_of(Array)
|
58
|
+
@down.subtitle_languages.length.should eql(51)
|
59
|
+
@down.subtitle_languages[0].should be_instance_of(String)
|
58
60
|
end
|
59
|
-
|
60
|
-
|
61
|
+
|
61
62
|
end
|
62
63
|
end
|
63
64
|
|
64
65
|
# REAL TESTS THAT USES THE INTERNET... DUNNO BETTER PRACTICE FOR THIS
|
65
66
|
# Mock is nice, but I would like to keep this here, who knows if
|
66
67
|
# Opensubtitle API changes.... any suggestions?
|
67
|
-
#
|
68
|
-
#
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
68
|
+
#
|
69
|
+
# #
|
70
|
+
# describe Subdown, " - Wired tests" do
|
71
|
+
# before(:each) do
|
72
|
+
# @down = Subdown.new
|
73
|
+
# @movie = mock(Movie, :haxx => '09a2c497663259cb')
|
74
|
+
# @down.log_in!
|
75
|
+
# end
|
76
|
+
#
|
77
|
+
# it "should get imdb info" do
|
78
|
+
# @movie.should_receive('info=').with({"MovieYear"=>"2004",
|
79
|
+
# "MovieImdbID"=>"403358",
|
80
|
+
# "MovieName"=>"Nochnoy dozor",
|
81
|
+
# "MovieHash"=>"09a2c497663259cb"})
|
82
|
+
# @down.imdb_info(@movie)
|
83
|
+
# end
|
84
|
+
#
|
85
|
+
# it "should search subs info" do
|
86
|
+
#
|
87
|
+
# @movie.stub!(:size).and_return(733589504)
|
88
|
+
# res = @down.search_subtitles(@movie, 'pt')
|
89
|
+
# res.should be_instance_of(Array)
|
90
|
+
# res.each do |r|
|
91
|
+
# r.should be_instance_of(Subtitle)
|
92
|
+
# end
|
93
|
+
# end
|
92
94
|
# end
|
data/subtitle_it.gemspec
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{subtitle_it}
|
3
|
-
s.version = "0.7.
|
3
|
+
s.version = "0.7.7"
|
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", "Giovanni Rapagnani"]
|
7
|
-
s.date = %q{2008-09-
|
7
|
+
s.date = %q{2008-09-20}
|
8
8
|
s.default_executable = %q{subtitle_it}
|
9
9
|
s.description = %q{description of gem}
|
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/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/
|
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/languages.rb", "lib/subtitle_it/movie.rb", "lib/subtitle_it/movie_hasher.rb", "lib/subtitle_it/platform_endl.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.
|
4
|
+
version: 0.7.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcos Piccinini
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2008-09-
|
14
|
+
date: 2008-09-20 00:00:00 -07:00
|
15
15
|
default_executable: subtitle_it
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -67,13 +67,14 @@ files:
|
|
67
67
|
- lib/subtitle_it/formats/xml.rb
|
68
68
|
- lib/subtitle_it/formats/yml.rb
|
69
69
|
- lib/subtitle_it/generator.rb
|
70
|
+
- lib/subtitle_it/languages.rb
|
70
71
|
- lib/subtitle_it/movie.rb
|
71
72
|
- lib/subtitle_it/movie_hasher.rb
|
73
|
+
- lib/subtitle_it/platform_endl.rb
|
72
74
|
- lib/subtitle_it/subdown.rb
|
73
75
|
- lib/subtitle_it/subline.rb
|
74
76
|
- lib/subtitle_it/substyle.rb
|
75
77
|
- lib/subtitle_it/subtime.rb
|
76
|
-
- lib/subtitle_it/platform_endl.rb
|
77
78
|
- lib/subtitle_it/subtitle.rb
|
78
79
|
- lib/subtitle_it/version.rb
|
79
80
|
- script/console
|