movie_searcher 0.0.8 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- movie_searcher (0.0.7)
5
- hintable_levenshtein
4
+ movie_searcher (0.0.8)
6
5
  httparty
6
+ levenshteinish
7
+ mimer_plus
7
8
 
8
9
  GEM
9
10
  remote: http://rubygems.org/
@@ -20,6 +21,9 @@ GEM
20
21
  hintable_levenshtein (0.0.3)
21
22
  httparty (0.7.3)
22
23
  crack (= 0.1.8)
24
+ levenshteinish (0.0.1)
25
+ hintable_levenshtein
26
+ mimer_plus (0.0.4)
23
27
  rspec (2.4.0)
24
28
  rspec-core (~> 2.4.0)
25
29
  rspec-expectations (~> 2.4.0)
@@ -38,7 +42,8 @@ DEPENDENCIES
38
42
  autotest-fsevent
39
43
  autotest-growl
40
44
  autotest-standalone
41
- hintable_levenshtein
42
45
  httparty
46
+ levenshteinish
47
+ mimer_plus
43
48
  movie_searcher!
44
49
  rspec
data/README.md CHANGED
@@ -8,6 +8,7 @@ It uses IMDB's API that their iPhone applications rely on.
8
8
  It's build on top of [maddox's](https://github.com/maddox) [imdb-party](https://github.com/maddox/imdb-party) but adds some extra functionality and bugs fixes.
9
9
 
10
10
  ## What makes this gem so awesome?
11
+
11
12
  MovieSearcher has a really cool feature (*method*) called `find_by_release_name` that makes it possible to search for a movie based on the release name.
12
13
  You can for example specify ***Heartbreaker 2010 LIMITED DVDRip XviD-SUBMERGE*** and it will return the not to good [*Heartbreaker*](http://www.imdb.com/title/tt1465487/) by [*Pascal Chaumeil*](http://www.imdb.com/name/nm0154312/)
13
14
 
@@ -32,6 +33,32 @@ Start `irb` and include the gem, `require 'movie_searcher'`
32
33
  => 8.9
33
34
  $ movie.certification
34
35
  => "PG-13"
36
+
37
+ ### Find a movie based on the release name
38
+
39
+ $ MovieSearcher.find_by_release_name("Heartbreaker 2010 LIMITED DVDRip XviD-SUBMERGE").imdb_id
40
+ => tt1465487
41
+
42
+ ### Find a movie based on a folder
43
+
44
+ $ MovieSearcher.find_by_folder('~/Downloads/Its.Kind.of.a.Funny.Story.2010.DVDRip.XviD-AMIABLE')
45
+ => #<ImdbParty::Movie:0x10198a060 ... >
46
+ ### Find a movie based on a file containing and imdb link
47
+
48
+ This method does not take any folder that starts with tilde **~** sign.
49
+
50
+ $ MovieSearcher.find_by_file('/Users/linus/Downloads/Its.Kind.of.a.Funny.Story.2010.DVDRip.XviD-AMIABLE/its.kind.of.a.funny.story.2010.dvdrip.xvid-amiable.nfo')
51
+ => #<ImdbParty::Movie:0x10198a060 ... >
52
+
53
+ ### Find a movie based on a downloaded thingy (folder or file)
54
+
55
+ This method takes anything that you have download and tries to figure out what movie you're talking about.
56
+ If a folder is passed it will list all text files in the folder and try to find an imdb link.
57
+ If no link or no files are found, it will fall back on the name of the folder.
58
+
59
+ $ MovieSearcher.find_by_download('/Users/linus/Downloads/some_thing_unknown')
60
+ => #<ImdbParty::Movie:0x10198a060 ... >
61
+
35
62
 
36
63
  ### Find the top 250 movies of all time
37
64
 
@@ -43,12 +70,8 @@ Start `irb` and include the gem, `require 'movie_searcher'`
43
70
  $ MovieSearcher.popular_shows
44
71
  => [#<ImdbParty::Movie:0x101ff2858 @imdb_id="tt1327801", @poster_url="http://ia.media-imdb.com/images/M/MV5BMTYxMjYxNjQxNl5BMl5BanBnXkFtZTcwNTU5Nzk4Mw@@._V1_.jpg", @year="2009", @title="Glee">, ... ]
45
72
 
46
- ### Search for a release name
47
-
48
- $ MovieSearcher.find_by_release_name("Heartbreaker 2010 LIMITED DVDRip XviD-SUBMERGE").imdb_id
49
- => tt1465487
50
-
51
73
  ### Some configure alternatives
74
+
52
75
  You can pass some options to the `find_by_release_name` method to specify how it should behave.
53
76
 
54
77
  Here is an example.
@@ -1,7 +1,7 @@
1
1
  excluded:
2
2
  - EXTENDED
3
3
  - "((xvid(-[a-z]+)?))"
4
- - "(720|480)p"
4
+ - "(720|480|1080)p"
5
5
  - B(R|D)Rip
6
6
  - cam
7
7
  - telesync|([^a-z])ts([^a-z]?)
@@ -1,6 +1,6 @@
1
1
  require "imdb_party"
2
- require 'imdb_party/levenshtein'
3
-
2
+ require 'levenshteinish'
3
+ require 'mimer_plus'
4
4
  class MovieSearcher
5
5
  attr_accessor :options, :cleaners
6
6
 
@@ -19,6 +19,7 @@ class MovieSearcher
19
19
  @cleaners = YAML.load(File.read("#{File.dirname(__FILE__)}/imdb_party/exclude.yaml"))["excluded"]
20
20
  end
21
21
 
22
+ # Finds the movie based on the release name of the movie
22
23
  def self.find_by_release_name(search_value, options = {})
23
24
  this = MovieSearcher.new(options.merge(:search_value => search_value.to_s))
24
25
  return if this.to_long?
@@ -30,6 +31,46 @@ class MovieSearcher
30
31
  this.options[:details] ? self.find_movie_by_id(movie.imdb_id) : movie
31
32
  end
32
33
 
34
+ # Finds the movie based on the nfo file (or similar file)
35
+ def self.find_by_file(file_path)
36
+ if File.read(file_path) =~ /imdb\.com\/title\/(tt\d+)/
37
+ return self.find_movie_by_id($1)
38
+ end
39
+ end
40
+
41
+ # Finds the movie based on the folder
42
+ def self.find_by_folder(folder_path)
43
+
44
+ # Relative path?
45
+ folder_path = self.relative?(folder_path)
46
+
47
+ # Makes sure that every directory looks the same, an raises an exception if the dir does not exist
48
+ folder_path = Dir.new(folder_path).path
49
+
50
+ %x{cd '#{folder_path}' && find #{folder_path} -maxdepth 4}.split(/\n/).each do |file|
51
+ # Locating every textfile in the directory
52
+ # We're hoping to find a nfo file
53
+ if Mimer.identify(file).text?
54
+ result = self.find_by_file(file)
55
+ return result unless result.nil?
56
+ end
57
+ end
58
+
59
+ # Last resort, we hope that the folder contain the release name
60
+ return self.find_by_release_name(File.split(folder_path).last)
61
+ end
62
+
63
+ # Try to figure out what method to use, folder or file
64
+ def self.find_by_download(unknown)
65
+ unknown = self.relative?(unknown)
66
+ File.directory?(unknown) ? self.find_by_folder(unknown) : self.find_by_file(unknown)
67
+ end
68
+
69
+ # Returns the full path of the file/folder
70
+ def self.relative?(unknown)
71
+ unknown.match(/^\//) ? unknown : File.expand_path(unknown)
72
+ end
73
+
33
74
  def to_long?
34
75
  @split = self.cleaner(@search_value).split(@options[:split])
35
76
  @split.length > @options[:long]
@@ -39,7 +80,7 @@ class MovieSearcher
39
80
  current = @split.length
40
81
 
41
82
  until current <= 0 do
42
- title = @split.take(current).join(' ')
83
+ title = @split.take(current).join(' ')
43
84
  movies = @options[:imdb].find_by_title(title)
44
85
  break if movies.any? and movies.reject{ |movie| self.shortest(movie, title).nil? }.any?
45
86
  current -= 1
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "movie_searcher"
6
- s.version = "0.0.8"
6
+ s.version = "0.1.0"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Linus Oleander", "Jon Maddox"]
9
9
  s.email = ["linus@oleander.nu", "jon@mustacheinc.com"]
@@ -17,7 +17,8 @@ Gem::Specification.new do |s|
17
17
  s.require_paths = ["lib"]
18
18
 
19
19
  s.add_dependency('httparty')
20
- s.add_dependency('hintable_levenshtein')
20
+ s.add_dependency('levenshteinish')
21
+ s.add_dependency('mimer_plus')
21
22
  s.add_development_dependency('rspec')
22
23
  s.add_development_dependency('autotest-standalone')
23
24
  s.add_development_dependency('autotest')
@@ -0,0 +1,83 @@
1
+ ::::::::::::::Enjoy:Another:Release:From:T0XiC::::::::::::::
2
+
3
+ File::127.Hours.2010.DVDSCR.AC3.XViD-T0XiC-iNK
4
+ Source:: ....thanks bro ;)
5
+ Language::English
6
+ IMDB::http://www.imdb.com/title/tt1542344/
7
+
8
+ Synopsis::A mountain climber becomes trapped under a boulder while canyoneering alone near Moab, Utah and resorts to desperate measures in order to survive.
9
+
10
+ Specs::
11
+
12
+ General
13
+
14
+ Format : AVI
15
+ Format/Info : Audio Video Interleave
16
+ File size : 1.22 GiB
17
+ Duration : 1h 32mn
18
+ Overall bit rate : 1 885 Kbps
19
+ Writing application : VirtualDubMod 1.5.10.2 (build 2542/release)
20
+ Writing library : VirtualDubMod build 2542/release
21
+
22
+ Video
23
+ ID : 0
24
+ Format : MPEG-4 Visual
25
+ Format profile : Advanced Simple@L5
26
+ Format settings, BVOP : Yes
27
+ Format settings, QPel : No
28
+ Format settings, GMC : No warppoints
29
+ Format settings, Matrix : Default (H.263)
30
+ Codec ID : XVID
31
+ Codec ID/Hint : XviD
32
+ Duration : 1h 32mn
33
+ Bit rate : 1 681 Kbps
34
+ Width : 592 pixels
35
+ Height : 320 pixels
36
+ Display aspect ratio : 1.850
37
+ Frame rate : 29.970 fps
38
+ Color space : YUV
39
+ Chroma subsampling : 4:2:0
40
+ Bit depth : 8 bits
41
+ Scan type : Progressive
42
+ Bits/(Pixel*Frame) : 0.296
43
+ Stream size : 1.09 GiB (89%)
44
+ Writing library : XviD 1.2.0.dev47 (UTC 2006-11-01)
45
+
46
+ Audio
47
+ ID : 1
48
+ Format : AC-3
49
+ Format/Info : Audio Coding 3
50
+ Mode extension : CM (complete main)
51
+ Codec ID : 2000
52
+ Duration : 1h 32mn
53
+ Bit rate mode : Constant
54
+ Bit rate : 192 Kbps
55
+ Channel(s) : 2 channels
56
+ Channel positions : Front: L R
57
+ Sampling rate : 48.0 KHz
58
+ Bit depth : 16 bits
59
+ Stream size : 127 MiB (10%)
60
+ Alignment : Split accross interleaves
61
+ Interleave, duration : 33 ms (1.00 video frame)
62
+ Interleave, preload duration : 500 ms
63
+
64
+
65
+
66
+ NOTES:: First of all, many thanks to iNK on this release.
67
+ The property mark only comes up once near the start.
68
+ You may also notice that imdb says runtime is 94mins and this is 92:49... not sure what's missing but i can't imagine its anything important,
69
+ If you enjoy this film, make sure you go watch it when it comes out :)
70
+
71
+
72
+ ::Why Complain? Whats Free Is Free::
73
+
74
+
75
+ ::We are looking for unreleased DVD's, Screeners, New Music Releases, R5's, Audio, Cams, Silvers,
76
+ And Any Other Good Sources You Have To Offer contact us: t0xicreleases@hushmail.com
77
+
78
+ [img]http://www.leetleech.org/images/89926097132725959680.png[/img]
79
+ [img]http://www.leetleech.org/images/20830707321516885904.png[/img]
80
+ [img]http://www.leetleech.org/images/59905068333029819777.png[/img]
81
+ [img]http://www.leetleech.org/images/86171707954549470975.png[/img]
82
+ [img]http://www.leetleech.org/images/85482313172362476602.png[/img]
83
+
@@ -0,0 +1,31 @@
1
+
2
+ __ .---.
3
+ __ / ` .-.7,--.
4
+ / `. .-''. -, , \
5
+ '--.- -; | ) /
6
+ ,` / \ ,_) / '-.
7
+ / ( ( | / .' ) \ AMIABLE proudly presents:
8
+ '. `--,/ .---' ,-.|
9
+ `--. / '-, -' .' Its.Kind.of.a.Funny.Story.2010.DVDRip.XviD-AMIABLE
10
+ .==,=; `-,.;--'
11
+ / ,' _;--;| Date .....: 25th January 2011
12
+ /_...=' you are my Runtime ..: 01:41:19
13
+ || .==,=. Size .....: 700mb
14
+ ||/ '.\ Video ....: 624x336 (XviD @ 23.976fps)
15
+ ,||`'=...__\ Bitrate ..: ~820kbps
16
+ || Audio ....: MP3 ~128kbps
17
+ sweetest downfall.. Source ...: Retail R1 DVD
18
+ ||, Lang .....: English
19
+ || Subs .....: English / Spanish / French
20
+ ,|| IMDB .....: http://www.imdb.com/title/tt0804497/
21
+ || Rating ...: 7.2/10 (1,423 votes)
22
+ I loved you first Screens ..: Opening Week - $2,013,406 (USA) (10 October 2010) (742 Screens)
23
+ || Genre ....: Comedy | Drama
24
+ ||, Director .: Anna Boden, Ryan Fleck
25
+ || Cast .....: Keir Gilchrist, Emma Roberts, Lauren Graham, Zach Galifianakis
26
+
27
+
28
+
29
+ Tomorrow's just your future yesterday!
30
+
31
+
@@ -0,0 +1,30 @@
1
+
2
+ __ .---.
3
+ __ / ` .-.7,--.
4
+ / `. .-''. -, , \
5
+ '--.- -; | ) /
6
+ ,` / \ ,_) / '-.
7
+ / ( ( | / .' ) \ AMIABLE proudly presents:
8
+ '. `--,/ .---' ,-.|
9
+ `--. / '-, -' .' Its.Kind.of.a.Funny.Story.2010.DVDRip.XviD-AMIABLE
10
+ .==,=; `-,.;--'
11
+ / ,' _;--;| Date .....: 25th January 2011
12
+ /_...=' you are my Runtime ..: 01:41:19
13
+ || .==,=. Size .....: 700mb
14
+ ||/ '.\ Video ....: 624x336 (XviD @ 23.976fps)
15
+ ,||`'=...__\ Bitrate ..: ~820kbps
16
+ || Audio ....: MP3 ~128kbps
17
+ sweetest downfall.. Source ...: Retail R1 DVD
18
+ ||, Lang .....: English
19
+ || Subs .....: English / Spanish / French
20
+ ,|| IMDB .....: com/title/tt0804497/
21
+ || Rating ...: 7.2/10 (1,423 votes)
22
+ I loved you first Screens ..: Opening Week - $2,013,406 (USA) (10 October 2010) (742 Screens)
23
+ || Genre ....: Comedy | Drama
24
+ ||, Director .: Anna Boden, Ryan Fleck
25
+ || Cast .....: Keir Gilchrist, Emma Roberts, Lauren Graham, Zach Galifianakis
26
+
27
+
28
+
29
+ Tomorrow's just your future yesterday!
30
+
@@ -0,0 +1,83 @@
1
+ ::::::::::::::Enjoy:Another:Release:From:T0XiC::::::::::::::
2
+
3
+ File::127.Hours.2010.DVDSCR.AC3.XViD-T0XiC-iNK
4
+ Source:: ....thanks bro ;)
5
+ Language::English
6
+ IMDB::http://www.imdb.com/title/tt1542344/
7
+
8
+ Synopsis::A mountain climber becomes trapped under a boulder while canyoneering alone near Moab, Utah and resorts to desperate measures in order to survive.
9
+
10
+ Specs::
11
+
12
+ General
13
+
14
+ Format : AVI
15
+ Format/Info : Audio Video Interleave
16
+ File size : 1.22 GiB
17
+ Duration : 1h 32mn
18
+ Overall bit rate : 1 885 Kbps
19
+ Writing application : VirtualDubMod 1.5.10.2 (build 2542/release)
20
+ Writing library : VirtualDubMod build 2542/release
21
+
22
+ Video
23
+ ID : 0
24
+ Format : MPEG-4 Visual
25
+ Format profile : Advanced Simple@L5
26
+ Format settings, BVOP : Yes
27
+ Format settings, QPel : No
28
+ Format settings, GMC : No warppoints
29
+ Format settings, Matrix : Default (H.263)
30
+ Codec ID : XVID
31
+ Codec ID/Hint : XviD
32
+ Duration : 1h 32mn
33
+ Bit rate : 1 681 Kbps
34
+ Width : 592 pixels
35
+ Height : 320 pixels
36
+ Display aspect ratio : 1.850
37
+ Frame rate : 29.970 fps
38
+ Color space : YUV
39
+ Chroma subsampling : 4:2:0
40
+ Bit depth : 8 bits
41
+ Scan type : Progressive
42
+ Bits/(Pixel*Frame) : 0.296
43
+ Stream size : 1.09 GiB (89%)
44
+ Writing library : XviD 1.2.0.dev47 (UTC 2006-11-01)
45
+
46
+ Audio
47
+ ID : 1
48
+ Format : AC-3
49
+ Format/Info : Audio Coding 3
50
+ Mode extension : CM (complete main)
51
+ Codec ID : 2000
52
+ Duration : 1h 32mn
53
+ Bit rate mode : Constant
54
+ Bit rate : 192 Kbps
55
+ Channel(s) : 2 channels
56
+ Channel positions : Front: L R
57
+ Sampling rate : 48.0 KHz
58
+ Bit depth : 16 bits
59
+ Stream size : 127 MiB (10%)
60
+ Alignment : Split accross interleaves
61
+ Interleave, duration : 33 ms (1.00 video frame)
62
+ Interleave, preload duration : 500 ms
63
+
64
+
65
+
66
+ NOTES:: First of all, many thanks to iNK on this release.
67
+ The property mark only comes up once near the start.
68
+ You may also notice that imdb says runtime is 94mins and this is 92:49... not sure what's missing but i can't imagine its anything important,
69
+ If you enjoy this film, make sure you go watch it when it comes out :)
70
+
71
+
72
+ ::Why Complain? Whats Free Is Free::
73
+
74
+
75
+ ::We are looking for unreleased DVD's, Screeners, New Music Releases, R5's, Audio, Cams, Silvers,
76
+ And Any Other Good Sources You Have To Offer contact us: t0xicreleases@hushmail.com
77
+
78
+ [img]http://www.leetleech.org/images/89926097132725959680.png[/img]
79
+ [img]http://www.leetleech.org/images/20830707321516885904.png[/img]
80
+ [img]http://www.leetleech.org/images/59905068333029819777.png[/img]
81
+ [img]http://www.leetleech.org/images/86171707954549470975.png[/img]
82
+ [img]http://www.leetleech.org/images/85482313172362476602.png[/img]
83
+
@@ -0,0 +1 @@
1
+ 0
@@ -0,0 +1 @@
1
+ 1
@@ -0,0 +1 @@
1
+ 10
@@ -0,0 +1 @@
1
+ 11
@@ -0,0 +1 @@
1
+ 12
@@ -0,0 +1 @@
1
+ 13
@@ -0,0 +1 @@
1
+ 14
@@ -0,0 +1 @@
1
+ 2
@@ -0,0 +1 @@
1
+ 3
@@ -0,0 +1 @@
1
+ 4
@@ -0,0 +1 @@
1
+ 5
@@ -0,0 +1 @@
1
+ 6
@@ -0,0 +1 @@
1
+ 7
@@ -0,0 +1 @@
1
+ 8
@@ -0,0 +1 @@
1
+ 9
@@ -30,6 +30,8 @@ describe MovieSearcher do
30
30
  :title => "The.Town.2010.EXTENDED.480p.BRRip.XviD-NYDIC", :iid => "tt0840361"
31
31
  }, {
32
32
  :title => "I Spit On Your Grave UNRATED 2010 DVDRip XviD-TWiZTED", :iid => "tt1242432"
33
+ },{
34
+ :title => "127 Hours 2010 DVDSCR AC3 XViD-T0XiC-iNK", :iid => "tt1542344"
33
35
  }].each do |movie|
34
36
  MovieSearcher.find_by_release_name(movie[:title]).imdb_id.should eq(movie[:iid])
35
37
  end
@@ -234,4 +236,40 @@ describe MovieSearcher, "should have a cleaner" do
234
236
  it "should not contain any -" do
235
237
  @movie.cleaner("The.Town.2010.EXTENDED.480p.BRRip.XviD-NYDIC").should_not match(/-/)
236
238
  end
239
+ end
240
+
241
+ describe MovieSearcher, "should have a working find_by_file method" do
242
+ it "should return the right imdb id, absolute path" do
243
+ MovieSearcher.find_by_file(File.expand_path(File.dirname(__FILE__)) + '/data/its.kind.of.a.funny.story.2010.dvdrip.xvid-amiable.nfo').imdb_id.should eq("tt0804497")
244
+ end
245
+
246
+ it "should not return a movie, due to the missing link in the file, relative path" do
247
+ MovieSearcher.find_by_file('spec/data/its.kind.of.a.funny.story.2010.dvdrip.xvid-amiable.nfo.bad').should be_nil
248
+ end
249
+ end
250
+
251
+ describe MovieSearcher, "should have a working find_by_folder method" do
252
+ it "should return the right imdb id, based on the name of the folder, absolute path" do
253
+ MovieSearcher.find_by_folder(File.expand_path(File.dirname(__FILE__)) + '/data/127.Hours.2010.DVDSCR.AC3.XViD-T0XiC-iNK').imdb_id.should eq("tt1542344")
254
+ end
255
+
256
+ it "should return the right imdb id, even though the directory contains some strange files, relative path" do
257
+ MovieSearcher.find_by_folder('spec/data/some_strange_name').imdb_id.should eq("tt1542344")
258
+ end
259
+
260
+ it "should raise an error if a non existing folder is given" do
261
+ lambda {
262
+ MovieSearcher.find_by_folder('folder?')
263
+ }.should raise_error(Exception)
264
+ end
265
+ end
266
+
267
+ describe MovieSearcher, "should have a working find_by_download" do
268
+ it "should work with an directoy" do
269
+ MovieSearcher.find_by_download('spec/data/some_strange_name').imdb_id.should eq("tt1542344")
270
+ end
271
+
272
+ it "should work with a file" do
273
+ MovieSearcher.find_by_download('spec/data/its.kind.of.a.funny.story.2010.dvdrip.xvid-amiable.nfo').imdb_id.should eq("tt0804497")
274
+ end
237
275
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'rspec'
2
2
  require "#{File.dirname(__FILE__)}/../lib/movie_searcher.rb"
3
- require "#{File.dirname(__FILE__)}/../lib/imdb_party/levenshtein.rb"
4
3
 
5
4
  RSpec.configure do |config|
6
5
  config.mock_with :rspec
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: movie_searcher
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease: false
4
+ hash: 27
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 8
10
- version: 0.0.8
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Linus Oleander
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-01-25 00:00:00 +01:00
19
+ date: 2011-02-02 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -34,7 +34,7 @@ dependencies:
34
34
  type: :runtime
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
37
- name: hintable_levenshtein
37
+ name: levenshteinish
38
38
  prerelease: false
39
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
40
  none: false
@@ -48,7 +48,7 @@ dependencies:
48
48
  type: :runtime
49
49
  version_requirements: *id002
50
50
  - !ruby/object:Gem::Dependency
51
- name: rspec
51
+ name: mimer_plus
52
52
  prerelease: false
53
53
  requirement: &id003 !ruby/object:Gem::Requirement
54
54
  none: false
@@ -59,10 +59,10 @@ dependencies:
59
59
  segments:
60
60
  - 0
61
61
  version: "0"
62
- type: :development
62
+ type: :runtime
63
63
  version_requirements: *id003
64
64
  - !ruby/object:Gem::Dependency
65
- name: autotest-standalone
65
+ name: rspec
66
66
  prerelease: false
67
67
  requirement: &id004 !ruby/object:Gem::Requirement
68
68
  none: false
@@ -76,7 +76,7 @@ dependencies:
76
76
  type: :development
77
77
  version_requirements: *id004
78
78
  - !ruby/object:Gem::Dependency
79
- name: autotest
79
+ name: autotest-standalone
80
80
  prerelease: false
81
81
  requirement: &id005 !ruby/object:Gem::Requirement
82
82
  none: false
@@ -90,7 +90,7 @@ dependencies:
90
90
  type: :development
91
91
  version_requirements: *id005
92
92
  - !ruby/object:Gem::Dependency
93
- name: autotest-growl
93
+ name: autotest
94
94
  prerelease: false
95
95
  requirement: &id006 !ruby/object:Gem::Requirement
96
96
  none: false
@@ -104,7 +104,7 @@ dependencies:
104
104
  type: :development
105
105
  version_requirements: *id006
106
106
  - !ruby/object:Gem::Dependency
107
- name: autotest-fsevent
107
+ name: autotest-growl
108
108
  prerelease: false
109
109
  requirement: &id007 !ruby/object:Gem::Requirement
110
110
  none: false
@@ -117,6 +117,20 @@ dependencies:
117
117
  version: "0"
118
118
  type: :development
119
119
  version_requirements: *id007
120
+ - !ruby/object:Gem::Dependency
121
+ name: autotest-fsevent
122
+ prerelease: false
123
+ requirement: &id008 !ruby/object:Gem::Requirement
124
+ none: false
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ hash: 3
129
+ segments:
130
+ - 0
131
+ version: "0"
132
+ type: :development
133
+ version_requirements: *id008
120
134
  description: IMDB client using the IMDB API that their iPhone app uses. It can also figure out what movie you are looking for just by looking at the release name of the movie
121
135
  email:
122
136
  - linus@oleander.nu
@@ -141,12 +155,29 @@ files:
141
155
  - lib/imdb_party/exclude.yaml
142
156
  - lib/imdb_party/httparty_icebox.rb
143
157
  - lib/imdb_party/imdb.rb
144
- - lib/imdb_party/levenshtein.rb
145
158
  - lib/imdb_party/movie.rb
146
159
  - lib/imdb_party/person.rb
147
160
  - lib/movie_searcher.rb
148
161
  - movie_searcher.gemspec
149
- - spec/levenshtein_spec.rb
162
+ - spec/data/127.Hours.2010.DVDSCR.AC3.XViD-T0XiC-iNK/127.Hours.2010.DVDSCR.AC3.XViD-T0XiC-iNK.nfo
163
+ - spec/data/its.kind.of.a.funny.story.2010.dvdrip.xvid-amiable.nfo
164
+ - spec/data/its.kind.of.a.funny.story.2010.dvdrip.xvid-amiable.nfo.bad
165
+ - spec/data/some_strange_name/127.Hours.2010.DVDSCR.AC3.XViD-T0XiC-iNK.nfo
166
+ - spec/data/some_strange_name/name_0
167
+ - spec/data/some_strange_name/name_1
168
+ - spec/data/some_strange_name/name_10
169
+ - spec/data/some_strange_name/name_11
170
+ - spec/data/some_strange_name/name_12
171
+ - spec/data/some_strange_name/name_13
172
+ - spec/data/some_strange_name/name_14
173
+ - spec/data/some_strange_name/name_2
174
+ - spec/data/some_strange_name/name_3
175
+ - spec/data/some_strange_name/name_4
176
+ - spec/data/some_strange_name/name_5
177
+ - spec/data/some_strange_name/name_6
178
+ - spec/data/some_strange_name/name_7
179
+ - spec/data/some_strange_name/name_8
180
+ - spec/data/some_strange_name/name_9
150
181
  - spec/movie_searcher_spec.rb
151
182
  - spec/spec_helper.rb
152
183
  has_rdoc: true
@@ -179,11 +210,29 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
210
  requirements: []
180
211
 
181
212
  rubyforge_project:
182
- rubygems_version: 1.3.7
213
+ rubygems_version: 1.5.0
183
214
  signing_key:
184
215
  specification_version: 3
185
216
  summary: IMDB client using the IMDB API that their iPhone app uses
186
217
  test_files:
187
- - spec/levenshtein_spec.rb
218
+ - spec/data/127.Hours.2010.DVDSCR.AC3.XViD-T0XiC-iNK/127.Hours.2010.DVDSCR.AC3.XViD-T0XiC-iNK.nfo
219
+ - spec/data/its.kind.of.a.funny.story.2010.dvdrip.xvid-amiable.nfo
220
+ - spec/data/its.kind.of.a.funny.story.2010.dvdrip.xvid-amiable.nfo.bad
221
+ - spec/data/some_strange_name/127.Hours.2010.DVDSCR.AC3.XViD-T0XiC-iNK.nfo
222
+ - spec/data/some_strange_name/name_0
223
+ - spec/data/some_strange_name/name_1
224
+ - spec/data/some_strange_name/name_10
225
+ - spec/data/some_strange_name/name_11
226
+ - spec/data/some_strange_name/name_12
227
+ - spec/data/some_strange_name/name_13
228
+ - spec/data/some_strange_name/name_14
229
+ - spec/data/some_strange_name/name_2
230
+ - spec/data/some_strange_name/name_3
231
+ - spec/data/some_strange_name/name_4
232
+ - spec/data/some_strange_name/name_5
233
+ - spec/data/some_strange_name/name_6
234
+ - spec/data/some_strange_name/name_7
235
+ - spec/data/some_strange_name/name_8
236
+ - spec/data/some_strange_name/name_9
188
237
  - spec/movie_searcher_spec.rb
189
238
  - spec/spec_helper.rb
@@ -1,27 +0,0 @@
1
- # Some code borrowed from http://www.erikveen.dds.nl/levenshtein/doc/index.html
2
- require 'hintable_levenshtein'
3
-
4
- class Levenshtein
5
- def self.distance(s1, s2, threshold = nil)
6
-
7
- # If the arguments is nil
8
- s1 = s1.to_s unless s1
9
- s2 = s2.to_s unless s2
10
-
11
- s1, s2 = s2, s1 if s1.length > s2.length # s1 is the short one; s2 is the long one.
12
-
13
- if s2.length == 0
14
- 0.0 # Since s1.length < s2.length, s1 must be empty as well.
15
- else
16
- if threshold
17
- if (d = HintableLevenshtein.new.distance(s1, s2).to_f/s2.length) <= threshold
18
- d
19
- else
20
- nil
21
- end
22
- else
23
- HintableLevenshtein.new.distance(s1, s2).to_f/s2.length
24
- end
25
- end
26
- end
27
- end
@@ -1,44 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Levenshtein do
4
- it "should return the right value when no threshold is being defined" do
5
- Levenshtein.distance("first", "last").should eq(0.6)
6
- end
7
-
8
- it "should return nil value when a threshold is being passed" do
9
- Levenshtein.distance("first", "last", 0.1).should be_nil
10
- end
11
-
12
- it "should not return nil value when a threshold is being passed" do
13
- Levenshtein.distance("first", "last", 0.8).should_not be_nil
14
- end
15
-
16
- it "should not change when a threshold is being passed" do
17
- Levenshtein.distance("first", "last", 0.8).should eq(0.6)
18
- end
19
-
20
- it "should be tested?" do
21
- Levenshtein.distance("first", "").should eq(1)
22
- end
23
-
24
- it "should return zero when to strings are equal" do
25
- Levenshtein.distance("abc123", "abc123").should eq(0)
26
- end
27
-
28
- it "should never return a value larger then 1" do
29
- Levenshtein.distance("asdasdasdasdasdasdasdasdasdasdasdasd", "a").should <= 1
30
- end
31
-
32
- it "should not crash if one if the arguments is nil" do
33
- lambda do
34
- Levenshtein.distance(nil, "")
35
- Levenshtein.distance(nil, nil)
36
- Levenshtein.distance("", nil)
37
- end.should_not raise_error
38
- end
39
-
40
- it "should return the same value using nil as an empty string" do
41
- Levenshtein.distance(nil, nil).should eq(Levenshtein.distance("", ""))
42
- Levenshtein.distance(nil, "Hello").should eq(Levenshtein.distance("", "Hell0"))
43
- end
44
- end