Markdown für Plex

This commit is contained in:
Akamaru 2016-08-17 21:59:58 +02:00
parent 3cddc0a122
commit 4b3ec8e72b

View File

@ -37,11 +37,11 @@ function plex:get_plex(query)
if not ok then return 'NOTOK' end if not ok then return 'NOTOK' end
local data = json.decode(table.concat(response_body))._children[1] local data = json.decode(table.concat(response_body))._children[1]
local title = data.title local title = '<b>'..data.title..'</b>'
if not title then return nil end if not title then return nil end
if data.tagline then if data.tagline then
tag = '\n"'..data.tagline..'"' tag = ' - <i>'..data.tagline..'</i>'
else else
tag = '' tag = ''
end end
@ -65,21 +65,21 @@ function plex:get_plex(query)
end end
if data.originalTitle then if data.originalTitle then
origtitle = '\nOriginal: '..data.originalTitle origtitle = '\n<b>Original:</b> '..data.originalTitle
else else
origtitle = '' origtitle = ''
end end
if data.studio then if data.studio then
studio = '\nStudio: '..data.studio studio = '\n<b>Studio:</b> '..data.studio
else else
studio = '' studio = ''
end end
if data.originallyAvailableAt then if data.originallyAvailableAt then
date = '\nAusstrahlung: '..makeOurDate(data.originallyAvailableAt) date = '\n<b>Ausstrahlung:</b> '..makeOurDate(data.originallyAvailableAt)
elseif data.year then elseif data.year then
date = '\nAusstrahlung: '..data.year date = '\n<b>Ausstrahlung:</b> '..data.year
else else
date = '' date = ''
end end
@ -91,26 +91,26 @@ function plex:get_plex(query)
end end
if data.contentRating then if data.contentRating then
fsk = '\nAltersfreigabe: '..gerRating(data.contentRating) fsk = '\n<b>Altersfreigabe:</b> '..gerRating(data.contentRating)
else else
fsk = '' fsk = ''
end end
if data.duration then if data.duration then
local totalseconds = math.floor(data.duration / 1000) local totalseconds = math.floor(data.duration / 1000)
duration = '\nLänge: '..makeHumanTime(totalseconds) duration = '\n<b>Länge:</b> '..makeHumanTime(totalseconds)
else else
duration = '' duration = ''
end end
if data.rating then if data.rating then
rating = '\nBewertung: '..data.rating rating = '\n<b>Bewertung:</b> '..data.rating
else else
rating = '' rating = ''
end end
if data.summary then if data.summary then
desc = '\n\n'..string.sub(unescape(data.summary:gsub("%b<>", "")), 1, DESC_LENTH)..'...' desc = '\n\n<i>'..string.sub(unescape(data.summary:gsub("%b<>", "")), 1, DESC_LENTH)..'...</i>'
else else
desc = '' desc = ''
end end
@ -147,7 +147,7 @@ function plex:action(msg, config)
local file = download_to_file(pic, 'plex.png') local file = download_to_file(pic, 'plex.png')
utilities.send_photo(self, msg.chat.id, file) utilities.send_photo(self, msg.chat.id, file)
end end
utilities.send_reply(self, msg, text) utilities.send_reply(self, msg, text, 'HTML')
end end
return plex return plex