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 - 2021-02-15

(2021-02-15, 12:07)flubshi Wrote: @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?
The two biggest open points on my TODO list are fixing the crashes that sometimes occur during shutdown and improving performance. The former is very hard to track because it only happens every once in a while. The latter is very hard to tackle because it is a general issue in Kodi and also affects the existing library scraping approach. But there it is not as notable as looking up all the necessary metadata usually takes longer than adding it to the database. With media importing all the metadata is already there and we have to retrieve it (which is usually fast) and store it in the database.

On the Emby / Plex importer add-ons side I'm always looking for small but nice features which could be added to demonstrate the versatility of the combination of media import add-ons and common video plugins. I've recently implemented the "Skip Intro" feature provided by Plex Pass for episodes but I haven't finalized it yet (since it requires a newer version of python-plexapi).

(2021-02-15, 12:07)flubshi Wrote: 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?
I'm always trying to get smaller parts of my work into Kodi but that only makes sense if it is not media import specific.

(2021-02-15, 12:07)flubshi Wrote: Is there anything we can support you? @LongMan maybe we can try to regularly provide LE builds with Media Importing enabled.
LibreElec / CoreElec builds would certainly be welcome. I also have to think about the hosting issue because the test builds on Kodi's mirror also vanish after a while which is not very nice. If anyone can help out or point me to a good (free) hosting approach I'd be grateful.

(2021-02-15, 12:07)flubshi Wrote: Is there a partial job for Media Importing that could be accomplished by a student? Maybe Media Importing could participate at GSoC 2021.
Trying to implement this for music would certainly be a nice project but I probably won't really have enough time to mentor such a project.

(2021-02-15, 12:29)LongMan Wrote: 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.
What do you mean with this? A video add-on taking advantage of the import concept?


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

Quote:What do you mean with this? A video add-on taking advantage of the import concept?
Yes. The big differentiator between Media import and current Sync addons, for Plex/Emby/Jellyfin, is that it co-exist comfortable with imports from other sources. That is a feature which many desire but don't realize that it is already possible.

https://github.com/jellyfin/jellyfin-kodi/issues/409
That issue is about exactly that. And based on observations of the number of video addons currently exporting strm files, many are already using something similar. I will start asking again as soon as there is a v19 final. Usually there is a lot of attention and activity right after release.


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

The abilty to use one instance of Kodi as a server for imports from video addons would be useful too.


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

@Lorddeff. Try Jellyfin.


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

(2021-02-15, 02:05)komplex Wrote:
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

Thanks that seems to partially work for me. I had to comment out the following two lines:
 
Code:

include /nginx/conf/errorV2.conf;
auth_request /auth-4;
For the former I'm missing errorV2.conf and when the auth_request /auth-4; was active opening Plex Web always resulted in the following error from nginx:
Code:

*9 CreateFile() "C:\Program Files\nginx\nginx-1.19.6/html/api/v2/auth" failed (3: The system cannot find the path specified), client: 127.0.0.1, server: localhost, request: "GET /plex/ HTTP/1.1", subrequest: "/api/v2/auth", host: "localhost"
Any idea what might be wrong with my setup to get the auth_request /auth-4; working?


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

Sorry the auth part is for Organizr, I just copy/paste the config without looking.
I think this should be OK.
php:
# Plex Reverse Proxy
location /plex/ {
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;
}



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

(2021-02-15, 19:31)komplex Wrote: Sorry the auth part is for Organizr, I just copy/paste the config without looking.
I think this should be OK.
php:
# Plex Reverse Proxy
location /plex/ {
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;
}
That works great thanks.

Can you give the improvement/change_url branch of mediaimporter.plex a try? It adds a new action setting to the Plex media provider settings to change the URL of the media provider. It will pop up an input dialog where you can change the URL and then it will try to authenticate with the existing MyPlex credentials / token and report back whether this worked or not. If it worked everything is fine but if it didn't you get to choose whether to keep the changed URL anyway or not. If you keep the changed URL anyway you can still try to authenticate with it using MyPlex.

I'm pretty sure that I haven't covered all cases yet because my local PMS is now both accessible over http://localhost:32400 and http://localhost/plex so it's not the exact same setup as in your case.


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

(2021-02-16, 00:55)Montellese Wrote: It adds a new action setting to the Plex media provider settings to change the URL of the media provider. It will pop up an input dialog where you can change the URL and then it will try to authenticate with the existing MyPlex credentials / token and report back whether this worked or not. If it worked everything is fine but if it didn't you get to choose whether to keep the changed URL anyway or not. If you keep the changed URL anyway you can still try to authenticate with it using MyPlex.

A question to Emby users: Would it also be useful for Emby servers to be able to change the URL of a discovered / added media provider?


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

Hi,

i have a question is it possible to integrate the media importer settings in other skins?? 
How can i do it?

Thx Vroniefan


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

(2021-02-16, 12:15)Vroniefan Wrote: Hi,

i have a question is it possible to integrate the media importer settings in other skins?? 
How can i do it?

Thx Vroniefan
There are basically three changes to a skin:
  1. Add a "media provider" entry point, see https://github.com/Montellese/xbmc/commit/ecea1711e50f37f2b4bbb076840a73d16b2939c8
  2. Add DialogMediaImportInfo.xml, see https://github.com/Montellese/xbmc/blob/media_import_19.0RC1-Matrix_rework/addons/skin.estuary/xml/DialogMediaImportInfo.xml
  3. Add MediaSourceBrowser.xml, see https://github.com/Montellese/xbmc/blob/media_import_19.0RC1-Matrix_rework/addons/skin.estuary/xml/MediaSourceBrowser.xml
I'm not sure how Kodi behaves if a skin doesn't provide all dialogs? Does it just show the missing dialogs from Estuary? If so you would only need step #1.
Unfortunately the commit history is currently a bit of a mess. I'm going to clean this up ASAP and then I can point you to the exact commits which add DialogMediaImportInfo.xml and MediaSourceBrowser.xml.

It might also make sense to add this information to the media import wiki.


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

Quote:It might also make sense to add this information to the media import wiki.
It has been added at the bottom of the Media Import page.
 
Quote:I'm not sure how Kodi behaves if a skin doesn't provide all dialogs? Does it just show the missing dialogs from Estuary? If so you would only need step #1.
If the dialogs are missing, it does not use the ones from Estuary.  So the two dialogs are also needed.

Edit: The page shows fine in the preview but when I refresh the browser it is not rendering correctly. Any help would be appreciated.

Edit 2: Thanks


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

(2021-02-16, 14:38)Montellese Wrote:
(2021-02-16, 12:15)Vroniefan Wrote: Hi,

i have a question is it possible to integrate the media importer settings in other skins?? 
How can i do it?

Thx Vroniefan
There are basically three changes to a skin:
  1. Add a "media provider" entry point, see https://github.com/Montellese/xbmc/commit/ecea1711e50f37f2b4bbb076840a73d16b2939c8
  2. Add DialogMediaImportInfo.xml, see https://github.com/Montellese/xbmc/blob/media_import_19.0RC1-Matrix_rework/addons/skin.estuary/xml/DialogMediaImportInfo.xml
  3. Add MediaSourceBrowser.xml, see https://github.com/Montellese/xbmc/blob/media_import_19.0RC1-Matrix_rework/addons/skin.estuary/xml/MediaSourceBrowser.xml
I'm not sure how Kodi behaves if a skin doesn't provide all dialogs? Does it just show the missing dialogs from Estuary? If so you would only need step #1.
Unfortunately the commit history is currently a bit of a mess. I'm going to clean this up ASAP and then I can point you to the exact commits which add DialogMediaImportInfo.xml and MediaSourceBrowser.xml.

It might also make sense to add this information to the media import wiki.
Thank you for the information i will try

Thx Vroniefan


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

(2021-02-15, 14:28)LongMan Wrote:
Quote:What do you mean with this? A video add-on taking advantage of the import concept?
Yes. The big differentiator between Media import and current Sync addons, for Plex/Emby/Jellyfin, is that it co-exist comfortable with imports from other sources. That is a feature which many desire but don't realize that it is already possible.

https://github.com/jellyfin/jellyfin-kodi/issues/409
That issue is about exactly that. And based on observations of the number of video addons currently exporting strm files, many are already using something similar. I will start asking again as soon as there is a v19 final. Usually there is a lot of attention and activity right after release.

FYI, for the Mezzmo media server platform the Mezzmo Kodi addon does a full sync to Kodi as a background service.  If another addon removes the Kodi database entries they are automatically added back.  Kodi 18 and Kodi 19 versions are available.

Jeff


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

@jbinkley60,
MediaImport provides the architecture for imports without having to write directly to the database. It would be greatly appreciated if you could either modify your existing addon or write a mediaimporter addon, similar to those for Emby/Jellyfin or Plex, for Mezzmo. We could then add it to the Repo so that anyone using MediaImport will be introduced to it as another option for a Media Server.

Cheers,
LongMan


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

(2021-02-21, 14:23)LongMan Wrote: @jbinkley60,
MediaImport provides the architecture for imports without having to write directly to the database. It would be greatly appreciated if you could either modify your existing addon or write a mediaimporter addon, similar to those for Emby/Jellyfin or Plex, for Mezzmo. We could then add it to the Repo so that anyone using MediaImport will be introduced to it as another option for a Media Server.

Cheers,
LongMan
Thanks for the feedback.  I am aware the direct database writes are viewed somewhat "taboo" but with them I get superb performance.  A full sync between Mezzmo and Kodi with 13,000 records takes just over a minute on an Intel NUC and 5 minutes on a Vero 4K+.  I might look at a Mediaimporter addon for Mezzmo as a background sync / import solution without the current Kodi Mezzmo addon GUI.  I am just not sure how many folks are running multiple media server types concurrently to where this would be a huge benefit.

Jeff


This forum uses Lukasz Tkacz MyBB addons.