Kleine Fixes beim Plex Plugin

This commit is contained in:
Akamaru 2016-02-25 19:10:29 +01:00
parent 7417683bbf
commit c557d11da2

View File

@ -27,6 +27,8 @@ local function get_plex(query)
local ok, response_code, response_headers, response_status_line = http.request(request_constructor) local ok, response_code, response_headers, response_status_line = http.request(request_constructor)
local data = json:decode(table.concat(response_body))._children[1] local data = json:decode(table.concat(response_body))._children[1]
if not data then return 'Nichts gefunden!' end
local title = data.title local title = data.title
if data.parentIndex then if data.parentIndex then
@ -77,17 +79,29 @@ local data = json:decode(table.concat(response_body))._children[1]
rating = '' rating = ''
end end
local desc = '\n\nBeschreibung: '..data.summary if data.summary then
local pic = baseurl..data.thumb desc = '\n\nBeschreibung: '..string.gsub(data.summary, 'EditBackgroundNo(.*)', '')
else
desc = ''
end
if data.thumb then
pic = baseurl..data.thumb
end
local text = title..from..origtitle..studio..date..fsk..rating..desc..'\n' local text = title..from..origtitle..studio..date..fsk..rating..desc..'\n'
if data.thumb then
return text, pic return text, pic
else
return text
end
end end
local function run(msg, matches) local function run(msg, matches)
local query = matches[1] local query = URL.escape(matches[1])
local query = string.gsub(query, ":", '%%3A' )
local query = string.gsub(query, " ", '+' ) local query = string.gsub(query, " ", '+' )
local text, pic = get_plex(query) local text, pic = get_plex(query)
local receiver = get_receiver(msg) local receiver = get_receiver(msg)