Advertisement
Guest User

Rainmeter Enigma Google Calendar fix

a guest
Dec 27th, 2014
1,703
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.58 KB | None | 0 0
  1. GoogleCalendar = {
  2.             MatchLink     = '<link.-rel=.-alternate.-href=["\'](.-)["\']',
  3.             MatchItem     = '<entry.-</entry>',
  4.             MatchItemID   = '<id.->(.-)</id>',
  5.             MatchItemLink = '<link.-href=["\'](.-)["\']',
  6.             MatchItemDesc = '<summary.->(.-)</summary>',
  7.             --MatchItemDate = 'startTime=["\'](.-)["\']',  Old format
  8.             MatchItemDate = '<summary.->(.-)</summary>',
  9.             MergeItems    = false,
  10.             ParseDate     = function(s)
  11.                 local Date = {}
  12.                 --local MatchTime = '(%d%d%d%d)%-(%d%d)%-(%d%d)T(%d%d)%:(%d%d)%:(%d%d)%.%d+(.-)$'
  13.                 --local MatchDate = '(%d%d%d%d)%-(%d%d)%-(%d%d)$'
  14.                 --When: Thu 1 Jan 2015 13:00 to 14:00
  15.                 local MatchTime = '(%d%d) (%u%a%a) (%d%d%d%d) (%d%d)[:](%d%d)'
  16.                 local MatchTime2 = '(%d) (%u%a%a) (%d%d%d%d) (%d%d)[:](%d%d)'
  17.                 local MatchDate = '(%d%d) (%u%a%a) (%d%d%d%d)'
  18.                 local MatchDate2 = '(%d) (%u%a%a) (%d%d%d%d)'
  19.                
  20.                 if s:match(MatchTime) then
  21.                     --Date.year, Date.month, Date.day, Date.hour, Date.min, Date.sec, Date.Offset = s:match(MatchTime)
  22.                     Date.day, Date.month, Date.year, Date.hour, Date.min = s:match(MatchTime)
  23.                     Date.sec = 0
  24.                     Date.Offset = os.date("%Z")
  25.                 elseif s:match(MatchTime2) then
  26.                     Date.day, Date.month, Date.year, Date.hour, Date.min = s:match(MatchTime2)
  27.                     Date.sec = 0
  28.                     Date.Offset = os.date("%Z")
  29.                 elseif s:match(MatchDate) then
  30.                     --Date.year, Date.month, Date.day = s:match(MatchDate)
  31.                     Date.day, Date.month, Date.year = s:match(MatchDate)
  32.                 elseif s:match(MatchDate2) then
  33.                     Date.day, Date.month, Date.year = s:match(MatchDate2)
  34.                 end
  35.  
  36.                 return Date
  37.             end
  38.             },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement