Any interest in helping me create a Sports View Addon
#1
I've been attempting to create an addon that utilizes local video files of sports games. It scrapes (from thesportsdb.com api) and displays information about the leagues, teams, players, etc. and allows you to play the videos. I've been at it for about 2 weeks. I can't even get the addon to display the first page which I have stored as an .xml in the resources folder. I'd be happy to provide any code/files/logs if you're interested. I feel like if I can get it to a point where it starts to work I can build from there. Any help appreciated!

I have been using info found here: 
https://kodi.wiki/view/Add-on_development
https://xbmc.github.io/docs.kodi.tv/mast...parts.html
https://romanvm.github.io/Kodistubs/_aut...mcgui.html
https://romanvm.github.io/Kodistubs/_aut...mcgui.html
and ChatGPT

Cheers!
Reply
#2
(2023-06-01, 16:32)mjc_cox Wrote: I've been attempting to create an addon that utilizes local video files of sports games. It scrapes (from thesportsdb.com api) and displays information about the leagues, teams, players, etc. and allows you to play the videos. I've been at it for about 2 weeks. I can't even get the addon to display the first page which I have stored as an .xml in the resources folder. I'd be happy to provide any code/files/logs if you're interested. I feel like if I can get it to a point where it starts to work I can build from there. Any help appreciated!

I have been using info found here: 
https://kodi.wiki/view/Add-on_development
https://xbmc.github.io/docs.kodi.tv/mast...parts.html
https://romanvm.github.io/Kodistubs/_aut...mcgui.html
https://romanvm.github.io/Kodistubs/_aut...mcgui.html
and ChatGPT

Cheers!

I don't think I've ever seen someone try to use CHat GPT to write a Kodi addon but that should prove interesting.  Anyway, I don't have time to go through a tremendous amount of coding with you but I am happy to provide some guides and pointers to specific questions.  You might want to take a look at this file in one of my addons, specifically lines  281-914.  There's a lot of code there but most of it is either parsing an XML response to format into listitem values for Kodi or some context menu code for additional functionality.  A couple of key lines are 859 and 914 which is where I created the listitems and tells Kodi it is done so it can display them. 

For the XML piece this is for a UPnP/DLNA server response but it could just as easily be an XML file source.  You say scrape an API, which typically is contradictory.  Typically I am accustomed to interfacing with an API and scraping a webpage.  API interfaces are much cleaner but as with all XML responses you need to check for the source returning the correct value.    You can see some of that in lines 132-165 where I check values returned from UPnP servers to determine their capabilities.  Some of them send back some interesting results. 

I hope this helps a little.


Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#3
the southpark addon i suggested last time is still quite a good example - https://forum.kodi.tv/showthread.php?tid...pid3154216

it loads its content from json, simple to make it load different information - would likely be easier to modify it than start over then you get a handle on how things are supposed to work in order to write your own

start by changing the path where it loads the json, inhibit its ability to load a new json file, change things around in the json file so you can see what does what

eliminate functions that are not necessary, work it down to where it shows a single item then you just have to repeat it x amount of times for the content you actually want to show

while doing all that you are learning quite a bit


(shorter answer, reverse engineer it until you understand it)
Reply
#4
(2023-06-01, 22:27)jepsizofye Wrote: (shorter answer, reverse engineer it until you understand it)

Indeed. That's how I learned to write Kodi addons.


Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#5
(2023-06-02, 00:43)jbinkley60 Wrote:
(2023-06-01, 22:27)jepsizofye Wrote: (shorter answer, reverse engineer it until you understand it)

Indeed. That's how I learned to write Kodi addons.


Jeff

... thats how i learned assembly, c, c++, perl, php, python, javascript, html, jquery, kodi skinning and kodi addons and a bunch of other useless stuff ... the last time i was in a class they were teaching basic on dos
Reply
#6
Ditto.  I did do a bit of assembly code in college for my EE degree.  I haven't done quite as many languages but the ones I do know all were learned the same way.  I did buy a CASE tool back in the 90s to build a Windows 3.x GUI interface in C.  I studied the heck out of the CASE tool output.  I taught myself C, Windows GUI programming and interfacing with inline assembler code to interface with  a circuit board I designed all over a Christmas break.  Of course that was 30 years ago   Smile



Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#7
Wow it's been a while since i created this post. Sorry about that. My family has been sick with the flu for a while. So I'm just going to get back into this. I was trying the "reverse engineer til it works" idea. The problem was that no matter what i did i couldn't get my addon to load an .xml file from resources. I tried a million different ways. This was the first step of the addon. Then looking at other addons it didn't seem like resources folder .xml files were all that common. This leaves me wondering if i'm using an outdated method or something. I have completely scrapped and restarted the addon probably a dozen times. When just getting the most basic function to work is impossible, my stubbornness to make it work wears out.

