It is currently October 9th, 2024, 6:53 pm

Enigma Google Calendar Patch

A package of skins with a "theme" or by a single author
Ruff_hi
Posts: 19
Joined: August 21st, 2018, 1:30 pm

Re: Enigma Google Calendar Patch

Post by Ruff_hi »

I have just started playing with a RPI and MagicMirror (mm). The mm calendar code reads from a gmail calendar and has no trouble with annual recurring appointments (eg Christmas, birthday, etc). I will peek at their code to see how they do it.

That said, I added Christmas to my google calendar as an annual recurring event ... and now my rainmeter calendar is showing Christmas. But it isn't showing New Years Day ... that is weird.

I just added NYEve (Dec 31) and it is showing in the rainmeter calendar. The calendar must have a thing about showing recurring events that occur NEXT YEAR.
Ruff_hi
Posts: 19
Joined: August 21st, 2018, 1:30 pm

Re: Enigma Google Calendar Patch

Post by Ruff_hi »

Well ... that was easy. The code was just sitting there.

There is some code to handle adding a month if the recurring frequency is monthly ... so i just stole that and used it for annual ...

Code: Select all

-- Yearly recurring events
elseif s:match('FREQ=YEARLY') then
	-- Match and set to this year
	Date.year, Date.month, Date.day = s:match('DTSTART;VALUE=DATE:(%d%d%d%d)(%d%d)(%d%d)')
	Date.year = os.date('%Y')
					
	-- If date is in the past then add a year
	if os.time(Date) < os.time() then
		Date.year = Date.year + 1
	end
	return Date
Ruff_hi
Posts: 19
Joined: August 21st, 2018, 1:30 pm

Re: Enigma Google Calendar Patch

Post by Ruff_hi »

Because the above just dumps all future annual recurring events ... I added some code to only show annual events if they occur in the next 3 months.

Code: Select all

-- ADD NEW ITEMS
for i = #Items, 1, -1 do
	if Items[i] then
		if t == 'iCalendar' then
			FutDate.year = os.date('%Y')
			FutDate.month = os.date('%m') + 3
			FutDate.day = os.date('%d')
			if FutDate.month > 12 then
				FutDate.year = FutDate.year + 1
				FutDate.month = FutDate.month - 12
			end
							
			if (Items[i].Date > os.time()) and (Items[i].Date < os.time(FutDate)) then
				table.insert(Feeds[f], 1, Items[i])
			end
		else
			table.insert(Feeds[f], 1, Items[i])
		end
	end
end
Note, you will have to define FutDate ...

Code: Select all

function Input(a)
        local f = a or f
	local FutDate = {}
User avatar
CodeCode
Posts: 1391
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Enigma Google Calendar Patch

Post by CodeCode »

Hey Ruff_hi,

Wow. Your grasp of lua is much better than mine.

That said, I noticed that if an event recurs, say weekly that the time gets messed up and shows fairly consistently for each event I created to be 2 hour early.

With what you've discovered so far (which I will add to mine ;-) ), perhaps you might understand what is going on there?

Cheers.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
Ruff_hi
Posts: 19
Joined: August 21st, 2018, 1:30 pm

Re: Enigma Google Calendar Patch

Post by Ruff_hi »

Not sure what is going on with the time. I see it too ... my 11am was showing as 7am.

The offending line of code (for weekly recurring meetings) has been removed from about line 500 ... just above the rememberthemilk routine.

Something to do with daylight saving ... but my DS is not 4 hrs ... that said, I am 4hrs from GMT (but in the other direction). Hmm ... file says my DS adjustment is -4 ... so it must take my 11am as 11am GMT and change that to 7am (New York). Where does it pick my location from? Why does it think my calendar is GMT and my location is NYC?

Code: Select all

				if s:match(MatchTime) then
					Date.year, Date.month, Date.day, Date.hour, Date.min, Date.sec = s:match(MatchTime)
--					Date.Offset = DS.Offset
				else
					Date.year, Date.month, Date.day = s:match(MatchDate)
				end
Edit: it needs that ds.offset for non-recurring meetings. So we can't just remove (and ignore) that line.
User avatar
CodeCode
Posts: 1391
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Enigma Google Calendar Patch

Post by CodeCode »

