Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add-on does not display under Add-ons / how to start it? #46

Closed
mYnDstrEAm opened this issue Aug 10, 2020 · 48 comments
Closed

Add-on does not display under Add-ons / how to start it? #46

mYnDstrEAm opened this issue Aug 10, 2020 · 48 comments
Labels

Comments

@mYnDstrEAm
Copy link

I followed the steps of "Install from repository". Some steps were a bit different so I had to search around a bit. For example the only way I could get to "Install from .zip file" was not Settings → Add-ons → Install from zip file but Add-ons (click, not hover) → the package icon in the upper left

But now I don't know how to launch it. No explainer was displayed. There aren't any steps in the readme with further info. No "Games" or "Lutris" or anything similarly clear is displayed in the panel on the left. I could find the Lutris AddOn after entering "Lutris" into the search under Add-ons (hover). When I click "Open" there nothing happens and I don't get any error messages in the console. I also looked into the configuration which should be fine and Lutris does launch when I click "Open Lutris" there.

How to use it? And could the documentation please be improved a bit to make things easier?

Debian10/KDE
Kodi 17.6
Lutris 0.5.7.1

@RobLoach
Copy link
Owner

It should appear under Program Addons.

@mYnDstrEAm
Copy link
Author

mYnDstrEAm commented Aug 10, 2020

It should appear under Program Addons.

It doesn't. I also installed an Add-on from the official repositories afterwards and it shows there just fine. I had the Library Node Editor Add-on installed before installing the Lutris Add-on and it showed under Add-ons as well. I'll try finding some logs (this didn't work so far: the only log entry within Kodi is "Kodi started successfully"). When I enter "Lutris" into the search it shows "Media sources - Lutris" and shows the page for the Add-on (including the open button but without any images) when I click on it. I also tried deinstalling and installing again (it showed the notification for successful installation but it still doesn't show up under Add-ons/Program Add-ons). Does the Add-on maybe use some special directories for which it may not have permissions?

@mYnDstrEAm mYnDstrEAm changed the title How to start it? Please improve the documentation Add-on does not display under Add-ons / how to start it? Aug 10, 2020
@solbero
Copy link
Collaborator

solbero commented Aug 10, 2020

This sounds like a skin issue. What skin are you using?

@mYnDstrEAm
Copy link
Author

The default skin of Kodi 17.6. Most settings are the default settings. And other Add-ons show up just fine. It could be a permissions problem or something like that. But it's still strange that it displays that it installed successfully. Logs would be useful.

@solbero
Copy link
Collaborator

solbero commented Aug 10, 2020

The problem is that Kodi v17 does not provide the Game category the add-on uses. The category was introduced in Kodi v18.

@mYnDstrEAm
Copy link
Author

That could be it. But shouldn't it fail installing in that case or show in some other category? Under "Download" in Add-ons it does display a tile for Game-Add-ons (but there are only Controller Add-ons).

If this is the cause: is there a way to use it in Kodi under Debian10? I already installed the Kodi version for Debian stable from backports.

@solbero
Copy link
Collaborator

solbero commented Aug 10, 2020

That also explains why the installation instructions seemed wrong. They are written with Estuary in mind, the new default skin in Kodi v18. I'll write up some changes in a branch tomorrow and you can see if they solve your problems.

@solbero solbero added the bug label Aug 10, 2020
@solbero
Copy link
Collaborator

solbero commented Aug 11, 2020

I made a few changes which hopefully will make the add-on show up in Kodi v17.

  1. Uninstall the add-on
  2. Delete ~/.kodi/addons/script.lutris if it exists
  3. Delete ~/.kodi/addons/packages/script.lutris-1.4.0.zip if it exists
  4. Delete ~/.kodi/userdata/addon_data/script.lutris if it exists
  5. Download the zip-file from the debian_fix branch
  6. Install the zip-file in Kodi

Please report back if it solves your problem.

@mYnDstrEAm
Copy link
Author

mYnDstrEAm commented Aug 11, 2020

Great, it works! It's showing up under Add-ons.
However unlike in Lutris it doesn't display any games.
It could be a permissions problem - I'm going to investigate a bit further later
The console output includes (including the last few lines):

Could not detect ldconfig on this system
MAME XML generation launched in the background, not returning anything this time
Getting full game list from MAME...
MAME isn't installed, can't retrieve systems list.
...
Running Lutris 0.5.7.1
...
x86_64 libvulkan.so.1 missing (needed by vulkan)
MAME XML written
Vulkan is not available or your system isn't Vulkan capable
Shutting down Lutris

