Kodi Community Forum
WIP Media importing and library integration (UPnP, Emby, Plex, ...) - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: WIP Media importing and library integration (UPnP, Emby, Plex, ...) (/showthread.php?tid=224794)



RE: Media importing and library integration (UPnP, Emby, Plex, ...) - Montellese - 2019-12-08

Ah I think I might know what the problem is. Can you try installing the mediaimporter.emby add-on from the ZIP file? Because with the pre-installed add-on Kodi does not properly install the necessary dependencies. You can
  • either install the add-on from the ZIP file
  • or go to Add-ons -> My add-ons -> Media importer -> Emby Media Importer 
    • Enable
    • Dependencies
      • Click on every uninstalled dependency and use the "Install" button
Once all dependencies have been installed things should look better. The Plex Media Importer add-on uses the same dependencies so you only need to do this for one of the two add-ons.
But it's still odd because I don't know how the "Test connection" button works without the "requests" library being installed Undecided
And it also doesn't really explain the crash yet. But one step at a time.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - LongMan - 2019-12-08

It is showing all dependencies installed. The version are listed below
  • python-dateutil 0.0.0 > 0.0.0
  • requests 0.0.0 > 0.0.0
  • six 1.5 > 1.5
  • urllibs 1.22 >1.22
  • chardet 3.04 > 3.04
  • idna 2.6 > 2.6
  • certifi 2017.07.27.1 > 2017.07.27.1

Edit: If you think the problem is on the python side, maybe we could ask one of the guys who help out in the addon development forum, @Roman_V_M, @enen92 or @ronie to take a look.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - Montellese - 2019-12-08

That's odd. In the log files you uploaded together with the crash dump files none of these libraries appear in the list of installed add-ons and the following errors are listed:
Code:
EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
 - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.ImportError'>
Error Contents: No module named requests
Traceback (most recent call last):
  File "C:\Program Files\Kodi\addons\mediaimporter.emby\discovery.py", line 18, in <module>
    from emby.server import Server
  File "C:\Program Files\Kodi\addons\mediaimporter.emby\emby\server.py", line 12, in <module>
    from emby.authenticator import Authenticator
  File "C:\Program Files\Kodi\addons\mediaimporter.emby\emby\authenticator.py", line 13, in <module>
    from emby.request import Request
  File "C:\Program Files\Kodi\addons\mediaimporter.emby\emby\request.py", line 10, in <module>
    import requests
ImportError: No module named requests
-->End of Python script error report<--
 
Code:
EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
 - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.ImportError'>
Error Contents: No module named dateutil
Traceback (most recent call last):
  File "C:\Program Files\Kodi\addons\mediaimporter.emby\observer.py", line 12, in <module>
    from emby.provider_observer import ProviderObserver
  File "C:\Program Files\Kodi\addons\mediaimporter.emby\emby\provider_observer.py", line 15, in <module>
    from emby.api import Api
  File "C:\Program Files\Kodi\addons\mediaimporter.emby\emby\api.py", line 10, in <module>
    from dateutil import parser
ImportError: No module named dateutil
-->End of Python script error report<--



RE: Media importing and library integration (UPnP, Emby, Plex, ...) - LongMan - 2019-12-09

Oh, that makes sense. That was when I first installed it and realized that the addons were included and activated the emby one. After activating and having it crash, I installed from the the zip file. Now the machine with fresh windows install does the same thing as the old one. It allows manual entry and setting up of the provider and imports but it does not sync. It also crashes if I choose the user from the list.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - LongMan - 2019-12-09

The auto discovery works to show the servers. I ended setting up Emby on 2 LibreELEC boxes and they all show up. However, as I stated before, kodi crashes whenever I try to select a user from the list. It allows manual entry but does not sync. It actually pops up the updating graphic as soon as it starts but then shows an error and 0%.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - Montellese - 2019-12-09

Can you upload a debug log from when you try to synchronize one of the imports?

I now also installed the test build and setup a new / fresh portable Kodi installation and everything works perfectly fine for me. So there must be something different in your Emby setup that I'm missing. One difference certainly is that I'm running Emby on the same machine as Kodi. I also never tested HTTPS but from your database it looks like you use HTTP as well.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - LongMan - 2019-12-09

It attempts to sync from two servers then gives the error

https://drive.google.com/file/d/1w4oM9O1sH5O3CRDekqkkwdKvNSAjcolv/view?usp=sharing


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - Montellese - 2019-12-09

Thanks that helped narrow down the problem. There were two places in the add-on which worked fine when using a specific user (which crashes for you in the settings) and didn't work when manually specifying the username. Please try again with https://www.dropbox.com/s/qr58iadjfeer1va/mediaimporter.emby.zip?dl=1. I've also added extensive debug logging to the callback which tries to get the list of users from Emby in case the crash is caused somewhere in the python code. If not I'll have to add more debug logging to the Kodi infrastructure and post another test build.

Thanks for your support.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - LongMan - 2019-12-09

Laugh  Some success. It is syncing now. That's good news. However, it still crashes when I try to select the user. The logs for the one that crashes is here.  BTW Kodi and Emby are running on the same machine in this case, ie the fresh windows install I set up for testing.

https://drive.google.com/file/d/1VN2Mjuj2o2vEJF4Bj7uCwll62IzmKb9A/view?usp=sharing

The one on my desktop is still syncing. It is connected to my main emby server so it could take a while. I will provide the logs when it is finished


Cheers,
LongMan


Edit: Here is the logs for the one that synced. After the sync completed, I tried to import an individual library/view for tv show and it crashed. logs below.

https://drive.google.com/file/d/1aXAbeqv4sXnOSLUB3et2jR8rtkvHpVgp/view?usp=sharing


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - Montellese - 2019-12-09

Thanks for the logs. I've seen / figured out the following things:
  • The python code for the settings callbacks is executed perfectly fine. This is also indicated by the fact that you can open the info / settings dialog at all which already executes the callbacks once to determine if there are any selectable options available or not.
  • In both cases where Kodi crashed on you the settings callbacks are executed in quick succession (within ~200ms). The first execution works fine but the second never finishes.
I'll have to see why the callbacks are executed multiple times. I'll probably add some debug logging to the respective part of Kodi to get more insight. I've also installed the last test build on another Windows machine and everything works fine. But both of these machines are "powerful" development machines. So maybe they are fast enough so that the execution in quick succession is not an issue.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - Montellese - 2019-12-09

I've started a new test build with additional debug logging in the settings callback handler: https://jenkins.kodi.tv/job/WIN-64/11304/. See http://mirrors.kodi.tv/test-builds/windows/win64/KodiSetup-20191209-d6e86693-media_import_rebase_20191003-x64.exe.
Furthermore I've gotten rid of one unnecessary call to the settings handlers which might already improve things.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - LongMan - 2019-12-09

I am not sure if it is by design but this build crashes almost immediately after startup.

https://drive.google.com/file/d/19z8gy_5eUaevR7lm6p0MyIP9Hh-1oZf1/view?usp=sharing


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - Montellese - 2019-12-10

Hm something went wrong with that build. It doesn't contain the mediaimporter.emby and mediaimporter.plex add-ons. I've started a new one at https://jenkins.kodi.tv/job/WIN-64/11306/. Hopefully this one works better.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - Norin_Radd - 2019-12-10

@Montellese 

How do i test this? i tried to install the addon and there's no option for configuration, how do i set it up so it imports from my server?

do i need to install your fork of kodi. I have a sonybravia tv with android.

I want to test this because nothing works properly with plex and emby or jellyfin cause they mess with kodi db as i have been told.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - LongMan - 2019-12-10

Yes. You have to install build that Montellese has linked here. then,
 
  • Settings>Addons>Install from Zip file. (It should prompt to enable Unknown sources, enable it and go back to install the zip file, mediaimporter.emby.zip.)
  • There are no settings for the addon itself so there is nothing to configure there.
  • Settings>Media Sources>Media Providers>All Media Providers/Active Media Providers (Either should work).  You should see your Emby Server here, sign in.
  • Go Back to Settings>Media Sources. Choose Media Imports>By Media Providers. You should see your Media types here.
  • Choose the type of media that you want to import. You call leave all to import all libraries of the media type, or select choose to select which libraries to import.
  • Importing should start as soon as you are finished.

Hope that helps.

Cheers,
LongMan


This forum uses Lukasz Tkacz MyBB addons.