Kodi Community Forum
WIP Unnamed/Sports Center - Sports for Kodi - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Program Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=151)
+---- Thread: WIP Unnamed/Sports Center - Sports for Kodi (/showthread.php?tid=216044)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23


RE: Unnamed/Sports Center - Sports for Kodi - Ovokx - 2015-05-05

unable to download the file Sad


RE: Unnamed/Sports Center - Sports for Kodi - enen92 - 2015-05-05

Try this one: https://meocloud.pt/link/cb5190ea-9597-4ed7-ae8b-f02a6b850ee3/librarystuff.zip/

File should be extracted in special://userdata/addon_data/script.sportscenter


RE: Unnamed/Sports Center - Sports for Kodi - sattekop - 2015-05-05

Hi Enen92,
That library looks fabulous!
Looking forward to when this will be fully up and running, but already for just football info this is great.


RE: Unnamed/Sports Center - Sports for Kodi - zag - 2015-05-06

Gave it a test and the library stuff worked as expected.

Saying that, it would be nice to have some kind of library button to make it obvious what is a stored library item, and what is a live feed from the sports db.


RE: Unnamed/Sports Center - Sports for Kodi - enen92 - 2015-05-06

I have to think about that, probably an icon similar to the ones we have for watched content or those flags that identify the quality of the media (HD/SD etc) to inform the information is about the library and not online.

-----

Some news about what I'm working on for the addon at the moment. I'm working at the same time on the on-screen information and on the scrapper. For the scrapper the configuration dialog is finished and working...the actions not really:

Image

The on-screen information is a menu you will be able to access by pressing a key on your keyboard while you're watching a match. This menu works with a service extension point that "tracks" what you watch and tries to match it with the livescores information (live games) by doing some regex on the pvr title of the livechannel or pvr description of the livechannel (for live content) and video label for regular video files. It's fully customizable and can be disabled if the user wants. No info is sent anywhere, all the processing happens on the HTPC itself:

Image

By the time you're watching a live football match the service might have already identified the match you're watching. Matching both team id's, livematch information (line-ups, details such as goals, redcards, etc), twitters, and league id. This will let you access with the click of a button to that information while you're watching the live match:

Image
Image

Nowadays, specially on leagues like the champions league or british premier league there is a twitter tag associated with the match you're watching. This made me do some changes to the "twitter api" of the addon and it can now display also a list of tweets by hashtag. The on-screen menu ask you what is the hash of the match you're watching and saves the hash along with the match information. So you will be able to watch a live soccer match in kodi and, at the same time, check what people are saying about the match with the press of a button:

Image

Image

Step by step, getting better than any commercial solution available Smile

Cheers


RE: Unnamed/Sports Center - Sports for Kodi - zag - 2015-05-06

This is seriously pioneering stuff! great!

I'll have some time to work on thesportsdb site in the next few weeks, so keep any feature requests coming.


RE: Unnamed/Sports Center - Sports for Kodi - Ovokx - 2015-05-06

library tested on works perfect! Amazing work you're doing here! Smile


RE: Unnamed/Sports Center - Sports for Kodi - mjccox - 2015-05-07

Amazing work and great ideas Enen! It's growing up so fast!


RE: Unnamed/Sports Center - Sports for Kodi - enen92 - 2015-05-08

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 Big Grin

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 Smile


RE: Unnamed/Sports Center - Sports for Kodi - enen92 - 2015-05-08

@zag, so now the feature requests:

Feature request 1:
Already requested before...we really need to make some matching on the idLeague on the livescores information. Getting the events to list is too slow if a lot of events are returned. Those are mainly from secondary leagues the user is most likely not interested in. We should be able to ignore leagues from the livescores. Also this would enable us to match the league on the on-screen information and presenting the league tables onscreen. I know this can be troublesome but the league names seem to be constant. If you can't match them...return 0 for the idLeague and it will be ignored in my code.

Feature request 2:
This one is more important and should have a higher priority than feature request 1. We need to add keywords to teams (and probably leagues). For us to have a decent scrapper, for us to be able to integrate with external websites, for us to develop any automated tool and either for onscreen information to work we need more than a name and an alternative name.
This won't cause any complexity on the code of the db (I think) because we really don't need to search by the keyword. The keywords are static data that are returned when doing the lookup by team_id. Latin languages are quite common to translate team names. If you look at the EPG data for Canal+ (spain) or movistar you'll see most of the team names are similar but translated. For instance, Hamburg is translated to Hamburgo, Espanyol is "translated" to EspaƱol, and so on. So ideally we should have something like:

Quote:{"idTeam":"133604","idSoccerXML":"9","intLoved":"1","strTeam":"Sporting Lisbon","strAlternate":"Sporting CP","strKeywords":"Sporting Clube de Portugal;Sporting Lisbonna;SCP;Sporting C.P.; S.Lisbon","intFormedYear":"1906" ...

Users on the database should be able to add keywords to each team to improve the scapper and to easy the process of matching the same team on external websites. Removing keywords I really don't know, probably it would be better to leave that power only to moderators.
The database would store the keywords as a string with each entry separated by ';' and present the information on the html. The edit page would have a field to "add a keyword".

This is specially important for the scrapper and I didn't want to start working on it to change the way it works later.

Feature request 3:
For the scrapper and considering the keywords we will probably need another method to get all the teams in the database by sport AND country.

Feature request 4:
If you are terribly bored you might want to start thinking how the database can handle the same team in different leagues. Probably a new parameter for leagues that store if they are a "main league" such as the premier league or a "secondary league" such as the champions league? Teams are always a child of a main league but can be assigned to secondary leagues. This is usefull for european competitions and probably later...country cups (FA cup, etc).

Let me know,

Cheers


RE: Unnamed/Sports Center - Sports for Kodi - enen92 - 2015-05-11

It seems there is a module in the default python library to compare two strings and have the return of the percent of similarity (difflib), I didn't know about. Of course it will work much better than trying to match entire strings. We just need to set a minimum percentage to assume we have found the game by making both home and away teams similarity to contribute to the overall percentage.
It might also work well for the parser Smile
So, @zag, if you are going to tackle my feature requests...feature request nbr 3 just moved to the top of the list Tongue


RE: Unnamed/Sports Center - Sports for Kodi - zag - 2015-05-11

No probs, will look at it later today


RE: Unnamed/Sports Center - Sports for Kodi - enen92 - 2015-05-11

(2015-05-11, 10:34)zag Wrote: No probs, will look at it later today

Sorry mate, while working on the scrapper found out other methods that should exist for this to work right. So I'll list here by order of priority what I need implemented to continue my work on the addon:

1) Provided the league and season get all the existent events on the database (as soon as possible)

2) Provided the league return all seasons available (as soon as possible)

3) Provided the sport and country return all teams available (as soon as possible)

4) Keywords (can wait as they will only improve the scrapping)

5) Match league id's on livescores data (can wait as it is only improvements and fixes on my side)

6) Think about european competitions (this one can wait much more time)


RE: Unnamed/Sports Center - Sports for Kodi - zag - 2015-05-13

Should be done now, sorry for the delay.

http://www.thesportsdb.com/forum/viewtopic.php?f=6&t=59&p=483#p483

As always, let me know any improvements needed


RE: Unnamed/Sports Center - Sports for Kodi - enen92 - 2015-05-13

Thanks zag Big Grin
I'll get back on track soon with those functions. I'm now working on getting the player details and team details to work correctly (something like what script.extended info does for movies and shows) and including a search function. Once done, I'll get back to the on-screen function and start working on the scrapper. Unfortunately, at least the first (on-screen) has to be done when a lot of matches are live and that happens only on weekends