cbr_to_epub 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +35 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/cbr_to_epub.gemspec +25 -0
- data/exe/cbr_to_epub +32 -0
- data/lib/cbr_to_epub.rb +5 -0
- data/lib/cbr_to_epub/converter.rb +38 -0
- data/lib/cbr_to_epub/file_manager.rb +26 -0
- data/lib/cbr_to_epub/input/cbr_extractor.rb +21 -0
- data/lib/cbr_to_epub/input/cbz_extractor.rb +21 -0
- data/lib/cbr_to_epub/input/extractor_factory.rb +25 -0
- data/lib/cbr_to_epub/output/content/data.rb +21 -0
- data/lib/cbr_to_epub/output/content/metadata.rb +20 -0
- data/lib/cbr_to_epub/output/content/page.rb +30 -0
- data/lib/cbr_to_epub/output/epub_builder.rb +58 -0
- data/lib/cbr_to_epub/output/epub_compressor.rb +29 -0
- data/lib/cbr_to_epub/version.rb +3 -0
- data/lib/template/META-INF/container.xml +6 -0
- data/lib/template/OEBPS/content.opf.erb +23 -0
- data/lib/template/OEBPS/page.xhtml.erb +13 -0
- data/lib/template/OEBPS/style.css +12 -0
- data/lib/template/OEBPS/toc.ncx.erb +24 -0
- data/lib/template/mimetype +1 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0e5bed551d5f54c32e132f64f8d45acc2ef708da
|
4
|
+
data.tar.gz: 46f8007dc1074e7832d6d2b1445951dc79735e96
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5d47ff54bc077963bd6e13cb2d3baf5b9769019fea8e3ac3e98460196f6a35dfcb920c32577523d381c20df5d76d9dc9e60939a6275c307cf971dc10ef9b70ec
|
7
|
+
data.tar.gz: fd72ba024a0c9dfac868fe3d7e27dfc66bfc262f036703ad0469fb35d6271830670d861c2694e88e6da5a216c9b573454c2051ae46836aa74424ec5c07d28324
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Rafal Cymerys
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Cbr to Epub Converter
|
2
|
+
|
3
|
+
This gem lets you convert .cbr and .cbz comic books to epub files.
|
4
|
+
This may come in handy if you want to be able to read them on your iPad.
|
5
|
+
|
6
|
+
The tool has been written for and tested on macOS, so if you want to use it on other platforms you'll need to port Input::CbrExtractor and Output::EpubCompressor classes, as they rely on shell utilities for macOS system.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
In order to use it, make sure you have unrar installed in your system. You can do it via homebrew:
|
11
|
+
|
12
|
+
`brew install unrar`
|
13
|
+
|
14
|
+
Then install the gem:
|
15
|
+
|
16
|
+
`gem install cbr_to_epub`
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
`cbr_to_epub -i input.cbr`
|
21
|
+
|
22
|
+
You can also specify author and title for metadata that will be embedded in the epub file:
|
23
|
+
|
24
|
+
`cbr_to_epub -i input.cbr --title "Batman 1" --author "Comic Book Guy"`
|
25
|
+
|
26
|
+
Use `-o` option if you want to specify output file manually.
|
27
|
+
|
28
|
+
## Contributing
|
29
|
+
|
30
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rafalcymerys/cbr_to_epub.
|
31
|
+
|
32
|
+
## License
|
33
|
+
|
34
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
35
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "cbr_to_epub"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/cbr_to_epub.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cbr_to_epub/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cbr_to_epub'
|
8
|
+
spec.version = CbrToEpub::VERSION
|
9
|
+
spec.authors = ['Rafal Cymerys']
|
10
|
+
spec.email = ['rafal@latenightcoding.co']
|
11
|
+
|
12
|
+
spec.summary = %q{A simple gem for converting cbr files to epub}
|
13
|
+
spec.homepage = 'https://rubygems.org/gems/cbr_to_epub'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = 'exe'
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.13'
|
24
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
+
end
|
data/exe/cbr_to_epub
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require_relative '../lib/cbr_to_epub'
|
5
|
+
|
6
|
+
options = {}
|
7
|
+
OptionParser.new do |opts|
|
8
|
+
opts.banner = 'Usage: cbr_to_epub [options]'
|
9
|
+
|
10
|
+
opts.on('-i', '--input FILE', 'Input CBR file to be converted') do |input|
|
11
|
+
options[:input] = input
|
12
|
+
end
|
13
|
+
|
14
|
+
opts.on('-o', '--output FILE', 'Output EPUB file that will be created') do |output|
|
15
|
+
options[:output] = output
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.on('-a', '--author [AUTHOR]', 'Add author to metadata') do |author|
|
19
|
+
options[:author] = author
|
20
|
+
end
|
21
|
+
|
22
|
+
opts.on('-t', '--title [TITLE]', 'Add title to metadata') do |title|
|
23
|
+
options[:title] = title
|
24
|
+
end
|
25
|
+
end.parse!
|
26
|
+
|
27
|
+
raise 'No input file specified' unless options[:input]
|
28
|
+
|
29
|
+
metadata = CbrToEpub::Output::Content::Metadata.new(options[:author], options[:title])
|
30
|
+
|
31
|
+
converter = CbrToEpub::Converter.new(options[:input], options[:output] || (options[:input] + '.epub'), metadata)
|
32
|
+
converter.convert
|
data/lib/cbr_to_epub.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require_relative 'file_manager'
|
2
|
+
require_relative 'input/extractor_factory'
|
3
|
+
require_relative 'output/content/data'
|
4
|
+
require_relative 'output/content/metadata'
|
5
|
+
require_relative 'output/epub_builder'
|
6
|
+
require_relative 'output/epub_compressor'
|
7
|
+
|
8
|
+
module CbrToEpub
|
9
|
+
class Converter
|
10
|
+
def initialize(input_path, output_path, metadata)
|
11
|
+
@input_path = input_path
|
12
|
+
@output_path = output_path
|
13
|
+
@metadata = metadata
|
14
|
+
@file_manager = FileManager.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def convert
|
18
|
+
file_manager.create
|
19
|
+
extractor = Input::ExtractorFactory.new(file_manager).for_file(input_path)
|
20
|
+
input_image_files = extractor.extract
|
21
|
+
|
22
|
+
epub_builder = Output::EpubBuilder.new(file_manager, Output::Content::Data.new(metadata, input_image_files))
|
23
|
+
epub_builder.generate_metadata
|
24
|
+
epub_builder.generate_pages
|
25
|
+
epub_builder.generate_images
|
26
|
+
|
27
|
+
epub_compressor = Output::EpubCompressor.new(file_manager)
|
28
|
+
epub_compressor.compress
|
29
|
+
epub_compressor.copy(output_path)
|
30
|
+
ensure
|
31
|
+
file_manager.cleanup
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
attr_reader :input_path, :output_path, :metadata, :file_manager
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'tmpdir'
|
3
|
+
|
4
|
+
module CbrToEpub
|
5
|
+
class FileManager
|
6
|
+
attr_reader :directory
|
7
|
+
|
8
|
+
def create
|
9
|
+
@directory = Dir.mktmpdir
|
10
|
+
Dir.mkdir(extracted_directory)
|
11
|
+
Dir.mkdir(epub_directory)
|
12
|
+
end
|
13
|
+
|
14
|
+
def extracted_directory
|
15
|
+
File.join(directory, 'extracted')
|
16
|
+
end
|
17
|
+
|
18
|
+
def epub_directory
|
19
|
+
File.join(directory, 'epub')
|
20
|
+
end
|
21
|
+
|
22
|
+
def cleanup
|
23
|
+
FileUtils.rm_rf(directory)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module CbrToEpub
|
2
|
+
module Input
|
3
|
+
class CbrExtractor
|
4
|
+
def initialize(file_manager, input_path)
|
5
|
+
@file_manager = file_manager
|
6
|
+
@input_path = input_path
|
7
|
+
end
|
8
|
+
|
9
|
+
def extract
|
10
|
+
system("unrar e \"#{input_path}\" \"#{file_manager.extracted_directory}\"")
|
11
|
+
|
12
|
+
pattern = File.join(file_manager.extracted_directory, '**', '*.{jpg,jpeg,png,JPG,JPEG}')
|
13
|
+
Dir.glob(pattern).sort
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
attr_reader :file_manager, :input_path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module CbrToEpub
|
2
|
+
module Input
|
3
|
+
class CbzExtractor
|
4
|
+
def initialize(file_manager, input_path)
|
5
|
+
@file_manager = file_manager
|
6
|
+
@input_path = input_path
|
7
|
+
end
|
8
|
+
|
9
|
+
def extract
|
10
|
+
system("unzip -j \"#{input_path}\" -d \"#{file_manager.extracted_directory}\"")
|
11
|
+
|
12
|
+
pattern = File.join(file_manager.extracted_directory, '**', '*.{jpg,jpeg,png,JPG,JPEG}')
|
13
|
+
Dir.glob(pattern).sort
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
attr_reader :file_manager, :input_path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative 'cbz_extractor'
|
2
|
+
require_relative 'cbr_extractor'
|
3
|
+
|
4
|
+
module CbrToEpub
|
5
|
+
module Input
|
6
|
+
class ExtractorFactory
|
7
|
+
def initialize(file_manager)
|
8
|
+
@file_manager = file_manager
|
9
|
+
end
|
10
|
+
|
11
|
+
def for_file(file)
|
12
|
+
extension = File.extname(file)
|
13
|
+
if extension == '.cbz'
|
14
|
+
CbzExtractor.new(file_manager, file)
|
15
|
+
else
|
16
|
+
CbrExtractor.new(file_manager, file)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
attr_reader :file_manager
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
require_relative 'page'
|
3
|
+
|
4
|
+
module CbrToEpub
|
5
|
+
module Output
|
6
|
+
module Content
|
7
|
+
class Data
|
8
|
+
attr_reader :metadata, :pages
|
9
|
+
|
10
|
+
def initialize(metadata, input_image_files)
|
11
|
+
@metadata = metadata
|
12
|
+
@pages = input_image_files.each_with_index.map { |image_file, index| Page.new(index, image_file)}
|
13
|
+
end
|
14
|
+
|
15
|
+
def erb_binding
|
16
|
+
binding
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module CbrToEpub
|
2
|
+
module Output
|
3
|
+
module Content
|
4
|
+
class Metadata
|
5
|
+
DEFAULT_AUTHOR = 'Unknown'.freeze
|
6
|
+
DEFAULT_TITLE = 'Comic Book'.freeze
|
7
|
+
|
8
|
+
private_constant :DEFAULT_AUTHOR, :DEFAULT_TITLE
|
9
|
+
|
10
|
+
attr_reader :author, :title, :uuid
|
11
|
+
|
12
|
+
def initialize(author, title)
|
13
|
+
@author = author || DEFAULT_AUTHOR
|
14
|
+
@title = title || DEFAULT_TITLE
|
15
|
+
@uuid = SecureRandom.uuid
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module CbrToEpub
|
2
|
+
module Output
|
3
|
+
module Content
|
4
|
+
class Page
|
5
|
+
attr_reader :number, :input_image_file
|
6
|
+
|
7
|
+
def initialize(number, input_image_file)
|
8
|
+
@number = number
|
9
|
+
@input_image_file = input_image_file
|
10
|
+
end
|
11
|
+
|
12
|
+
def page_file
|
13
|
+
"#{number}.xhtml"
|
14
|
+
end
|
15
|
+
|
16
|
+
def image_file
|
17
|
+
"#{number}.jpg"
|
18
|
+
end
|
19
|
+
|
20
|
+
def image_media_type
|
21
|
+
'image/jpeg'
|
22
|
+
end
|
23
|
+
|
24
|
+
def erb_binding
|
25
|
+
binding
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'erb'
|
3
|
+
|
4
|
+
module CbrToEpub
|
5
|
+
module Output
|
6
|
+
class EpubBuilder
|
7
|
+
def initialize(file_manager, data)
|
8
|
+
@file_manager = file_manager
|
9
|
+
@data = data
|
10
|
+
end
|
11
|
+
|
12
|
+
def generate_metadata
|
13
|
+
Dir.mkdir(File.join(output_directory, 'META-INF'))
|
14
|
+
Dir.mkdir(File.join(output_directory, 'OEBPS'))
|
15
|
+
|
16
|
+
copy_template('mimetype')
|
17
|
+
copy_template('META-INF/container.xml')
|
18
|
+
copy_template('OEBPS/style.css')
|
19
|
+
render_template('OEBPS/content.opf', data)
|
20
|
+
render_template('OEBPS/toc.ncx', data)
|
21
|
+
end
|
22
|
+
|
23
|
+
def generate_pages
|
24
|
+
data.pages.each do |page|
|
25
|
+
render_template('OEBPS/page.xhtml', page, output_file_name = File.join('OEBPS', page.page_file))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def generate_images
|
30
|
+
data.pages.each do |page|
|
31
|
+
FileUtils.copy(page.input_image_file, File.join(output_directory, 'OEBPS/', page.image_file))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
attr_reader :file_manager, :data
|
38
|
+
|
39
|
+
def copy_template(file_name)
|
40
|
+
FileUtils.copy(File.join(template_directory, file_name), File.join(output_directory, file_name))
|
41
|
+
end
|
42
|
+
|
43
|
+
def render_template(file_name, bind_object, output_file_name = nil)
|
44
|
+
template = File.read(File.join(template_directory, file_name + '.erb'))
|
45
|
+
rendered_template = ERB.new(template).result(bind_object.erb_binding)
|
46
|
+
File.write(File.join(output_directory, output_file_name || file_name), rendered_template)
|
47
|
+
end
|
48
|
+
|
49
|
+
def template_directory
|
50
|
+
File.join(__dir__, '../../template/')
|
51
|
+
end
|
52
|
+
|
53
|
+
def output_directory
|
54
|
+
file_manager.epub_directory
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module CbrToEpub
|
4
|
+
module Output
|
5
|
+
class EpubCompressor
|
6
|
+
def initialize(file_manager)
|
7
|
+
@file_manager = file_manager
|
8
|
+
end
|
9
|
+
|
10
|
+
def compress
|
11
|
+
# mimetype needs to be the first file in epub archive
|
12
|
+
system("cd \"#{file_manager.epub_directory}\" && zip -0 -rX \"#{zip_path}\" mimetype")
|
13
|
+
system("cd \"#{file_manager.epub_directory}\" && zip -0 -rX \"#{zip_path}\" * -x mimetype")
|
14
|
+
end
|
15
|
+
|
16
|
+
def copy(path)
|
17
|
+
FileUtils.copy(zip_path, path)
|
18
|
+
end
|
19
|
+
|
20
|
+
def zip_path
|
21
|
+
File.join(file_manager.directory, 'output.epub')
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
attr_reader :file_manager
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="BookID" version="2.0">
|
3
|
+
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
|
4
|
+
<dc:title><%= metadata.title %></dc:title>
|
5
|
+
<dc:creator opf:role="aut"><%= metadata.author %></dc:creator>
|
6
|
+
<dc:language>en</dc:language>
|
7
|
+
<dc:identifier id="BookID" opf:scheme="URN"><%= metadata.uuid %></dc:identifier>
|
8
|
+
<meta name="cover" content="image_0"/>
|
9
|
+
</metadata>
|
10
|
+
<manifest>
|
11
|
+
<item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml"/>
|
12
|
+
<item id="css" href="style.css" media-type="text/css"/>
|
13
|
+
<% pages.each do |page| %>
|
14
|
+
<item id="page_<%= page.number %>" href="<%= page.page_file %>" media-type="application/xhtml+xml"/>
|
15
|
+
<item id="image_<%= page.number %>" href="<%= page.image_file %>" media-type="<%= page.image_media_type %>"/>
|
16
|
+
<% end %>
|
17
|
+
</manifest>
|
18
|
+
<spine toc="ncx">
|
19
|
+
<% pages.each do |page| %>
|
20
|
+
<itemref idref="page_<%= page.number %>"/>
|
21
|
+
<% end %>
|
22
|
+
</spine>
|
23
|
+
</package>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:epub="http://www.idpf.org/2007/ops">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
5
|
+
<title>Comic Book</title>
|
6
|
+
<link rel="stylesheet" href="style.css"/>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<div id="comic-book-page">
|
10
|
+
<img class="image" src="<%= image_file %>" alt="Page"/>
|
11
|
+
</div>
|
12
|
+
</body>
|
13
|
+
</html>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN"
|
2
|
+
"http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">
|
3
|
+
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
|
4
|
+
<head>
|
5
|
+
<meta name="dtb:uid"
|
6
|
+
content="<%= metadata.uuid %>>"/>
|
7
|
+
<meta name="dtb:depth" content="1"/>
|
8
|
+
<meta name="dtb:totalPageCount" content="<%= pages.size %>"/>
|
9
|
+
<meta name="dtb:maxPageNumber" content="<%= pages.size %>"/>
|
10
|
+
</head>
|
11
|
+
<docTitle>
|
12
|
+
<text><%= metadata.title %></text>
|
13
|
+
</docTitle>
|
14
|
+
<navMap>
|
15
|
+
<% pages.each do |page| %>
|
16
|
+
<navPoint id="navPoint-<%= page.number %>" playOrder="<%= page.number %>">
|
17
|
+
<navLabel>
|
18
|
+
<text>Page <%= page.number %></text>
|
19
|
+
</navLabel>
|
20
|
+
<content src="<%= page.page_file %>"/>
|
21
|
+
</navPoint>
|
22
|
+
<% end %>
|
23
|
+
</navMap>
|
24
|
+
</ncx>
|
@@ -0,0 +1 @@
|
|
1
|
+
application/epub+zip
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cbr_to_epub
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rafal Cymerys
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-02-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.13'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.13'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- rafal@latenightcoding.co
|
44
|
+
executables:
|
45
|
+
- cbr_to_epub
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- bin/console
|
55
|
+
- bin/setup
|
56
|
+
- cbr_to_epub.gemspec
|
57
|
+
- exe/cbr_to_epub
|
58
|
+
- lib/cbr_to_epub.rb
|
59
|
+
- lib/cbr_to_epub/converter.rb
|
60
|
+
- lib/cbr_to_epub/file_manager.rb
|
61
|
+
- lib/cbr_to_epub/input/cbr_extractor.rb
|
62
|
+
- lib/cbr_to_epub/input/cbz_extractor.rb
|
63
|
+
- lib/cbr_to_epub/input/extractor_factory.rb
|
64
|
+
- lib/cbr_to_epub/output/content/data.rb
|
65
|
+
- lib/cbr_to_epub/output/content/metadata.rb
|
66
|
+
- lib/cbr_to_epub/output/content/page.rb
|
67
|
+
- lib/cbr_to_epub/output/epub_builder.rb
|
68
|
+
- lib/cbr_to_epub/output/epub_compressor.rb
|
69
|
+
- lib/cbr_to_epub/version.rb
|
70
|
+
- lib/template/META-INF/container.xml
|
71
|
+
- lib/template/OEBPS/content.opf.erb
|
72
|
+
- lib/template/OEBPS/page.xhtml.erb
|
73
|
+
- lib/template/OEBPS/style.css
|
74
|
+
- lib/template/OEBPS/toc.ncx.erb
|
75
|
+
- lib/template/mimetype
|
76
|
+
homepage: https://rubygems.org/gems/cbr_to_epub
|
77
|
+
licenses:
|
78
|
+
- MIT
|
79
|
+
metadata: {}
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 2.5.1
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: A simple gem for converting cbr files to epub
|
100
|
+
test_files: []
|
101
|
+
has_rdoc:
|