diff --git a/src/library.cr b/src/library.cr index 8bacfd2..ca6ac8b 100644 --- a/src/library.cr +++ b/src/library.cr @@ -61,9 +61,9 @@ end class Title JSON.mapping dir: String, entries: Array(Entry), title: String, - id: String, encoded_title: String, mtime: Time + id: String, encoded_title: String, mtime: Time, logger: MLogger - def initialize(dir : String, storage) + def initialize(dir : String, storage, @logger : MLogger) @dir = dir @id = storage.get_id @dir, true @title = File.basename dir @@ -91,6 +91,8 @@ class Title file.close return true rescue + @logger.warn "File #{path} is corrupted or is not a valid zip "\ + "archive. Ignoring it." return false end end @@ -200,7 +202,7 @@ class Library end @titles = (Dir.entries @dir) .select { |path| File.directory? File.join @dir, path } - .map { |path| Title.new File.join(@dir, path), @storage } + .map { |path| Title.new File.join(@dir, path), @storage, @logger } .select { |title| !title.entries.empty? } .sort { |a, b| a.title <=> b.title } @logger.debug "Scan completed" diff --git a/src/mango.cr b/src/mango.cr index ceeeee5..bd57a8b 100644 --- a/src/mango.cr +++ b/src/mango.cr @@ -3,7 +3,7 @@ require "./context" require "./mangadex/*" require "option_parser" -VERSION = "0.1.0" +VERSION = "0.1.2" config_path = nil