Ruff_hi wrote: October 20th, 2020, 9:27 pm Not sure what is going on with the time. I see it too ... my 11am was showing as 7am.

The offending line of code (for weekly recurring meetings) has been removed from about line 500 ... just above the rememberthemilk routine.

Something to do with daylight saving ... but my DS is not 4 hrs ... that said, I am 4hrs from GMT (but in the other direction). Hmm ... file says my DS adjustment is -4 ... so it must take my 11am as 11am GMT and change that to 7am (New York). Where does it pick my location from? Why does it think my calendar is GMT and my location is NYC?

Code: Select all

				if s:match(MatchTime) then
					Date.year, Date.month, Date.day, Date.hour, Date.min, Date.sec = s:match(MatchTime)
--					Date.Offset = DS.Offset
				else
					Date.year, Date.month, Date.day = s:match(MatchDate)
				end
Edit: it needs that ds.offset for non-recurring meetings. So we can't just remove (and ignore) that line.
I was poking around as well but I found that most - if not all time references are based on local time. But, for me as well since I am +10 GMT which is that same time difference but on my end of 2 hours or 10 rather which might explain why my Am and PM were being incorrect for recurring events.

The code mentions UTC once and a tired to set it to AEST but woah not good.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
Ruff_hi
Posts: 19
Joined: August 21st, 2018, 1:30 pm

Re: Enigma Google Calendar Patch

Post by Ruff_hi »

Yeah ... yearly or monthly recurring meetings don't have their time squashed. Weekly does ... I expect anything other than annual or monthly does. There is something in the code re recurring meetings (not yearly or monthly) that is borked.

AEST is Australian East summer time ... I am an Aussie but have been living in the US for ... sigh ... 20 yrs.
User avatar
CodeCode
Posts: 1391
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Enigma Google Calendar Patch

Post by CodeCode »

Ruff_hi wrote: October 20th, 2020, 10:34 pm Yeah ... yearly or monthly recurring meetings don't have their time squashed. Weekly does ... I expect anything other than annual or monthly does. There is something in the code re recurring meetings (not yearly or monthly) that is borked.
Well, that might help identify where the error is. I'll keep looking..
Ruff_hi wrote: October 20th, 2020, 10:34 pm AEST is Australian East summer time ... I am an Aussie but have been living in the US for ... sigh ... 20 yrs.
Heh. I'm from the US and been in Aus for 15 years.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
markpud
Posts: 9
Joined: December 11th, 2017, 6:35 pm

Re: Enigma Google Calendar Patch

Post by markpud »

Hello all,

Just discovered this thread after on/off looking for Gcal widget for Rainmeter over the years. I've managed to get it working with public/shared calendar feeds but not my personal calendar yet!

I just have a couple of questions which are hopefully not too complicated..

How to change the time format to 24h clock?

And how to make the background not fully transparent? I've found the setting for SkinBackgroundAlpha which controls the transparency value of the mouseover, but not spotted a similar one for the default bg transparency? I tried SidebarAlpha but that doesn't seem to work.

Any help appreciated!
User avatar
balala
Rainmeter Sage
Posts: 16645
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Enigma Google Calendar Patch

Post by balala »

markpud wrote: March 8th, 2021, 3:06 pm How to change the time format to 24h clock?
There might be setting in the Settings skin (Enigma\Options\Options.ini), but I didn't find it, so I'm gonna describe you how to make manually the needed adjustments.
You have to work with the Enigma\Taskbar\Clock\Clock.inc file. All clock skins of the Enigma\Taskbar\Clock config will get the new format. So open the above Clock.inc file and look for and replace the Format option of the [MeasureText] measure (Format="%#I.%M") by Format=%#H.%M. Note that beside replacing the I format option by H, I did remove the absolutely not-needed quotes as well.
And beside this, if the format has been updated, I also would remove the AM/PM parameter. To do this, you have to make two more adjustments in the same clock.inc file:
  • Replace the ToolTipText option of the [Icon] meter with the following one: ToolTipText=[MeasureText] (removed the [MeasureLabel] parameter from the original option: ToolTipText=[MeasureText] [MeasureLabel].
  • Add a Hidden=1 option to the [Label] meter.
Don't forget to refresh the skin.