Except for the last line the last 4 (3) lines above are also in the output when running lutris.

I installed Vulkan support on one of my machines and Lutris still doesn't start games which worked previously (I think there was a Lutris update in between) even though it doesn't display the error messages anymore. I'll report back once I get Lutris on its own working again (and checked for permissions problems with syslog).

@mYnDstrEAm
Copy link
Author

Lutris and PCSX2 do work on the machine for which I haven't added Vulkan support. Lutris and the Dolphin emulator (runner) do run on the machine which should run Vulkan now but not PCSX2.

When starting lutris via the add-on the console output is:

Running Lutris 0.5.7.1
...
Running Mesa driver 18.3.6 on Mesa ...
...
Vulkan is supported
Shutting down Lutris
MAME XML written

When starting lutris directly the output is the same except that instead of "Shutting down Lutris" there are three common Gtk warnings (which shouldn't be a problem).

@solbero
Copy link
Collaborator

solbero commented Aug 12, 2020

Does Lutris shut down when you start Lutris directly? It was unclear from your last message if that was the case or not.

Type which lutris into a terminal. Post the path it returns. Also run lutris -d and post the output to a GitHub Gist or similar service.

@mYnDstrEAm
Copy link
Author

mYnDstrEAm commented Aug 12, 2020

No: Lutris and the Dolphin emulator (runner) do run on the machine which should run Vulkan now, but not PCSX2. Lutris and PCSX2 (and Dolphin) do run on another machine on which I haven't added Vulkan support. Lutris does not shut down there. Which emulators run on these machines may be irrelevant here.
It returns /usr/games/lutris. I thought it was /usr/bin/lutris, strange.
I changed the path in the Add-on settings but nothing changed: no games show up but it does start lutris.
The output of lutris -d on the machine without Vulkan support: https://pastebin.com/rD1D7RmL

@solbero
Copy link
Collaborator

solbero commented Aug 14, 2020

It returns /usr/games/lutris. I thought it was /usr/bin/lutris, strange.
I changed the path in the Add-on settings but nothing changed: no games show up but it does start lutris.

You should not need to add the path to Lutris in the add-on settings. The add-on finds the path to Lutris autmatically as long as it is in your $PATH. It is really only used if you have compiled Lutris yourself and it is not in $PATH.

No: Lutris and the Dolphin emulator (runner) do run on the machine which should run Vulkan now, but not PCSX2. Lutris and PCSX2 (and Dolphin) do run on another machine on which I haven't added Vulkan support. Lutris does not shut down there. Which emulators run on these machines may be irrelevant here.

This sound more and more like a Lutris error and not any problem with the add-on. On the machine where you are using the add-on run this lutris --list-games --installed --json and post the output. Make sure that some games are installed and that they are showing up in Lutris before you run the command.

@mYnDstrEAm
Copy link
Author

mYnDstrEAm commented Aug 14, 2020

You should not need to add the path to Lutris in the add-on settings. The add-on finds the path to Lutris autmatically as long as it is in your $PATH. It is really only used if you have compiled Lutris yourself and it is not in $PATH.

Yes, otherwise it wouldn't have started Lutris.

This sound more and more like a Lutris error and not any problem with the add-on. On the machine where you are using the add-on run this lutris --list-games --installed --json and post the output. Make sure that some games are installed and that they are showing up in Lutris before you run the command.

I would have thought so too but Lutris is running fine. It shows all the games and I can start games via Lutris. I have games for the Dolphin emulator and the PCSX2 emulator installed. On the machine on which Lutris, Dolphin emulator games and PCSX2 emulator games are running and which does not have Vulkan support (but still no games show up in Kodi) the output of lutris --list-games --json is:

MAME XML generation launched in the background, not returning anything this time
Getting full game list from MAME...
MAME isn't installed, can't retrieve systems list.

(lutris:14723): Gtk-WARNING **: Theme parsing error: gtk.css:68:35: The style property GtkButton:child-displacement-x is deprecated and shouldn't be used anymore. It will be removed in a future version

(lutris:14723): Gtk-WARNING **: Theme parsing error: gtk.css:69:35: The style property GtkButton:child-displacement-y is deprecated and shouldn't be used anymore. It will be removed in a future version

(lutris:14723): Gtk-WARNING **: Theme parsing error: gtk.css:73:46: The style property GtkScrolledWindow:scrollbars-within-bevel is deprecated and shouldn't be used anymore. It will be removed in a future version
Running Lutris 0.5.7.1
Using Intel Open Source Technology Center
Running Mesa driver 18.3.6 on Mesa [...]
GPU: [...] drivers
i386 libvulkan.so.1 missing (needed by vulkan)
MAME XML written
Vulkan is not available or your system isn't Vulkan capable
[
  {
    "id": 3,
    "slug": "na-me",
    "name": "na me",
    "runner": "pcsx2",
    "directory": "filepath"
  },
  {
    "id": 2,
    "slug": "name",
    "name": "name",
    "runner": "dolphin",
    "directory": ""
  },
  {
    "id": 1,
    "slug": "pcsxr",
    "name": "PCSXR",
    "runner": "linux",
    "directory": ""
  }
]
Shutting down Lutris

(I have removed the "PCSXR" entry in Lutris now so now there are only 2 entries with the ids 2 and 3.)

On the machine with Vulkan support it's basically the same. The games don't show up in Kodi but they do show up in Lutris and in the json output of that command. No error messages like "i386 libvulkan.so.1 missing" are in the output there.

@solbero
Copy link
Collaborator

solbero commented Aug 17, 2020

Looking at your JSON output, there are only two games installed: one called na me and one called name. If you have games installed and they do show up in the Lutris GUI, then they should also show up when you request Lutris to output its game list in JSON.

So lets see if we can populate the JSON with a known entry.

  1. Go to lutris.net and install Spelunky using the browser installer script.
  2. Rerun lutris --list-games --installed --json
  3. See if Spelunky turns up in the output.

If there is no entry for Spelunky, that suggests that the problem resides in Lutris. If Lutris is not outputting the correct JSON the add-on will not display anything.

@mYnDstrEAm
Copy link
Author

mYnDstrEAm commented Aug 17, 2020

But they do! Please see the recent edit before your reply (the bottom paragraph). I'm having the same problem on another machine.
I currently don't install Wine games (mostly for security reasons) - the games I have installed and added to Lutris are all Dolphin or PCSX2 games as of right now. Could you try it with a PCSX2 or Dolphin emulator game?

@solbero
Copy link
Collaborator

solbero commented Aug 19, 2020

Could you try it with a PCSX2 or Dolphin emulator game?
I don't have access to any games for those emulator.

Could you please follow the procedure in the previous post? It would help a lot to see the JSON output with a known entry to confirm that it is not Lutris acting up. Please post the output here if not to long or to a paste site.

@mYnDstrEAm
Copy link
Author

mYnDstrEAm commented Aug 20, 2020

I added SuperTuxKart and ExtremeTuxRacer (Linux native games) which are also known entries. It still doesn't show any games in Kodi even though I can launch them in Lutris where they have the correct image set. Maybe it has to do with these:

MAME XML generation launched in the background, not returning anything this time
MAME isn't installed, can't retrieve systems list.
Shutting down Lutris
MAME XML written

Does /usr/games need to be writeable? (I didn't change any directory permissions.) Output of lutris --list-games --installed --json includes:

{
    "id": 13,
    "slug": "supertuxkart",
    "name": "SuperTuxKart",
    "runner": "linux",
    "directory": "/usr/games"
  },

@solbero
Copy link
Collaborator

solbero commented Aug 20, 2020

Perfect. So there doesn't seem to be a problem with the JSON. You can ignore the MAME errors.

Next step is to enable debug in Kodi settings. Afterwards, run the add-on. Then post the whole debug log to a paste site.

@mYnDstrEAm
Copy link
Author

It's here: https://pastebin.com/H0rVwLEV
Maybe it has something to do with "GetImageHash - unable to stat url" but right now I don't immediately see what's causing it.

@solbero
Copy link
Collaborator

solbero commented Aug 27, 2020

This issue is confusing. Looking at you debug log Kodi reports that it creates an item listing with three items. So they should show up.

 INFO: CPythonInvoker(0, /home/username/.kodi/addons/script.lutris/default.py): script successfully run
DEBUG: Saving fileitems [plugin://script.lutris/]
DEBUG:   -- items: 3, sort method: 0, ascending: false

But there are a few peculiarities to you log, the items reported by the add-on are a bit weird. Are the emulators installed using Lutris scripts or manually? I'm asking since the names of the entries are game name, game name 2 and PCSXR.

DEBUG: Lutris: JSON output is [{u'runner': u'pcsx2', u'directory': u'/home/username/game path', u'id': 3, u'name': u'game name', u'slug': u'game-name'}, {u'runner': u'dolphin', u'directory': u'', u'id': 2, u'name': u'game name 2', u'slug': u'game-name-2'}, {u'runner': u'linux', u'directory': u'', u'id': 4, u'name': u'PCSXR', u'slug': u'pcsxr'}]

You can ignore the DEBUG: GetImageHash - unable to stat url errors. They are only reporting that there is not an image installed by Lutris which corresponds with the name of the item name in Kodi.

To be honest there doesn't seem to be anything wrong. Could you try another Kodi skin and see if the issue persists?

@mYnDstrEAm
Copy link
Author

mYnDstrEAm commented Aug 27, 2020

I have the Dolphin emulator and PCSXR installed separately from Lutris and additionally I have installed the Lutris runners Dolphin and PCSX2 (and some other ones) with Lutris. I don't know why there is an entry for PCSXR and why it's still there - see the bottom of this comment. Maybe I added it but I doubt it because I wouldn't add an emulator as a game (but I don't think it's there on another Debian machine but I'll have to check later). The names of game name and game name 2 are fine (and one of the two has the correct image set in Lutris, I think both have the correct set on another machine but I'll have to check) - I just manually changed the names in the logs for the pastebin post.
I could show a screenshot if that would be useful (I don't think so) - it's just a the blue background without anything in there - nothing invisible either as nothing happens when I click anywhere.
It's the default skin and I didn't configure any uncommon options. I only changed things like region/language settings.

As it's the default skin, it doesn't make much sense to change it imo.
Could you try it with a virtual machine running Debian? The problem occurs on multiple of my Debian machines...
If you won't, maybe I will but not now and I don't think I could debug it as good as you without your knowledge of the internals of the addon code.

@solbero
Copy link
Collaborator

solbero commented Aug 28, 2020

Thanks for the explanation regarding the game names. I'll see if I have the time to run Debian in a virtual machine over the weekend. Hopefully I can reproduce the issue.

@solbero
Copy link
Collaborator

solbero commented Aug 31, 2020

Good news, I can reproduce the issue on Debian 10. Bad news is that all the logs I looked at gives no indication where the problem might be. I'll look more into it and see if I can find the cause of the problem.

@mYnDstrEAm
Copy link
Author

Any news on that? Also is it supposed to run under Kodi 19 alpha 2? I have compiled this version now and when trying to install the Lutris Kodi addon, which I can also only find via the search there, nothing happens (no popup, no output in the console or anything) and it doesn't get installed.

@solbero
Copy link
Collaborator

solbero commented Oct 21, 2020

Try downloading the latest .zip of the feature/python3 branch for Kodi 19. It is not backward compatible with any previous Kodi versions.

Also, I never found a solution for your troubles with addon on Debian. However, I was able to install and use v1.3.1.

@mYnDstrEAm
Copy link
Author

mYnDstrEAm commented Oct 24, 2020

Now I installed Kodi v19 via this repo: https://github.com/basilgello/kodi-nightly-debian-repo and the addon isn't working with the latest .zip. Unlike that other version I tried with the compiled version something does happen and a popup is shown but I get these errors (like earlier):

i386 libGL.so.1 missing (needed by opengl)
x86_64 libGL.so.1 missing (needed by opengl)
i386 libvulkan.so.1 missing (needed by vulkan)
x86_64 libvulkan.so.1 missing (needed by vulkan)
MAME XML written
Vulkan is supported
Shutting down Lutris

in the console and this message window in Lutris:

Missing vulkan libraries
Lutris was unable to detect Vulkan support for the i386 and x86_64 architecture.
This will prevent many games and programs from working.
To install it, please use the following guide: Installing Graphics Drivers

(same as I had here: lutris/lutris#3083)

I don't get this message window and these console errors when running Lutris directly.

Could it be some kind of version mismatch?

Thanks for providing a solution though and for also providing one for the current version in Debian's repos (haven't tested that yet)!

@mYnDstrEAm
Copy link
Author

mYnDstrEAm commented Oct 28, 2020

It seems like this is a probem with or when using firejail, when running kodi without it I don't get the errors of these errors. Instead I get these errors (full output):

failed to open zone.tab
libva info: VA-API version 1.9.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_4
libva info: va_openDriver() returns 0
MAME XML generation launched in the background, not returning anything this time
Getting full game list from MAME...
MAME isn't installed, can't retrieve systems list.

(lutris:11685): Gtk-WARNING **: Theme parsing error: gtk.css:68:35: The style property GtkButton:child-displacement-x is deprecated and shouldn't be used anymore. It will be removed in a future version

(lutris:11685): Gtk-WARNING **: Theme parsing error: gtk.css:69:35: The style property GtkButton:child-displacement-y is deprecated and shouldn't be used anymore. It will be removed in a future version

(lutris:11685): Gtk-WARNING **: Theme parsing error: gtk.css:73:46: The style property GtkScrolledWindow:scrollbars-within-bevel is deprecated and shouldn't be used anymore. It will be removed in a future version
Running Lutris 0.5.7.1
Using Intel Open Source Technology Center
Running Mesa driver 18.3.6 on Mesa DRI ...
GPU: ... using ... drivers
Vulkan is supported
Shutting down Lutris
MAME XML written

Maybe the first line of the output has something to do with tzdata? I couldn't find anything about it with a search.

For the libva errors I found intel/libva#278 and intel/libva#375 - maybe libva is too old? I have libva1 1.7 and libva2 2.9. Maybe it's a problem with lva-drm? Or is it a "driver init issue. it is driver issue. or permission issue... it is not a libva issue"? I don't run proprietary graphics drivers. Lutris itself runs just fine, but not the kodi-lutris addon. Any suggestions what the problem might be? I'm also discussing this at xbmc/xbmc#18612

@mYnDstrEAm
Copy link
Author

mYnDstrEAm commented Oct 29, 2020

Okay, so now the Lutris-Kodi addon displays on two machines (with Kodi v19.0 from Basil Gello's repo and latest.zip from above):

On one without Vulkan support I get the i386 libGL.so.1 missing (needed by opengl) errors (see above) and I get permissions errors when trying to run a game (but these are issues of firejail / the firejail profile which I'll try to solve later). When opening the addon in Kodi it display a message window from Lutris that recommends to enable Vulkan support (no Kodi popup about errors though). However it does display the games Lutris has! (Currently just the title without any cover or anything; note that I have not allowed any extra ports in the firewall or anything.)

On another machine with Vulkan support and when running it without firejail I don't get these i386 libGL.so.1 missing (needed by opengl) errors but the output of the previous comment in the console. It does not display a popup about Kodi errors / the Kodi logs. And it does not display any games of Lutris. The Kodi logs have this:

JSONRPC Server: Successfully initialized
INFO <general>: CDVDVideoCodecFFmpeg::Open() Using codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
INFO <general>: Loading skin file: MyGames.xml, load type: KEEP_IN_MEMORY
INFO <general>: initializing python engine.
INFO <general>: CPythonInvoker(0, /home/username/.kodi/addons/service.xbmc.versioncheck/resources/lib/runner.py): script successfully run
INFO <general>: Python interpreter stopped
ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'json.decoder.JSONDecodeError'>
                                                   Error Contents: Unterminated string starting at: line 28 column 18 (char 583)
                                                   Traceback (most recent call last):
                                                     File "/home/username/.kodi/addons/script.lutris/default.py", line 293, in <module>
                                                       router(sys.argv[2][1:])
                                                     File "/home/username/.kodi/addons/script.lutris/default.py", line 286, in router
                                                       create_list_games()
                                                     File "/home/username/.kodi/addons/script.lutris/default.py", line 166, in create_list_games
                                                       games = get_games()
                                                     File "/home/username/.kodi/addons/script.lutris/default.py", line 148, in get_games
                                                       response = json.loads(result)
                                                     File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
                                                       return _default_decoder.decode(s)
                                                     File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
                                                       obj, end = self.raw_decode(s, idx=_w(s, 0).end())
                                                     File "/usr/lib/python3.7/json/decoder.py", line 353, in raw_decode
                                                       obj, end = self.scan_once(s, idx)
                                                   json.decoder.JSONDecodeError: Unterminated string starting at: line 28 column 18 (char 583)
                                                   -->End of Python script error report<--
                                                   
WARNING <general>: CPythonInvoker(1, /home/username/.kodi/addons/script.lutris/default.py): the python script "/home/username/.kodi/addons/script.lutris/default.py" has left several classes in memory that we couldn't clean up. The classes include: N9XBMCAddon9xbmcaddon5AddonE
INFO <general>: Python interpreter stopped
ERROR <general>: GetDirectory - Error getting plugin://script.lutris/
ERROR <general>: CGUIMediaWindow::GetDirectory(plugin://script.lutris/) failed
INFO <general>: Loading skin file: DialogButtonMenu.xml, load type: KEEP_IN_MEMORY
INFO <general>: Stopping player
INFO <general>: Storing total System Uptime
INFO <general>: Saving settings

(And here is the full log of the other machine without Vulkan support (ran with firejail).) The lutris-kodi-addon-feature-python3.zip I downloaded from the comment above and am using has SHA256sum eeaa9d53620e165e94acbe9dcedb51f0601cde2ceab5a7e977b4f7e8bd5920cc.

@solbero
Copy link
Collaborator

solbero commented Oct 31, 2020

Are both machines running the Kodi v19 and the .zip from the Python 3 branch? Could you post a log from the machine where the add-on is not working with debug mode enabled in Kodi?

@mYnDstrEAm
Copy link
Author

Yes, both use Kodi v 19 (from Basil Gello's repo) and exactly the same latest .zip from the Python 3 branch.

Log with debug mode enabled on the machine with Vulkan support but no games showing and an error popup in Kodi.

@solbero
Copy link
Collaborator

solbero commented Nov 1, 2020

There seems to be something wrong with the JSON output from Lutris. So lets try to log the raw JSON output.

If you could find the file ~/.kodi/addons/plugin.lutris/default.py and open it in an editor. Find line 144 and add log(f'Raw JSON is: {raw_resut}') below line 144. It should look like this:

# Get the list of games from lutris as a JSON object
raw_result = subprocess.check_output(cmd)
log(f'Raw JSON is: {raw_resut}')
# Remove warning messages from JSON output
result = raw_result[raw_result.index(b'['):raw_result.index(b']')+1]

Then restart Kodi and try to access the add-on. Make sure debug is enabled and post the log here when it fails.

@mYnDstrEAm
Copy link
Author

Thanks for looking into it. It's ~/.kodi/addons/script.lutris/default.py on my side and there was a typo in raw_resut.

Here's the log (the other games are formatted like the example).

@solbero
Copy link
Collaborator

solbero commented Nov 1, 2020

Try to copy the raw JSON output into JSONLint and see if it throws any errors. If it does, reply with the offending line an I'll see if I can filter it out.

@mYnDstrEAm
Copy link
Author

mYnDstrEAm commented Nov 1, 2020

When I remove all \n newline characters as well as b' at start and ' at the end, JSONLint says Valid JSON (as does another site).

The line with char 583 looks like this (from comma to comma):
\n {\n "id": 4,\n "slug": "abc-2",\n "name": "abc 2",\n "runner": "dolphin",\n "directory": "/home/username/Games/abc 2 [abc123]"\n } 583 starts after "directory": The directory exists. Maybe a problem parsing the [ and ]

@solbero
Copy link
Collaborator

solbero commented Nov 1, 2020

Lets try if this fixes it:

raw_result = subprocess.check_output(cmd).decode('UTF-8')
log(f'Raw JSON is: {raw_resut}')
# Remove warning messages from JSON output
result = raw_result[raw_result.index('['):raw_result.index(']')+1]

Notice that the b prefix has been removed from the line raw_result[raw_result.index('['):raw_result.index(']')+1]

@mYnDstrEAm
Copy link
Author

mYnDstrEAm commented Nov 1, 2020

(After correcting the typo raw_resut -> raw_result) it now only properly formats the JSON in the output - the error is still the same. Error Contents: Unterminated string starting at: line 28 column 18 (char 583). I checked that it's really the location I named above and also typed out the entire line in the search to ensure that there are no characters that only appear like other characters. I guess one could try whether this json.loads method can handle "directory": "/home/username/Games/aBc 2 [aBc123aBc123]".
Is the dependency with json.loads the latest version? Not sure whether it's possible to set breakpoints in python scripts called by Kodi?

@solbero
Copy link
Collaborator

solbero commented Nov 2, 2020

I am pretty sure I found the mistake. Comment out the line result = raw_result[raw_result.index('['):raw_result.index(']')+1] and everything should work.

raw_result = subprocess.check_output(cmd).decode('UTF-8')
# Remove warning messages from JSON output
# result = raw_result[raw_result.index('['):raw_result.index(']')+1]

However, this might introduce new issues. Depending on your Lutris configuration, Lutris v.0.5.7.1 is not always outputting valid JSON. See Issue #47 for more information. This problem has been fixed in Lutris master with Commit lutris/lutris@fe01f93.

@mYnDstrEAm
Copy link
Author

Amazing - it finally works now! Thank you.
I also had to change line response = json.loads(result) to response = json.loads(raw_result) beneath.

I hope this addon gets featured in the official addon repos or at least Basil Gello's repo's addons soon.
One problem I noticed was that some icons are missing and those that display are very low-quality. The games for which no icon displays have an icon set within Lutris though. But that would be a separate issue and I'll look into it further first. I haven't allowed any additional ports in the firewall. Maybe there should be "scan library" functionality for games built into the addon?
Is it possible to set a default view for the addon? (I'd suggest the view-mode "Wall".)
I requested a firejail profile for Lutris so that Kodi started with firejail can start firejailed lutris for better privacy, security and stability.
Lastly also thanks for finding and commenting in the relevant other issue. I guess this issue can be closed if a fix is already implemented over at the Lutris repo.

@solbero solbero closed this as completed Nov 2, 2020
@solbero
Copy link
Collaborator

solbero commented Nov 2, 2020

To answer your questions:

  • I host my own repo for the add-on. That way I can control what add-ons it is associated with and the releases. The add-on would never be included in the official repos since it relies on external binaries.
  • The artwork is scraped from Lutris' own icons and banners. They are low res, and I am not planning on implementing my own artwork scraper. My hope is that someone would create a game artwork scraper add-on for Kodi which I could use.
  • The view is set by your skin. The add-on only announces that its contents are games, the views are implemented by the skin.

@mYnDstrEAm
Copy link
Author

  • Couldn't such dependencies be removed at some point? I think having to add an additional repository is a major barrier to wider adoption / use of this addon even though integrating Lutris is (or could be) a major use-case and advantage of Kodi. I think the releases could also be controlled, at least at some point, if it's being featured in the official repos. Also there would still be the option of adding it to Basil Gello's repos. Which external binaries are you referring to?
  • The icons that did not display did not exist in the directory the addon looked for them. I asked about it and described it in more detail here: Lutris not downloading icons for games into icons folder (no icons displayed in Kodi due to "GetImageHash - unable to stat url") lutris/lutris#3249
  • Alright, that would be a Kodi issue then. I guess if addons were able to override the default view for their own (default) view that would defeat the purpose of that skin-setting.

@mYnDstrEAm
Copy link
Author

Now it's not working anymore again. Looks like my 2 changes to ~/.kodi/addons/script.lutris/default.py have been undone. After redoing them and changing raw_result = subprocess.check_output(cmd) to raw_result = subprocess.check_output(cmd).decode('UTF-8') I'm still getting the same error. The file has:

    # Get the list of games from lutris as a JSON object
    raw_result = subprocess.check_output(cmd).decode('UTF-8')
    # Remove warning messages from JSON output
    #result = raw_result[raw_result.index(b'['):raw_result.index(b']')+1]
    # Parse the list of games from a JSON object to a Python array
    response = json.loads(raw_result)

The error in kodi.log is:

ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'subprocess.CalledProcessError'>
                                                   Error Contents: Command '['/usr/games/lutris', '--list-games', '--json', '--installed']' returned non-zero exit status 1.
                                                   Traceback (most recent call last):
                                                     File "/home/username/.kodi/addons/script.lutris/default.py", line 293, in <module>
                                                       router(sys.argv[2][1:])
                                                     File "/home/username/.kodi/addons/script.lutris/default.py", line 286, in router
                                                       create_list_games()
                                                     File "/home/username/.kodi/addons/script.lutris/default.py", line 166, in create_list_games
                                                       games = get_games()
                                                     File "/home/username/.kodi/addons/script.lutris/default.py", line 144, in get_games
                                                       raw_result = subprocess.check_output(cmd).decode('UTF-8')
                                                     File "/usr/local/lib/python3.7/subprocess.py", line 395, in check_output
                                                       **kwargs).stdout
                                                     File "/usr/local/lib/python3.7/subprocess.py", line 487, in run
                                                       output=stdout, stderr=stderr)
                                                   subprocess.CalledProcessError: Command '['/usr/games/lutris', '--list-games', '--json', '--installed']' returned non-zero exit status 1.
                                                   -->End of Python script error report<--

Did I miss something trivial? Why did the file change back at all (was it updated) and how to solve it?

(And probably irrelevant: in the console when running firejail kodi and starting the Kodi-Lutris addon:)

Traceback (most recent call last):
  File "/usr/games/lutris", line 54, in <module>
    from lutris.gui.application import Application  # pylint: disable=no-name-in-module
  File "/usr/lib/python3/dist-packages/lutris/gui/application.py", line 41, in <module>
    from lutris.gui.installerwindow import InstallerWindow
  File "/usr/lib/python3/dist-packages/lutris/gui/installerwindow.py", line 17, in <module>
    from lutris.installer import interpreter
  File "/usr/lib/python3/dist-packages/lutris/installer/interpreter.py", line 14, in <module>
    from lutris.installer.installer import LutrisInstaller
  File "/usr/lib/python3/dist-packages/lutris/installer/installer.py", line 17, in <module>
    from lutris.util.game_finder import find_linux_game_executable, find_windows_game_executable
  File "/usr/lib/python3/dist-packages/lutris/util/game_finder.py", line 8, in <module>
    import magic
  File "/usr/lib/python3/dist-packages/magic/__init__.py", line 361, in <module>
    add_compat(globals())
  File "/usr/lib/python3/dist-packages/magic/__init__.py", line 325, in add_compat
    from magic import compat
  File "/usr/lib/python3/dist-packages/magic/compat.py", line 61, in <module>
    _open = _libraries['magic'].magic_open
  File "/usr/lib/python3.7/ctypes/__init__.py", line 369, in __getattr__
    func = self.__getitem__(name)
  File "/usr/lib/python3.7/ctypes/__init__.py", line 374, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/bin/python3: undefined symbol: magic_open

@solbero
Copy link
Collaborator

solbero commented Dec 4, 2020

What version of Lutris are you running? Use lutris -v in a terminal to find out. There is a bug in v0.5.8 which stops the add-on from working. It has been fixed in 0.5.8.1. See this issue for more info.

@mYnDstrEAm
Copy link
Author

0.5.8.1

Lutris recently updated and some addons recently updated as well. That must also have undone my changes to default.py. Are addons reinstalled after updating? Do I maybe need to reinstall that .zip file? How can i see which version of the Lutris-Kodi addon is used? I'm having this problem on multiple machines.

@solbero
Copy link
Collaborator

solbero commented Dec 4, 2020

You are not experiencing the same problem as earlier. The line subprocess.CalledProcessError: Command '['/usr/games/lutris', '--list-games', '--json', '--installed']' returned non-zero exit status 1. shows that the add-on gets an error trying to call the Lutris executable with the given arguments through Python.

I don’t have a fix right now but I am working on it. I am Just waiting for VitualBox to make a release for Fedora 33 which is on my development machine.

@solbero
Copy link
Collaborator

solbero commented Jan 5, 2021

I have completely rewritten the add-on to Python3. You can download the zip from the develop-branch to see if it solves your problem. Make sure you are using Kodi v19 Matrix.

@mYnDstrEAm
Copy link
Author

mYnDstrEAm commented Jan 5, 2021

Amazing, thanks and happy new year!
sha256sum of the downloaded .zip is b3fb0007d49e0f6f0e06721f1a0bd05decd1658e6f6bb7ed79fdb6ade49dd1a3; I deinstalled the previous version, which doesn't properly show in search results, by Addons->User Addons->All->Lutris->Deinstall.

It works nicely with it when not using firejail. I have created an issue at the firejail repo that would allow it to also work with Kodi sandboxed with firejail via a way to allow firejailed apps to run other software with other firejail profiles than that of the current sandbox, which could allow running lutris with profile B to be called by Kodi with profile A.
(Btw if you have issues with VitualBox I can recommend aqemu and Virtual Machine Manager [libvirt] - especially the latter works great and unlike VirtualBox is entirely FOSS.)

Having a full-fledged modern media-center with gaming integrated is a flagship project of the FOSS/GNU/Linux ecosystem, playing a large role in its advantage over competition/alternatives like Windows+TV and a console imo. It's really important to get this working so it's great it's also working with the latest Kodi and Debian. This addon certainly should become more popular.

For the game-icons, the default view-type and getting this addon into official repos: #46 (comment)

@solbero
Copy link
Collaborator

solbero commented Jan 6, 2021

Great it works for you. I can't do anything about Firejail, though. It is doing exactly what it is supposed to do, and stops Kodi from calling Lutris.

When I have the time I'll have a look and see if I could submit the add-on to the official repository. However, it is a bit of a process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants