It is currently June 20th, 2024, 12:58 pm

Mlb Live Scores

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

Re: Mlb Live Scores

Post by jake2456 »

Yincognito wrote: September 3rd, 2023, 8:53 pm I did notice, however, that at times the skin doesn't display anything, even though it used to do for the same thing - not sure yet what would be the reason, maybe you're not accounting for spaces in all places.
This is what i cant figure out an its driving me nuts. My thought was that its one of the lookaheads and i wasnt sure i was doing them correctly because i had changed them so many times to get it to work. So Ill try to do what you suggested an see if it makes a difference.
User avatar
Yincognito
Rainmeter Sage
Posts: 7458
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Mlb Live Scores

Post by Yincognito »

jake2456 wrote: September 3rd, 2023, 9:07 pm This is what i cant figure out an its driving me nuts. My thought was that its one of the lookaheads and i wasnt sure i was doing them correctly because i had changed them so many times to get it to work. So Ill try to do what you suggested an see if it makes a difference.
Don't forget about spaces too, if necessary. If you want to have a better idea of what's there to help you extract data from it, you can use WebFormatter.com to do it - just paste the JSON you're getting in that box, click Format and save it somewhere on your computer for easier viewing (Notepad++ displays it nicely if you set the Language to Javascript from the menu):
MLB JSON Notepad++.jpg
Obviously, you should keep in mind that after formatting, there will be a lot of spaces, tabs and newline characters added (that don't exist in the original output from the site), so this helps more with identifying the fields, values and what you need, and not entirely when designing the regexes. Personally, I do my tests with the help of offline local files where I save both the original and the formatted version of what I interrogate online. It helps by not polling the site too often to get banned or similar, by the way, and the changes to the URL option are minor, via commenting lines:
MLB URLs.jpg
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
jake2456
Posts: 87
Joined: June 8th, 2015, 10:39 pm

Re: Mlb Live Scores

Post by jake2456 »

I changed all the lookaheads to the way you said need to be

Code: Select all

(?(?=.*"innings".*"num":1,.*"home".*"runs":.*,.*"away".*"runs":.*,).*"innings".*"num":1,.*"home".*"runs":(.*),.*"away".*"runs":(.*),)
and made a few small changes to a few of them and now seems to all be working correctly. Past Present and Future games seem to be display correctly now. I had tryed a way to do them similar to your way at one point but they didnt work. So thank you for that correction on how its supposed to be. Much appreciated. Now i can look at giving this thing an updated look.
User avatar
Yincognito
Rainmeter Sage
Posts: 7458
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Mlb Live Scores

Post by Yincognito »

jake2456 wrote: September 3rd, 2023, 10:09 pm I changed all the lookaheads to the way you said need to be

Code: Select all

(?(?=.*"innings".*"num":1,.*"home".*"runs":.*,.*"away".*"runs":.*,).*"innings".*"num":1,.*"home".*"runs":(.*),.*"away".*"runs":(.*),)
and made a few small changes to a few of them and now seems to all be working correctly. Past Present and Future games seem to be display correctly now. I had tryed a way to do them similar to your way at one point but they didnt work. So thank you for that correction on how its supposed to be. Much appreciated. Now i can look at giving this thing an updated look.
No problem, glad it worked out eventually. Good luck with the rest of the updating. :thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
jake2456
Posts: 87
Joined: June 8th, 2015, 10:39 pm

Re: Mlb Live Scores

Post by jake2456 »

Few more things to do an i think itll be finished. Should have it uploaded tonight or tomorrow night.

Preview:
You do not have the required permissions to view the files attached to this post.
jake2456
Posts: 87
Joined: June 8th, 2015, 10:39 pm

Re: Mlb Live Scores

Post by jake2456 »

Ive got a small bug im trying to work out but im not sure how to fix it.

Im using this:

Code: Select all

(?(?=.*"num":6,.*"home".*"runs":.*,.*"away".*"runs":.*,).*"num":6,.*"home".*"runs":(.*),.*"away".*"runs":(.*),)
To Capture this:

Code: Select all

{"num":6,"ordinalNum":"6th","home":{"runs":0,"hits":0,"errors":0,"leftOnBase":0},"away":{"runs":0,"hits":2,"errors":0,"leftOnBase":0}}]
But the "runs":0, section doesnt always exist for that inning until either a run is scored or the inning is over and they add another inning("num":7 section)
For example:

Code: Select all

{"num":6,"ordinalNum":"6th","home":{"hits":0,"errors":0,"leftOnBase":0},"away":{"runs":1,"hits":2,"errors":0,"leftOnBase":1}}],"teams":{"home":{"runs":1,"hits":3,"errors":0,"leftOnBase":3},"away":{"runs":1,"hits":8,"errors":0,"leftOnBase":7}},
So in turn it jumps ahead to the next instance:

Code: Select all

"teams":{"home":{"runs":1,"hits":3,"errors":0,"leftOnBase":3},"away":{"runs":1,"hits":8,"errors":0,"leftOnBase":7}},
which always exists and captures that instead those giving the wrong values.

Ive tryd a few different ways. Even thought i had it solved with this:

Code: Select all

(?(?=.*"num":6,"ordinalNum":".*","home":{"runs":.*,).*"num":6,"ordinalNum":".*","home":{"runs":(.*),)(?(?=.*"num":6,"ordinalNum":".*","home":{"runs":.*,"hits":.*,"errors":.*,"leftOnBase":.*},"away":{"runs":.*,).*"num":6,"ordinalNum":".*","home":{"runs":.*,"hits":.*,"errors":.*,"leftOnBase":.*},"away":{"runs":(.*),)
But for some reason this never captures a value for the away runs even if they exist.
User avatar
kfonda
Posts: 20
Joined: May 8th, 2015, 8:15 pm
Location: Manasquan, NJ USA

Re: Mlb Live Scores

Post by kfonda »

Can you post what you currently have? I'm not very good at this but, I can take a look.
jake2456
Posts: 87
Joined: June 8th, 2015, 10:39 pm

Re: Mlb Live Scores

Post by jake2456 »

Yea. Its pretty much done I think, besides the bug, an you cant really test for that unless theres a game currently being played.

Click the circle in top right to choose team.
Last edited by jake2456 on September 6th, 2023, 5:33 am, edited 1 time in total.
User avatar
kfonda
Posts: 20
Joined: May 8th, 2015, 8:15 pm
Location: Manasquan, NJ USA

Re: Mlb Live Scores

Post by kfonda »

It certainly looks better than before. :) I'll look at tomorrow when the games are on. One thing I noticed during the brief time it showed data (before midnight) is that it listed the city name for the Mets as 'Flushing' ( I know they are bad, but really :D ) I don't know if any of the other teams have the issue, I assume it's because New York has 2 teams.
jake2456
Posts: 87
Joined: June 8th, 2015, 10:39 pm

Re: Mlb Live Scores

Post by jake2456 »

:rolmfao: I do see that. The webpages code is showing flushing for location name. If it stays that ill have to change the parse to franchiseName.
Also noticed i forgot that while changing things back after doing some trial and erroring i didnt put in the correct Substitute= for the innings.

In measurses.inc replace Substitute=0 in each inning measure with Substitute="":"0" otherwise Heres an updated one.

Let me know if you figure anything out.
You do not have the required permissions to view the files attached to this post.