From bb563826fa51eeaaf456077d19fb561408c44b6a Mon Sep 17 00:00:00 2001 From: Arcidayne <9382522b@opayq.com> Date: Wed, 16 Mar 2016 17:16:30 -0400 Subject: [PATCH] More bug fixes --- Epic_Calendar/Epic_Calendar.xml | 46 ++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/Epic_Calendar/Epic_Calendar.xml b/Epic_Calendar/Epic_Calendar.xml index 4a15791..f34648c 100644 --- a/Epic_Calendar/Epic_Calendar.xml +++ b/Epic_Calendar/Epic_Calendar.xml @@ -66,6 +66,7 @@ function OnPluginInstall() SetEpicDebug = 0 just_today = 0 not_found = 0 + update_only = 1 PLUGIN_VERSION = GetPluginInfo(GetPluginID(), 19) PLUGIN_NAME = GetPluginInfo(GetPluginID(), 1) @@ -84,7 +85,7 @@ end -- Update code -- function update_plugin() - local raw = "https://raw.githubusercontent.com/Arcidayne/Aardwolf-Scripts/master/Epic_Calendar/Epic_Calendar.xml" + raw = "https://raw.githubusercontent.com/Arcidayne/Aardwolf-Scripts/master/Epic_Calendar/Epic_Calendar.xml" async_ok, async = pcall (require, "async") @@ -184,36 +185,39 @@ function get_cal(epic) calid = epic_list.all elseif epic:lower() == "update" then update_plugin() + update_only = 1 else not_found = 1 end - if not_found == 0 then - offset_utc, string_offset = os.difftime(os.time(os.date("*t")), os.time(os.date("!*t"))), "" + if update_only == 0 then + if not_found == 0 then + offset_utc, string_offset = os.difftime(os.time(os.date("*t")), os.time(os.date("!*t"))), "" - if offset_utc < 0 then - string_offset = "-" .. string.format("%02d", (offset_utc*-1)/3600) .. ":00" - else - string_offset = "%2b" .. string.format("%02d", math.floor(offset_utc/3600)) .. ":00" - end + if offset_utc < 0 then + string_offset = "-" .. string.format("%02d", (offset_utc*-1)/3600) .. ":00" + else + string_offset = "%2b" .. string.format("%02d", math.floor(offset_utc/3600)) .. ":00" + end - timeMin = os.date("%Y-%m-%dT%H:%M:%S", os.time()) .. string_offset + timeMin = os.date("%Y-%m-%dT%H:%M:%S", os.time()) .. string_offset - if just_today == 1 then - rpage = "https://www.googleapis.com/calendar/v3/calendars/" .. calid .. "/events?key=" .. key .. "&timeMin=" .. timeMin .. "&timeMax=" .. timeMax - just_today = 0 - else - rpage = "https://www.googleapis.com/calendar/v3/calendars/" .. calid .. "/events?key=" .. key .. "&timeMin=" .. timeMin - end + if just_today == 1 then + rpage = "https://www.googleapis.com/calendar/v3/calendars/" .. calid .. "/events?key=" .. key .. "&timeMin=" .. timeMin .. "&timeMax=" .. timeMax + just_today = 0 + else + rpage = "https://www.googleapis.com/calendar/v3/calendars/" .. calid .. "/events?key=" .. key .. "&timeMin=" .. timeMin + end - if async_ok then - epage = async.doAsyncRemoteRequest(rpage, get_results, "HTTPS") + if async_ok then + epage = async.doAsyncRemoteRequest(rpage, get_results, "HTTPS") + else + ColourNote("white", "blue", "Epic Calendar Error: Please try again. If problem persists, please contact Arcidayne.") + end else - ColourNote("white", "blue", "Epic Calendar Error: Please try again. If problem persists, please contact Arcidayne.") + ColourNote("cyan", "", "Epic Calendar Error: ", "white", "", "Valid choices are: IF/Icefall, Inferno, OC, Genie, All, Today") + epage, starttime, summary, not_found = nil, nil, nil, 0 end - else - ColourNote("cyan", "", "Epic Calendar Error: ", "white", "", "Valid choices are: IF/Icefall, Inferno, OC, Genie, All, Today") - epage, starttime, summary, not_found = nil, nil, nil, 0 end end