MyAnimeList Plugin angepasst
This commit is contained in:
parent
41cb630710
commit
956e3241aa
@ -46,8 +46,14 @@ end
|
|||||||
local makeOurDate = function(dateString)
|
local makeOurDate = function(dateString)
|
||||||
local pattern = "(%d+)%-(%d+)%-(%d+)"
|
local pattern = "(%d+)%-(%d+)%-(%d+)"
|
||||||
local year, month, day = dateString:match(pattern)
|
local year, month, day = dateString:match(pattern)
|
||||||
|
if month == "00" then
|
||||||
|
return year
|
||||||
|
elseif day == "00" then
|
||||||
|
return month..'.'..year
|
||||||
|
else
|
||||||
return day..'.'..month..'.'..year
|
return day..'.'..month..'.'..year
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function mal:get_mal_info(query, typ)
|
function mal:get_mal_info(query, typ)
|
||||||
if typ == 'anime' then
|
if typ == 'anime' then
|
||||||
@ -62,20 +68,26 @@ function mal:get_mal_info(query, typ)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function mal:send_anime_data(result, receiver)
|
function mal:send_anime_data(result, receiver)
|
||||||
local title = xml.find(result, 'title')[1]
|
local title = '*'..xml.find(result, 'title')[1]..'*'
|
||||||
local id = xml.find(result, 'id')[1]
|
local id = xml.find(result, 'id')[1]
|
||||||
local mal_url = 'http://myanimelist.net/anime/'..id
|
local mal_url = 'http://myanimelist.net/anime/'..id
|
||||||
|
|
||||||
if xml.find(result, 'synonyms')[1] then
|
if xml.find(result, 'type')[1] then
|
||||||
alt_name = '\noder: '..unescape(mal:delete_tags(xml.find(result, 'synonyms')[1]))
|
typ = ' ('..xml.find(result, 'type')[1]..')'
|
||||||
else
|
else
|
||||||
alt_name = ''
|
typ = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
if xml.find(result, 'synopsis')[1] then
|
if xml.find(result, 'english')[1] then
|
||||||
desc = '\n'..unescape(mal:delete_tags(string.sub(xml.find(result, 'synopsis')[1], 1, 200))) .. '...'
|
eng = '\nEnglisch: *'..xml.find(result, 'english')[1]..'*'
|
||||||
else
|
else
|
||||||
desc = ''
|
eng = ''
|
||||||
|
end
|
||||||
|
|
||||||
|
if xml.find(result, 'synonyms')[1] then
|
||||||
|
syno = '\nAlternativ: *'..xml.find(result, 'synonyms')[1]..'*'
|
||||||
|
else
|
||||||
|
syno = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
if xml.find(result, 'episodes')[1] then
|
if xml.find(result, 'episodes')[1] then
|
||||||
@ -96,14 +108,8 @@ function mal:send_anime_data(result, receiver)
|
|||||||
score = ''
|
score = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
if xml.find(result, 'type')[1] then
|
|
||||||
typ = '\nTyp: '..xml.find(result, 'type')[1]
|
|
||||||
else
|
|
||||||
typ = ''
|
|
||||||
end
|
|
||||||
|
|
||||||
if xml.find(result, 'start_date')[1] ~= "0000-00-00" then
|
if xml.find(result, 'start_date')[1] ~= "0000-00-00" then
|
||||||
startdate = '\nVeröffentlichungszeitraum: '..makeOurDate(xml.find(result, 'start_date')[1])
|
startdate = '\nAusstrahlung: '..makeOurDate(xml.find(result, 'start_date')[1])
|
||||||
else
|
else
|
||||||
startdate = ''
|
startdate = ''
|
||||||
end
|
end
|
||||||
@ -114,7 +120,14 @@ function mal:send_anime_data(result, receiver)
|
|||||||
enddate = ''
|
enddate = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
local text = '*'..title..'*'..alt_name..typ..episodes..status..score..startdate..enddate..'_'..desc..'_\n[Auf MyAnimeList ansehen]('..mal_url..')'
|
if xml.find(result, 'synopsis')[1] then
|
||||||
|
desc = '\n_'..unescape(mal:delete_tags(string.sub(xml.find(result, 'synopsis')[1], 1, 250)))..'..._'
|
||||||
|
else
|
||||||
|
desc = ''
|
||||||
|
end
|
||||||
|
|
||||||
|
local text = title..typ..eng..syno..episodes..status..score..startdate..enddate..'\n'..desc..'\n[Auf MyAnimeList ansehen]('..mal_url..')'
|
||||||
|
|
||||||
if xml.find(result, 'image') then
|
if xml.find(result, 'image') then
|
||||||
local image_url = xml.find(result, 'image')[1]
|
local image_url = xml.find(result, 'image')[1]
|
||||||
return text, image_url
|
return text, image_url
|
||||||
|
Reference in New Issue
Block a user