It is currently June 23rd, 2024, 11:23 pm

Mlb Live Scores

Get help with creating, editing & fixing problems with skins
jake2456
Posts: 87
Joined: June 8th, 2015, 10:39 pm

Mlb Live Scores

Post by jake2456 »

I came across some mlb live info and im working on a skin. I tested with a game tonight and it was working.

My issue im looking at right now is that the url will change every day. It happens to change by date. So what im looking for is if there is a way to make a variable like Day= that will get the current day number to replace the number in the url with #Day# so it keeps up with the url changing every day?
jake2456
Posts: 87
Joined: June 8th, 2015, 10:39 pm

Re: Mlb Live Scores

Post by jake2456 »

I found my answer with a bit of trial and error. section variables in the url werent working unless i added & between [ and Measure.

So far looks like this will be working.
jake2456
Posts: 87
Joined: June 8th, 2015, 10:39 pm

Re: Mlb Live Scores

Post by jake2456 »

Seems to be an issue with the innings info im working on. the link im parsing from gets updated continually during a game. and new line is added. right now i have it parsing info for 9 innings but during a game in progress not all innings code is there as the code gets updated when it enters that inning. which in turn returns a webparse error and no info gets collected unless the game is in the bottom of the 9th or over. Can this be made to work somehow or is this beyond something webparsing and regexp can do?
User avatar
balala
Rainmeter Sage
Posts: 16325
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Mlb Live Scores

Post by balala »

Please post some code, because it would be much easier to help.
jake2456
Posts: 87
Joined: June 8th, 2015, 10:39 pm

Re: Mlb Live Scores

Post by jake2456 »

Sorry most have forgot to hit past.

Code: Select all

[MeasureBoxScore]
Measure=Plugin
Plugin=WebParser
URL=http://gd2.mlb.com/components/game/mlb/year_2016/month_05/day_04/gid_2016_05_04_chnmlb_pitmlb_1/boxscore.xml
RegExp=(?siU).*away_fname="(.*)".*home_fname="(.*)".*away_team_runs="(.*)".*home_team_runs="(.*)".*away_team_hits="(.*)".*home_team_hits="(.*)".*away_team_errors="(.*)".*home_team_errors="(.*)">.*away="(.*)".*home="(.*)".*inning="(.*)"/>.*away="(.*)".*home="(.*)".*inning="(.*)"/>.*away="(.*)".*home="(.*)".*inning="(.*)"/>.*away="(.*)".*home="(.*)".*inning="(.*)"/>.*away="(.*)".*home="(.*)".*inning="(.*)"/>.*away="(.*)".*home="(.*)".*inning="(.*)"/>.*away="(.*)".*home="(.*)".*inning="(.*)"/>.*away="(.*)".*home="(.*)".*inning="(.*)"/>.*away="(.*)".*home="(.*)".*inning="(.*)"/>.*
DynamicVariables=1
User avatar
balala
Rainmeter Sage
Posts: 16325
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Mlb Live Scores

Post by balala »

That's just the parent WebParser measure and is not enough. Please post the whole code, including the included files, if there is any.
jake2456
Posts: 87
Joined: June 8th, 2015, 10:39 pm

Re: Mlb Live Scores

Post by jake2456 »

If your testing in rainregexp youll need to parse from this URL: http://gd2.mlb.com/components/game/mlb/year_2016/month_05/day_04/gid_2016_05_04_chnmlb_pitmlb_1/boxscore.xml

Measure.inc file

Code: Select all

[MeasureDay]
Measure=Time
Format=%d
DynamicVariables=1

[MeasureMonth]
Measure=Time
Format=%m
DynamicVariables=1

[MeasureYear]
Measure=Time
Format=%Y
DynamicVariables=1

[MeasureScores]
Measure=Plugin
Plugin=WebParser
URL=http://gd2.mlb.com/components/game/mlb/year_[&MeasureYear]/month_[&MeasureMonth]/day_[&MeasureDay]
RegExp=(?siU).*pitmlb.*/"> (.*)</a>
DynamicVariables=1

[MeasureTeam1]
Measure=Plugin
Plugin=WebParser
Url=[MeasureScores]
StringIndex=1
DynamicVariables=1

[MeasureScoreBoard]
Measure=Plugin
Plugin=WebParser
URL=http://gd2.mlb.com/components/game/mlb/year_[&MeasureYear]/month_[&MeasureMonth]/day_[&MeasureDay]/scoreboard.xml
RegExp=(?siU).*pitmlb.*status="(.*)".*<team name="(.*)".* R="(.*)".*H="(.*)".*E="(.*)"/>.*<team name="(.*)".* R="(.*)".*H="(.*)".*E="(.*)"/>
DynamicVariables=1

[MeasureStatus2]
Measure=Plugin
Plugin=WebParser
Url=[MeasureScoreBoard]
StringIndex=1
DynamicVariables=1

[MeasureHomeTeam2]
Measure=Plugin
Plugin=WebParser
Url=[MeasureScoreBoard]
StringIndex=2
DynamicVariables=1

[MeasureHomeRuns2]
Measure=Plugin
Plugin=WebParser
Url=[MeasureScoreBoard]
StringIndex=3
DynamicVariables=1

[MeasureHomeHits2]
Measure=Plugin
Plugin=WebParser
Url=[MeasureScoreBoard]
StringIndex=4
DynamicVariables=1

[MeasureHomeErrors2]
Measure=Plugin
Plugin=WebParser
Url=[MeasureScoreBoard]
StringIndex=5
DynamicVariables=1

[MeasureAwayTeam2]
Measure=Plugin
Plugin=WebParser
Url=[MeasureScoreBoard]
StringIndex=6
DynamicVariables=1

[MeasureAwayRuns2]
Measure=Plugin
Plugin=WebParser
Url=[MeasureScoreBoard]
StringIndex=7
DynamicVariables=1

[MeasureAwayHits2]
Measure=Plugin
Plugin=WebParser
Url=[MeasureScoreBoard]
StringIndex=8
DynamicVariables=1

[MeasureAwayErrors2]
Measure=Plugin
Plugin=WebParser
Url=[MeasureScoreBoard]
StringIndex=9
DynamicVariables=1

[MeasureBoxScore]
Measure=Plugin
Plugin=WebParser
URL=http://gd2.mlb.com/components/game/mlb/year_[&MeasureYear]/month_[&MeasureMonth]/day_[&MeasureDay]/[&MeasureTeam1]boxscore.xml
RegExp=(?siU).*away_fname="(.*)".*home_fname="(.*)".*away_team_runs="(.*)".*home_team_runs="(.*)".*away_team_hits="(.*)".*home_team_hits="(.*)".*away_team_errors="(.*)".*home_team_errors="(.*)">.*away="(.*)".*home="(.*)".*inning="(.*)"/>.*away="(.*)".*home="(.*)".*inning="(.*)"/>.*away="(.*)".*home="(.*)".*inning="(.*)"/>.*away="(.*)".*home="(.*)".*inning="(.*)"/>.*away="(.*)".*home="(.*)".*inning="(.*)"/>.*away="(.*)".*home="(.*)".*inning="(.*)"/>.*away="(.*)".*home="(.*)".*inning="(.*)"/>.*away="(.*)".*home="(.*)".*inning="(.*)"/>.*away="(.*)".*home="(.*)".*inning="(.*)"/>.*
DynamicVariables=1

[MeasureAwayTeam1]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=1
DynamicVariables=1

[MeasureHomeTeam1]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=2
DynamicVariables=1

[MeasureAwayRuns1]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=3
DynamicVariables=1

[MeasureHomeRuns1]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=4
DynamicVariables=1

[MeasureAwayHits1]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=5
DynamicVariables=1

[MeasureHomeHits1]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=6
DynamicVariables=1

[MeasureAwayErrors1]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=7
DynamicVariables=1

[MeasureHomeErrors1]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=8
DynamicVariables=1

[MeasureAwayInning1]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=9
DynamicVariables=1

[MeasureHomeInning1]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=10
DynamicVariables=1

[MeasureInning1]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=11
DynamicVariables=1

[MeasureAwayInning2]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=12
DynamicVariables=1

[MeasureHomeInning2]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=13
DynamicVariables=1

[MeasureInning2]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=14
DynamicVariables=1

[MeasureAwayInning3]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=15
DynamicVariables=1

[MeasureHomeInning3]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=16
DynamicVariables=1

[MeasureInning3]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=17
DynamicVariables=1

[MeasureAwayInning4]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=18
DynamicVariables=1

[MeasureHomeInning4]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=19
DynamicVariables=1

[MeasureInning4]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=20
DynamicVariables=1

[MeasureAwayInning5]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=21
DynamicVariables=1

[MeasureHomeInning5]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=22
DynamicVariables=1

[MeasureInning5]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=23
DynamicVariables=1

[MeasureAwayInning6]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=24
DynamicVariables=1

[MeasureHomeInning6]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=25
DynamicVariables=1

[MeasureInning6]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=26
DynamicVariables=1

[MeasureAwayInning7]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=27
DynamicVariables=1

[MeasureHomeInning7]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=28
DynamicVariables=1

[MeasureInning7]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=29
DynamicVariables=1

[MeasureAwayInning8]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=30
DynamicVariables=1

[MeasureHomeInning8]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=31
DynamicVariables=1

[MeasureInning8]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=32
DynamicVariables=1

[MeasureAwayInning9]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=33
DynamicVariables=1

[MeasureHomeInning9]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=34
DynamicVariables=1

[MeasureInning9]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBoxScore]
StringIndex=35
DynamicVariables=1
Boxscores.ini file

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
SkinWidth=250
SkinHeight=100
@include=#@#Measures.inc

[Variables]
Color1=255,255,255,100

[OddStyle]
FontColor=#Color1#
FontSize=10
AntiAlias=1

[mAwayTeam1]
Meter=String
MeasureName=MeasureAwayTeam1
MeterStyle=OddStyle
StringAlign=Left
X=0
Y=20
Text=%1
DynamicVariables=1

[mAwayRuns1]
Meter=String
MeasureName=MeasureAwayRuns1
MeterStyle=OddStyle
StringAlign=Left
X=(250-40)
Y=20
Text=%1
DynamicVariables=1

[mAwayHits1]
Meter=String
MeasureName=MeasureAwayHits1
MeterStyle=OddStyle
StringAlign=Left
X=(250-27)
Y=20
Text=%1
DynamicVariables=1

[mAwayErrors1]
Meter=String
MeasureName=MeasureAwayErrors1
MeterStyle=OddStyle
StringAlign=Left
X=(250-10)
Y=20
Text=%1
DynamicVariables=1

[mHomeTeam1]
Meter=String
MeasureName=MeasureHomeTeam1
MeterStyle=OddStyle
StringAlign=Left
X=0
Y=40
Text=%1
DynamicVariables=1

[mHomeRuns2]
Meter=String
MeasureName=MeasureHomeRuns1
MeterStyle=OddStyle
StringAlign=Left
X=(250-40)
Y=40
Text=%1
DynamicVariables=1

[mHomeHits2]
Meter=String
MeasureName=MeasureHomeHits1
MeterStyle=OddStyle
StringAlign=Left
X=(250-27)
Y=40
Text=%1
DynamicVariables=1

[mHomeErrors2]
Meter=String
MeasureName=MeasureHomeErrors1
MeterStyle=OddStyle
StringAlign=Left
X=(250-10)
Y=40
Text=%1
DynamicVariables=1

[mRuns]
Meter=String
MeterStyle=OddStyle
StringAlign=Left
X=(250-40)
Y=0
Text=R
DynamicVariables=1

[mHits]
Meter=String
MeterStyle=OddStyle
StringAlign=Left
X=(250-25)
Y=0
Text=H
DynamicVariables=1

[mErrors]
Meter=String
MeterStyle=OddStyle
StringAlign=Left
X=(250-10)
Y=0
Text=E
DynamicVariables=1

[mInning1]
Meter=String
MeasureName=MeasureInning1
MeterStyle=OddStyle
StringAlign=Left
X=110
Y=0
Text=%1
DynamicVariables=1

[mAwayInning1]
Meter=String
MeasureName=MeasureAwayInning1
MeterStyle=OddStyle
StringAlign=Left
X=110
Y=20
Text=%1
DynamicVariables=1

[mHomeInning1]
Meter=String
MeasureName=MeasureHomeInning1
MeterStyle=OddStyle
StringAlign=Left
X=110
Y=40
Text=%1
DynamicVariables=1

[mInning2]
Meter=String
MeasureName=MeasureInning2
MeterStyle=OddStyle
StringAlign=Left
X=120
Y=0
Text=%1
DynamicVariables=1

[mAwayInning2]
Meter=String
MeasureName=MeasureAwayInning2
MeterStyle=OddStyle
StringAlign=Left
X=120
Y=20
Text=%1
DynamicVariables=1

[mHomeInning2]
Meter=String
MeasureName=MeasureHomeInning2
MeterStyle=OddStyle
StringAlign=Left
X=120
Y=40
Text=%1
DynamicVariables=1

[mInning3]
Meter=String
MeasureName=MeasureInning3
MeterStyle=OddStyle
StringAlign=Left
X=130
Y=0
Text=%1
DynamicVariables=1

[mAwayInning3]
Meter=String
MeasureName=MeasureAwayInning3
MeterStyle=OddStyle
StringAlign=Left
X=130
Y=20
Text=%1
DynamicVariables=1

[mHomeInning3]
Meter=String
MeasureName=MeasureHomeInning3
MeterStyle=OddStyle
StringAlign=Left
X=130
Y=40
Text=%1
DynamicVariables=1

[mInning4]
Meter=String
MeasureName=MeasureInning4
MeterStyle=OddStyle
StringAlign=Left
X=140
Y=0
Text=%1
DynamicVariables=1

[mAwayInning4]
Meter=String
MeasureName=MeasureAwayInning4
MeterStyle=OddStyle
StringAlign=Left
X=140
Y=20
Text=%1
DynamicVariables=1

[mHomeInning4]
Meter=String
MeasureName=MeasureHomeInning4
MeterStyle=OddStyle
StringAlign=Left
X=140
Y=40
Text=%1
DynamicVariables=1

[mInning5]
Meter=String
MeasureName=MeasureInning5
MeterStyle=OddStyle
StringAlign=Left
X=150
Y=0
Text=%1
DynamicVariables=1

[mAwayInning5]
Meter=String
MeasureName=MeasureAwayInning5
MeterStyle=OddStyle
StringAlign=Left
X=150
Y=20
Text=%1
DynamicVariables=1

[mHomeInning5]
Meter=String
MeasureName=MeasureHomeInning5
MeterStyle=OddStyle
StringAlign=Left
X=150
Y=40
Text=%1
DynamicVariables=1

[mInning6]
Meter=String
MeasureName=MeasureInning6
MeterStyle=OddStyle
StringAlign=Left
X=160
Y=0
Text=%1
DynamicVariables=1

[mAwayInning6]
Meter=String
MeasureName=MeasureAwayInning6
MeterStyle=OddStyle
StringAlign=Left
X=160
Y=20
Text=%1
DynamicVariables=1

[mHomeInning6]
Meter=String
MeasureName=MeasureHomeInning6
MeterStyle=OddStyle
StringAlign=Left
X=160
Y=40
Text=%1
DynamicVariables=1

[mInning7]
Meter=String
MeasureName=MeasureInning7
MeterStyle=OddStyle
StringAlign=Left
X=170
Y=0
Text=%1
DynamicVariables=1

[mAwayInning7]
Meter=String
MeasureName=MeasureAwayInning7
MeterStyle=OddStyle
StringAlign=Left
X=170
Y=20
Text=%1
DynamicVariables=1

[mHomeInning7]
Meter=String
MeasureName=MeasureHomeInning7
MeterStyle=OddStyle
StringAlign=Left
X=170
Y=40
Text=%1
DynamicVariables=1

[mInning8]
Meter=String
MeasureName=MeasureInning8
MeterStyle=OddStyle
StringAlign=Left
X=180
Y=0
Text=%1
DynamicVariables=1

[mAwayInning8]
Meter=String
MeasureName=MeasureAwayInning8
MeterStyle=OddStyle
StringAlign=Left
X=180
Y=20
Text=%1
DynamicVariables=1

[mHomeInning8]
Meter=String
MeasureName=MeasureHomeInning8
MeterStyle=OddStyle
StringAlign=Left
X=180
Y=40
Text=%1
DynamicVariables=1

[mInning9]
Meter=String
MeasureName=MeasureInning9
MeterStyle=OddStyle
StringAlign=Left
X=190
Y=0
Text=%1
DynamicVariables=1

[mAwayInning9]
Meter=String
MeasureName=MeasureAwayInning9
MeterStyle=OddStyle
StringAlign=Left
X=190
Y=20
Text=%1
DynamicVariables=1

[mHomeInning9]
Meter=String
MeasureName=MeasureHomeInning9
MeterStyle=OddStyle
StringAlign=Left
X=190
Y=40
Text=%1
DynamicVariables=1
User avatar
balala
Rainmeter Sage
Posts: 16325
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Mlb Live Scores

Post by balala »

For the beginning I worked just with the Measure.inc file and found the followings:
1. First of all you should disable the [MeasureBoxScore] measure (will enable it a bit later, at point 3.), adding a Disabled=1 option.
2. Remove its URL option (yes, I know it's absolutely needed, but will add it after the [MeasureScores] is resolved - also see the point 3.).
3. Add the following FinishAction option to the [MeasureScores] measure: FinishAction=[!SetOption MeasureBoxScore URL "http://gd2.mlb.com/components/game/mlb/year_[&MeasureYear]/month_[&MeasureMonth]/day_[&MeasureDay]/[&MeasureTeam1]boxscore.xml"][!EnableMeasure "MeasureBoxScore"][!CommandMeasure "MeasureBoxScore" "Update"].
4. Now the [MeasureBoxScore] measure still won't work every time, because what you've described summary. Replace its RegExp option with this:

Code: Select all

RegExp=(?siU).*away_fname="(.*)".*home_fname="(.*)".*away_team_runs="(.*)".*home_team_runs="(.*)".*away_team_hits="(.*)".*home_team_hits="(.*)".*away_team_errors="(.*)".*home_team_errors="(.*)">(?(?=.*away=).*"(.*)".*home="(.*)".*inning="(.*)"/>)(?(?=.*away=).*"(.*)".*home="(.*)".*inning="(.*)"/>)(?(?=.*away=).*"(.*)".*home="(.*)".*inning="(.*)"/>)(?(?=.*away=).*"(.*)".*home="(.*)".*inning="(.*)"/>)(?(?=.*away=).*"(.*)".*home="(.*)".*inning="(.*)"/>)(?(?=.*away=).*"(.*)".*home="(.*)".*inning="(.*)"/>)(?(?=.*away=).*"(.*)".*home="(.*)".*inning="(.*)"/>)(?(?=.*away=).*"(.*)".*home="(.*)".*inning="(.*)"/>)(?(?=.*away=).*"(.*)".*home="(.*)".*inning="(.*)"/>)
I used here the Lookahead assertion. This will ensure you that even if there are less away="(.*)".*home="(.*)".*inning="(.*)"/> elements, the measure(s) will return results or empty strings.
Please let me know if this helped.
jake2456
Posts: 87
Joined: June 8th, 2015, 10:39 pm

Re: Mlb Live Scores

Post by jake2456 »

I stumbled upon lookahead assertitions a few minutes ago and was just looking into that.

I think I followed your instructions for the other stuff, but for some reason the scores.ini is showing up blank except for R H E.
It just started doing this before i made the changes. If I replace [&MeasureTeam1]boxscore.xml with gid_2016_05_04_chnmlb_pitmlb_1/boxscore.xml it works. The whole point of [MeasureScores] is to search for a specific team an get the link info for the boxscore.xml. in this case its recieving (gid_2016_05_04_chnmlb_pitmlb_1/) and should be then named as [MeasureTeam1]. Its Parsing the right info but for some reason having this [&MeasureTeam1]boxscore.xml instead of this gid_2016_05_04_chnmlb_pitmlb_1/boxscore.xml isnt working.
jake2456
Posts: 87
Joined: June 8th, 2015, 10:39 pm

Re: Mlb Live Scores

Post by jake2456 »

I guess the error was in the new boxscore regexp had to make the lookaheads as (?(?=.*away=).*"(.*)")(?(?=.*home=).*"(.*)")(?(?=.*inning=).*"(.*)") instead of what you posted. As of right now with that change everything is working correctly. Thank you for your help.