autosub 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/autosub.gemspec +2 -2
  3. data/lib/sites/betaseries.rb +25 -15
  4. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{autosub}
8
- s.version = "0.4.0"
8
+ s.version = "0.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Pirate"]
12
- s.date = %q{2009-11-06}
12
+ s.date = %q{2009-11-08}
13
13
  s.default_executable = %q{bin/autosub}
14
14
  s.description = %q{Ruby tool to automatically download subtitles (srt) inside your TV Shows folder}
15
15
  s.email = %q{pirate.2061@gmail.com}
@@ -42,24 +42,34 @@ private
42
42
  el.search("ul.srt li a") do |srt_link|
43
43
  title = srt_link.inner_text
44
44
  if !found && good_language?(title, lang) && good_format?(episode, title) && no_tag?(title)
45
- Tempfile.open("tv.zip") do |tempfile|
46
- tempfile.write(agent.get_file(srt_link[:href])) # download the zip
47
- tempfile.close # tempfile need to be closed for unzip it
48
- Zip::ZipFile.open(tempfile.path) do |zip_file|
49
- if zip_file.size == 1
50
- file = zip_file.first
51
- else
52
- zip_file.each do |f|
53
- if f.size > 5000 && good_episode?(episode, f.name) && good_language?(f.name, lang) && episode.good_format?(f.name) && no_tag?(f.name)
54
- file = f
45
+ if title.include?('zip')
46
+ Tempfile.open("tv.zip") do |tempfile|
47
+ tempfile.write(agent.get_file(srt_link[:href])) # download the zip
48
+ tempfile.close # tempfile need to be closed for unzip it
49
+ Zip::ZipFile.open(tempfile.path) do |zip_file|
50
+ if zip_file.size == 1
51
+ file = zip_file.first
52
+ else
53
+ zip_file.each do |f|
54
+ if f.size > 5000 && good_episode?(episode, f.name) && good_language?(f.name, lang) && episode.good_format?(f.name) && no_tag?(f.name)
55
+ file = f
56
+ end
55
57
  end
56
58
  end
59
+ if file
60
+ @srt_name = file.name
61
+ zip_file.extract(file, episode.srt_filename(lang))
62
+ found = true
63
+ end
57
64
  end
58
- if file
59
- @srt_name = file.name
60
- zip_file.extract(file, episode.srt_filename(lang))
61
- found = true
62
- end
65
+ end
66
+ else
67
+ @srt_name = title
68
+ Tempfile.open("tv.srt") do |tempfile|
69
+ tempfile.write(agent.get_file(srt_link[:href])) # download the zip
70
+ tempfile.close
71
+ File.move(tempfile.path, episode.srt_filename(lang))
72
+ found = true
63
73
  end
64
74
  end
65
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autosub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pirate
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-06 00:00:00 +01:00
12
+ date: 2009-11-08 00:00:00 +01:00
13
13
  default_executable: bin/autosub
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency