It is currently December 10th, 2018, 8:52 pm

Unexpected/Missing results using lookahead

Help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 7152
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Unexpected/Missing results using lookahead

balala » November 29th, 2018, 3:39 pm

Not sure what to say, because with the last posted code, I get some results (2x5 numbers, in fact).
Tical84
Posts: 14
Joined: November 24th, 2018, 9:34 pm

Re: Unexpected/Missing results using lookahead

Tical84 » November 29th, 2018, 9:39 pm

The code as I posted it gave you 5 games (10 teams with 10 scores)?

When I tried it gave 9 teams and 10 scores with the last team showing that it was grabbing way too much information in the log.
User avatar
balala
Rainmeter Sage
Posts: 7152
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Unexpected/Missing results using lookahead

balala » November 30th, 2018, 6:56 pm

Tical84 wrote:
November 29th, 2018, 9:39 pm
The code as I posted it gave you 5 games (10 teams with 10 scores)?

When I tried it gave 9 teams and 10 scores with the last team showing that it was grabbing way too much information in the log.
First, sorry for the late reply.

Secondly, yes and no: with the posted URL (URL=https://statsapi.web.nhl.com/api/v1/schedule?expand=schedule.linescore) I get ten 0s:
Image
If I save the posted HTML code:
Tical84 wrote:
November 29th, 2018, 12:43 am
New URL (json maybe?)

Code: Select all

{
  "copyright" : "NHL and the NHL Shield are registered trademarks of the National Hockey League. NHL and NHL team marks are the property of the NHL and its teams. © NHL 2018. All Rights Reserved.",
  "totalItems" : 5,
  "totalEvents" : 0,
  "totalGames" : 5,
  "totalMatches" : 0,
  "wait" : 10,
  "dates" : [ {
    "date" : "2018-11-28",
    "totalItems" : 5,
    "totalEvents" : 0,
    "totalGames" : 5,
    "totalMatches" : 0,
    "games" : [ {
      "gamePk" : 2018020377,
      "link" : "/api/v1/game/2018020377/feed/live",
      "gameType" : "R",
      "season" : "20182019",
      "gameDate" : "2018-11-29T00:00:00Z",
      "status" : {
        "abstractGameState" : "Live",
        "codedGameState" : "3",
        "detailedState" : "In Progress",
        "statusCode" : "3",
        "startTimeTBD" : false
      },
      "teams" : {
        "away" : {
          "leagueRecord" : {
            "wins" : 8,
            "losses" : 11,
            "ot" : 3,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 19,
            "name" : "St. Louis Blues",
            "link" : "/api/v1/teams/19"
          }
        },
        "home" : {
          "leagueRecord" : {
            "wins" : 10,
            "losses" : 11,
            "ot" : 3,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 17,
            "name" : "Detroit Red Wings",
            "link" : "/api/v1/teams/17"
          }
        }
      },
      "linescore" : {
        "currentPeriod" : 1,
        "currentPeriodOrdinal" : "1st",
        "currentPeriodTimeRemaining" : "09:42",
        "periods" : [ {
          "periodType" : "REGULAR",
          "startTime" : "2018-11-29T00:10:18Z",
          "num" : 1,
          "ordinalNum" : "1st",
          "home" : {
            "goals" : 0,
            "shotsOnGoal" : 9,
            "rinkSide" : "right"
          },
          "away" : {
            "goals" : 0,
            "shotsOnGoal" : 4,
            "rinkSide" : "left"
          }
        } ],
        "shootoutInfo" : {
          "away" : {
            "scores" : 0,
            "attempts" : 0
          },
          "home" : {
            "scores" : 0,
            "attempts" : 0
          }
        },
        "teams" : {
          "home" : {
            "team" : {
              "id" : 17,
              "name" : "Detroit Red Wings",
              "link" : "/api/v1/teams/17"
            },
            "goals" : 0,
            "shotsOnGoal" : 9,
            "goaliePulled" : false,
            "numSkaters" : 5,
            "powerPlay" : true
          },
          "away" : {
            "team" : {
              "id" : 19,
              "name" : "St. Louis Blues",
              "link" : "/api/v1/teams/19"
            },
            "goals" : 0,
            "shotsOnGoal" : 4,
            "goaliePulled" : false,
            "numSkaters" : 4,
            "powerPlay" : false
          }
        },
        "powerPlayStrength" : "5-on-4",
        "hasShootout" : false,
        "intermissionInfo" : {
          "intermissionTimeRemaining" : 0,
          "intermissionTimeElapsed" : 0,
          "inIntermission" : false
        },
        "powerPlayInfo" : {
          "situationTimeRemaining" : 120,
          "situationTimeElapsed" : 0,
          "inSituation" : true
        }
      },
      "venue" : {
        "id" : 5145,
        "name" : "Little Caesars Arena",
        "link" : "/api/v1/venues/5145"
      },
      "content" : {
        "link" : "/api/v1/game/2018020377/content"
      }
    }, {
      "gamePk" : 2018020378,
      "link" : "/api/v1/game/2018020378/feed/live",
      "gameType" : "R",
      "season" : "20182019",
      "gameDate" : "2018-11-29T00:00:00Z",
      "status" : {
        "abstractGameState" : "Live",
        "codedGameState" : "3",
        "detailedState" : "In Progress",
        "statusCode" : "3",
        "startTimeTBD" : false
      },
      "teams" : {
        "away" : {
          "leagueRecord" : {
            "wins" : 11,
            "losses" : 10,
            "ot" : 5,
            "type" : "league"
          },
          "score" : 1,
          "team" : {
            "id" : 24,
            "name" : "Anaheim Ducks",
            "link" : "/api/v1/teams/24"
          }
        },
        "home" : {
          "leagueRecord" : {
            "wins" : 9,
            "losses" : 9,
            "ot" : 4,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 13,
            "name" : "Florida Panthers",
            "link" : "/api/v1/teams/13"
          }
        }
      },
      "linescore" : {
        "currentPeriod" : 1,
        "currentPeriodOrdinal" : "1st",
        "currentPeriodTimeRemaining" : "08:31",
        "periods" : [ {
          "periodType" : "REGULAR",
          "startTime" : "2018-11-29T00:09:08Z",
          "num" : 1,
          "ordinalNum" : "1st",
          "home" : {
            "goals" : 0,
            "shotsOnGoal" : 8,
            "rinkSide" : "right"
          },
          "away" : {
            "goals" : 1,
            "shotsOnGoal" : 7,
            "rinkSide" : "left"
          }
        } ],
        "shootoutInfo" : {
          "away" : {
            "scores" : 0,
            "attempts" : 0
          },
          "home" : {
            "scores" : 0,
            "attempts" : 0
          }
        },
        "teams" : {
          "home" : {
            "team" : {
              "id" : 13,
              "name" : "Florida Panthers",
              "link" : "/api/v1/teams/13"
            },
            "goals" : 0,
            "shotsOnGoal" : 8,
            "goaliePulled" : false,
            "numSkaters" : 5,
            "powerPlay" : false
          },
          "away" : {
            "team" : {
              "id" : 24,
              "name" : "Anaheim Ducks",
              "link" : "/api/v1/teams/24"
            },
            "goals" : 1,
            "shotsOnGoal" : 7,
            "goaliePulled" : false,
            "numSkaters" : 5,
            "powerPlay" : false
          }
        },
        "powerPlayStrength" : "Even",
        "hasShootout" : false,
        "intermissionInfo" : {
          "intermissionTimeRemaining" : 0,
          "intermissionTimeElapsed" : 0,
          "inIntermission" : false
        },
        "powerPlayInfo" : {
          "situationTimeRemaining" : 511,
          "situationTimeElapsed" : 59,
          "inSituation" : false
        }
      },
      "venue" : {
        "id" : 5027,
        "name" : "BB&T Center",
        "link" : "/api/v1/venues/5027"
      },
      "content" : {
        "link" : "/api/v1/game/2018020378/content"
      }
    }, {
      "gamePk" : 2018020379,
      "link" : "/api/v1/game/2018020379/feed/live",
      "gameType" : "R",
      "season" : "20182019",
      "gameDate" : "2018-11-29T00:30:00Z",
      "status" : {
        "abstractGameState" : "Preview",
        "codedGameState" : "2",
        "detailedState" : "Pre-Game",
        "statusCode" : "2",
        "startTimeTBD" : false
      },
      "teams" : {
        "away" : {
          "leagueRecord" : {
            "wins" : 12,
            "losses" : 8,
            "ot" : 5,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 28,
            "name" : "San Jose Sharks",
            "link" : "/api/v1/teams/28"
          }
        },
        "home" : {
          "leagueRecord" : {
            "wins" : 17,
            "losses" : 8,
            "ot" : 0,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 10,
            "name" : "Toronto Maple Leafs",
            "link" : "/api/v1/teams/10"
          }
        }
      },
      "linescore" : {
        "currentPeriod" : 0,
        "periods" : [ ],
        "shootoutInfo" : {
          "away" : {
            "scores" : 0,
            "attempts" : 0
          },
          "home" : {
            "scores" : 0,
            "attempts" : 0
          }
        },
        "teams" : {
          "home" : {
            "team" : {
              "id" : 10,
              "name" : "Toronto Maple Leafs",
              "link" : "/api/v1/teams/10"
            },
            "goals" : 0,
            "shotsOnGoal" : 0,
            "goaliePulled" : false,
            "numSkaters" : 0,
            "powerPlay" : false
          },
          "away" : {
            "team" : {
              "id" : 28,
              "name" : "San Jose Sharks",
              "link" : "/api/v1/teams/28"
            },
            "goals" : 0,
            "shotsOnGoal" : 0,
            "goaliePulled" : false,
            "numSkaters" : 0,
            "powerPlay" : false
          }
        },
        "powerPlayStrength" : "Even",
        "hasShootout" : false,
        "intermissionInfo" : {
          "intermissionTimeRemaining" : 0,
          "intermissionTimeElapsed" : 0,
          "inIntermission" : false
        }
      },
      "venue" : {
        "name" : "Scotiabank Arena",
        "link" : "/api/v1/venues/null"
      },
      "content" : {
        "link" : "/api/v1/game/2018020379/content"
      }
    }, {
      "gamePk" : 2018020380,
      "link" : "/api/v1/game/2018020380/feed/live",
      "gameType" : "R",
      "season" : "20182019",
      "gameDate" : "2018-11-29T02:00:00Z",
      "status" : {
        "abstractGameState" : "Preview",
        "codedGameState" : "1",
        "detailedState" : "Scheduled",
        "statusCode" : "1",
        "startTimeTBD" : false
      },
      "teams" : {
        "away" : {
          "leagueRecord" : {
            "wins" : 12,
            "losses" : 10,
            "ot" : 3,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 25,
            "name" : "Dallas Stars",
            "link" : "/api/v1/teams/25"
          }
        },
        "home" : {
          "leagueRecord" : {
            "wins" : 14,
            "losses" : 9,
            "ot" : 1,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 20,
            "name" : "Calgary Flames",
            "link" : "/api/v1/teams/20"
          }
        }
      },
      "linescore" : {
        "currentPeriod" : 0,
        "periods" : [ ],
        "shootoutInfo" : {
          "away" : {
            "scores" : 0,
            "attempts" : 0
          },
          "home" : {
            "scores" : 0,
            "attempts" : 0
          }
        },
        "teams" : {
          "home" : {
            "team" : {
              "id" : 20,
              "name" : "Calgary Flames",
              "link" : "/api/v1/teams/20"
            },
            "goals" : 0,
            "shotsOnGoal" : 0,
            "goaliePulled" : false,
            "numSkaters" : 0,
            "powerPlay" : false
          },
          "away" : {
            "team" : {
              "id" : 25,
              "name" : "Dallas Stars",
              "link" : "/api/v1/teams/25"
            },
            "goals" : 0,
            "shotsOnGoal" : 0,
            "goaliePulled" : false,
            "numSkaters" : 0,
            "powerPlay" : false
          }
        },
        "powerPlayStrength" : "Even",
        "hasShootout" : false,
        "intermissionInfo" : {
          "intermissionTimeRemaining" : 0,
          "intermissionTimeElapsed" : 0,
          "inIntermission" : false
        }
      },
      "venue" : {
        "id" : 5075,
        "name" : "Scotiabank Saddledome",
        "link" : "/api/v1/venues/5075"
      },
      "content" : {
        "link" : "/api/v1/game/2018020380/content"
      }
    }, {
      "gamePk" : 2018020381,
      "link" : "/api/v1/game/2018020381/feed/live",
      "gameType" : "R",
      "season" : "20182019",
      "gameDate" : "2018-11-29T02:30:00Z",
      "status" : {
        "abstractGameState" : "Preview",
        "codedGameState" : "1",
        "detailedState" : "Scheduled",
        "statusCode" : "1",
        "startTimeTBD" : false
      },
      "teams" : {
        "away" : {
          "leagueRecord" : {
            "wins" : 10,
            "losses" : 8,
            "ot" : 5,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 5,
            "name" : "Pittsburgh Penguins",
            "link" : "/api/v1/teams/5"
          }
        },
        "home" : {
          "leagueRecord" : {
            "wins" : 14,
            "losses" : 6,
            "ot" : 4,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 21,
            "name" : "Colorado Avalanche",
            "link" : "/api/v1/teams/21"
          }
        }
      },
      "linescore" : {
        "currentPeriod" : 0,
        "periods" : [ ],
        "shootoutInfo" : {
          "away" : {
            "scores" : 0,
            "attempts" : 0
          },
          "home" : {
            "scores" : 0,
            "attempts" : 0
          }
        },
        "teams" : {
          "home" : {
            "team" : {
              "id" : 21,
              "name" : "Colorado Avalanche",
              "link" : "/api/v1/teams/21"
            },
            "goals" : 0,
            "shotsOnGoal" : 0,
            "goaliePulled" : false,
            "numSkaters" : 0,
            "powerPlay" : false
          },
          "away" : {
            "team" : {
              "id" : 5,
              "name" : "Pittsburgh Penguins",
              "link" : "/api/v1/teams/5"
            },
            "goals" : 0,
            "shotsOnGoal" : 0,
            "goaliePulled" : false,
            "numSkaters" : 0,
            "powerPlay" : false
          }
        },
        "powerPlayStrength" : "Even",
        "hasShootout" : false,
        "intermissionInfo" : {
          "intermissionTimeRemaining" : 0,
          "intermissionTimeElapsed" : 0,
          "inIntermission" : false
        }
      },
      "venue" : {
        "id" : 5064,
        "name" : "Pepsi Center",
        "link" : "/api/v1/venues/5064"
      },
      "content" : {
        "link" : "/api/v1/game/2018020381/content"
      }
    } ],
    "events" : [ ],
    "matches" : [ ]
  } ]
}
and use this one into the skin (modifying accordingly the URL option), I get nine 0s and one 1:
Image
But in both cases I get ten numbers.
I also get 20 "Not enough substrings" warnings in the log.
Tical84
Posts: 14
Joined: November 24th, 2018, 9:34 pm

Re: Unexpected/Missing results using lookahead

Tical84 » December 1st, 2018, 12:46 am

Ah, Ok. I'll need to explain a little more.

First, That URL is live so if you're testing when there are no active games, you'll get all 0s for the games scheduled for that day. The one I posted must have been when only one game was currently active, or there was just no score yet in the other games.

Second, I changed the teams to images which of course you wouldn't have locally so you're not getting teams showing up at all. If you change Meter=Image to Meter=String you'll get the team ID. I had to use the ID and not the name because there were some weird things going on like sometimes when the site updated it would randomly change Montreal to Montréal and back so I needed two .pngs for Montréal but then with St. Louis Blues it would look for a file name with an extension of ". Louis Blues".

Third, You should get a few "not enough substrings" because I have enough variables for 15 games when there is rarely 15 games/day (unless there's a way around that I'm not aware of)

This is what it looks like as of this post (17:43 MST UTC-7)
Image

All current scores and all teams with their logos except the last one where it tries to grab more information than I feel like I'm asking for (This time it's:

Code: Select all

ImageName: Unable to open: C:\Users\...\20,
            "name" : "Calgary Flames",
            "link" : "/api/v1/teams/20"
          }
        }
      },
      "linescore" : {
        "currentPeriod" : 0,
        "periods" : [ ],
        "shootoutInfo" : {
          "away" : {
            "scores" : 0,
            "attempts" : 0
          },
          "home" : {
            "scores" : 0,
            "attempts" : 0
          }
        },
        "teams"
So you can see it's grabbing the ID (20) but then not stopping at the comma like it does for every other team.
Tical84
Posts: 14
Joined: November 24th, 2018, 9:34 pm

Re: Unexpected/Missing results using lookahead

Tical84 » December 6th, 2018, 1:43 am

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

Re: Unexpected/Missing results using lookahead

balala » December 6th, 2018, 6:22 pm

Tical84 wrote:
December 6th, 2018, 1:43 am
Bump?
I have an issue here. Due to the time difference, I can't get results in the "online" version of the skin. There are no active games when I am active.
Tical84
Posts: 14
Joined: November 24th, 2018, 9:34 pm

Re: Unexpected/Missing results using lookahead

Tical84 » December 7th, 2018, 3:40 am

Thanks for looking at it again balala. I don't think it should matter if the game is active or not because it's the last team that's not showing up for me. For example if you go to https://www.nhl.com/scores and scroll down to the bottom of today's date (whatever date "today" happens to be) it'll be the last team in that list that never shows up.

For Thursday, December 6th at 20:39 UTC -7, it looked like this (with some other teams above that you can't see):

Image

And my skin looked like this:

Image

So you can see that the last team in the first image is the Lighting, and they beat the Bruins 3-2. In my skin there is no team at the bottom, but I do get a score of 3. If no games are active, the scores will all be 0, but the teams that are playing that day will still show up (except for the last one).
User avatar
balala
Rainmeter Sage
Posts: 7152
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Unexpected/Missing results using lookahead

balala » December 7th, 2018, 4:45 pm

Ok, right now I got some results, the shown numbers are not zero. However I don't see any logo (image, whatever). I checked the code and the measures used into the MeasureName options of the Image meters ([MeterGame1AwayTeam], [MeterGame1HomeTeam], [MeterGame2AwayTeam], [MeterGame2HomeTeam] and so on) are returning just some numbers. You probably have some images named accordingly into your config, which are the logos of the appropriate teams, right?
If this is right, please first pack the whole config and upload it here. I'd need those images to can check what's going on.
Tical84
Posts: 14
Joined: November 24th, 2018, 9:34 pm

Re: Unexpected/Missing results using lookahead

Tical84 » December 7th, 2018, 10:58 pm

Here are the images and latest ini. There's some junk in the ini that I was playing around with but is either commented out or just not used.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 7152
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Unexpected/Missing results using lookahead

balala » December 8th, 2018, 7:16 am

Tical84 wrote:
December 7th, 2018, 10:58 pm
Here are the images and latest ini. There's some junk in the ini that I was playing around with but is either commented out or just not used.
Right now I got the online results and checked the skin. Now I see what the problem is.
Not sure yet why, but the [MeasureGame4HomeTeam] measure doesn't return the number of the appropriate team, but a much longer html code. Because of this, the corresponding Image meter ([MeterGame4HomeTeam]) can't show up the logo of the named team.
A first solution is to short down the RegExp option of the [MeasureNHL] measure. If you replace this option with the much shorter RegExp=(?siU)#Away##Away##Away##Away# (just four #Away# variables, instead of the initial 15), all logos are shown, including the last one. But something still isn't ok, because the error messages are still there in the log. This looks to be a bit weird, because in the #Away# variable lookahead assertion is used, but however something still don't work as it should.
Right now here is morning (UTC+2). I can't work now longer with this, but I promise later today I'll try to figure out a much better solution. I saved the appropriate file which is needed to get the results and will use it even when there won't be results any more online.