It is currently May 6th, 2024, 10:11 pm

Need help with image file copy after download

Get help with creating, editing & fixing problems with skins
rakibdepu
Posts: 9
Joined: October 9th, 2020, 4:43 pm

Re: Need help with image file copy after download

Post by rakibdepu »

rbriddickk84 wrote: October 24th, 2020, 10:39 am What kind of error do you get?

Also i noticed your main update rate is 100 only, it can take some performance impact globally. At least for me, and usually better to go with minimum 1000 and then in the other measures and meters should control separatly those. Like with "WebParser" the "UpdateRate"
invalid image in DownloadFile folder.
User avatar
balala
Rainmeter Sage
Posts: 16201
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Need help with image file copy after download

Post by balala »

rakibdepu wrote: October 24th, 2020, 7:37 am It does work but after some time image download got error, that's why i add [GetWidth], [GetHeight] and [MeasureSize] measures.
rbriddickk84 wrote: October 24th, 2020, 10:39 am Also i noticed your main update rate is 100 only, it can take some performance impact globally. At least for me, and usually better to go with minimum 1000 and then in the other measures and meters should control separatly those. Like with "WebParser" the "UpdateRate"
Yes, but in this case an "animation" (not sure this is the best term) takes place. Related to this, see how the [MeterSeconds] Roundline acts, on each second, but even more when the second goes from 59 to 0. This is why the Update=100 is required. Normally yes, all skins using WebParser measures should have been set to the default Update=1000, this is the best approach for these skins, however if any kind of animation is involved, the default Update might be too much and has to be decreased.
However since the Update is set to a tenth second, this along with the UpdateRate=1200 option of the [Measure_PIC] measure means one update of the measure on each two minutes (120 seconds). First thing whach has to be tried out is to increase the UpdateRate of the measure to UpdateRate=12000, which gives an update on every 1200 seconds = 20 minutes. This is a completely acceptable update rate.
Does this fix the error?
User avatar
balala
Rainmeter Sage
Posts: 16201
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Need help with image file copy after download

Post by balala »

rakibdepu wrote: October 24th, 2020, 11:31 am invalid image in DownloadFile folder.
There are some errors on two options:
  • Replace the DownloadFile option of the [Measure_PIC] measure with: DownloadFile=Earth.jpg.
  • Replace the ImageName option of the [MeterClockFace] with MeasureName=Measure_PIC.
Hope this fix the invalid image download error. Does it?
User avatar
rbriddickk84
Rainmeter Sage
Posts: 276
Joined: February 17th, 2014, 12:39 pm
Location: Hungary

Re: Need help with image file copy after download

Post by rbriddickk84 »

balala wrote: October 24th, 2020, 11:32 am Yes, but in this case an "animation" (not sure this is the best term) takes place. Related to this, see how the [MeterSeconds] Roundline acts, on each second, but even more when the second goes from 59 to 0. This is why the Update=100 is required. Normally yes, all skins using WebParser measures should have been set to the default Update=1000, this is the best approach for these skins, however if any kind of animation is involved, the default Update might be too much and has to be decreased.
Yep, i am aware of that :)
That is why i tried to approach kind of different method with animation updates. Such as if in Rainmeter the update is on 1000 but i need a simple fast animation, then recently i experimented with ActionTimer - loop. It took just a small impact on performance. I know this is not the best solution, but it works for me so far :D
Since in the skin where i implemented my animation was using only one animated effect, i thought it would be better to change the global update to 1000 in best case. I know, i changed all my elements update divided to -1, so i update them if those needed separately. :)
User avatar
rbriddickk84
Rainmeter Sage
Posts: 276
Joined: February 17th, 2014, 12:39 pm
Location: Hungary

Re: Need help with image file copy after download

Post by rbriddickk84 »

balala wrote: October 24th, 2020, 11:36 am There are some errors on two options:
  • Replace the DownloadFile option of the [Measure_PIC] measure with: DownloadFile=Earth.jpg.
  • Replace the ImageName option of the [MeterClockFace] with MeasureName=Measure_PIC.
Hope this fix the invalid image download error. Does it?
It makes sense, possibly the first idea should single-handedly solve the error.
I think in the [MeterClockFace] it should read and display that .jpg just fine, but i would only add an UpdateDivider=-1 to that meter, and i would update it when the Command finished copying the new image.
I don't know if my theory is useable?
User avatar
balala
Rainmeter Sage
Posts: 16201
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Need help with image file copy after download

Post by balala »

rbriddickk84 wrote: October 24th, 2020, 11:55 am I don't know if my theory is useable?
Yep, I think it definitely is. Try it out.
User avatar
rbriddickk84
Rainmeter Sage
Posts: 276
Joined: February 17th, 2014, 12:39 pm
Location: Hungary

