mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 11:25:29 -04:00
Formatting in mangadex/api.cr
This commit is contained in:
parent
f8e0c6d795
commit
28ac5c7a00
@ -25,7 +25,8 @@ module MangaDex
|
|||||||
property pages = [] of {String, String} # filename, url
|
property pages = [] of {String, String} # filename, url
|
||||||
property groups = [] of {Int32, String} # group_id, group_name
|
property groups = [] of {Int32, String} # group_id, group_name
|
||||||
|
|
||||||
def initialize(@id, json_obj : JSON::Any, @manga, lang : Hash(String, String))
|
def initialize(@id, json_obj : JSON::Any, @manga, lang :
|
||||||
|
Hash(String, String))
|
||||||
self.parse_json json_obj, lang
|
self.parse_json json_obj, lang
|
||||||
end
|
end
|
||||||
def to_info_json
|
def to_info_json
|
||||||
@ -147,12 +148,12 @@ module MangaDex
|
|||||||
raise "" if obj["status"] != "OK"
|
raise "" if obj["status"] != "OK"
|
||||||
server = obj["server"].as_s
|
server = obj["server"].as_s
|
||||||
hash = obj["hash"].as_s
|
hash = obj["hash"].as_s
|
||||||
chapter.pages = obj["page_array"].as_a.map{|fn|
|
chapter.pages = obj["page_array"].as_a.map do |fn|
|
||||||
{
|
{
|
||||||
fn.as_s,
|
fn.as_s,
|
||||||
"#{server}#{hash}/#{fn.as_s}"
|
"#{server}#{hash}/#{fn.as_s}"
|
||||||
}
|
}
|
||||||
}
|
end
|
||||||
rescue
|
rescue
|
||||||
raise "Failed to parse JSON"
|
raise "Failed to parse JSON"
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user