Kodi Community Forum

Full Version: trying to debug an addon
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Greetings,

I'm using an addon that seems to have broken after the update kodi 18.
the addon isn't maintained anymore (the developer doesn't responds to issue opened on the project's github).
I was wondering how to fix it.

here is the trace:
python:

10:06:29.229 T:3452957552 ERROR: EXCEPTION: not implemented.
10:06:29.231 T:3452957552 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.RuntimeError'>
Error Contents: not implemented.
Traceback (most recent call last):
File "/storage/.kodi/addons/script.100fm/addon.py", line 15, in
player_window = PlayerWindow()
File "/storage/.kodi/addons/script.100fm/player.py", line 21, in init
self.setCoordinateResolution(0) # 1920x1080
RuntimeError: not implemented.
-->End of Python script error report<--

the relevant code can be found at https://github.com/nire0510/script.100fm...yer.py#L21

any ideas?

Thanks.
Thread moved to add-on development
setCoordinateResolution is deprecated.

Call the constructor with 1080i in the call. 

Looks like you have fanart.jpg as the background for the window, so just create a simple skin.xml file that loads the fanart and put it under resources/skins/Default in your addon structure.

Then you would call it from addon.py with

python:
ADDON_PATH = ADDON.getAddonInfo('path').decode('utf-8')
player_window = PlayerWindow(skin.xml, ADDON_PATH, Default, 1080i)
(2019-07-20, 19:25)black_eagle Wrote: [ -> ]setCoordinateResolution is deprecated.

Call the constructor with 1080i in the call. 

Looks like you have fanart.jpg as the background for the window, so just create a simple skin.xml file that loads the fanart and put it under resources/skins/Default in your addon structure.

Then you would call it from addon.py with

python:
ADDON_PATH = ADDON.getAddonInfo('path').decode('utf-8')
player_window = PlayerWindow(skin.xml, ADDON_PATH, Default, 1080i)

thanks for the help, is there a template for suck skin xml_
seems like I cannot edit the post, *such skin xml?
No, but probably something like this would work ( I haven't tested it !!)
xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<window>
    <defaultcontrol always="true">1</defaultcontrol>
    <coordinates>
        <system>0</system>
        <left>0</left>
        <top>0</top>
    </coordinates>
    <animation effect="fade" time="250">WindowOpen</animation>
    <animation effect="fade" time="250">WindowClose</animation>
    <controls>
        <control type="image">
            <description>background window texture</description>
            <left>0</left>
            <top>0</top>
            <width>1920</width>
            <height>1080</height>
            <texture border="80">fanart.jpg</texture>
            <colordiffuse>DDFFFFFF</colordiffuse>
        </control>
    </controls>
</window>

Put fanart.jpg in addon_name/resources/skins/Default/media

Lots of help in the wiki.  https://kodi.wiki/view/Skinning  &  https://kodi.wiki/view/Add-on_development
(2019-07-22, 19:57)daggs Wrote: [ -> ]seems like I cannot edit the post, *such skin xml?

Your post count is too low for that priv to have kicked in yet (it's a generic anti-spam measure).

A few more posts will do it.
looks like I need addons 101, I'll try a basic addon and see how I merge the old code into it.

Thanks.
ok, I'm trying to fix it, with the following diff I get this error:
Code:

2019-07-25 21:02:22.156 T:139822702249728   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                                             Error Type: <type 'exceptions.SyntaxError'>
                                                                             Error Contents: invalid syntax (addon.py, line 14)
                                                                             File "/home/dagg/.kodi/addons/script.100fm/addon.py", line 14
                                                                             player_window = PlayerWindow(skin.xml, ADDON_PATH, Default, 1080i)
                                                                                                                                                                                      ^
                                                                             SyntaxError: invalid syntax
                                                                             -->End of Python script error report<--]
diff:
python:

diff -Nupr ./addon.py /home/dagg/workspace/script.100fm/addon.py
--- ./addon.py  2019-07-25 21:00:26.000000000 +0300
+++ /home/dagg/workspace/script.100fm/addon.py  2019-07-25 20:59:08.000000000 +0300
@@ -10,9 +10,9 @@ ADDON = Addon()
 ADDON_ID = ADDON.getAddonInfo('id')
 ADDON_NAME = ADDON.getAddonInfo('name')
 ADDON_DATA_FOLDER = translatePath(ADDON.getAddonInfo('profile')).decode('utf-8')
-ADDON_PATH = ADDON.getAddonInfo('path').decode('utf-8')
-player_window = PlayerWindow(skin.xml, ADDON_PATH, Default, 1080i)
 
+
+player_window = PlayerWindow()
 api = API()
 
 # stop player if track is not part of this addon:
Binary files ./fanart.jpg and /home/dagg/workspace/script.100fm/fanart.jpg differ
diff -Nupr ./player.py /home/dagg/workspace/script.100fm/player.py
--- ./player.py 2019-07-25 21:01:05.000000000 +0300
+++ /home/dagg/workspace/script.100fm/player.py 2019-07-25 20:59:08.000000000 +0300
@@ -25,7 +25,7 @@ class PlayerWindow(xbmcgui.WindowDialog)
 
         # background
         overlay = xbmcgui.ControlImage(0, 0, 1920, 1080,
-                                       'special://home/addons/{0}/resources/skins/Default/Media/fanart.jpg'.format(ADDON_ID))
+                                       'special://home/addons/{0}/fanart.jpg'.format(ADDON_ID))
         # top bar + shadow
         topbar = xbmcgui.ControlImage(0, 0, 1920, 290,
                                       'special://home/addons/{0}/resources/media/132f54.png'.format(ADDON_ID))
