From d3d8dff6d23074b8786ba0ee679ac1258aac7405 Mon Sep 17 00:00:00 2001 From: Alex Ling Date: Fri, 28 Feb 2020 17:37:08 +0000 Subject: [PATCH] Add MangaDex::Queue to Context --- src/context.cr | 3 ++- src/mango.cr | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) 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