- cbz support

This commit is contained in:
Alex Ling 2020-02-17 01:12:40 +00:00
parent ec09a1b381
commit 2cbb719855
2 changed files with 5 additions and 2 deletions

View File

@ -17,3 +17,6 @@
#scan-status {
cursor: auto;
}
.uk-card-title {
word-wrap: break-word;
}

View File

@ -18,7 +18,7 @@ class Entry
def initialize(path, @book_title)
@zip_path = path
@title = File.basename path, ".zip"
@title = File.basename path, File.extname path
@size = (File.size path).humanize_bytes
@pages = Zip::File.new(path).entries
.select { |e|
@ -57,7 +57,7 @@ class Title
@dir = dir
@title = File.basename dir
@entries = (Dir.entries dir)
.select { |path| (File.extname path) == ".zip" }
.select { |path| [".zip", ".cbz"].includes? File.extname path }
.map { |path| Entry.new File.join(dir, path), @title }
.select { |e| e.pages > 0 }
.sort { |a, b| a.title <=> b.title }