It is currently April 19th, 2024, 4:24 am

Help with SunRiseSet

Get help with creating, editing & fixing problems with skins
von__zeppelin
Posts: 9
Joined: December 26th, 2016, 8:44 am

Help with SunRiseSet

Post by von__zeppelin »

So let's get one very important tidbit out of the way...I am still rather new to rainmeter and I have zero coding experience. :confused:

Anyway...on to what brought me here!

So I was browsing the deviant art pages for new skins when I stumbled upon "SunRiseSet" http://www.deviantart.com/art/SunRiseSet-1-0-425738654

As someone who is obsessed with knowing such things I obviously had to have it! Only it was broken and not working...So I started digging. Soon discovered that the problem involved using yahoo weather as it's source. Not to give in easily I set out to make it work one way or another. Then came the 2nd problem...As I said I have no coding experience and was literally feeling my way around a pitch black room. But I'm pretty smart and intuitive and love figuring/learning new things out. After hours of beating my head against the wall I finally managed to get it working!!

However, the "current day" on the skin doesn't seem to be updating correctly(still showed yesterday which was "sunday")

So here is the original code:

Code: Select all

;===== Rainmeter ===============;
[Rainmeter]
AppVersion=2003000
Update=1000

;===== Metadata ================;
[Metadata]
Name=
Author=sJ
Description=Displays the position of the sun, wind speed, direction and etc.
Version=
License=

;===== Variables ===============;
[Variables]
Font="Roboto Th"
FontCOlor=255,255,255,217
COEID=24877369
;COEID=23418302
Units=F
Width=182
Height=90
Xorigin=25
Yorigin=70

WebParserSunRiseSet=<yweather:astronomy sunrise="(.*):.*(.*) .*(.*)"   .*sunset="(.*):.*(.*) .*(.*)"/>

;===== MeasureParent ===========;
[MeasureParent]
Measure=Plugin
Plugin=WebParser
UpdateRate=1800
URL=http://weather.yahooapis.com/forecastrss?w=#COEID#&u=#Units#
RegExp="(?siU)#WebParserSunRiseSet#"
Debug=1

;===== MeasureSunrise/set ======;
[MeasureAstronomySunriseHour]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=1

[MeasureAstronomySunriseMin]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=2

[MeasureAstronomySunriseAMPM]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=3
Substitute="am":"0","pm":"1"

[MeasureAstronomySunsetHour]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=4

[MeasureAstronomySunsetMin]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=5

[MeasureAstronomySunsetAMPM]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=6
Substitute="am":"0","pm":"1"

;===== MeasurePosition =========;
[MeasureAstronomySunriseHourAdjust]
Measure=Calc
Formula=[MeasureAstronomySunriseAMPM]*12+MeasureAstronomySunriseHour
DynamicVariables=1

[MeasureAstronomySunsetHourAdjust]
Measure=Calc
Formula=[MeasureAstronomySunsetAMPM]*12+MeasureAstronomySunsetHour
DynamicVariables=1

[MeasureDifferenceinMin]
Measure=Calc
Formula=(MeasureAstronomySunsetHourAdjust*60+MeasureAstronomySunsetMin)-(MeasureAstronomySunriseHourAdjust*60+MeasureAstronomySunriseMin)

[MeasureCurrentHour]
Measure=Time
Format=%H

[MeasureCurrentMin]
Measure=Time
Format=%M

[MeasurePosition1]
Measure=Calc
Formula=((MeasureCurrentHour*60+MeasureCurrentMin)-(MeasureAstronomySunriseHourAdjust*60+MeasureAstronomySunriseMin))/MeasureDifferenceinMin

[MeasurePosition2]
Measure=Calc
Formula=MeasurePosition1 < 0 ? 0 : (MeasurePosition1 < 1 ? MeasurePosition1 : 1)

[MeasureX]
Measure=Calc
Formula=#Xorigin#+0.5*#Width#*(1-cos(pi*MeasurePosition2))

[MeasureY]
Measure=Calc
Formula=#Yorigin#+#Height#*(1-sin(pi*MeasurePosition2))

;===== Meters ==================;
[MeterBase]
Meter=Image
ImageName=#@#\Base.png
ImageAlpha=217
W=270
H=300
X=0
Y=0

[MeterSun]
Meter=String
FontColor=#FontColor#
FontFace=#Font#
FontSize=25
AntiAlias=1
ClipString=1
W=240
H=50
X=15
Y=15
Text=Sun

[MeterSunTrail]
Meter=Image
ImageName=#@#\SunRiseSet\SunTrail.png
ImageAlpha=217
W=250
H=150
X=10
Y=50

[MeterSunIcon]
Meter=Image
ImageName=#@#\SunRiseSet\Sun.png
ImageAlpha=217
W=35
H=35
X=[MeasureX]
Y=[MeasureY]
DynamicVariables=1

[MeterAstronomySunrise]
Meter=String
FontColor=#FontColor#
FontFace=#Font#
FontSize=12
AntiAlias=1
ClipString=1
StringAlign=Left
MeasureName=MeasureAstronomySunriseHourAdjust
MeasureName2=MeasureAstronomySunriseMin
W=75
H=20
X=23
Y=190
Text=%1:%2

[MeterAstronomySunset]
Meter=String
FontColor=#FontColor#
FontFace=#Font#
FontSize=12
AntiAlias=1
ClipString=1
StringAlign=Right
MeasureName=MeasureAstronomySunsetHourAdjust
MeasureName2=MeasureAstronomySunsetMin
W=75
H=20
X=222r
Y=r
Text=%1:%2

[MeterDivider1]
Meter=Image
ImageName=#@#\Divider.png
ImageAlpha=217
W=230
H=5
X=20
Y=50r

[MeterProvider]
Meter=STRING
FontColor=#FontColor#
FontFace=#Font#
FontSize=10
AntiAlias=1
ClipString=1
MeasureName=MeasureAtmosphereError
W=230
H=35
X=r
Y=20r
Text=by Yahoo! Weather
And here is my butchered but seemingly working edit/fix:

Code: Select all

;===== Rainmeter ===============;
[Rainmeter]
AppVersion=2003000
Update=1000

;===== Metadata ================;
[Metadata]
Name=
Author=sJ
Description=Displays the position of the sun, wind speed, direction and etc.
Version=
License=

;===== Variables ===============;
[Variables]
Font="Roboto Th"
FontColor=100,251,0
COEID=24877369
;COEID=23418302
Units=F
Width=180
Height=90
Xorigin=25
Yorigin=70


;===== MeasureParent ===========;
[MeasureParent]
Measure=Plugin
Plugin=WebParser
UpdateRate=3600
Url=http://wxdata.weather.com/wxdata/weather/local/USKY1021?cc=*&unit=i&dayf=1
RegExp=(?siU)<weather ver="(.*)">.*<dnam>(.*)</dnam>.*<lat>(.*)</lat>.*<lon>(.*)</lon>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<zone>(.*)</zone>.*<tmp>(.*)</tmp>.*<flik>(.*)</flik>.*<t>(.*)</t>.*<icon>(.*)</icon>.*<moon>.*<icon>(.*)</icon>.*<t>(.*)</t>.*</moon>.*t="(.*)" dt="(.*)">.*<hi>(.*)</hi>.*<low>(.*)</low>.*<icon>(.*)</icon>.*<t>(.*)</t>
Debug=1

;===== MeasureSunrise/set ======;
[MeasureAstronomySunriseHour]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=

[MeasureAstronomySunriseMin]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=5

[MeasureAstronomySunriseAMPM]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=
Substitute="am":"0","pm":"1"

[MeasureAstronomySunsetHour]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=

[MeasureAstronomySunsetMin]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=6

[MeasureAstronomySunsetAMPM]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=
Substitute="am":"0","pm":"1"

;===== MeasurePosition =========;
[MeasureAstronomySunriseHourAdjust]
Measure=Calc
Formula=[MeasureAstronomySunriseAMPM]*12+MeasureAstronomySunriseHour
DynamicVariables=1

[MeasureAstronomySunsetHourAdjust]
Measure=Calc
Formula=[MeasureAstronomySunsetAMPM]*12+MeasureAstronomySunsetHour
DynamicVariables=1

[MeasureDifferenceinMin]
Measure=Calc
Formula=(MeasureAstronomySunsetHourAdjust*60+MeasureAstronomySunsetMin)-(MeasureAstronomySunriseHourAdjust*60+MeasureAstronomySunriseMin)

[MeasureCurrentHour]
Measure=Time
Format=%H

[MeasureCurrentMin]
Measure=Time
Format=%M

[MeasurePosition1]
Measure=Calc
Formula=((MeasureCurrentHour*60+MeasureCurrentMin)-(MeasureAstronomySunriseHourAdjust*60+MeasureAstronomySunriseMin))/MeasureDifferenceinMin

[MeasurePosition2]
Measure=Calc
Formula=MeasurePosition1 < 0 ? 0 : (MeasurePosition1 < 1 ? MeasurePosition1 : 1)

[MeasureX]
Measure=Calc
Formula=#Xorigin#+0.5*#Width#*(1-cos(pi*MeasurePosition2))

[MeasureY]
Measure=Calc
Formula=#Yorigin#+#Height#*(1-sin(pi*MeasurePosition2))

;===== Meters ==================;
[MeterBase]
Meter=Image
ImageName=#@#\Base.png
ImageAlpha=217
W=270
H=300
X=0
Y=0

[MeterSun]
Meter=String
FontColor=#FontColor#
FontFace=#Font#
FontSize=25
AntiAlias=1
ClipString=1
W=240
H=50
X=15
Y=15
Text=Mon

[MeterSunTrail]
Meter=Image
ImageName=#@#\SunRiseSet\SunTrail.png
ImageAlpha=217
W=250
H=150
X=10
Y=50

[MeterSunIcon]
Meter=Image
ImageName=#@#\SunRiseSet\Sun.png
ImageAlpha=217
W=35
H=35
X=[MeasureX]
Y=[MeasureY]
DynamicVariables=1

[MeterAstronomySunrise]
Meter=String
FontColor=#FontColor#
FontFace=#Font#
FontSize=12
AntiAlias=1
ClipString=1
StringAlign=Left
MeasureName=MeasureAstronomySunriseHourAdjust
MeasureName2=MeasureAstronomySunriseMin
W=75
H=20
X=23
Y=190
Text=%1:%2

[MeterAstronomySunset]
Meter=String
FontColor=#FontColor#
FontFace=#Font#
FontSize=12
AntiAlias=1
ClipString=1
StringAlign=Right
MeasureName=MeasureAstronomySunsetHourAdjust
MeasureName2=MeasureAstronomySunsetMin
W=75
H=20
X=222r
Y=r
Text=%1:%2

[MeterDivider1]
Meter=Image
FontColor=#FontColor#
ImageName=#@#\Divider.png
ImageAlpha=217
W=230
H=5
X=20
Y=50r

[MeterProvider]
Meter=STRING
FontColor=#FontColor#
FontFace=#Font#
FontSize=10
AntiAlias=1
ClipString=1
MeasureName=MeasureAtmosphereError
W=230
H=35
X=r
Y=20r
Text=von__Zeppelin

Anyone care to give this a look over and give some input/suggestions?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help with SunRiseSet

Post by jsmorley »

Here is how I would fix the original code:

Code: Select all

;===== Rainmeter ===============;
[Rainmeter]
AppVersion=2003000
Update=1000

;===== Metadata ================;
[Metadata]
Name=
Author=sJ
Description=Displays the position of the sun.
Version=
License=

;===== Variables ===============;
[Variables]
Font="Roboto Th"
FontCOlor=255,255,255,217
LocationCode=USVA0944
;COEID=23418302
Units=c
Width=182
Height=90
Xorigin=25
Yorigin=70

WebParserSunRiseSet=<sunr>(.*):(.*) (.*)</sunr>.*<suns>(.*):(.*) (.*)</suns>

;===== MeasureParent ===========;
[MeasureParent]
Measure=Plugin
Plugin=WebParser
UpdateRate=1800
;URL=http://weather.yahooapis.com/forecastrss?w=#COEID#&u=#Units#
URL=https://wxdata.weather.com/wxdata/weather/local/#LocationCode#?cc=*&unit=#Units#&dayf=1
RegExp="(?siU)#WebParserSunRiseSet#"
Debug=2

;===== MeasureSunrise/set ======;
[MeasureAstronomySunriseHour]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=1

[MeasureAstronomySunriseMin]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=2

[MeasureAstronomySunriseAMPM]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=3
Substitute="AM":"0","PM":"1"

[MeasureAstronomySunsetHour]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=4

[MeasureAstronomySunsetMin]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=5

[MeasureAstronomySunsetAMPM]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=6
Substitute="AM":"0","PM":"1"

;===== MeasurePosition =========;
[MeasureAstronomySunriseHourAdjust]
Measure=Calc
Formula=[MeasureAstronomySunriseAMPM]*12+MeasureAstronomySunriseHour
DynamicVariables=1

[MeasureAstronomySunsetHourAdjust]
Measure=Calc
Formula=[MeasureAstronomySunsetAMPM]*12+MeasureAstronomySunsetHour
DynamicVariables=1

[MeasureDifferenceinMin]
Measure=Calc
Formula=(MeasureAstronomySunsetHourAdjust*60+MeasureAstronomySunsetMin)-(MeasureAstronomySunriseHourAdjust*60+MeasureAstronomySunriseMin)

[MeasureCurrentHour]
Measure=Time
Format=%H

[MeasureCurrentMin]
Measure=Time
Format=%M

[MeasurePosition1]
Measure=Calc
Formula=((MeasureCurrentHour*60+MeasureCurrentMin)-(MeasureAstronomySunriseHourAdjust*60+MeasureAstronomySunriseMin))/MeasureDifferenceinMin

[MeasurePosition2]
Measure=Calc
Formula=MeasurePosition1 < 0 ? 0 : (MeasurePosition1 < 1 ? MeasurePosition1 : 1)

[MeasureX]
Measure=Calc
Formula=#Xorigin#+0.5*#Width#*(1-cos(pi*MeasurePosition2))

[MeasureY]
Measure=Calc
Formula=#Yorigin#+#Height#*(1-sin(pi*MeasurePosition2))

;===== Meters ==================;
[MeterBase]
Meter=Image
ImageName=#@#\Base.png
ImageAlpha=217
W=270
H=300
X=0
Y=0

[MeterSun]
Meter=String
FontColor=#FontColor#
FontFace=#Font#
FontSize=25
AntiAlias=1
ClipString=1
W=240
H=50
X=15
Y=15
Text=Sun

[MeterSunTrail]
Meter=Image
ImageName=#@#\SunRiseSet\SunTrail.png
ImageAlpha=217
W=250
H=150
X=10
Y=50

[MeterSunIcon]
Meter=Image
ImageName=#@#\SunRiseSet\Sun.png
ImageAlpha=217
W=35
H=35
X=[MeasureX]
Y=[MeasureY]
DynamicVariables=1

[MeterAstronomySunrise]
Meter=String
FontColor=#FontColor#
FontFace=#Font#
FontSize=12
AntiAlias=1
ClipString=1
StringAlign=Left
MeasureName=MeasureAstronomySunriseHourAdjust
MeasureName2=MeasureAstronomySunriseMin
W=75
H=20
X=23
Y=190
Text=%1:%2

[MeterAstronomySunset]
Meter=String
FontColor=#FontColor#
FontFace=#Font#
FontSize=12
AntiAlias=1
ClipString=1
StringAlign=Right
MeasureName=MeasureAstronomySunsetHourAdjust
MeasureName2=MeasureAstronomySunsetMin
W=75
H=20
X=222r
Y=r
Text=%1:%2

[MeterDivider1]
Meter=Image
ImageName=#@#\Divider.png
ImageAlpha=217
W=230
H=5
X=20
Y=50r

[MeterProvider]
Meter=STRING
FontColor=#FontColor#
FontFace=#Font#
FontSize=10
AntiAlias=1
ClipString=1
MeasureName=MeasureAtmosphereError
W=230
H=35
X=r
Y=20r
Text=by Weather.com
So you need to use the WXData website, and that requires a different "location code" then Yahoo! does. You can get that by going using the URL:

http://wxdata.weather.com/wxdata/search/search?where=YourCityName

Where you replace "YouCityName" with uhm... your city name.

Then the RegExp is pretty straightforward, just get the hours, minutes and AM/PM of the sunrise and sunset values in the feed.

Note that WXData uses "AM / PM", instead of "am / pm", so I changed the Substitute for those to turn them to "0" and "1".

That's about all you have to do, the rest works just fine.
1.png
P.S. that "Sun" at the top is not the day of the week, but literally the word "Sun", as that is what the skin is about... ;-)
You do not have the required permissions to view the files attached to this post.
von__zeppelin
Posts: 9
Joined: December 26th, 2016, 8:44 am

Re: Help with SunRiseSet

Post by von__zeppelin »

jsmorley wrote:P.S. that "Sun" at the top is not the day of the week, but literally the word "Sun", as that is what the skin is about... ;-)
*Facepalms*

Yeah I just got done working a 10hr shift in a busy ER(on christmas of all days) so I definitely was not thinking straight :?

My feeble brain was making a connection that it represented the current day since when I first started playing with it, it actually was Sunday lol.

Thanks a ton for your help! I'll definitely give it a whirl!
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Help with SunRiseSet

Post by fonpaolo »

If you're interested in something similar and/or a little more "complex", you can give a look at my weather skin.
I don't like self promotions... however...
http://fav.me/d8diqq0
You do not have the required permissions to view the files attached to this post.
von__zeppelin
Posts: 9
Joined: December 26th, 2016, 8:44 am

Re: Help with SunRiseSet

Post by von__zeppelin »

fonpaolo wrote:If you're interested in something similar and/or a little more "complex", you can give a look at my weather skin.
I don't like self promotions... however...
http://fav.me/d8diqq0

Self promote away friend! I love checking out skins....err..rainmeter skins that is lol. That looks pretty dope! Will definitely give it a try!
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Help with SunRiseSet

Post by fonpaolo »

Edited previous post to add at least one image...

I said more complex, because depending on the time expected for sunrise and sunset, the little sun became moon, with moon phases.
von__zeppelin
Posts: 9
Joined: December 26th, 2016, 8:44 am

Re: Help with SunRiseSet

Post by von__zeppelin »

fonpaolo wrote:Edited previous post to add at least one image...

I said more complex, because depending on the time expected for sunrise and sunset, the little sun became moon, with moon phases.
Yeah I like it, will definitely play around with it. I have already noticed that the Header/background colors can't be changed outside of orange,blue, and red since it uses actual images? Anyway to possible add more?....cause bright green is almost always the main color of my theme :)
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Help with SunRiseSet

Post by fonpaolo »

Everything is possible, I'm planning to convert most of the images with the new shape meter*.
If you need/want some specific skins I can add a new color, for the whole suite... I'll see.

* (before the end of the millennium, if Rainmeter is developed so fast...) :rofl:
von__zeppelin
Posts: 9
Joined: December 26th, 2016, 8:44 am

Re: Help with SunRiseSet

Post by von__zeppelin »

fonpaolo wrote:Everything is possible, I'm planning to convert most of the images with the new shape meter*.
If you need/want some specific skins I can add a new color, for the whole suite... I'll see.

* (before the end of the millennium, if Rainmeter is developed so fast...) :rofl:
I would mostly just be interested in the weather skin for now. But don't go out of your way to add other colors. Buuuut...if you do.... "100,251,0" is my jam :D
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Help with SunRiseSet

Post by fonpaolo »

von__zeppelin wrote:I would mostly just be interested in the weather skin for now. But don't go out of your way to add other colors. Buuuut...if you do.... "100,251,0" is my jam :D
Ouch!
...my poor eyes. ;-)
...It's a very strong shade of green, it's almost fluorescent.

If you want it for the weather, I'll see if I can find some time to edit the color layer.