I'm in the process of finishing up the on-screen stuff. The service is working okay and saving the information locally when you watch a channel. I'll try to explain how it works to move then to the feature requests
What it does is basically to make a request to thesportsdb (when you watch a livetv channel or a video) to get the list of matches that are live at the moment (neglecting any matches that either haven't started or that are already finished). For those that are live, it will make a request to the database to do the lookup for each team involved. This is done so we can get both the name and alternative name of each team on the livematch and create new variables hometeam_keywords = "homename;homealternative" and awayteam_keywords= "awayname;awayalternative". Those variables are stored as another key in the event dictionary of each valid (live) event from the livescores data obtained.
Then I try to match the channel title and channel plot for these patterns (and some variations of the same pattern):
Quote:something1 v something2 (title + plot)
something1 vs. something2 (title + plot)
something1 vs something2 (title + plot)
someting1 x something2 (title + plot)
something1-something2 (title + plot)
something1 - something2 (title + plot)
something1 at something2 (tile + plot)
something1 play something2 (plot only)
something1 take something2 (plot only)
something1 face something2 (plot only)
All those patterns were obtained from the epg sites posted a few pages ago by ovokx (thanks by the way).
For every string match on those patterns (possible home and away teams) I then check if they have more (or) 3 letters (if not they are neglected as they are most likely, rubish). I than check if the lowercase string of something1 is in the lowercase string of hometeamkeywords and if something2 is in the lowercase string of awayteamkeywords. If both "match"...we found the match we are watching.
If the hometeam matches but the away team doesn't, we assume the match we are watching is the one that has the hometeam. Priority is given to the hometeam in relation to the awayteam since the probability of getting the away team right is smaller the the hometeam.
Then if we matched the away team but not the hometeam, then we assume the match is the one with the away team "matched".
If none of the teams match...we couldn't find the match you're watching. However, the livescores icon is still present (if enabled on the settings) on the onscreen dialog and you can access the information by clicking on the respective match (if it is present).
Important to say I made this to make the smaller ammount of requests possible. This means that only one request will be made by video, if you stop the video and watch it again and the channel title is the same no requests are made. From the moment you start watching something the service will start to check what you're watching from x to x time (defined by the user). No aditional requests are made, it just compares what you're watch with what is stored. This is done because you might be watching the same channel but a different program/match.
I'll post my feature requests for @
zag in the next post