It is currently June 22nd, 2024, 3:42 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 »

Well i have been able to get live scores working. Pretty much the same as the old one. Just seems to be a few bugs im trying to work out. regarding the regexp code. I thought i had it all worked out last night but seems to have broke for today. Thinking ill have to use more of the look ahead assertions.

As far as the images for your standings app. You could use the images included in the resources folder of my old version of my scoreboard. I do believe they are png.
User avatar
Yincognito
Rainmeter Sage
Posts: 7482
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Mlb Live Scores

Post by Yincognito »

jake2456 wrote: September 2nd, 2023, 3:04 pm Well i have been able to get live scores working. Pretty much the same as the old one. Just seems to be a few bugs im trying to work out. regarding the regexp code. I thought i had it all worked out last night but seems to have broke for today. Thinking ill have to use more of the look ahead assertions.

As far as the images for your standings app. You could use the images included in the resources folder of my old version of my scoreboard. I do believe they are png.
Indeed. If you already have an older version built on a similar foundation, it's easier to upgrade. Just curious, where do you get that MLB API from? Does it come as a JSON or similar, avoiding the need to parse the webpage? :???:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
jake2456
Posts: 87
Joined: June 8th, 2015, 10:39 pm

Re: Mlb Live Scores

Post by jake2456 »

Yincognito wrote: September 2nd, 2023, 4:53 pm Indeed. If you already have an older version built on a similar foundation, it's easier to upgrade. Just curious, where do you get that MLB API from? Does it come as a JSON or similar, avoiding the need to parse the webpage? :???:
For example heres a link to a game today. https://statsapi.mlb.com/api/v1.1/game/716755/feed/live It does show up as json for me an i switch to raw data for the web parse. is there i new feature or way im not aware of? remember just getting back into rainmeter an have mostly just used what i remember doing years ago.
You need to know the right links to get the data you are looking for. i found a few githubs explaining things. I do believe you can register with them also for a free login.
https://github.com/toddrob99/MLB-StatsAPI/blob/master/statsapi/endpoints.py
https://github.com/brianhaferkamp/mlbapidata
User avatar
Yincognito
Rainmeter Sage
Posts: 7482
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Mlb Live Scores

Post by Yincognito »

jake2456 wrote: September 2nd, 2023, 6:02 pm For example heres a link to a game today. https://statsapi.mlb.com/api/v1.1/game/716755/feed/live It does show up as json for me an i switch to raw data for the web parse. is there i new feature or way im not aware of? remember just getting back into rainmeter an have mostly just used what i remember doing years ago.
You need to know the right links to get the data you are looking for. i found a few githubs explaining things. I do believe you can register with them also for a free login.
https://github.com/toddrob99/MLB-StatsAPI/blob/master/statsapi/endpoints.py
https://github.com/brianhaferkamp/mlbapidata
Ah, that's nice, thanks for the info - knowing the right links is indeed quite useful. Yes, it's a JSON for me too on my phone, and I suppose on my laptop as well, can't see a reason why it would be otherwise. No, using WebParser as you do is the typical way to parse that data, although there is at least one JSON plugin for Rainmeter that I know of, which in theory would make the data access easier:
https://forum.rainmeter.net/viewtopic.php?t=34378
Of course, it's debatable whether the data access will be easier when the JSON is dynamic in nature, but you can experiment with it if you want.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
jake2456
Posts: 87
Joined: June 8th, 2015, 10:39 pm

Re: Mlb Live Scores

Post by jake2456 »

I think i finally got it to parse correctly after a lot of trial and error. Fingers Crossed. Just need to wait tell tomorrow to find out for sure. Then the real fun begins with creating a new look.
jake2456
Posts: 87
Joined: June 8th, 2015, 10:39 pm

Re: Mlb Live Scores

Post by jake2456 »

I could use some help. I dont know enough about regexp to get it to work correctly. Games played, currently playing, or coming in next few hours seem to read fine but games farther out in the day or next day dont work. Ive trial and errored this many times but am at a lose.

Replace [&MeasureGameId1] in url with 716755 for yesterdays game example and use 716735 or [&MeasureGameId1] for a game today. 716713 for a game on monday.
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7482
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Mlb Live Scores

Post by Yincognito »

jake2456 wrote: September 3rd, 2023, 4:27 pm I could use some help. I dont know enough about regexp to get it to work correctly. Games played, currently playing, or coming in next few hours seem to read fine but games farther out in the day or next day dont work. Ive trial and errored this many times but am at a lose.

Replace [&MeasureGameId1] in url with 716755 for yesterdays game example and use 716735 or [&MeasureGameId1] for a game today. 716713 for a game on monday.
Didn't check the skin yet, but just from the top of my head, are you sure you didn't exceed the maximum of 99 captures in a regex pattern, supported by Rainmeter?
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
jake2456
Posts: 87
Joined: June 8th, 2015, 10:39 pm

Re: Mlb Live Scores

Post by jake2456 »

As in (.*)? There's I think around just 50 at the moment.
User avatar
Yincognito
Rainmeter Sage
Posts: 7482
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Mlb Live Scores

Post by Yincognito »

jake2456 wrote: September 3rd, 2023, 5:15 pm As in (.*)? There's I think around just 50 at the moment.
Ah, I see. I'll take a look on it later on.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7482
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Mlb Live Scores

Post by Yincognito »

jake2456 wrote: September 3rd, 2023, 4:27 pmI dont know enough about regexp to get it to work correctly. Games played, currently playing, or coming in next few hours seem to read fine but games farther out in the day or next day dont work. Ive trial and errored this many times but am at a lose.

Replace [&MeasureGameId1] in url with 716755 for yesterdays game example and use 716735 or [&MeasureGameId1] for a game today. 716713 for a game on monday.
And I don't know enough about baseball to get what doesn't work. I mean, according to your "innings" capture of home and away runs, the skin displays exactly what it's told to - albeit only stuff about a single game in that day (which, IMHO, is not what a live scoreS should look like, but anyway). 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.

I'll say this though: your lookahead assertions are not exactly correct. Instead of like this:
(?(?=.*"innings".*"num":1,.*"home".*"runs":(.*),.*"away".*"runs":(.*),))
they should be like this:
(?(?=.*"innings".*"num":1,.*"home".*"runs":.*,.*"away".*"runs":.*,).*"innings".*"num":1,.*"home".*"runs":(.*),.*"away".*"runs":(.*),)
So basically, it's (?(?=ConditionToMatchWithoutCaptures)ActualMatchWithCaptures) - in your code, the second part is empty. Obviously, you don't need the condition to be the entire actual match, it can be just the sufficient part of it, for example:
(?(?=.*"innings".*"num":1,).*"innings".*"num":1,.*"home".*"runs":(.*),.*"away".*"runs":(.*),)
or something like that.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth