mobi 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/mobi/metadata.rb +11 -0
- data/mobi.gemspec +65 -0
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/mobi/metadata.rb
CHANGED
@@ -6,6 +6,7 @@ module Mobi
|
|
6
6
|
106 => :published_at, 107 => :review, 108 => :contributor, 109 => :rights, 110 => :subject_code,
|
7
7
|
111 => :type, 112 => :source, 113 => :asin, 114 => :version}
|
8
8
|
attr_reader *EXTH_RECORDS.values
|
9
|
+
attr_reader :title
|
9
10
|
|
10
11
|
attr_accessor :stream, :data, :mobi, :exth
|
11
12
|
attr_reader :exth_records
|
@@ -16,6 +17,9 @@ module Mobi
|
|
16
17
|
@exth_records = []
|
17
18
|
return unless bookmobi?
|
18
19
|
@mobi = mobi_stream
|
20
|
+
|
21
|
+
@title = read_title
|
22
|
+
|
19
23
|
@exth = exth_stream
|
20
24
|
|
21
25
|
store_mobi_data
|
@@ -37,6 +41,13 @@ module Mobi
|
|
37
41
|
StreamSlicer.new(stream, exth_off, @mobi.stop)
|
38
42
|
end
|
39
43
|
|
44
|
+
def read_title
|
45
|
+
offset, = @mobi[84, 4].unpack('N*')
|
46
|
+
puts offset
|
47
|
+
length, = @mobi[88, 4].unpack('N*')
|
48
|
+
@mobi[offset.to_i, length.to_i]
|
49
|
+
end
|
50
|
+
|
40
51
|
def store_mobi_data
|
41
52
|
record_count, = @exth[8, 4].unpack('N*')
|
42
53
|
start = 12
|
data/mobi.gemspec
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{mobi}
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["jkongie"]
|
12
|
+
s.date = %q{2011-04-09}
|
13
|
+
s.description = %q{Mobi is a Rubygem that allows you to easily read MOBI e-book format metadata }
|
14
|
+
s.email = %q{jkongie@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"lib/mobi.rb",
|
28
|
+
"lib/mobi/metadata.rb",
|
29
|
+
"lib/mobi/stream_slicer.rb",
|
30
|
+
"mobi.gemspec",
|
31
|
+
"test/helper.rb",
|
32
|
+
"test/test_mobi.rb"
|
33
|
+
]
|
34
|
+
s.homepage = %q{http://github.com/jkongie/mobi}
|
35
|
+
s.licenses = ["MIT"]
|
36
|
+
s.require_paths = ["lib"]
|
37
|
+
s.rubygems_version = %q{1.6.2}
|
38
|
+
s.summary = %q{A Rubygem that inspects MOBI metadata}
|
39
|
+
s.test_files = [
|
40
|
+
"test/helper.rb",
|
41
|
+
"test/test_mobi.rb"
|
42
|
+
]
|
43
|
+
|
44
|
+
if s.respond_to? :specification_version then
|
45
|
+
s.specification_version = 3
|
46
|
+
|
47
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
48
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
49
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
50
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
|
51
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
54
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
55
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
56
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
57
|
+
end
|
58
|
+
else
|
59
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
60
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
61
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
62
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: mobi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- jkongie
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- lib/mobi.rb
|
78
78
|
- lib/mobi/metadata.rb
|
79
79
|
- lib/mobi/stream_slicer.rb
|
80
|
+
- mobi.gemspec
|
80
81
|
- test/helper.rb
|
81
82
|
- test/test_mobi.rb
|
82
83
|
has_rdoc: true
|
@@ -93,7 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
93
94
|
requirements:
|
94
95
|
- - ">="
|
95
96
|
- !ruby/object:Gem::Version
|
96
|
-
hash: -
|
97
|
+
hash: -4366855236519816057
|
97
98
|
segments:
|
98
99
|
- 0
|
99
100
|
version: "0"
|