From 0ccf89e7ba156be8a6bd8327e5409c20e546b8c7 Mon Sep 17 00:00:00 2001 From: Akamaru Date: Tue, 23 Aug 2016 17:08:21 +0200 Subject: [PATCH] Text spezifisch je nach Art --- miku/bot.lua | 2 +- miku/plugins/plex.lua | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/miku/bot.lua b/miku/bot.lua index 7f0b9de..e6c69e5 100644 --- a/miku/bot.lua +++ b/miku/bot.lua @@ -3,7 +3,7 @@ local bot = {} bindings = require('miku.bindings') utilities = require('miku.utilities') -bot.version = '160816' +bot.version = '160823' function bot:init(config) -- The function run when the bot is started or reloaded. cred_data = load_cred() diff --git a/miku/plugins/plex.lua b/miku/plugins/plex.lua index f7c5fa9..69f2893 100644 --- a/miku/plugins/plex.lua +++ b/miku/plugins/plex.lua @@ -57,6 +57,12 @@ function plex:get_plex(query) episode = '' end + if data.parentTitle then + artist = ''..data.parentTitle..'' + else + artist = '' + end + if data.grandparentTitle then from = ' (aus '..data.grandparentTitle..' ['..string.gsub(season..episode, 'S0E', 'SP')..']'..') ' else @@ -76,9 +82,9 @@ function plex:get_plex(query) end if data.originallyAvailableAt then - date = '\nAusstrahlung: '..makeOurDate(data.originallyAvailableAt) + date = makeOurDate(data.originallyAvailableAt) elseif data.year then - date = '\nAusstrahlung: '..data.year + date = data.year else date = '' end @@ -128,7 +134,17 @@ function plex:get_plex(query) pic = nil end - local text = title..tag..from..origtitle..studio..date..episodes..fsk..duration..rating..desc + if data.librarySectionTitle == 'Animes' then + text = title..from..studio..'\nAusstrahlung: '..date..episodes..fsk..duration..rating..desc + elseif data.librarySectionTitle == 'Cartoons' then + text = title..from..studio..'\nAusstrahlung: '..date..episodes..fsk..duration..rating..desc + elseif data.librarySectionTitle == 'Filme' then + text = title..tag..origtitle..studio..'\nVeröffentlicht: '..date..fsk..duration..rating..desc + elseif data.librarySectionTitle == 'Musik' then + text = title..' von '..artist..'\nVeröffentlicht: '..date + elseif data.librarySectionTitle == 'Serien' then + text = title..from..studio..'\nAusstrahlung: '..date..episodes..fsk..duration..rating..desc + end if string.match(title, 'Local Network') then return 'Nichts gefunden!'