|
|
@ -66,6 +66,7 @@ function OnPluginInstall()
|
|
|
|
SetEpicDebug = 0
|
|
|
|
SetEpicDebug = 0
|
|
|
|
just_today = 0
|
|
|
|
just_today = 0
|
|
|
|
not_found = 0
|
|
|
|
not_found = 0
|
|
|
|
|
|
|
|
update_only = 1
|
|
|
|
PLUGIN_VERSION = GetPluginInfo(GetPluginID(), 19)
|
|
|
|
PLUGIN_VERSION = GetPluginInfo(GetPluginID(), 19)
|
|
|
|
PLUGIN_NAME = GetPluginInfo(GetPluginID(), 1)
|
|
|
|
PLUGIN_NAME = GetPluginInfo(GetPluginID(), 1)
|
|
|
|
|
|
|
|
|
|
|
@ -84,7 +85,7 @@ end
|
|
|
|
-- Update code --
|
|
|
|
-- Update code --
|
|
|
|
|
|
|
|
|
|
|
|
function update_plugin()
|
|
|
|
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")
|
|
|
|
async_ok, async = pcall (require, "async")
|
|
|
|
|
|
|
|
|
|
|
@ -184,36 +185,39 @@ function get_cal(epic)
|
|
|
|
calid = epic_list.all
|
|
|
|
calid = epic_list.all
|
|
|
|
elseif epic:lower() == "update" then
|
|
|
|
elseif epic:lower() == "update" then
|
|
|
|
update_plugin()
|
|
|
|
update_plugin()
|
|
|
|
|
|
|
|
update_only = 1
|
|
|
|
else
|
|
|
|
else
|
|
|
|
not_found = 1
|
|
|
|
not_found = 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if not_found == 0 then
|
|
|
|
if update_only == 0 then
|
|
|
|
offset_utc, string_offset = os.difftime(os.time(os.date("*t")), os.time(os.date("!*t"))), ""
|
|
|
|
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
|
|
|
|
if offset_utc < 0 then
|
|
|
|
string_offset = "-" .. string.format("%02d", (offset_utc*-1)/3600) .. ":00"
|
|
|
|
string_offset = "-" .. string.format("%02d", (offset_utc*-1)/3600) .. ":00"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
string_offset = "%2b" .. string.format("%02d", math.floor(offset_utc/3600)) .. ":00"
|
|
|
|
string_offset = "%2b" .. string.format("%02d", math.floor(offset_utc/3600)) .. ":00"
|
|
|
|
end
|
|
|
|
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
|
|
|
|
if just_today == 1 then
|
|
|
|
rpage = "https://www.googleapis.com/calendar/v3/calendars/" .. calid .. "/events?key=" .. key .. "&timeMin=" .. timeMin .. "&timeMax=" .. timeMax
|
|
|
|
rpage = "https://www.googleapis.com/calendar/v3/calendars/" .. calid .. "/events?key=" .. key .. "&timeMin=" .. timeMin .. "&timeMax=" .. timeMax
|
|
|
|
just_today = 0
|
|
|
|
just_today = 0
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rpage = "https://www.googleapis.com/calendar/v3/calendars/" .. calid .. "/events?key=" .. key .. "&timeMin=" .. timeMin
|
|
|
|
rpage = "https://www.googleapis.com/calendar/v3/calendars/" .. calid .. "/events?key=" .. key .. "&timeMin=" .. timeMin
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if async_ok then
|
|
|
|
if async_ok then
|
|
|
|
epage = async.doAsyncRemoteRequest(rpage, get_results, "HTTPS")
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|