It is currently April 27th, 2024, 11:09 am

Need help to create a new calendar skin

Get help with creating, editing & fixing problems with skins
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Need help to create a new calendar skin

Post by Mordasius »

edei890 wrote:but if you grab the from a website, then does it also mean that
you would need to have a Internet connection to be able to use it?..
Well yes... but I guess it could be written to fall back on your os.date based skin if there was no internet connection. I couldn't find anything that showed both the numbers and text using Arabic script but that could have been because it had been stuck in an odd place and I didn't recognise it as a date. Anyway, here is a version that needs an internet connection:

Code: Select all

[Rainmeter]
Author=Mordasius
DynamicWindowsize=1

[Metadata]
Name=Arabic Date
Version=14072012
Description= Displays the date in (mostly) Arabic script using the hijrah calendar
License=Creative Commons Attribution-Noncommercial-Share Alike 3.0

[mFeed]
Measure=PLUGIN
Plugin=WebParser.dll
Url=http://www.ahram.org.eg/RssContent.aspx
RegExp="(?siU)<title>(.*)</title>.*<td id="header1_DateTD".*size='2'>(.*)&nbsp;"
UpdateDivider=3600
StringIndex=2

[MtShowDate]
Meter=STRING
MeasureName=mFeed
FontSize=16
StringStyle=BOLD
FontColor=ffffffff
StringEffect=SHADOW
FontEffectColor=000000aa
SolidColor=00000001
AntiAlias=1
ArabicDate.jpg
By the way, I noticed that you have taken the "-1" off myRes[5] = id -- islamic date (modified with -1). Does that make it fit in with Malaysian dates? It doesn't seem to agree with sites like Islamic Philosophy Online. Maybe that's where the 'adjustment' thingee should have been kicking in.
You do not have the required permissions to view the files attached to this post.
Last edited by Mordasius on July 15th, 2012, 1:33 am, edited 1 time in total.
User avatar
edei890
Posts: 11
Joined: July 9th, 2012, 1:08 am

Re: Need help to create a new calendar skin

Post by edei890 »

It actually need to use the -1..
when I check with Malaysia National Islamic Organization calendar,
it suppose to be 24 today in Malaysia.. but it shows 25 instead..
I didn't use the -1, because it was delayed by one day yesterday..
but got it fixed now..
User avatar
edei890
Posts: 11
Joined: July 9th, 2012, 1:08 am

Re: Need help to create a new calendar skin

Post by edei890 »

http://edei890.deviantart.com/art/Hijra-Calendar-314615149

this is the link to the Hijra Calendar I submitted to deviantart.. Pls tell me if I didn't properly credit to you guys..
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Need help to create a new calendar skin

Post by Mordasius »

I've found a way to show the weekday and month in Arabic script without going online and was working on a moon-phase background (which seems appropriate for a Hijri calendar) when I noticed that the javascript used as a basis for the lua script had problems around the new moon dates. It sets the date as '0' when it should be '1' and the problem will next occur on 19th July at the beginning of Ramadan. Sorry about that.

Anyway, here is bettter Lua script using parts of the javascript from http://www.muslimphilosophy.com/ip/hijri.htm. I suggest you use it to update the skin you posted on Deviant Art ASAP.

HijriCalendar.lua

Code: Select all

--[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]][][][][]
-- Revised script 'translated' from the JavaScript on http://www.muslimphilosophy.com/ip/hijri.htm
function Update()       
			today = os.date('!*t')
			day = today.day
			month = today.month
			year = today.year
          --[ the following can be used for testing ]
          -- day =19
          -- month =7
          -- year = 2012
			 --  --------------------------------			
			SKIN:Bang('!SetOption', 'MtShowYear', 'Text',  WriteHijriDate( day-1 , month , year, 'Hyear') )
			SKIN:Bang('!SetOption', 'MtShowMonth', 'Text',  WriteHijriDate( day-1 , month , year, 'Hmonth') )
			SKIN:Bang('!SetOption', 'MtShowDate', 'Text',  WriteHijriDate( day-1 , month , year, 'Hdate') )
			 SKIN:Bang('!SetOption', 'MtShowDay', 'Text',  WriteHijriDate( day-1 , month , year, 'Hdayname') )
		return 'dates set...'
end -- function Update		

function intPart(floatNum)      
		if (floatNum< -0.0000001) 
		   then 	 return math.ceil(floatNum-0.0000001)
		   else		return math.floor(floatNum+0.0000001)	
		   end	
end --- function intPart

function CalcHijriDate( d , m , y)
		if ((y>1582) or ((y==1582) and (m>10)) or ((y==1582) and (m==10) and (d>14))) 
			then  jd=intPart((1461*(y+4800+intPart((m-14)/12)))/4)+intPart((367*(m-2-12*(intPart((m-14)/12))))/12)-
	intPart( (3* (intPart(  (y+4900+ intPart( (m-14)/12)     )/100)    )   ) /4)+d-32075
			else jd = 367*y-intPart((7*(y+5001+intPart((m-9)/7)))/4)+intPart((275*m)/9)+d+1729777
			end
			jd = jd + 1
			l=jd-1948440+10632
			n=intPart((l-1)/10631)
			l=l-10631*n+354
			j=(intPart((10985-l)/5316))*(intPart((50*l)/17719))+(intPart(l/5670))*(intPart((43*l)/15238))
			l=l-(intPart((30-j)/15))*(intPart((17719*j)/50))-(intPart(j/16))*(intPart((15238*j)/43))+29
			m=intPart((24*l)/709)
			d=l-intPart((709*m)/24)
			wd =( ((jd+1%7)+7)%7)+1
			y=30*n+j-30				
				Hdate = {}
				Hdate[0] = jd  	--  julian day number
				Hdate[1] = wd  	--  weekday number
				Hdate[2] = d  	--   date 
				Hdate[3] = m  	--   month
				Hdate[4] = y  	--  year
      return Hdate
end--- function CalcHijriDate

function WriteHijriDate( Gd, Gm, Gy, ReturnValue)
      local iwdNames = {"al-Ahad","al-Ithnayn","ath-Thalaathaa","al-Arba‘aa’","al-Khamis","al-Jumu‘ah","as-Sabt"}
       local iMonthNames = {"Muharam","Safar","Rabi'ul Awal","Rabiul Akhir","Jamadil Awal","Jamadil Akhir","Rajab","Sha'ban","Ramadhan","Shawwal","Dhulka'edah","Dzulhijjah"}
      local iDate = CalcHijriDate( Gd , Gm , Gy)
      if ReturnValue == 'Hyear' then
        HijriDatePart = (" "..iDate[4].." Hijrah")
      elseif ReturnValue == 'Hmonth' then
        HijriDatePart = (" "..iMonthNames[iDate[3]].." ")
      elseif ReturnValue == 'Hdate' then
        HijriDatePart = (" "..iDate[2].." ")
		elseif ReturnValue == 'Hdayname' then
        HijriDatePart = (" "..iwdNames[iDate[1]].." ")
      end
      return HijriDatePart
end -- of writeHijriDate
User avatar
edei890
Posts: 11
Joined: July 9th, 2012, 1:08 am

Re: Need help to create a new calendar skin

Post by edei890 »

Done! ;-)

thanks Mordasius.. I'll try to put a few skin for the arabic script later..
for now there are few things come up right now and I've to put this project on hold..
maybe for 2-3 days later I'll try to come out with something..

thanks again for fixing those problem :bow: ..
did'nt even realize it was there.. :confused: