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, ...) - LongMan - 2021-02-11

Thanks. Posted on the Emby Forum


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - Montellese - 2021-02-11

(2021-02-11, 23:23)LongMan Wrote: Thanks. Posted on the Emby Forum
Thanks. I just gave it a quick spin and something is wrong with the behaviour of the settings in the media import info dialog. It doesn't properly update the setting controls when switching from "Local" to "Emby Connect" authentication or when switching from "Local" to "MyPlex" authentication. So this must be something in Kodi core. Maybe I broke something in my rework because I made some minor changes there. If someone runs into these issues just perform the Emby Connect / MyPlex login procedure and then save and close the dialog even if it hasn't been properly updated. When you re-open it everything will look fine. So the settings are stored properly but the dialog is not updated as expected.


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

Thanks for pointing that out. I will inform anyone who has that problem.

I have LibrELEC builds for Generic and PI 4 (Pi 4 is quite unstable maybe not as useful.) Not sure where I can post it.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - Montellese - 2021-02-13

I figured out what the issue with the media provider settings dialog was. As suspected it was introduced due to another fix I made during my rework. I had to revert that fix but found a better solution without regressions. See [Downloads](https://github.com/Montellese/xbmc/wiki/Downloads) for new test builds.

I also updated mediaimporter.emby to 0.0.11. This contains
  • a fix for authenticating using Emby Connect
  • the possibility to authenticate with an empty password
  • a new advanced option to generate a new device ID



RE: Media importing and library integration (UPnP, Emby, Plex, ...) - komplex - 2021-02-13

Gave this another go, still have issues. It adds my Plex account fine but fails when adding the server.
Image
Image
Code:
2021-02-13 14:14:35.893 T:1392 DEBUG <general>: [mediaimporter.plex] failed to connect to 'MediaServer' at http://192.168.0.5:32400

It fails to add it because 192.168.0.5:32400 doesn't open plex, it would be http://192.168.0.5/plex which redirects to https://mydomain/plex/web/index.html. I have nginx reverse proxy.

@anxdpanic fixed a similar issue when I was testing Composite. If I try to use the Local Only part and add http://192.168.0.5/plex it throws an error
Code:
2021-02-13 14:23:04.645 T:16508 ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class 'xml.etree.ElementTree.ParseError'>
Error Contents: not well-formed (invalid token): line 2, column 27
Traceback (most recent call last):
File "C:\Users\kompl\AppData\Roaming\Kodi\addons\mediaimporter.plex\importer.py", line 20, in <module>
importer.run(sys.argv)
File "C:\Users\kompl\AppData\Roaming\Kodi\addons\mediaimporter.plex\lib\importer.py", line 1176, in run
actionMethod(handle, options)
File "C:\Users\kompl\AppData\Roaming\Kodi\addons\mediaimporter.plex\lib\importer.py", line 541, in discoverProvider
provider = discoverProviderLocally(handle, options)
File "C:\Users\kompl\AppData\Roaming\Kodi\addons\mediaimporter.plex\lib\importer.py", line 199, in discoverProviderLocally
plexServer = PlexServer(baseUrl, timeout=plex.constants.REQUEST_TIMEOUT)
File "C:\Users\kompl\AppData\Roaming\Kodi\addons\mediaimporter.plex\plexapi\server.py", line 104, in __init__
data = self.query(self.key, timeout=timeout)
File "C:\Users\kompl\AppData\Roaming\Kodi\addons\mediaimporter.plex\plexapi\server.py", line 438, in query
return ElementTree.fromstring(data) if data.strip() else None
File "C:\Program Files\Kodi\system\python\Lib\xml\etree\ElementTree.py", line 1320, in XML
parser.feed(text)
File "<string>", line None
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 2, column 27
-->End of Python script error report<--

2021-02-13 14:23:04.645 T:16508 DEBUG <general>: CPythonInvoker::onExecutionDone(14, C:\Users\kompl\AppData\Roaming\Kodi\addons\mediaimporter.plex\importer.py)



RE: Media importing and library integration (UPnP, Emby, Plex, ...) - LongMan - 2021-02-14

@komplex, Thanks for testing and providing feedback.
Since you are already aware of the problem, can you provide some more details about the problem and how it was addressed. Pointing to the code changes could also be useful.

Cheers,
LongMan


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - komplex - 2021-02-14

(2021-02-14, 01:39)LongMan Wrote: @komplex, Thanks for testing and providing feedback.
Since you are already aware of the problem, can you provide some more details about the problem and how it was addressed. Pointing to the code changes could also be useful.

Cheers,
LongMan

This is him explaining a lil bit https://forum.kodi.tv/showthread.php?tid=351179&pid=2952953#pid2952953 and from the date of the post it should be this PR https://github.com/anxdpanic/plugin.video.composite_for_plex/pull/155


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - Montellese - 2021-02-14

(2021-02-13, 16:30)komplex Wrote: Gave this another go, still have issues. It adds my Plex account fine but fails when adding the server.
Code:
2021-02-13 14:14:35.893 T:1392 DEBUG <general>: [mediaimporter.plex] failed to connect to 'MediaServer' at http://192.168.0.5:32400

It fails to add it because 192.168.0.5:32400 doesn't open plex, it would be http://192.168.0.5/plex which redirects to https://mydomain/plex/web/index.html. I have nginx reverse proxy.

@anxdpanic fixed a similar issue when I was testing Composite. If I try to use the Local Only part and add http://192.168.0.5/plex it throws an error
Code:
2021-02-13 14:23:04.645 T:16508 ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class 'xml.etree.ElementTree.ParseError'>
Error Contents: not well-formed (invalid token): line 2, column 27
Traceback (most recent call last):
File "C:\Users\kompl\AppData\Roaming\Kodi\addons\mediaimporter.plex\importer.py", line 20, in <module>
importer.run(sys.argv)
File "C:\Users\kompl\AppData\Roaming\Kodi\addons\mediaimporter.plex\lib\importer.py", line 1176, in run
actionMethod(handle, options)
File "C:\Users\kompl\AppData\Roaming\Kodi\addons\mediaimporter.plex\lib\importer.py", line 541, in discoverProvider
provider = discoverProviderLocally(handle, options)
File "C:\Users\kompl\AppData\Roaming\Kodi\addons\mediaimporter.plex\lib\importer.py", line 199, in discoverProviderLocally
plexServer = PlexServer(baseUrl, timeout=plex.constants.REQUEST_TIMEOUT)
File "C:\Users\kompl\AppData\Roaming\Kodi\addons\mediaimporter.plex\plexapi\server.py", line 104, in __init__
data = self.query(self.key, timeout=timeout)
File "C:\Users\kompl\AppData\Roaming\Kodi\addons\mediaimporter.plex\plexapi\server.py", line 438, in query
return ElementTree.fromstring(data) if data.strip() else None
File "C:\Program Files\Kodi\system\python\Lib\xml\etree\ElementTree.py", line 1320, in XML
parser.feed(text)
File "<string>", line None
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 2, column 27
-->End of Python script error report<--

2021-02-13 14:23:04.645 T:16508 DEBUG <general>: CPythonInvoker::onExecutionDone(14, C:\Users\kompl\AppData\Roaming\Kodi\addons\mediaimporter.plex\importer.py)
Thanks for your report. Unfortunately there are two issues at hand:
  1. The discovery message broadcasted by Plex is pretty meager. It only includes the URI and the port. It doesn't even cover whether PMS should be accessed through HTTPS or HTTP. And in your case it probably doesn't know the reverse proxy so it happily announces the URI 192.168.0.5 and the port 32400.
  2. mediaimporter.plex uses python-plexapi to communicate with PMS. All I can do is pass it a base URL and after that I don't have any influence over what happens. I can bring the topic up with them but without being able to reproduce the issue myself it's hard to provide feedback. Can you send me your nginx reverse proxy setup for PMS so I can try to replicate it?



RE: Media importing and library integration (UPnP, Emby, Plex, ...) - komplex - 2021-02-15

(2021-02-14, 22:48)Montellese Wrote: Can you send me your nginx reverse proxy setup for PMS so I can try to replicate it?
php:

# Plex Reverse Proxy
location /plex/ {
include /nginx/conf/errorV2.conf;
auth_request /auth-4;
proxy_pass http://127.0.0.1:32400/;
add_header X-Frame-Options "SAMEORIGIN";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

#Websockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 36000s;

proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
}
if ($http_referer ~* /plex/) {
rewrite ^/web/(.*) /plex/web/$1? redirect;
}
location ~ /auth-(.*) {
rewrite ^/auth-(.*) /api/v2/auth?group=$1;
} #Org Auth



RE: Media importing and library integration (UPnP, Emby, Plex, ...) - Lorddeff - 2021-02-15

This is very interesting. Like Pkc on steroids.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - webmaher - 2021-02-15

(2021-02-15, 09:02)Lorddeff Wrote: This is very interesting. Like Pkc on steroids.

do you try import lets just say over 10k episodes from Plex... see here 

https://forum.kodi.tv/showthread.php?tid=224794&pid=3001112#pid3001112


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - LongMan - 2021-02-15

(2021-02-15, 10:41)webmaher Wrote:
(2021-02-15, 09:02)Lorddeff Wrote: This is very interesting. Like Pkc on steroids.

do you try import lets just say over 10k episodes from Plex... see here 

https://forum.kodi.tv/showthread.php?tid=224794&pid=3001112#pid3001112
@Lorddeff is interested in Kodi to Kodi Sharing.  He wants to avoid Plex.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - flubshi - 2021-02-15

@Montellese since you started rework and the last time I tested your Media Importing feature it already was awesome, maybe you could point out what the next steps are?

Do you plan to bring it in Kodi v20? Could it split into parts that maybe could already be submitted upstream early in v20 cycle?

Is there anything we can support you? @LongMan maybe we can try to regularly provide LE builds with Media Importing enabled.


Is there a partial job for Media Importing that could be accomplished by a student? Maybe Media Importing could participate at GSoC 2021.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - LongMan - 2021-02-15

Quote:Is there anything we can support you? @LongMan maybe we can try to regularly provide LE builds with Media Importing enabled.
I have been able to build for Generic and Pi4. Haven't tried the others. Not too familiar with hosting though.
Quote:Is there a partial job for Media Importing that could be accomplished by a student? Maybe Media Importing could participate at GSoC 2021.
Maybe music importing.

On another note. It would be nice to have a video addon in the repo along with the server importer addons. It would help to demonstrate the versatility of the approach. It's a pity your addon is not a python one.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - Lorddeff - 2021-02-15

(2021-02-15, 11:18)LongMan Wrote:
(2021-02-15, 10:41)webmaher Wrote:
(2021-02-15, 09:02)Lorddeff Wrote: This is very interesting. Like Pkc on steroids.

do you try import lets just say over 10k episodes from Plex... see here 

https://forum.kodi.tv/showthread.php?tid=224794&pid=3001112#pid3001112
@Lorddeff is interested in Kodi to Kodi Sharing.  He wants to avoid Plex.
Yup. As is, I have been using plex for over a year or two. But back on Kodi, plex does some strange shit. First, it insists on transcoding stuff that your native device may even be able to play and then it will not work well without an internet connection. 

But since I still have plex, and it was a small nightmare getting SMB up and running, I used pkc to import my library from Plex to Kodi. And its a "BIG" library. So much so that I am even hesitant to clear it out and then use my recently configured SMB shared folders and repopulate my library from scratch. And then there is this option. 

The one singular thing I want and the major thing for me is that I need a server that can work as long as its connected to my home network, even if there is no internet connection. Plex (and as a result, pkc) fails in that regard.


This forum uses Lukasz Tkacz MyBB addons.