diff --git a/src/context.cr b/src/context.cr index e0f34ac..a6dfec4 100644 --- a/src/context.cr +++ b/src/context.cr @@ -8,8 +8,9 @@ class Context property library : Library property storage : Storage property logger : MLogger + property queue : MangaDex::Queue - def initialize(@config, @logger, @library, @storage) + def initialize(@config, @logger, @library, @storage, @queue) end {% for lvl in LEVELS %} diff --git a/src/mango.cr b/src/mango.cr index 38616ff..ceeeee5 100644 --- a/src/mango.cr +++ b/src/mango.cr @@ -1,5 +1,6 @@ require "./server" require "./context" +require "./mangadex/*" require "option_parser" VERSION = "0.1.0" @@ -27,8 +28,11 @@ config = Config.load config_path logger = MLogger.new config storage = Storage.new config.db_path, logger library = Library.new config.library_path, config.scan_interval, logger, storage +queue = MangaDex::Queue.new config.mangadex["download_queue_db_path"].to_s +api = MangaDex::API.new config.mangadex["api_url"].to_s +downloader = MangaDex::Downloader.new queue, api, config.library_path, config.mangadex["download_wait_seconds"].to_i, config.mangadex["download_retries"].to_i -context = Context.new config, logger, library, storage +context = Context.new config, logger, library, storage, queue server = Server.new context server.start