It is currently May 7th, 2024, 10:28 am

Tv Guide - Current Program Time Calculation

Get help with creating, editing & fixing problems with skins
Ariex
Posts: 14
Joined: December 23rd, 2010, 1:33 pm
Location: Germany

Tv Guide - Current Program Time Calculation

Post by Ariex »

Hello Guys,

I've made a German TV-Guide Config, it works all perfectly but i want "More".

There are two Time Values, Program beginning and Program end, it is possible to calculate the current Program length?
The Format of the Values is XX:XX, for example 16:15.
I have tried this in Rainmeter:

Code: Select all

[MeasureTimeRTL]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[Klack]
StringIndex=1
Substitute=":":""

[MeasureTime2RTL]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[Klack]
StringIndex=5
Substitute=":":""

---------------------------------

[MeasureCalcTime]
Measure=Calc
Formula=[MeasureTime2RTL]-[MeasureTimeRTL]
DynamicVariables=1
That works, but how to convert it to Minutes?
You do not have the required permissions to view the files attached to this post.
Ariex
Posts: 14
Joined: December 23rd, 2010, 1:33 pm
Location: Germany

Re: Tv Guide - Current Program Time Calculation

Post by Ariex »

Nobody an Idea? :confused:
User avatar
Chewtoy
Moderator
Posts: 995
Joined: June 10th, 2009, 12:44 pm
Location: Sweden

Re: Tv Guide - Current Program Time Calculation

Post by Chewtoy »

Alex might. He's the math freak here.

But lets see here.
I would probably use decimal time and then convert it.
How you are to convert it, I have not yet figured out.

But 1 Decimal second = 0.864 seconds
1 Decimal minute = 1.44 minutes
1 Decimal hour = 2.4 hours

I bet you can think something up with that.
I don't think, therefore I'm not.
Ariex
Posts: 14
Joined: December 23rd, 2010, 1:33 pm
Location: Germany

Re: Tv Guide - Current Program Time Calculation

Post by Ariex »

Oh big thank's Man

I've tested it, works very well - but sometimes i have little deviations from 1-12minutes in the calculated value, but i read that this is unfortunately normal :(

But thank's anyway for the tip Dude :thumbup:
User avatar
Alex2539
Rainmeter Sage
Posts: 642
Joined: July 19th, 2009, 5:59 am
Location: Montreal, QC, Canada

Re: Tv Guide - Current Program Time Calculation

Post by Alex2539 »

I would have done it like this:

Code: Select all

[MeasureCalcTime]
Measure=Calc
Formula=((MeasureTime2RTL%100)+(FLOOR(MeasureTime2RTL/100)*60))-((MeasureTimeRTL%100)+(FLOOR(MeasureTimeRTL/100)*60))+(MeasureTimeRTL > MeasureTime2RTL ? 1440 : 0)
This will give you the number of minutes a show lasts. It adds the rightmost digits to 60 times the leftmost digits, converting the time into minutes, and subtracts the start from the end. The conditional statement at the end is in case the program goes past midnight. In that case the time would have been negative so it just adds a day to it to bring it around.
ImageImageImageImage
User avatar
Chewtoy
Moderator
Posts: 995
Joined: June 10th, 2009, 12:44 pm
Location: Sweden

Re: Tv Guide - Current Program Time Calculation

Post by Chewtoy »

Like I said. The math freak. :)
I don't think, therefore I'm not.
Ariex
Posts: 14
Joined: December 23rd, 2010, 1:33 pm
Location: Germany

Re: Tv Guide - Current Program Time Calculation

Post by Ariex »

Holy Shit!, It Works! :o

I've only put square brackets around the measures, and then it worked!

Thank you very much Alex, alone I would never have come to this formula. :great:
User avatar
santa_ryan
Posts: 397
Joined: June 22nd, 2010, 4:11 am

Re: Tv Guide - Current Program Time Calculation

Post by santa_ryan »

aww Alex.. you beat me to this ... xP i saw it this morning but had to go :/
I have three rules when I'm trying to help you.
  • Don't get mad when you don't understand something
  • Be VERY specific with what you ask for.
    The more specific you are, the higher the quality of support you receive.
  • Do not just copy and paste what I put in examples and come back saying it doesn't work.
    It does work, but I purposely left blanks that you need to fill for your specific needs.
Ariex
Posts: 14
Joined: December 23rd, 2010, 1:33 pm
Location: Germany

Re: Tv Guide - Current Program Time Calculation

Post by Ariex »

New Idea, new Problem :D

I don't start a new Topic, because the Problem is nearly the same.

Okay, maybe someone can help, its a very "Special" Problem
The Formula from Alex works wonderful, but i want "More" again...

I want to know how long the following Program is, so i took the time of the following Program in minutes (calculated with Alex's formula) and then i add the time from MeasureTimeLength2RTL (minutevalue, for example 10 or 150 or 90) and converted it to Decimal Numbers and splitted it into two 2 values, hours and minutes, on the Screen you can see thats works very well, but, and now comes the Problem - if the minutevalue under 10, i get for example 17:9 or 12:3, the same Problem is by the hoursvalue, so you see, i need zero's :D

Of course i have tried it with Substitute="3":"03" , but then it change all three's in the value, for example 17:30 i get 17:030 - not good...

So thats it, i hope this is possible, thanks in advance guys.
You do not have the required permissions to view the files attached to this post.
User avatar
Chewtoy
Moderator
Posts: 995
Joined: June 10th, 2009, 12:44 pm
Location: Sweden

Re: Tv Guide - Current Program Time Calculation

Post by Chewtoy »

[Add0]
Measure=Calc
Formula=MinuteValueMeasure < 9.5 ? 0 : 1
Substitute="1":""

Then just add that before where ever you use your MinuteValueMeasure.

[SomeMeter]
Meter=String
MeasureName=Add0
MeasureName2=MinuteValueMeasure
Text="%1%2min"
I don't think, therefore I'm not.