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 - 2020-01-27

It seems that you are almost there with parity with Emby for Kodi.
I suspect that once there is parity, there is going to be a bit more activity because Emby for Kodi is not usually updated until Kodi hits beta. However, there have been some noteworthy features added to Kodi matrix that many people would want to try out. Especially in PVR, in Video (HDR) and in music.

Great stuff.

BTW: strm files do not work when imported from another Kodi install either. They import fine but they do not play. A snippet of the log is below. I can provide a full log if required.

NOTICE: VideoPlayer::OpenFile: upnp://e9462a6c-e720-ff46-794e-661ba73f2e50/videodb://tvshows/titles/967/1/38567/?local
2020-01-27 10:34:56.450 T:10064  NOTICE: Creating InputStream
2020-01-27 10:34:56.501 T:10064  NOTICE: Creating Demuxer
2020-01-27 10:34:56.502 T:10064   ERROR: CDVDDemuxFFmpeg::Open - error probing input format, smb://192.168.1.99:445/Media Library III/Streaming Series/Netflix/Ares/Season 1/Ares. S01E08.strm
2020-01-27 10:34:56.502 T:10064   ERROR: CVideoPlayer::OpenDemuxStream - Error creating demuxer


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - Montellese - 2020-01-28

(2020-01-27, 18:10)LongMan Wrote: It seems that you are almost there with parity with Emby for Kodi.
I suspect that once there is parity, there is going to be a bit more activity because Emby for Kodi is not usually updated until Kodi hits beta. However, there have been some noteworthy features added to Kodi matrix that many people would want to try out. Especially in PVR, in Video (HDR) and in music.
There is still a lot in Emby for Kodi that is not in mediaimporter.emby like transcoding, cinema mode etc.

(2020-01-27, 18:10)LongMan Wrote: It seems that you are almost there with parity with Emby for Kodi.
Great stuff.
Thanks.

(2020-01-27, 18:10)LongMan Wrote: It seems that you are almost there with parity with Emby for Kodi.
BTW: strm files do not work when imported from another Kodi install either. They import fine but they do not play. A snippet of the log is below. I can provide a full log if required.

NOTICE: VideoPlayer::OpenFile: upnp://e9462a6c-e720-ff46-794e-661ba73f2e50/videodb://tvshows/titles/967/1/38567/?local
2020-01-27 10:34:56.450 T:10064  NOTICE: Creating InputStream
2020-01-27 10:34:56.501 T:10064  NOTICE: Creating Demuxer
2020-01-27 10:34:56.502 T:10064   ERROR: CDVDDemuxFFmpeg::Open - error probing input format, smb://192.168.1.99:445/Media Library III/Streaming Series/Netflix/Ares/Season 1/Ares. S01E08.strm
2020-01-27 10:34:56.502 T:10064   ERROR: CVideoPlayer::OpenDemuxStream - Error creating demuxer
Can you play STRM files locally from your filesystem in Kodi?


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - bg_x - 2020-01-28

@Montellese other thinks I noticed was no people and cdartwork syncing with Kodi. And no instand Update If something changed in emby database. Needs restart of kodi for syncing...


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - Montellese - 2020-01-28

(2020-01-28, 13:00)bg_x Wrote: @Montellese other thinks I noticed was no people and cdartwork syncing with Kodi.
People from casts should be imported. But I don't think it imports their artwork or any details apart from their name and which roles they play in which videos. Are you not seeing any cast or just missing some of its information?
The add-on currently imports the following artwork if present:
  • poster
  • fanart
  • clearlogo
  • clearart
  • banner
  • landscape
  • discart
That's what I also found in the Emby for Kodi code. I tested all except discart because I don't have those in my library or in Estuary.
 
(2020-01-28, 13:00)bg_x Wrote: And no instand Update If something changed in emby database. Needs restart of kodi for syncing...
The add-on should open a websocket connection to your Emby server and receive notifications when something changes. Please provide a debug log so that I can check if something doesn't work with that connection. On my setup I can edit or watch a video using Emby's web client and then Kodi is automatically updated.
Furthermore you can manually start synchronizing a whole media provider or import from the context menu in the view where you added and configured the provider and imports.


Media importing and library integration (UPnP, Emby, Plex, ...) - bg_x - 2020-01-28

