kindle_strip 0.0.1 → 0.0.2

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/README.md CHANGED
@@ -27,3 +27,12 @@ Or install it yourself as:
27
27
  3. Commit your changes (`git commit -am 'Add some feature'`)
28
28
  4. Push to the branch (`git push origin my-new-feature`)
29
29
  5. Create new Pull Request
30
+
31
+ ## Specifications
32
+
33
+ - http://wiki.mobileread.com/wiki/PDB
34
+ - http://wiki.mobileread.com/wiki/MOBI
35
+
36
+ ## Referenced
37
+
38
+ - http://www.mobileread.com/forums/showthread.php?t=96903
@@ -4,13 +4,11 @@ $LOAD_PATH << File.expand_path("../lib", File.dirname(__FILE__))
4
4
 
5
5
  require "kindle_strip"
6
6
 
7
- include KindleStrip
8
-
9
7
  if ARGV.length == 2
10
8
  File.open(ARGV[0], "rb") do |src|
11
9
  buf = src.read
12
10
  File.open(ARGV[1], "wb") do |dest|
13
- dest.write(strip_srcs(buf))
11
+ dest.write(KindleStrip.strip_srcs(buf))
14
12
  end
15
13
  end
16
14
  else
@@ -5,6 +5,8 @@ module KindleStrip
5
5
  OFFSET_NUMBER_OF_RECORDS = 76
6
6
  OFFSET_RECORD_INFO = 78
7
7
 
8
+ extend self
9
+
8
10
  def strip_srcs(input)
9
11
  if input[0x3c, 8] != "BOOKMOBI"
10
12
  raise "MobiPocket marker not found"
@@ -73,7 +75,7 @@ module KindleStrip
73
75
 
74
76
  def make_padding(output)
75
77
  record_offset = uint32_be(output, OFFSET_RECORD_INFO)
76
- [].pack("x#{record_offset - output.length}") # padding by NUL
78
+ "\0" * (record_offset - output.length) # padding by NUL
77
79
  end
78
80
  private :make_padding
79
81
 
@@ -1,3 +1,3 @@
1
1
  module KindleStrip
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kindle_strip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-02 00:00:00.000000000 Z
12
+ date: 2012-12-26 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Strip SRCS records from .mobi
15
15
  email: