mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 11:25:29 -04:00
Move common code to Queue::Downloader
This commit is contained in:
parent
ae7c72ab85
commit
b75a838e14
@ -3,12 +3,9 @@ require "zip"
|
|||||||
|
|
||||||
module MangaDex
|
module MangaDex
|
||||||
class Downloader < Queue::Downloader
|
class Downloader < Queue::Downloader
|
||||||
property stopped = false
|
|
||||||
@wait_seconds : Int32 = Config.current.mangadex["download_wait_seconds"]
|
@wait_seconds : Int32 = Config.current.mangadex["download_wait_seconds"]
|
||||||
.to_i32
|
.to_i32
|
||||||
@retries : Int32 = Config.current.mangadex["download_retries"].to_i32
|
@retries : Int32 = Config.current.mangadex["download_retries"].to_i32
|
||||||
@library_path : String = Config.current.library_path
|
|
||||||
@downloading = false
|
|
||||||
|
|
||||||
def self.default : self
|
def self.default : self
|
||||||
unless @@default
|
unless @@default
|
||||||
@ -18,9 +15,8 @@ module MangaDex
|
|||||||
end
|
end
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@queue = Queue.default
|
super
|
||||||
@api = API.default
|
@api = API.default
|
||||||
@queue << self
|
|
||||||
|
|
||||||
spawn do
|
spawn do
|
||||||
loop do
|
loop do
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
class Plugin
|
class Plugin
|
||||||
class Downloader < Queue::Downloader
|
class Downloader < Queue::Downloader
|
||||||
@library_path : String = Config.current.library_path
|
|
||||||
@downloading = false
|
|
||||||
|
|
||||||
def self.default : self
|
def self.default : self
|
||||||
unless @@default
|
unless @@default
|
||||||
@ -11,8 +9,7 @@ class Plugin
|
|||||||
end
|
end
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@queue = Queue.default
|
super
|
||||||
@queue << self
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
require "sqlite3"
|
require "sqlite3"
|
||||||
|
require "./util/*"
|
||||||
|
|
||||||
class Queue
|
class Queue
|
||||||
class Downloader
|
class Downloader
|
||||||
property stopped = false
|
property stopped = false
|
||||||
|
@library_path : String = Config.current.library_path
|
||||||
|
@downloading = false
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
@queue = Queue.default
|
||||||
|
@queue << self
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class PageJob
|
class PageJob
|
||||||
|
Loading…
x
Reference in New Issue
Block a user