Binary files ./resources/skins/Default/Media/fanart.jpg and /home/dagg/workspace/script.100fm/resources/skins/Default/Media/fanart.jpg differ
diff -Nupr ./resources/skins/Default/skin.xml /home/dagg/workspace/script.100fm/resources/skins/Default/skin.xml
--- ./resources/skins/Default/skin.xml  2019-07-25 21:01:53.000000000 +0300
+++ /home/dagg/workspace/script.100fm/resources/skins/Default/skin.xml  1970-01-01 02:00:00.000000000 +0200
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<window>
-    <defaultcontrol always="true">1</defaultcontrol>
-    <coordinates>
-        <system>0</system>
-        <left>0</left>
-        <top>0</top>
-    </coordinates>
-    <animation effect="fade" time="250">WindowOpen</animation>
-    <animation effect="fade" time="250">WindowClose</animation>
-    <controls>
-        <control type="image">
-            <description>background window texture</description>
-            <left>0</left>
-            <top>0</top>
-            <width>1920</width>
-            <height>1080</height>
-            <texture border="80">fanart.jpg</texture>
-            <colordiffuse>DDFFFFFF</colordiffuse>
-        </control>
-    </controls>
-</window>

I've changed 1080i to 1080 and I get this error:
Code:

2019-07-25 21:07:00.688 T:140441999632128   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.NameError'>
                                            Error Contents: name 'skin' is not defined
                                            Traceback (most recent call last):
                                              File "/home/dagg/.kodi/addons/script.100fm/addon.py", line 14, in <module>
                                                player_window = PlayerWindow(skin.xml, ADDON_PATH, Default, 1080)
                                            NameError: name 'skin' is not defined

what am I doing wrong?
the diff is reversed, my bad!
another update, modified the playwindow line to this:
Code:
player_window = PlayerWindow('skin.xml', ADDON_PATH, 'Default', '1080i')
and I'm getting a different error:
[syntax
                                            ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.TypeError'>
                                            Error Contents: __init__() takes exactly 1 argument (5 given)
                                            Traceback (most recent call last):
                                              File "/home/dagg/.kodi/addons/script.100fm/addon.py", line 15, in <module>
                                                player_window = PlayerWindow('skin.xml', ADDON_PATH, 'Default', '1080i')
                                            TypeError: __init__() takes exactly 1 argument (5 given)
                                            -->End of Python script error report<--

[/syntax]
looks like this change is the correct one, question is, how I address this error?
got it to run, the error points to the init, so I've added ", *args, **kwargs" to PlayerWindow.__init__ and addon started and seems to be working, the only issue is the resolution, it is larger then 1920x1080.
I don't know to set it. checking but will appreciate any help.
(2019-07-26, 14:45)daggs Wrote: [ -> ]got it to run, the error points to the init, so I've added ", *args, **kwargs" to PlayerWindow.__init__ and addon started and seems to be working, the only issue is the resolution, it is larger then 1920x1080.
I don't know to set it. checking but will appreciate any help.

Post the contents of skin.xml or a link to your source code (github ??) .  For ref, you can look at how my database cleaner uses windows. https://github.com/the-black-eagle/scrip...se.cleaner
here:
xml:

dagg@NCC-5001D ~ $ cat .kodi/addons/script.100fm/resources/skins/Default/1080i/skin.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<window>
    <defaultcontrol always="true">1</defaultcontrol>
    <coordinates>
        <system>0</system>
        <left>0</left>
        <top>0</top>
    </coordinates>
    <animation effect="fade" time="250">WindowOpen</animation>
    <animation effect="fade" time="250">WindowClose</animation>
    <controls>
        <control type="image">
            <description>background window texture</description>
            <left>0</left>
            <top>0</top>
            <width>1920</width>
            <height>1080</height>
            <texture border="80">fanart.jpg</texture>
            <colordiffuse>DDFFFFFF</colordiffuse>
        </control>
    </controls>
</window>
Just mess with the <width> & <height> tags untul you get it how you want it.  I can't see a reson why it wouldn't be the right size.
Pages: 1 2