It is currently March 28th, 2024, 10:40 pm

Problem with NASA wallpaper

Get help with creating, editing & fixing problems with skins
matthewbuns
Posts: 2
Joined: January 24th, 2017, 3:39 am

Problem with NASA wallpaper

Post by matthewbuns »

I'm brand new to Rainmeter meter making and I've been trying to pull images from NASA's DSCOVR: EPIC API to make a daily Earth wallpaper, but I've been having problems with WebParser. I have a simple version working below, but it uses outdated API and doesn't allow the enhanced color images.

Code: Select all

[Rainmeter]
Update=1000
Debug=1
AccurateText=1

[Metadata]
Name=
Author=matthewbuns
Information=
Version=
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[MeterString]
Meter=String

[MeasureImageName]
Measure=Plugin
Plugin=WebParser
URL=https://epic.gsfc.nasa.gov/api/natural
RegExp=(?siU)"image":"(.*)"
UpdateRate=600
StringIndex=1

[MeasureImageFile]
Measure=Plugin
Plugin=WebParser
URL=http://epic.gsfc.nasa.gov/epic-archive/png/[MeasureImageName].png
UpdateRate=600
StringIndex=1
Download=1
FinishAction=!SetWallpaper [MeasureImageFile] Fit
Below is the version that I have been having problems with, as it seems like you can't reference multiple measures in a string. It should be pulling the correct values, as I used RainRegEp. Thanks!

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Metadata]
Name=
Author=matthewbuns
Information=
Version=
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[MeterString]
Meter=String

[MeasureImage]
Measure=Plugin
Plugin=WebParser
URL=https://epic.gsfc.nasa.gov/api/natural
RegExp=(?siU)"image":"(.*)".*"lat":(.*),.*"lon":(.*)}.*"date":"(.*) .*"date":"(.*)-.*"date":".*-(.*)-.*"date":".*-.*-(.*) .*"date":".* (.*)"
UpdateRate=600

[MeasureImageName]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=1

[MeasureImageLat]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=2

[MeasureImageLon]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=3

[MeasureImageDate]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=4

[MeasureImageYear]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=5

[MeasureImageMonth]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=6

[MeasureImageDay]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=7

[MeasureImageTime]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=8

[MeasureImageFile]
Measure=Plugin
Plugin=WebParser
URL=http://epic.gsfc.nasa.gov/archive/natural/[MeasureImageYear]/[MeasureImageMonth]/[MeasureImageDay]/jpg/[MeasureImageName].jpg
UpdateRate=600
Download=1
FinishAction=!SetWallpaper [MeasureImageFile] Fit
User avatar
Brian
Developer
Posts: 2673
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Problem with NASA wallpaper

Post by Brian »

Referencing section variables with the URL option of the Webparser measure requires an extra & character.

https://docs.rainmeter.net/manual/plugins/webparser/#URL

So you will probably have edit your URL like this:

Code: Select all

URL=http://epic.gsfc.nasa.gov/archive/natural/[&MeasureImageYear]/[&MeasureImageMonth]/[&MeasureImageDay]/jpg/[&MeasureImageName].jpg
However, since this measure depends on the results of another parent webparser measure, you may need to disable this measure initially and re-enable it (with the FinishAction option) on the other parent webparser measure.

Hopefully that makes sense.

-Brian
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Problem with NASA wallpaper

Post by jsmorley »

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Metadata]
Name=
Author=matthewbuns
Information=
Version=
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[MeterString]
Meter=String

[MeasureImage]
Measure=Plugin
Plugin=WebParser
URL=https://epic.gsfc.nasa.gov/api/natural
RegExp=(?siU)"image":"(.*)".*"lat":(.*),.*"lon":(.*)}.*"date":"(.*) .*"date":"(.*)-.*"date":".*-(.*)-.*"date":".*-.*-(.*) .*"date":".* (.*)"
UpdateRate=600
FinishAction=[!EnableMeasure MeasureImageFile][!CommandMeasure MeasureImageFile "Update"][!UpdateMeasure MeasureImageFile]

[MeasureImageName]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=1

[MeasureImageLat]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=2

[MeasureImageLon]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=3

[MeasureImageDate]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=4

[MeasureImageYear]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=5

[MeasureImageMonth]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=6

[MeasureImageDay]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=7

[MeasureImageTime]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=8

[MeasureImageFile]
Measure=Plugin
Plugin=WebParser
URL=http://epic.gsfc.nasa.gov/archive/natural/[&MeasureImageYear]/[&MeasureImageMonth]/[&MeasureImageDay]/jpg/[&MeasureImageName].jpg
DynamicVariables=1
UpdateRate=86400
Disabled=1
Download=1
FinishAction=!SetWallpaper [MeasureImageFile] Fit
DynamicVariables=1
matthewbuns
Posts: 2
Joined: January 24th, 2017, 3:39 am

Re: Problem with NASA wallpaper

Post by matthewbuns »

Brian wrote:Referencing section variables with the URL option of the Webparser measure requires an extra & character.
...
However, since this measure depends on the results of another parent webparser measure, you may need to disable this measure initially and re-enable it (with the FinishAction option) on the other parent webparser measure.
-Brian
I think I did it correctly, but all it's trying to do is get the image http://epic.gsfc.nasa.gov/archive/natural////jpg/.jpg

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Metadata]
Name=
Author=matthewbuns
Information=
Version=
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[MeterString]
Meter=String

[MeasureImage]
Measure=Plugin
Plugin=WebParser
URL=https://epic.gsfc.nasa.gov/api/natural
RegExp=(?siU)"image":"(.*)".*"lat":(.*),.*"lon":(.*)}.*"date":"(.*) .*"date":"(.*)-.*"date":".*-(.*)-.*"date":".*-.*-(.*) .*"date":".* (.*)"
UpdateRate=600
FinishAction=[!EnableMeasure MeasureImageFile]

[MeasureImageName]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=1

[MeasureImageLat]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=2

[MeasureImageLon]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=3

[MeasureImageDate]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=4

[MeasureImageYear]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=5

[MeasureImageMonth]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=6

[MeasureImageDay]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=7

[MeasureImageTime]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=8

[MeasureImageFile]
Measure=Plugin
Plugin=WebParser
URL=http://epic.gsfc.nasa.gov/archive/natural/[&MeasureImageYear]/[&MeasureImageMonth]/[&MeasureImageDay]/jpg/[&MeasureImageName].jpg
UpdateRate=600
Download=1
Disabled=1
FinishAction=!SetWallpaper [MeasureImageFile] Fit
EDIT:
jsmorley wrote:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Metadata]
Name=
Author=matthewbuns
Information=
Version=
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[MeterString]
Meter=String

[MeasureImage]
Measure=Plugin
Plugin=WebParser
URL=https://epic.gsfc.nasa.gov/api/natural
RegExp=(?siU)"image":"(.*)".*"lat":(.*),.*"lon":(.*)}.*"date":"(.*) .*"date":"(.*)-.*"date":".*-(.*)-.*"date":".*-.*-(.*) .*"date":".* (.*)"
UpdateRate=600
FinishAction=[!EnableMeasure MeasureImageFile][!CommandMeasure MeasureImageFile "Update"][!UpdateMeasure MeasureImageFile]

[MeasureImageName]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=1

[MeasureImageLat]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=2

[MeasureImageLon]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=3

[MeasureImageDate]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=4

[MeasureImageYear]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=5

[MeasureImageMonth]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=6

[MeasureImageDay]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=7

[MeasureImageTime]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImage]
StringIndex=8

[MeasureImageFile]
Measure=Plugin
Plugin=WebParser
URL=http://epic.gsfc.nasa.gov/archive/natural/[&MeasureImageYear]/[&MeasureImageMonth]/[&MeasureImageDay]/jpg/[&MeasureImageName].jpg
DynamicVariables=1
UpdateRate=86400
Disabled=1
Download=1
FinishAction=!SetWallpaper [MeasureImageFile] Fit
DynamicVariables=1
That did it. Thanks so much!
Last edited by matthewbuns on January 24th, 2017, 4:08 am, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Problem with NASA wallpaper

Post by jsmorley »

matthewbuns wrote:I think I did it correctly, but all it's trying to do is get the image http://epic.gsfc.nasa.gov/archive/natural////jpg/.jpg
https://forum.rainmeter.net/viewtopic.php?p=131684#p131684
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Problem with NASA wallpaper

Post by jsmorley »

Glad to help.

The key is that you are using those [&MeasureNames] as "section variables", and those will generally require DynamicVariables=1 on the measures or meters using them.
User avatar
Brian
Developer
Posts: 2673
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Problem with NASA wallpaper

Post by Brian »

matthewbuns wrote:I think I did it correctly, but all it's trying to do is get the image http://epic.gsfc.nasa.gov/archive/natural////jpg/.jpg
I tried to mention that at the end of my last post, but I wasn't clear enough - I should have given you a quick example like jsmorley did.

Glad you got it working!

-Brian