Kleine Fixes beim Plex Plugin

This commit is contained in:
Akamaru 2016-02-25 19:10:29 +01:00
parent 7417683bbf
commit c557d11da2
1 changed files with 19 additions and 5 deletions

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 data = json:decode(table.concat(response_body))._children[1]
if not data then return 'Nichts gefunden!' end
local title = data.title
if data.parentIndex then
@ -77,17 +79,29 @@ local data = json:decode(table.concat(response_body))._children[1]
rating = ''
end
local desc = '\n\nBeschreibung: '..data.summary
local pic = baseurl..data.thumb
if data.summary then
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'
return text, pic
if data.thumb then
return text, pic
else
return text
end
end
local function run(msg, matches)
local query = matches[1]
local query = string.gsub(query, ":", '%%3A' )
local query = URL.escape(matches[1])
local query = string.gsub(query, " ", '+' )
local text, pic = get_plex(query)
local receiver = get_receiver(msg)