pirate-autonzb 0.4 → 0.4.1

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.
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require 'rake'
4
4
  require 'echoe'
5
5
 
6
- Echoe.new('autonzb', '0.4') do |p|
6
+ Echoe.new('autonzb', '0.4.1') do |p|
7
7
  p.description = "Ruby tool to automatically download x264 HD nzb movies files from newzleech.com"
8
8
  p.url = "http://github.com/pirate/autonzb"
9
9
  p.author = "Pirate"
data/autonzb.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{autonzb}
5
- s.version = "0.4"
5
+ s.version = "0.4.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Pirate"]
9
- s.date = %q{2009-02-07}
9
+ s.date = %q{2009-02-08}
10
10
  s.default_executable = %q{autonzb}
11
11
  s.description = %q{Ruby tool to automatically download x264 HD nzb movies files from newzleech.com}
12
12
  s.email = %q{pirate.2061@gmail.com}
data/lib/imdb.rb CHANGED
@@ -12,6 +12,7 @@ class IMDB
12
12
  @coder = HTMLEntities.new
13
13
  set_doc
14
14
  set_id
15
+ p @id
15
16
  end
16
17
 
17
18
  def score
@@ -36,6 +37,7 @@ private
36
37
  def set_doc
37
38
  if @link
38
39
  @doc = Hpricot(open(@link.gsub(/\/\s*$/,'')))
40
+ @id = @link.match(/tt[0-9]+/)[0]
39
41
  else
40
42
  query = "#{@name} (#{@year})"
41
43
  search_url = "http://www.imdb.com/find?q=#{CGI::escape(query)}"
@@ -51,7 +53,10 @@ private
51
53
  else
52
54
  movie_url = nil
53
55
  end
54
- @doc = Hpricot(open(movie_url)) if movie_url
56
+ if movie_url
57
+ @doc = Hpricot(open(movie_url))
58
+ @id = movie_url.match(/tt[0-9]+/)[0]
59
+ end
55
60
  else # direct in movie page
56
61
  @doc = doc
57
62
  end
@@ -59,7 +64,7 @@ private
59
64
  end
60
65
 
61
66
  def set_id
62
- @id = doc.search("a[@href*='/title/tt']").first[:href].match(/tt[0-9]+/)[0] if doc
67
+ @id ||= doc.search("a[@href*='/title/tt']").first[:href].match(/tt[0-9]+/)[0] if doc
63
68
  end
64
69
 
65
70
  end
data/lib/movie.rb CHANGED
@@ -54,10 +54,11 @@ private
54
54
  def set_imdb_id
55
55
  if imdb_link
56
56
  @imdb_id = imdb_link.match(/tt[0-9]+/)[0]
57
- elsif matched = @raw_name.match(/\{(.*)\}/)
57
+ elsif matched = @raw_name.match(/\{(tt[0-9]+)\}/)
58
58
  @imdb_id = matched[1]
59
- elsif path
60
- add_imdb_id_to_file
59
+ elsif imdb
60
+ @imdb_id = imdb.id
61
+ add_imdb_id_to_file if path
61
62
  else
62
63
  nil
63
64
  end
@@ -137,6 +138,8 @@ private
137
138
  @srt = nfo.srt
138
139
  elsif matched = @raw_name.match(/\[(.*)\]/)
139
140
  matched[1].split(',').each { |srt| @srt << srt }
141
+ else
142
+ @srt << 'no nfo'
140
143
  end
141
144
  end
142
145
 
@@ -172,7 +175,6 @@ private
172
175
  end
173
176
 
174
177
  def add_imdb_id_to_file_if_not_present
175
- @imdb_id = imdb.id
176
178
  dir_name = File.dirname(path)
177
179
  ext_name = File.extname(path)
178
180
  base_name = File.basename(path, ext_name)
data/lib/nfo.rb CHANGED
@@ -20,10 +20,12 @@ private
20
20
  when /subtitle|sub/i
21
21
  @srt << 'fr' if line =~ /fr|fre|french/i
22
22
  @srt << 'en' if line =~ /en|eng|english/i
23
+ @srt << 'none' if line =~ /none/i
23
24
  when /imdb\.com\/title\//
24
25
  @imdb_link = (matched = line.match(/imdb.com\/title\/(tt[0-9]+)/)) && "http://imdb.com/title/#{matched[1]}"
25
26
  end
26
27
  end
28
+ @srt << 'nfo but ?' if @srt.empty?
27
29
  end
28
30
 
29
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pirate-autonzb
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.4"
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-02-07 00:00:00 -08:00
12
+ date: 2009-02-08 00:00:00 -08:00
13
13
  default_executable: autonzb
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency