Advertisement
Guest User

Untitled

a guest
Jan 19th, 2015
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.10 KB | None | 0 0
  1. GoogleCalendar = {
  2.  
  3.             MatchLink     = '<link.-rel=.-alternate.-href=["\'](.-)["\']',
  4.             MatchItem     = '<entry.-</entry>',
  5.             MatchItemID   = '<id.->(.-)</id>',
  6.             MatchItemLink = '<link.-href=["\'](.-)["\']',
  7.             MatchItemDesc = '<summary.->(.-)</summary>',
  8.             --MatchItemDate = 'startTime=["\'](.-)["\']',  Thomas
  9.             MatchItemDate = '<summary.->(.-)</summary>',
  10.             MergeItems    = false,
  11.             ParseDate     = function(s)
  12.                
  13.                
  14.                 local Date = {}
  15.                 --When: Mon Jan 26, 2015 12:30pm to 2pm
  16.                 local MatchTime = '(%u%a%a) (%d+)[,] (%d%d%d%d) (%d+)[:](%d+)'
  17.                 local MatchTimep = '(%u%a%a) (%d+)[,] (%d%d%d%d) (%d+)[:](%d+)pm'
  18.                 local MatchTime2 = '(%u%a%a) (%d)[,] (%d%d%d%d) (%d+)'
  19.                 local MatchTime2p = '(%u%a%a) (%d)[,] (%d%d%d%d) (%d+)pm'
  20.                 local MatchTime3 = '(%u%a%a) (%d)[,] (%d%d%d%d) (%d)'
  21.                 local MatchTime3p = '(%u%a%a) (%d)[,] (%d%d%d%d) (%d)pm'
  22.                 local MatchDate = '(%u%a%a) (%d+)[,] (%d%d%d%d)'
  23.                
  24.                 if s:match(MatchTime) then
  25.                     Date.month, Date.day, Date.year, Date.hour, Date.min = s:match(MatchTime)
  26.                     Date.sec = 0
  27.                 elseif s:match(MatchTimep) then
  28.                     Date.month, Date.day, Date.year, Date.hour, Date.min = s:match(MatchTimep)
  29.                     Date.hour = 12 + Date.hour
  30.                     Date.sec = 0
  31.                 elseif s:match(MatchTime2) then
  32.                     Date.month, Date.day, Date.year, Date.hour = s:match(MatchTime2)
  33.                     Date.min = 0
  34.                     Date.sec = 0
  35.                 elseif s:match(MatchTime2p) then
  36.                     Date.month, Date.day, Date.year, Date.hour = s:match(MatchTime2p)
  37.                     Date.hour = 12 + Date.hour
  38.                     Date.min = 0
  39.                     Date.sec = 0
  40.                 elseif s:match(MatchTime3) then
  41.                     Date.month, Date.day, Date.year, Date.hour = s:match(MatchTime3)
  42.                     Date.min = 0
  43.                     Date.sec = 0
  44.                 elseif s:match(MatchTime3p) then
  45.                     Date.month, Date.day, Date.year, Date.hour = s:match(MatchTime3p)
  46.                     Date.hour = 12 + Date.hour
  47.                     Date.min = 0
  48.                     Date.sec = 0
  49.                 elseif s:match(MatchDate) then
  50.                     Date.month, Date.day, Date.year = s:match(MatchDate)
  51.                 elseif s:match(MatchDate2) then
  52.                     Date.month, Date.day, Date.year = s:match(MatchDate2)
  53.                    
  54.                 end
  55.                 return Date
  56.             end
  57.             },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement