It is currently November 15th, 2019, 11:40 am

Unexpected/Missing results using lookahead

Help with creating, editing & fixing problems with skins
Tical84
Posts: 25
Joined: November 24th, 2018, 9:34 pm

Re: Unexpected/Missing results using lookahead

Tical84 » December 8th, 2018, 3:36 pm

Yes, that is what I discovered too. If you have the right number of variables for the right number of teams it works but some days there are only 1 or 2 games and some days there are up to 15 so I'd like to have 15 in there.

I did add more to it last night and made a discovery. It's not necessarily the last team that that doesn't show up it's the last "value". I added the period and time remaining last night and now the last team shows up but time remaining shows the long string of HTML. I don't know what that means yet but thought I'd let you know in case it means something to you
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 9053
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Unexpected/Missing results using lookahead

balala » December 8th, 2018, 6:59 pm

Here is the solution: you have to rewrite the Away variable. Use the following form: Away=(?(?=.*"teams").*"score" : (\d*),.*"id" : (\d*),.*"score" : (\d*),.*"id" : (\d*),). See that with this variable the returned elements can be just numbers (the only thing I did was to replace the (.*) elements, with (\d*) - these new elements are marked red above). This way even the last returned element is a number, which can be used by the appropriate Image meter (whatever that one would be).
This fixes the issue of the missing last logo. But the error messages in the log still exist. The solution of this issue will come soon, I hope.
Tical84
Posts: 25
Joined: November 24th, 2018, 9:34 pm

Re: Unexpected/Missing results using lookahead

Tical84 » December 8th, 2018, 7:57 pm

Yes! That worked. The (\d*) tells it to return a number instead of a string? What is the error you're getting? Is it "Not enough substrings" or is it something else?
User avatar
balala
Rainmeter Sage
Posts: 9053
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Unexpected/Missing results using lookahead

balala » December 8th, 2018, 8:46 pm

Tical84 wrote:
December 8th, 2018, 7:57 pm
The (\d*) tells it to return a number instead of a string?
Exactly. \d means digit, \d* means any number of digits. The dot (.) means any character, including numbers (digits), letters and so on.
Tical84 wrote:
December 8th, 2018, 7:57 pm
What is the error you're getting? Is it "Not enough substrings" or is it something else?
I'm not very sure, because I don't have them anymore. But yes, something like this was shown.
So, the solution of the error messages issue: the problem is that if there are no enough strings to be returned by every WebParser measure, the measures which don't get a string, give the error message. To avoid this, you should have to disable all child WebParser measures, then, when the parent measure finished parsing the content of the site, you have to enable the proper number of child measures. But how can you know what this number is, or how many games are playing at a given moment? Well, for this you have to add a new WebParser measure, which returns exactly the number of playing games. So, you have to rewrite the RegExp option of the parent WebParser measure ([MeasureNHL]). But this means that the StringIndex options of all child WebParser measures have to be modified, adding one to each value.
I grouped the child WebParser measures, adding Group options to all of them and also disabled all child WebParser measures, adding a Disabled=1 option to each of them, then the appropriate IfTrueAction option of the newly added [MeasureItemNum] measure, enables the appropriate measures. This way all error messages are gone, none appears any more.
And I did one more thing: the resources (images, but not just) of a skin should have to be into the @Resources folder. This is not something mandatory, the skin can work even if those images are in the root config (or somewhere else), but using them from the @Resources folder is the best idea. That's why I moved all those images into the mentioned @Resources folder and modified the code of the skin, to make the Image meters to read the images from that folder (practically I added an ImagePath=#@# option to all Image meters).
I didn't remove the commented out options, but you probably should have to remove them. They are not needed.
See attached the rewritten skin, packed as a skin installer. Please install and check it, to see how does it work. Then please let me know as well.
You do not have the required permissions to view the files attached to this post.
Tical84
Posts: 25
Joined: November 24th, 2018, 9:34 pm

Re: Unexpected/Missing results using lookahead

Tical84 » December 8th, 2018, 10:26 pm

Thank you so much balala!
I want to add the period and time remaining next that means I'll need to do something similar so let me take a long look at your code and I'll try to make that happen.

Thanks again!
User avatar
balala
Rainmeter Sage
Posts: 9053
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Unexpected/Missing results using lookahead

balala » December 8th, 2018, 10:39 pm

Tical84 wrote:
December 8th, 2018, 10:26 pm
Thank you so much balala!
I want to add the period and time remaining next that means I'll need to do something similar so let me take a long look at your code and I'll try to make that happen.

Thanks again!
You're welcome.
I'm glad we finally have succeeded figuring out what's going on there. I'm sorry this took me so much time, because your first request was posted on November 25th, which means two weeks and this is pretty much. I have to admit I was a bit lazy this time. Sorry...
Ok, go ahead with what you want to add and let me know how does it goes on, or if you have any question or request there.
Tical84
Posts: 25
Joined: November 24th, 2018, 9:34 pm

Re: Unexpected/Missing results using lookahead

Tical84 » December 8th, 2018, 11:00 pm

No need to be sorry. You're helping for free. I can understand how someone else's skin isn't your top priority. It's not even my top priority right now. I'm just playing around with it when I have time. I will let you know if when I need more help.
User avatar
balala
Rainmeter Sage
Posts: 9053
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Unexpected/Missing results using lookahead

balala » December 8th, 2018, 11:02 pm

Tical84 wrote:
December 8th, 2018, 11:00 pm
No need to be sorry. You're helping for free. I can understand how someone else's skin isn't your top priority. It's not even my top priority right now. I'm just playing around with it when I have time. I will let you know if when I need more help.
Ok, good luck. :thumbup:
Tical84
Posts: 25
Joined: November 24th, 2018, 9:34 pm

Re: Unexpected/Missing results using lookahead

Tical84 » December 16th, 2018, 7:59 pm

I've come across another issue.

Everything is going fine except I noticed that when a game hasn't started yet, it doesn't give me the right parameters.

For example, here is the HTML that will show what I mean. Because of your timezone you probably wont see this with the live HTML

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" : 7,
  "totalEvents" : 0,
  "totalGames" : 7,
  "totalMatches" : 0,
  "wait" : 10,
  "dates" : [ {
    "date" : "2018-12-16",
    "totalItems" : 7,
    "totalEvents" : 0,
    "totalGames" : 7,
    "totalMatches" : 0,
    "games" : [ {
      "gamePk" : 2018020505,
      "link" : "/api/v1/game/2018020505/feed/live",
      "gameType" : "R",
      "season" : "20182019",
      "gameDate" : "2018-12-16T17:30:00Z",
      "status" : {
        "abstractGameState" : "Live",
        "codedGameState" : "3",
        "detailedState" : "In Progress",
        "statusCode" : "3",
        "startTimeTBD" : false
      },
      "teams" : {
        "away" : {
          "leagueRecord" : {
            "wins" : 18,
            "losses" : 14,
            "ot" : 2,
            "type" : "league"
          },
          "score" : 3,
          "team" : {
            "id" : 54,
            "name" : "Vegas Golden Knights",
            "link" : "/api/v1/teams/54"
          }
        },
        "home" : {
          "leagueRecord" : {
            "wins" : 14,
            "losses" : 13,
            "ot" : 4,
            "type" : "league"
          },
          "score" : 3,
          "team" : {
            "id" : 3,
            "name" : "New York Rangers",
            "link" : "/api/v1/teams/3"
          }
        }
      },
      "linescore" : {
        "currentPeriod" : 3,
        "currentPeriodOrdinal" : "3rd",
        "currentPeriodTimeRemaining" : "10:18",
        "periods" : [ {
          "periodType" : "REGULAR",
          "startTime" : "2018-12-16T17:38:43Z",
          "endTime" : "2018-12-16T18:16:18Z",
          "num" : 1,
          "ordinalNum" : "1st",
          "home" : {
            "goals" : 1,
            "shotsOnGoal" : 7,
            "rinkSide" : "right"
          },
          "away" : {
            "goals" : 1,
            "shotsOnGoal" : 15,
            "rinkSide" : "left"
          }
        }, {
          "periodType" : "REGULAR",
          "startTime" : "2018-12-16T18:34:39Z",
          "endTime" : "2018-12-16T19:18:57Z",
          "num" : 2,
          "ordinalNum" : "2nd",
          "home" : {
            "goals" : 1,
            "shotsOnGoal" : 10,
            "rinkSide" : "left"
          },
          "away" : {
            "goals" : 2,
            "shotsOnGoal" : 13,
            "rinkSide" : "right"
          }
        }, {
          "periodType" : "REGULAR",
          "startTime" : "2018-12-16T19:37:19Z",
          "num" : 3,
          "ordinalNum" : "3rd",
          "home" : {
            "goals" : 1,
            "shotsOnGoal" : 8,
            "rinkSide" : "right"
          },
          "away" : {
            "goals" : 0,
            "shotsOnGoal" : 5,
            "rinkSide" : "left"
          }
        } ],
        "shootoutInfo" : {
          "away" : {
            "scores" : 0,
            "attempts" : 0
          },
          "home" : {
            "scores" : 0,
            "attempts" : 0
          }
        },
        "teams" : {
          "home" : {
            "team" : {
              "id" : 3,
              "name" : "New York Rangers",
              "link" : "/api/v1/teams/3"
            },
            "goals" : 3,
            "shotsOnGoal" : 25,
            "goaliePulled" : false,
            "numSkaters" : 5,
            "powerPlay" : false
          },
          "away" : {
            "team" : {
              "id" : 54,
              "name" : "Vegas Golden Knights",
              "link" : "/api/v1/teams/54"
            },
            "goals" : 3,
            "shotsOnGoal" : 33,
            "goaliePulled" : false,
            "numSkaters" : 5,
            "powerPlay" : false
          }
        },
        "powerPlayStrength" : "Even",
        "hasShootout" : false,
        "intermissionInfo" : {
          "intermissionTimeRemaining" : 0,
          "intermissionTimeElapsed" : 0,
          "inIntermission" : false
        },
        "powerPlayInfo" : {
          "situationTimeRemaining" : 618,
          "situationTimeElapsed" : 116,
          "inSituation" : false
        }
      },
      "venue" : {
        "id" : 5054,
        "name" : "Madison Square Garden",
        "link" : "/api/v1/venues/5054"
      },
      "content" : {
        "link" : "/api/v1/game/2018020505/content"
      }
    }, {
      "gamePk" : 2018020506,
      "link" : "/api/v1/game/2018020506/feed/live",
      "gameType" : "R",
      "season" : "20182019",
      "gameDate" : "2018-12-16T18:00:00Z",
      "status" : {
        "abstractGameState" : "Live",
        "codedGameState" : "3",
        "detailedState" : "In Progress",
        "statusCode" : "3",
        "startTimeTBD" : false
      },
      "teams" : {
        "away" : {
          "leagueRecord" : {
            "wins" : 14,
            "losses" : 15,
            "ot" : 2,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 53,
            "name" : "Arizona Coyotes",
            "link" : "/api/v1/teams/53"
          }
        },
        "home" : {
          "leagueRecord" : {
            "wins" : 13,
            "losses" : 13,
            "ot" : 5,
            "type" : "league"
          },
          "score" : 2,
          "team" : {
            "id" : 12,
            "name" : "Carolina Hurricanes",
            "link" : "/api/v1/teams/12"
          }
        }
      },
      "linescore" : {
        "currentPeriod" : 2,
        "currentPeriodOrdinal" : "2nd",
        "currentPeriodTimeRemaining" : "END",
        "periods" : [ {
          "periodType" : "REGULAR",
          "startTime" : "2018-12-16T18:08:52Z",
          "endTime" : "2018-12-16T18:43:51Z",
          "num" : 1,
          "ordinalNum" : "1st",
          "home" : {
            "goals" : 0,
            "shotsOnGoal" : 9,
            "rinkSide" : "right"
          },
          "away" : {
            "goals" : 0,
            "shotsOnGoal" : 8,
            "rinkSide" : "left"
          }
        }, {
          "periodType" : "REGULAR",
          "startTime" : "2018-12-16T19:02:11Z",
          "endTime" : "2018-12-16T19:38:44Z",
          "num" : 2,
          "ordinalNum" : "2nd",
          "home" : {
            "goals" : 2,
            "shotsOnGoal" : 6,
            "rinkSide" : "left"
          },
          "away" : {
            "goals" : 0,
            "shotsOnGoal" : 6,
            "rinkSide" : "right"
          }
        } ],
        "shootoutInfo" : {
          "away" : {
            "scores" : 0,
            "attempts" : 0
          },
          "home" : {
            "scores" : 0,
            "attempts" : 0
          }
        },
        "teams" : {
          "home" : {
            "team" : {
              "id" : 12,
              "name" : "Carolina Hurricanes",
              "link" : "/api/v1/teams/12"
            },
            "goals" : 2,
            "shotsOnGoal" : 15,
            "goaliePulled" : false,
            "numSkaters" : 5,
            "powerPlay" : true
          },
          "away" : {
            "team" : {
              "id" : 53,
              "name" : "Arizona Coyotes",
              "link" : "/api/v1/teams/53"
            },
            "goals" : 0,
            "shotsOnGoal" : 14,
            "goaliePulled" : false,
            "numSkaters" : 4,
            "powerPlay" : false
          }
        },
        "powerPlayStrength" : "5-on-4",
        "hasShootout" : false,
        "intermissionInfo" : {
          "intermissionTimeRemaining" : 256,
          "intermissionTimeElapsed" : 824,
          "inIntermission" : true
        },
        "powerPlayInfo" : {
          "situationTimeRemaining" : 85,
          "situationTimeElapsed" : 35,
          "inSituation" : true
        }
      },
      "venue" : {
        "id" : 5066,
        "name" : "PNC Arena",
        "link" : "/api/v1/venues/5066"
      },
      "content" : {
        "link" : "/api/v1/game/2018020506/content"
      }
    }, {
      "gamePk" : 2018020507,
      "link" : "/api/v1/game/2018020507/feed/live",
      "gameType" : "R",
      "season" : "20182019",
      "gameDate" : "2018-12-16T20:00:00Z",
      "status" : {
        "abstractGameState" : "Preview",
        "codedGameState" : "2",
        "detailedState" : "Pre-Game",
        "statusCode" : "2",
        "startTimeTBD" : false
      },
      "teams" : {
        "away" : {
          "leagueRecord" : {
            "wins" : 21,
            "losses" : 10,
            "ot" : 2,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 20,
            "name" : "Calgary Flames",
            "link" : "/api/v1/teams/20"
          }
        },
        "home" : {
          "leagueRecord" : {
            "wins" : 12,
            "losses" : 14,
            "ot" : 4,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 19,
            "name" : "St. Louis Blues",
            "link" : "/api/v1/teams/19"
          }
        }
      },
      "linescore" : {
        "currentPeriod" : 0,
        "periods" : [ ],
        "shootoutInfo" : {
          "away" : {
            "scores" : 0,
            "attempts" : 0
          },
          "home" : {
            "scores" : 0,
            "attempts" : 0
          }
        },
        "teams" : {
          "home" : {
            "team" : {
              "id" : 19,
              "name" : "St. Louis Blues",
              "link" : "/api/v1/teams/19"
            },
            "goals" : 0,
            "shotsOnGoal" : 0,
            "goaliePulled" : false,
            "numSkaters" : 0,
            "powerPlay" : false
          },
          "away" : {
            "team" : {
              "id" : 20,
              "name" : "Calgary Flames",
              "link" : "/api/v1/teams/20"
            },
            "goals" : 0,
            "shotsOnGoal" : 0,
            "goaliePulled" : false,
            "numSkaters" : 0,
            "powerPlay" : false
          }
        },
        "powerPlayStrength" : "Even",
        "hasShootout" : false,
        "intermissionInfo" : {
          "intermissionTimeRemaining" : 0,
          "intermissionTimeElapsed" : 0,
          "inIntermission" : false
        }
      },
      "venue" : {
        "id" : 5076,
        "name" : "Enterprise Center",
        "link" : "/api/v1/venues/5076"
      },
      "content" : {
        "link" : "/api/v1/game/2018020507/content"
      }
    }, {
      "gamePk" : 2018020508,
      "link" : "/api/v1/game/2018020508/feed/live",
      "gameType" : "R",
      "season" : "20182019",
      "gameDate" : "2018-12-16T22:00:00Z",
      "status" : {
        "abstractGameState" : "Preview",
        "codedGameState" : "1",
        "detailedState" : "Scheduled",
        "statusCode" : "1",
        "startTimeTBD" : false
      },
      "teams" : {
        "away" : {
          "leagueRecord" : {
            "wins" : 19,
            "losses" : 9,
            "ot" : 5,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 7,
            "name" : "Buffalo Sabres",
            "link" : "/api/v1/teams/7"
          }
        },
        "home" : {
          "leagueRecord" : {
            "wins" : 17,
            "losses" : 11,
            "ot" : 4,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 6,
            "name" : "Boston Bruins",
            "link" : "/api/v1/teams/6"
          }
        }
      },
      "linescore" : {
        "currentPeriod" : 0,
        "periods" : [ ],
        "shootoutInfo" : {
          "away" : {
            "scores" : 0,
            "attempts" : 0
          },
          "home" : {
            "scores" : 0,
            "attempts" : 0
          }
        },
        "teams" : {
          "home" : {
            "team" : {
              "id" : 6,
              "name" : "Boston Bruins",
              "link" : "/api/v1/teams/6"
            },
            "goals" : 0,
            "shotsOnGoal" : 0,
            "goaliePulled" : false,
            "numSkaters" : 0,
            "powerPlay" : false
          },
          "away" : {
            "team" : {
              "id" : 7,
              "name" : "Buffalo Sabres",
              "link" : "/api/v1/teams/7"
            },
            "goals" : 0,
            "shotsOnGoal" : 0,
            "goaliePulled" : false,
            "numSkaters" : 0,
            "powerPlay" : false
          }
        },
        "powerPlayStrength" : "Even",
        "hasShootout" : false,
        "intermissionInfo" : {
          "intermissionTimeRemaining" : 0,
          "intermissionTimeElapsed" : 0,
          "inIntermission" : false
        }
      },
      "venue" : {
        "id" : 5085,
        "name" : "TD Garden",
        "link" : "/api/v1/venues/5085"
      },
      "content" : {
        "link" : "/api/v1/game/2018020508/content"
      }
    }, {
      "gamePk" : 2018020509,
      "link" : "/api/v1/game/2018020509/feed/live",
      "gameType" : "R",
      "season" : "20182019",
      "gameDate" : "2018-12-17T00:00:00Z",
      "status" : {
        "abstractGameState" : "Preview",
        "codedGameState" : "1",
        "detailedState" : "Scheduled",
        "statusCode" : "1",
        "startTimeTBD" : false
      },
      "teams" : {
        "away" : {
          "leagueRecord" : {
            "wins" : 17,
            "losses" : 11,
            "ot" : 5,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 28,
            "name" : "San Jose Sharks",
            "link" : "/api/v1/teams/28"
          }
        },
        "home" : {
          "leagueRecord" : {
            "wins" : 10,
            "losses" : 18,
            "ot" : 6,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 16,
            "name" : "Chicago Blackhawks",
            "link" : "/api/v1/teams/16"
          }
        }
      },
      "linescore" : {
        "currentPeriod" : 0,
        "periods" : [ ],
        "shootoutInfo" : {
          "away" : {
            "scores" : 0,
            "attempts" : 0
          },
          "home" : {
            "scores" : 0,
            "attempts" : 0
          }
        },
        "teams" : {
          "home" : {
            "team" : {
              "id" : 16,
              "name" : "Chicago Blackhawks",
              "link" : "/api/v1/teams/16"
            },
            "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" : {
        "id" : 5092,
        "name" : "United Center",
        "link" : "/api/v1/venues/5092"
      },
      "content" : {
        "link" : "/api/v1/game/2018020509/content"
      }
    }, {
      "gamePk" : 2018020510,
      "link" : "/api/v1/game/2018020510/feed/live",
      "gameType" : "R",
      "season" : "20182019",
      "gameDate" : "2018-12-17T00:00:00Z",
      "status" : {
        "abstractGameState" : "Preview",
        "codedGameState" : "1",
        "detailedState" : "Scheduled",
        "statusCode" : "1",
        "startTimeTBD" : false
      },
      "teams" : {
        "away" : {
          "leagueRecord" : {
            "wins" : 25,
            "losses" : 7,
            "ot" : 1,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 14,
            "name" : "Tampa Bay Lightning",
            "link" : "/api/v1/teams/14"
          }
        },
        "home" : {
          "leagueRecord" : {
            "wins" : 21,
            "losses" : 9,
            "ot" : 2,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 52,
            "name" : "Winnipeg Jets",
            "link" : "/api/v1/teams/52"
          }
        }
      },
      "linescore" : {
        "currentPeriod" : 0,
        "periods" : [ ],
        "shootoutInfo" : {
          "away" : {
            "scores" : 0,
            "attempts" : 0
          },
          "home" : {
            "scores" : 0,
            "attempts" : 0
          }
        },
        "teams" : {
          "home" : {
            "team" : {
              "id" : 52,
              "name" : "Winnipeg Jets",
              "link" : "/api/v1/teams/52"
            },
            "goals" : 0,
            "shotsOnGoal" : 0,
            "goaliePulled" : false,
            "numSkaters" : 0,
            "powerPlay" : false
          },
          "away" : {
            "team" : {
              "id" : 14,
              "name" : "Tampa Bay Lightning",
              "link" : "/api/v1/teams/14"
            },
            "goals" : 0,
            "shotsOnGoal" : 0,
            "goaliePulled" : false,
            "numSkaters" : 0,
            "powerPlay" : false
          }
        },
        "powerPlayStrength" : "Even",
        "hasShootout" : false,
        "intermissionInfo" : {
          "intermissionTimeRemaining" : 0,
          "intermissionTimeElapsed" : 0,
          "inIntermission" : false
        }
      },
      "venue" : {
        "id" : 5058,
        "name" : "Bell MTS Place",
        "link" : "/api/v1/venues/5058"
      },
      "content" : {
        "link" : "/api/v1/game/2018020510/content"
      }
    }, {
      "gamePk" : 2018020511,
      "link" : "/api/v1/game/2018020511/feed/live",
      "gameType" : "R",
      "season" : "20182019",
      "gameDate" : "2018-12-17T03:00:00Z",
      "status" : {
        "abstractGameState" : "Preview",
        "codedGameState" : "1",
        "detailedState" : "Scheduled",
        "statusCode" : "1",
        "startTimeTBD" : false
      },
      "teams" : {
        "away" : {
          "leagueRecord" : {
            "wins" : 18,
            "losses" : 12,
            "ot" : 3,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 22,
            "name" : "Edmonton Oilers",
            "link" : "/api/v1/teams/22"
          }
        },
        "home" : {
          "leagueRecord" : {
            "wins" : 15,
            "losses" : 16,
            "ot" : 4,
            "type" : "league"
          },
          "score" : 0,
          "team" : {
            "id" : 23,
            "name" : "Vancouver Canucks",
            "link" : "/api/v1/teams/23"
          }
        }
      },
      "linescore" : {
        "currentPeriod" : 0,
        "periods" : [ ],
        "shootoutInfo" : {
          "away" : {
            "scores" : 0,
            "attempts" : 0
          },
          "home" : {
            "scores" : 0,
            "attempts" : 0
          }
        },
        "teams" : {
          "home" : {
            "team" : {
              "id" : 23,
              "name" : "Vancouver Canucks",
              "link" : "/api/v1/teams/23"
            },
            "goals" : 0,
            "shotsOnGoal" : 0,
            "goaliePulled" : false,
            "numSkaters" : 0,
            "powerPlay" : false
          },
          "away" : {
            "team" : {
              "id" : 22,
              "name" : "Edmonton Oilers",
              "link" : "/api/v1/teams/22"
            },
            "goals" : 0,
            "shotsOnGoal" : 0,
            "goaliePulled" : false,
            "numSkaters" : 0,
            "powerPlay" : false
          }
        },
        "powerPlayStrength" : "Even",
        "hasShootout" : false,
        "intermissionInfo" : {
          "intermissionTimeRemaining" : 0,
          "intermissionTimeElapsed" : 0,
          "inIntermission" : false
        }
      },
      "venue" : {
        "id" : 5073,
        "name" : "Rogers Arena",
        "link" : "/api/v1/venues/5073"
      },
      "content" : {
        "link" : "/api/v1/game/2018020511/content"
      }
    } ],
    "events" : [ ],
    "matches" : [ ]
  } ]
}
While a game is in progress or completed it gives you:

Code: Select all

    "linescore" : {
        "currentPeriod" : 3,
        "currentPeriodOrdinal" : "3rd",
        "currentPeriodTimeRemaining" : "10:18",
So I set my variables to include this as:

Code: Select all

(?(?=.*"teams").*"score" : (\d*),.*"id" : (\d*),.*"score" : (\d*),.*"id" : (\d*),.*"currentPeriodOrdinal" : "(.*)".*"currentPeriodTimeRemaining" : "(.*)")
This works except the "currentPeriodOrdinal" and "currentPeriodTimeRemaining" don't exist if the game hasn't started yet. Instead, I'd like to replace that with the start time from

Code: Select all

 "gameDate" : "2018-12-16T17:30:00Z",
Is this possible? Can I include an "if 'currentperiodordinal' doesn't exist, then get 'gamedate' instead" somehow?
User avatar
balala
Rainmeter Sage
Posts: 9053
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Unexpected/Missing results using lookahead

balala » December 16th, 2018, 8:16 pm

Let's see if I understood what you want:
  • If a game has started you'd like to see the current result.
  • If a games hasn't started yet, you'd like to get the expected start date and time.
Is this correct?