Re: Need help with image file copy after download

Post by rbriddickk84 »

Okay, i played a bit around, and looked through again everything.
-So i removed the [GetWidth], [GetHeight], [MeasureSize] and the [MeasureScript] measures.
-Then i modified the [Measure_PIC] measure to "FinishAction=[!CommandMeasure MeasureRun "Run"]", and the "DownloadFile=Earth.jpg".
-Finally added to the [MeterClockFace] an "UpdateDivider=-1" parameter, and so far it works wihout any problems.

Also checked the image files date modified timestamps, and both files are modified to the new.


Here is the code-part for that:

Code: Select all

[Measure_PIC]
Measure=WEBPARSER
Url="https://www.fourmilab.ch/cgi-bin/Earth?img=NASAmMM-l.evif&imgsize=1000&dynimg=y&gamma=1.32&opt=-l&lat=90&ns=North&lon=180&ew=East&alt=35785&tle=&date=0&utc=&jd="
Download=1
DownloadFile=Earth.jpg
UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
FinishAction=[!CommandMeasure MeasureRun "Run"]
UpdateRate=1200
DynamicVariables=1

[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Parameter=copy "#InFile#" "#OutFile#"
FinishAction=[!UpdateMeter "MeterClockFace"]

[MeasureTime]
Measure=Time

[MeasureSeconds]
Measure=Time
Format="%S"
AverageSize=10

[MeasureSeconds1]
Measure=Calc
Formula=MeasureSeconds * 10

[MeasureMinutes]
Measure=Time
Format="%M"

[MeasureMinutes1]
Measure=Calc
Formula=MeasureMinutes * 10

[MeasureHours]
Measure=Time
Format="%H"

[MeasureHours1]
Measure=Calc
Formula=MeasureHours * 10

[MeterBG]
Meter=Image
SolidColor=0,0,0,1
W=#ImageW#
H=#ImageH#
X=(#ImageXCenter# - ([MeterBG:W] / 2))
Y=(#ImageYCenter# - ([MeterBG:H] / 2))
MouseScrollUpAction=[!SetVariable Scaler (Clamp(#Scaler#+0.1,0.5,2.9))][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!SetVariable Scaler (Clamp(#Scaler#-0.1,0.5,2.9))][!UpdateMeter *][!Redraw]
MiddleMouseUpACtion=[!SetVariable Scaler 1][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeterClockFace]
Meter=Image
ImageName=Earth.jpg
W=#ImageW#
H=#ImageH#
X=(#ImageXCenter# - ([MeterClockFace:W] / 2))
Y=(#ImageYCenter# - ([MeterClockFace:H] / 2))
MaskImageName=mask.png
TransformationMatrix=#Scaler#;0;0;#Scaler#;((1-#Scaler#)*([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2));((1-#Scaler#)*([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2))
DynamicVariables=1
UpdateDivider=-1

User avatar
balala
Rainmeter Sage
Posts: 16201
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Need help with image file copy after download

Post by balala »

rbriddickk84 wrote: October 24th, 2020, 12:48 pm Here is the code-part for that:
Ok, let's wait for the OP to see if he still encounters troubles. Hope he doesn't, but let's see...
User avatar
rbriddickk84
Rainmeter Sage
Posts: 276
Joined: February 17th, 2014, 12:39 pm
Location: Hungary

Re: Need help with image file copy after download

Post by rbriddickk84 »

balala wrote: October 24th, 2020, 1:03 pm Ok, let's wait for the OP to see if he still encounters troubles. Hope he doesn't, but let's see...
Yep :) I am curious. :D
rakibdepu
Posts: 9
Joined: October 9th, 2020, 4:43 pm

Re: Need help with image file copy after download

Post by rakibdepu »

balala wrote: October 24th, 2020, 1:03 pm Ok, let's wait for the OP to see if he still encounters troubles. Hope he doesn't, but let's see...
Thanks for help,

Now i'm facing new problem.

Code: Select all

[MeterClockFace]
Meter=Image
ImageName=Earth.jpg
W=#ImageW#
H=#ImageH#
X=(#ImageXCenter# - ([MeterClockFace:W] / 2))
Y=(#ImageYCenter# - ([MeterClockFace:H] / 2))
MaskImageName=mask.png
TransformationMatrix=#Scaler#;0;0;#Scaler#;((1-#Scaler#)*([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2));((1-#Scaler#)*([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2))
DynamicVariables=1

[MeterRotate]
Meter=Rotator
MeasureName=MeasureHours1
ImageName=Earth.jpg
X=0
Y=0
W=#Wi#
H=#Hi#
OffsetX=([MeterRotate:W] / 2))
OffsetY=([MeterRotate:H] / 2))
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
ValueRemainder=240

Want that image to rotate in it's center.