It is currently May 3rd, 2024, 12:29 pm

[SOLVED] Wrong time and text displayed from gmail feed

Get help with creating, editing & fixing problems with skins
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [HELP] Wrong time and TEXT displayed from gmail feed

Post by smurfier »

That's because all of the magic is happening in Lua now. It was the easiest way to get everything working right. Lua does not support Unicode well.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
DioVikingoMetal
Posts: 29
Joined: January 26th, 2012, 10:40 am
Location: Italy

Re: [HELP] Wrong time and TEXT displayed from gmail feed

Post by DioVikingoMetal »

Image
User avatar
DioVikingoMetal
Posts: 29
Joined: January 26th, 2012, 10:40 am
Location: Italy

Re: [HELP] Wrong time and TEXT displayed from gmail feed

Post by DioVikingoMetal »

Image
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [HELP] Wrong time and TEXT displayed from gmail feed

Post by smurfier »

That would require the ability to use External Libraries with the current implementation of Lua in Rainmeter. I'm afraid that currently just isn't possible.

I am considering different options at this time.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
DioVikingoMetal
Posts: 29
Joined: January 26th, 2012, 10:40 am
Location: Italy

Re: [HELP] Wrong time and TEXT displayed from gmail feed

Post by DioVikingoMetal »

With the old version of jsmorley code written with RegExp, unicode was supported very well! :-(

Back to the primitive? :x
Image
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [HELP] Wrong time and TEXT displayed from gmail feed

Post by jsmorley »

DioVikingoMetal wrote:With the old version of jsmorley code written with RegExp, unicode was supported very well! :-(

Back to the primitive? :x
Who you callin primitive? ;-)
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [HELP] Wrong time and TEXT displayed from gmail feed

Post by smurfier »

I can make it so that the Lua portion only handles the date & time, passing the values to time measures. It's the best workaround I can come up with.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
DioVikingoMetal
Posts: 29
Joined: January 26th, 2012, 10:40 am
Location: Italy

Re: [HELP] Wrong time and TEXT displayed from gmail feed

Post by DioVikingoMetal »

The old skin with time issue

Code: Select all

[Rainmeter]
Update=1000
Author=diovikingometal
MiddleMouseDownAction=!RainmeterActivateConfig "Posta" "GmailN.ini"
DynamicWindowSize=1

[Variables]
Username=*******
Password=*******

Url=https://#Username#:#Password#@gmail.google.com/gmail/feed/atom
Get=(?(?=.*<title>).*<title>(.*)</title>.*<modified>(.*)T(.*)Z.*<author>.*<name>(.*)</name>)

[RSS]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=#Url#
RegExp="(?siU)Gmail - Inbox for (.*)@.*<entry>#Get##Get##Get#"
ForceReload=1
DecodeCharacterReference=1

[MeasureMailCount]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=#Url#
RegExp="(?siU)<fullcount>(.*)</fullcount>"
UpdateRate=60
StringIndex=1

[MeasureAccount]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=1

[MeasureItem1]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=2
DecodeCharacterReference=1

[MeasureDate1]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=3
RegExpSubstitute=1
Substitute="(.*)-(.*)-(.*)":"\3-\2-\1"

[MeasureTime1]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=4

[MeasureAuthor1]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=5

[MeasureItem2]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=6
DecodeCharacterReference=1

[MeasureDate2]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=7
RegExpSubstitute=1
Substitute="(.*)-(.*)-(.*)":"\3-\2-\1"

[MeasureTime2]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=8

[MeasureAuthor2]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=9

[MeasureItem3]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=10
DecodeCharacterReference=1

[MeasureDate3]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=11
RegExpSubstitute=1
Substitute="(.*)-(.*)-(.*)":"\3-\2-\1"

[MeasureTime3]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=12

[MeasureAuthor3]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=13

[MeterMailIcon]
Meter=IMAGE
X=2
Y=2
ImageName=mailB.png
ToolTipTitle=[MeasureAccount] @ Gmail [[MeasureMailCount]] da leggere
ToolTipText=[MeasureDate1] ~ [MeasureTime1] ~ [MeasureAuthor1] ~ [MeasureItem1]#CRLF#[MeasureDate2] ~ [MeasureTime2] ~ [MeasureAuthor2] ~ [MeasureItem2]#CRLF#[MeasureDate3] ~ [MeasureTime3] ~ [MeasureAuthor3] ~ [MeasureItem3]
ToolTipIcon=#SKINSPATH#\Posta\64.ico
;ToolTipWidth=300
DynamicVariables=1
LeftMouseUpAction=!Execute ["C:\Program Files\Internet Explorer\iexplore.exe" https://mail.google.com/mail/]

[Count]
Meter=STRING
MeasureName=MeasureMailCount
X=8r
Y=64r
Fontface=Century Gothic
Fontsize=12
FontColor=255, 255, 255, 200
StringAlign=Left
;StringEffect=SHADOW
;FontEffectColor=0, 0, 0, 200
AntiAlias=1
AutoScale=1
Text="Gmail [%1]"

[mGmailSound]
Measure=Plugin
Plugin=WebParser.dll
Url=https://#Username#:#Password#@mail.google.com/mail/feed/atom
RegExp="(?siU)<fullcount(.*)/fullcount>"
UpdateRate=60
StringIndex=1
Substitute=">":"","<":""
DecodeCharacterReference=0

[mGmailSound2]
Measure=Calc
Formula=[mGmailSound]
IfEqualValue=1
IfEqualAction=!Execute [PLAY #CURRENTPATH#\Sounds\notify.wav]
IfAboveValue=1
IfAboveAction=!Execute [PLAY #CURRENTPATH#\Sounds\notify.wav]
IfBelowValue=1
IfBelowAction=!Execute [PLAY #CURRENTPATH#\Sounds\mail.wav]
DynamicVariables=1
The last one with unicode issue
.ini

Code: Select all

[Rainmeter]
Update=1000
Author=diovikingometal
MiddleMouseDownAction=!ActivateConfig "Posta" "GmailN.ini"
DynamicWindowSize=1

[Variables]
Username=***
Password=***

[RSS]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=https://#Username#:#Password#@mail.google.com/gmail/feed/atom
RegExp=(?siU)(.*)$
FinishAction=!CommandMeasure Lua Read()
ForceReload=1
DecodeCharacterReference=1

[Lua]
Measure=Script
ScriptFile=#@#Lua.lua
IfEqualValue=1
IfEqualAction=[PLAY #@#Sounds\notify.wav]
IfAboveValue=1
IfAboveAction=[PLAY #@#Sounds\notify.wav]
IfBelowValue=1
IfBelowAction=[PLAY #@#Sounds\mail.wav]

[MeterMailIcon]
Meter=IMAGE
X=2
Y=2
ImageName=#@#mailB.png
ToolTipTitle=Attendere...
ToolTipText=Caricamento Feed
ToolTipIcon=#@#64.ico
;ToolTipWidth=300
LeftMouseUpAction=["C:\Program Files\Opera x64\opera.exe" https://mail.google.com/mail/]

[Count]
Meter=STRING
MeasureName=Lua
X=8r
Y=64r
Fontface=Century Gothic
Fontsize=12
FontColor=255, 255, 255, 200
StringAlign=Left
;StringEffect=SHADOW
;FontEffectColor=0, 0, 0, 200
AntiAlias=1
Text="Gmail [%1]"
.lua

Code: Select all

function Initialize()
	ms=SKIN:GetMeasure('RSS')
	OldText=''
end

function Update()
	return Count or 0
end

function Read()
	Text=ms:GetStringValue()
	if Text~=OldText then
		OldText=Text
		Count=tonumber(string.match(Text,'<fullcount>(.+)</fullcount>')) or 0
		local Messages={}
		for message in string.gmatch(Text,'<entry>.-</entry>') do
			local d,t=TimeStamp(string.match(message,'<modified>(.+)%-(.+)%-(.+)T(.+):(.+):(.+)Z</modified>'))
			table.insert(Messages,table.concat({
				d,t, --Date & Time
				string.match(message,'<name>(.+)</name>'), --Author
				string.match(message,'<title>(.+)</title>'), --Subject
			},' ~ '))
		end
		for i=1,3 do
			if not Messages[i] then
				Messages[i]=''
			end
		end
		for k,v in pairs({
			ToolTipTitle=string.match(Text,'^.-<title>Gmail %- Inbox for (.+)@gmail.com</title>')..' @ Gmail ['..Count..'] da leggere',
			ToolTipText=#Messages>0 and table.concat(Messages,'\n',1,3) or 'No Unread Mail',
		}) do SKIN:Bang('!SetOption','MeterMailIcon',k,v) end
	end
end

function Double(a)
	return string.format('%02d',a)
end

function TimeStamp(y,m,d,h,mn,s)
	local Time=os.date('*t')
	local offset=os.time()-os.time(os.date('!*t'))
	local t=os.time({day=d,month=m,year=y,hour=h,min=mn,sec=s})+offset+(Time.isdst and 3600 or 0)
	local tbl=os.date('*t',t)
	return Double(tbl.day)..'-'..Double(tbl.month)..'-'..tbl.year,Double(tbl.hour)..':'..Double(tbl.min)..':'..Double(tbl.sec)
end
Are we creating a Frankenstein skin ? :D
Image
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [HELP] Wrong time and TEXT displayed from gmail feed

Post by smurfier »

This version should work as you wish.
You do not have the required permissions to view the files attached to this post.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
DioVikingoMetal
Posts: 29
Joined: January 26th, 2012, 10:40 am
Location: Italy

SOLVED!

Post by DioVikingoMetal »

And now? Let's have a party! :yahoo:
Image