entangledstate-isbn 1.2.0 → 1.3.0
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 +1 -10
- data/VERSION.yml +2 -2
- data/isbn.gemspec +2 -2
- data/lib/isbn.rb +10 -1
- metadata +2 -2
data/Rakefile
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/testtask'
|
3
3
|
require 'rake/rdoctask'
|
4
|
-
require 'rcov/rcovtask'
|
5
4
|
|
6
5
|
begin
|
7
6
|
require 'jeweler'
|
@@ -29,12 +28,4 @@ Rake::RDocTask.new do |rdoc|
|
|
29
28
|
rdoc.options << '--line-numbers' << '--inline-source'
|
30
29
|
rdoc.rdoc_files.include('README*')
|
31
30
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
32
|
-
end
|
33
|
-
|
34
|
-
Rcov::RcovTask.new do |t|
|
35
|
-
t.libs << 'test'
|
36
|
-
t.test_files = FileList['test/**/*_test.rb']
|
37
|
-
t.verbose = true
|
38
|
-
end
|
39
|
-
|
40
|
-
task :default => :rcov
|
31
|
+
end
|
data/VERSION.yml
CHANGED
data/isbn.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{isbn}
|
5
|
-
s.version = "1.
|
5
|
+
s.version = "1.3.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Tim Kersey"]
|
9
|
-
s.date = %q{2009-06-
|
9
|
+
s.date = %q{2009-06-08}
|
10
10
|
s.description = %q{library to transform ISBN's from new to used, between 10 and 13, etc...}
|
11
11
|
s.email = %q{entangledstate@gmail.com}
|
12
12
|
s.extra_rdoc_files = [
|
data/lib/isbn.rb
CHANGED
@@ -73,7 +73,16 @@ module ISBN
|
|
73
73
|
rescue InvalidISBNError => isbn_error
|
74
74
|
false
|
75
75
|
end
|
76
|
-
|
76
|
+
end
|
77
|
+
|
78
|
+
def from_image(url)
|
79
|
+
require "image_science"
|
80
|
+
require "open-uri"
|
81
|
+
tmpfile = "#{Time.now.nsec}.pbm"
|
82
|
+
ImageScience.with_image_from_memory(open(url, "rb:binary").read) {|i| i.save tmpfile}
|
83
|
+
isbn = %x{gocr -i #{tmpfile}}.strip.gsub(" ", "").gsub(/o/i, "0").gsub("_", "2").gsub(/2J$/, "45")
|
84
|
+
File.delete(tmpfile)
|
85
|
+
isbn
|
77
86
|
end
|
78
87
|
|
79
88
|
class InvalidISBNError < RuntimeError
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: entangledstate-isbn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Kersey
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-08 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|