The south park addon does work but the functionality is quite different to the one that I want to make. At least in the beginning stages. I'm sure it's just my inexperience. But I can't figure out how to apply the south park example to mine. Reading through the documentation sometimes feels like I'm looking at outdated material since Kodi v19. I'll work through my code and get it back to a point where I think it should just work and I'll share it here. Maybe that's the best way to figure out my problem.
Reply
#8
(2023-06-16, 17:05)mjc_cox Wrote: I'll work through my code and get it back to a point where I think it should just work and I'll share it here. Maybe that's the best way to figure out my problem.

That is probably the best way to get specific help.

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#9
Not to dissuade anyone from working on or using something like this, but there is a scraper for TheSportsDB (Kodi Nexus and later) that will add your games to the Kodi TV Show Library that avoids having to have a separate add-on to get game information and play the video files.

https://forum.kodi.tv/showthread.php?tid...id=3097517
Reply
#10
I hear ya. I just wish that Kodi worked a little more friendly when displaying sports as a tv show. My theory was to make a platform (addon) to display sports as sports and then we can have more flexibility with how it's displayed and maybe make use of more of the fancy stuff that thesportsdb has available. I'm thinking it would be great to be able to display info on sports, leagues, teams, players, game info, etc. This is way way down the road. Right now I can't get the .xml page to load.
Reply
#11
(2023-06-20, 15:19)mjc_cox Wrote: I hear ya. I just wish that Kodi worked a little more friendly when displaying sports as a tv show. My theory was to make a platform (addon) to display sports as sports and then we can have more flexibility with how it's displayed and maybe make use of more of the fancy stuff that thesportsdb has available. I'm thinking it would be great to be able to display info on sports, leagues, teams, players, game info, etc. This is way way down the road. Right now I can't get the .xml page to load.

If you post some of your XML parsing code and tell us what is happening, we can probably help.  XML parsing under Kodi and Python is fairly well defined.  Here's a very simple example of parsing a simple XML file in a Kodi addon.  It begins with line 82.


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#12
Here's the contents of the files in my addon and log file:

addon.xml:          https://paste.kodi.tv/cavotimuwo.kodi
default.py:           https://paste.kodi.tv/dazumejafa
sportswall.xml       https://paste.kodi.tv/ibenizenup.kodi

I'm trying to get my information from here:   https://kodi.wiki/view/Add-on_development
More specifically here:   https://kodi.wiki/view/Add-on_structure
Is this information valid for Kodi v19 and up? I am using version 20.1.

I have successfully launched my sportswall.xml page. This page helped a lot: https://kodi.wiki/view/HOW-TO:Script_addon
Reply
#13
(2023-06-20, 17:21)mjc_cox Wrote: I'm trying to get my information from here:   Add-on_development (wiki)

Yes, this is a good place to start. I noticed your logfile disappeared from your post.  It was there earlier and mentioned the ADDON variable and an issue with the path.  For this I typically use the Kodi special protocol capability.    You can look here on line 27 as an example I use of a folder within my addon, in this case for writing but you could do the same for reading.  Based upon the recent changes you've made can you tell me what's not working, if anything,  and post a new logfile, if you are still getting errors ?


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#14
Thanks for the suggestion. Yeah I've been getting familiarized with the Special protocol. Sometimes it makes sense sometimes I'm left scratching my head. The entry point seems to differ depending on what you're doing? does tha make sense? Anyway... I've made some progress. I've been able to narrow down my problems by focusing on creating the pages in the **.xml files and then I'll deal with the functionality in the default.py file later. 

I have run into a little snag here though. I've got my first page opening and i can arrange within it. But i'm trying to place an image behind whichever menu item has focus. But the log keeps saying "2023-06-23 01:05:11.953 T:23860   error <general>: Control 102 in window 13000 has been asked to focus, but it can't". This makes sense because i have 102 set as default focus. But I can't figure out WHY it can't. Here's the file:

landingpage.xml: https://paste.kodi.tv/ohinoxusam
Reply
#15
try adding allowhiddenfocus

https://kodi.wiki/view/Conditional_visibility
Reply

Logout Mark Read Team Forum Stats Members Help
Any interest in helping me create a Sports View Addon0