plugin.video.elementum icon indicating copy to clipboard operation
plugin.video.elementum copied to clipboard

Elementum 0.1.106 crash/restarts when integrating library

Open siwyroot opened this issue 1 year ago • 11 comments

Every time I try to integrate elementum library with kodi, elementum restarts.

Expected Behavior

integrate library with kodi

Current Behavior

elementum plugin crash

Steps to Reproduce (for bugs)

  1. Install elementum
  2. Go to Setting -> General
  3. Select "Open directory with Kodi file browser"
  4. Elementum restarts

Your Environment

  • Version used: Kodi 21.1
  • Environment name and version: Elementum 0.1.106
  • Operating System and version: Fedora 40
2024-11-14 19:23:38.409 T:1382     info <general>: CActiveAESink::OpenSink - initialize sink
2024-11-14 19:23:38.409 T:1382     info <general>: CAESinkALSA::Initialize - Attempting to open device "@:CARD=Intel,DEV=0"
2024-11-14 19:23:38.419 T:1382     info <general>: CAESinkALSA::Initialize - Opened device "sysdefault:CARD=Intel"
2024-11-14 19:23:38.419 T:1382     info <general>: CAESinkALSA::InitializeHW - Your hardware does not support AE_FMT_FLOAT, trying other formats
2024-11-14 19:23:38.419 T:1382     info <general>: CAESinkALSA::InitializeHW - Using data format AE_FMT_S16NE
2024-11-14 19:23:43.567 T:1313    error <general>: Control 55 in window 10025 has been asked to focus, but it can't
2024-11-14 19:23:43.922 T:1406     info <general>: JSONRPC Server: New connection added
2024-11-14 19:23:43.923 T:1406     info <general>: JSONRPC Server: Disconnection detected
2024-11-14 19:23:43.925 T:1412  warning <general>: [plugin.video.elementum] [GIN] 2024/11/14 - 19:23:43 | 200 |    2.942513ms |   2.6 kB |       127.0.0.1 | GET      "/?doresume=false"
2024-11-14 19:23:46.544 T:1412  warning <general>: [plugin.video.elementum] [GIN] 2024/11/14 - 19:23:46 | 200 |    1.875619ms |      0 B |       127.0.0.1 | GET      "/settings/plugin.video.elementum?doresume=false"
2024-11-14 19:23:46.594 T:33925   error <general>: GetDirectory - Error getting plugin://plugin.video.elementum/settings/plugin.video.elementum
2024-11-14 19:23:58.909 T:1313  warning <general>: CGUIWindowManager - HandleAction - ignoring action 107, because topmost modal dialog closing animation is running

siwyroot avatar Nov 14 '24 18:11 siwyroot

Tested on both VM and read system. If needed I can rebuild this system multiple times for testing.

siwyroot avatar Nov 14 '24 18:11 siwyroot

@siwyroot It is impossible to see the error without full log file.

elgatito avatar Nov 14 '24 19:11 elgatito

Here is full log but rest is just plugin startup kodi.log

siwyroot avatar Nov 14 '24 20:11 siwyroot

I captured log in moment when I clicked "Open directory with Kodi file browser"

siwyroot avatar Nov 14 '24 20:11 siwyroot

tried on ubuntu 24.04 and flatpak kodi 21.1

so it works if trakt is authorized, otherwise it does not. no restart, though - but it does reload for some reason. but browser is not launched when you click the button. at the moment - i do not see in code why this is happening.

but to be fair - it is just a "sugar" - to really configure library you need to click on path itself, not on "Open directory with Kodi file browser".

antonsoroko avatar Nov 15 '24 19:11 antonsoroko

For men browser do not lunch but I gest throw back to main menu and in logs it looks like elemntum reloads

siwyroot avatar Nov 15 '24 20:11 siwyroot

@siwyroot just to be 100% clear: there is bug with that button, indeed. in general - we need to figure out why it is happening.

BUT you do not need to click that button to configure library integration:

but to be fair - it is just a "sugar" - to really configure library you need to click on path itself, not on "Open directory with Kodi file browser".

so you can configure elementum without waiting for a fix.

can you confirm that clicking on "path" works for you?

antonsoroko avatar Nov 16 '24 08:11 antonsoroko

this is outdated, read next comment.

i think i found the issue. option="close" (it will close settings window - it must be closed before opening new window) is set for those "Open directory..." buttons, and after close elementum does reload (unless trakt or opensubtitles token was changed - that's why it was working 1st time on me test environment - i authorized trakt first) and reload "interrupts" "Open directory..." command, so you do not see file browser but you see reload.

https://github.com/elgatito/plugin.video.elementum/blob/5711491e96fcd3e4fad469bae907eb2e3fb844c3/resources/settings.xml#L47

there was a logic added to ignore tokens (trakt or opensubtitles) so trakt auth process (that also uses option="close") so reload will not be initiated: https://github.com/elgatito/plugin.video.elementum/commit/3aa2818bcc39ba825f810eeb6ad16eab68f69fe1

antonsoroko avatar Nov 16 '24 09:11 antonsoroko

found the real root cause: if you open settings not from elementum menu but from kodi context menu or from addons page - then button works, i think because in this case settings window is not considered as modal window , so it does not prevent showing new window.

fail when open settings from elementum's menu:

  debug <general>: [plugin.video.elementum] Requesting http://127.0.0.1:65220/cmd/open_path/download?doresume=false from ['plugin://plugin.video.elementum/cmd/open_path/download', '-1', '', 'resume:false']
warning <general>: [plugin.video.elementum] DEBU  api          ▶ OpenCustomPath   Opening /home/user/.kodi/temp/elementum_downloads in Kodi browser
warning <general>: [plugin.video.elementum] [GIN] 2024/11/16 - 14:18:45 | 200 |   37.418031ms |    18 EB |       127.0.0.1 | GET      "/cmd/open_path/download?doresume=false"
  debug <general>: Activating window ID: 10025
   info <general>: Activate of window '10025' refused because there are active modal dialogs <------- !!!

antonsoroko avatar Nov 16 '24 11:11 antonsoroko

@antonsoroko Thanks for explanation, I was using that button for so long that I did not consider different way. I can confirm that I can configure library by setting path button. Tanks again!

siwyroot avatar Nov 16 '24 11:11 siwyroot

if i disable reload in function onSettingsChanged() (python part of the code) - then those buttons works.

so there is some incompatibility between settings when they are in "modal dialog" mode (when they launched from elementum's menu) and "reload" process.

but i am not sure how to fix this. @elgatito maybe you can take a look into this, please.

looks like we can't use builtin functions as ListItem path here https://github.com/elgatito/elementum/blob/638d5c307b53763e752a698252ecb03de06e085a/api/index.go#L42

i tried Path: "Addon.OpenSettings('plugin.video.elementum')", Path: "xbmc.executebuiltin('Addon.OpenSettings(plugin.video.elementum)')",

but looks like only paths like "plugin://" or "script://" or directly playable URL or filepath can be used as ListItem path. some info here.

so i do not know how to launch settings windows not as modal window from elementum's menu. maybe it is impossible.

maybe we can ignore reload somehow - then buttons should work in any window mode.

antonsoroko avatar Nov 16 '24 12:11 antonsoroko