Thank you, can't test at the moment because I'm not at home. Will test in two days and report back.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - LongMan - 2020-01-29

It does play locally. The logs are here. https://paste.kodi.tv/egisatavot.kodi
 
  • I played two episodes of Lost in Space via file menu (not added to library)
    • It show an error but the episodes played. (1x1 and 1x3. 1x2 did not play)
  • I attempted to play the same two episodes imported from another Kodi installation.
    • It says that the item is no longer present.
    • I have been noticing that If I start the client after the server, the client does not see the server. I have to toggle UPnP off and on again before the clients sees it and initiates the sync. It is the same for initial discovery too.
  • Finally, for completeness, I attempted to play two movies imported from Emby.
    • I didn't expect them to play but the log could be useful for comparison.

Hope that helps.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - LongMan - 2020-01-29

Quote:There is still a lot in Emby for Kodi that is not in mediaimporter.emby like transcoding, cinema mode etc.
That's true. I don't use some of those features which is why it didn't stand out for me. It has been interesting while monitoring these forums, Emby's and Jellyfin's, how we pick and choose the features that are most important to us.

Some use Kodi only with addons, others only with local media and maybe Youtube. Others for music, some lossless others mp3. For some Cinema mode is a must, others have never heard of it. Yet others cannot live without subtitles, with some indifferent and others despising it.

It is crucial to have a wide testing audience. It is no wonder there is often a quick point release after a new major release. The guy who lives for his clear logo had not tested it before.

That's what makes Kodi so great. It can be exactly what you want it to be. Wink

Cheers,
LongMan


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - Montellese - 2020-01-30

(2020-01-29, 03:01)LongMan Wrote: It does play locally. The logs are here. https://paste.kodi.tv/egisatavot.kodi
 
  • I played two episodes of Lost in Space via file menu (not added to library)
    • It show an error but the episodes played. (1x1 and 1x3. 1x2 did not play)
  • I attempted to play the same two episodes imported from another Kodi installation.
    • It says that the item is no longer present.
    • I have been noticing that If I start the client after the server, the client does not see the server. I have to toggle UPnP off and on again before the clients sees it and initiates the sync. It is the same for initial discovery too.
  • Finally, for completeness, I attempted to play two movies imported from Emby.
    • I didn't expect them to play but the log could be useful for comparison.

Hope that helps. 

I created an STRM file for a movie on another drive so the STRM file contains the absolute path to another movie (MKV). I then let Emby scan the movie into the library and Kodi import it from Emby into its library. Playback works perfectly fine.
I also tested several playback URLs manually in the browser and independent of whether I use
  • stream?static=true
  • stream.strm?static=true
  • stream.mkv?static=true
Emby always provides a "stream.mkv". Unfortunately I don't have any streaming services like Netflix which I could try.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - LongMan - 2020-01-30

Quote:Unfortunately I don't have any streaming services like Netflix which I could try.

You could use Youtube. An example is below

plugin://plugin.video.youtube/play/?video_id=YQHsXMglC9A


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - Montellese - 2020-01-30

(2020-01-30, 12:05)LongMan Wrote:
Quote:Unfortunately I don't have any streaming services like Netflix which I could try.

You could use Youtube. An example is below

plugin://plugin.video.youtube/play/?video_id=YQHsXMglC9A 
I tried that as well but the Emby server responds with Only 'http' and 'https' schemes are allowed. (Parameter 'requestUri') when I try to access the STRM as a stream. The same happens when I manually open the URL in the browser or when I use Swagger to make the call.
And playback in Emby Web obviously also doesn't work because it doesn't understand Kodi plugin URLs.

I've also looked at the code for Emby for Kodi but didn't see any special handling for STRM files. It builds the exact same URL as mediaimporter.emby does.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - LongMan - 2020-01-30

@Montellese,

Some how I remember  a routine having a name similar to "PlayStrm". It doesn't seems to be there anymore. The references to strm below are the only ones I could find

https://github.com/MediaBrowser/plugin.video.emby/blob/4f9d2d54315a52e8764b43dd97576876e7c89113/resources/lib/helper/playutils.py#L170
https://github.com/MediaBrowser/plugin.video.emby/blob/4f9d2d54315a52e8764b43dd97576876e7c89113/resources/lib/helper/playutils.py#L203

Edit:  From an older version of the plugin

 def directPlay(self):

        try:
            playurl = self.item['MediaSources'][0]['Path']
        except (IndexError, KeyError):
            playurl = self.item['Path']

        if self.item.get('VideoType'):
            # Specific format modification
            if self.item['VideoType'] == "Dvd":
                playurl = "%s/VIDEO_TS/VIDEO_TS.IFO" % playurl
            elif self.item['VideoType'] == "BluRay":
                playurl = "%s/BDMV/index.bdmv" % playurl

        # Assign network protocol
        if playurl.startswith('\\\\'):
            playurl = playurl.replace("\\\\", "smb://")
            playurl = playurl.replace("\\", "/")

        if "apple.com" in playurl:
            USER_AGENT = "QuickTime/7.7.4"
            playurl += "?|User-Agent=%s" % USER_AGENT

        # Strm
        if playurl.endswith('.strm'):
            playurl = urllib.urlencode(playurl)

        return playurl


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - sualfred - 2020-01-30

To be honest, I don't understand why people are using plugin urls packed in strm files in Emby. That's not what Emby is made for and will only work on Kodi setups. In my eyes this is just working by "accident". If it works with mediaimporter, ok, if not -> ¯\_(ツ)_/¯
With the mediaimporter branch it's possible to have a Emby, Plex and Kodi db without having issues. Netflix/Amazon users can just add the strm files as a regular DB item. No need for adding them to Emby. 

Anyway, Emby for Kodi just passing the stream url. If it's a .strm file -> Kodi is handling the content.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - LongMan - 2020-01-30

@sualfred, You are correct. It could just be added to Kodi. If look a few posts up, you will see that the initial post was about it not playing after being imported from another Kodi install.
Why use Emby for this? In my case, multi user support. Yes I could add it to Kodi, however, I would lose the multi-user support.

Cheers,
LongMan


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - sualfred - 2020-01-30

I fully understand why people do it in this way. But it's like kissing your own sister. Feels good but is just wrong ^^ And it results in a unusable Emby experience if you don't use Kodi. Sure, if you rape Emby just as centralized database for Kodi -> no big deal.

Anyway, just my 2cts and off-topic. If @Montellese is able to get it working, good. But I won't give it a high priority. It's a corner and unusual usecase.


RE: Media importing and library integration (UPnP, Emby, Plex, ...) - Montellese - 2020-01-31

(2020-01-30, 19:15)LongMan Wrote: @Montellese,

Some how I remember  a routine having a name similar to "PlayStrm". It doesn't seems to be there anymore. The references to strm below are the only ones I could find

https://github.com/MediaBrowser/plugin.video.emby/blob/4f9d2d54315a52e8764b43dd97576876e7c89113/resources/lib/helper/playutils.py#L170
https://github.com/MediaBrowser/plugin.video.emby/blob/4f9d2d54315a52e8764b43dd97576876e7c89113/resources/lib/helper/playutils.py#L203

Edit:  From an older version of the plugin

 def directPlay(self):

        try:
            playurl = self.item['MediaSources'][0]['Path']
        except (IndexError, KeyError):
            playurl = self.item['Path']

        if self.item.get('VideoType'):
            # Specific format modification
            if self.item['VideoType'] == "Dvd":
                playurl = "%s/VIDEO_TS/VIDEO_TS.IFO" % playurl
            elif self.item['VideoType'] == "BluRay":
                playurl = "%s/BDMV/index.bdmv" % playurl

        # Assign network protocol
        if playurl.startswith('\\\\'):
            playurl = playurl.replace("\\\\", "smb://")
            playurl = playurl.replace("\\", "/")

        if "apple.com" in playurl:
            USER_AGENT = "QuickTime/7.7.4"
            playurl += "?|User-Agent=%s" % USER_AGENT

        # Strm
        if playurl.endswith('.strm'):
            playurl = urllib.urlencode(playurl)

        return playurl
Ah that makes sense. It only works if you can use Direct Play on the STRM i.e. if Kodi has direct access to the STRM file (wherever it is stored). I can give that a try i.e. if Direct Play is enabled and Kodi can directly access the STRM it will use it directly. If Direct Play is disabled or Kodi can't directly access the STRM it will not be imported. Would that be acceptable?