Work in Progress - Media importing and library integration (UPnP, Emby, ...)

  Thread Rating:
  • 5 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Mettbrot Offline
Senior Member
Posts: 279
Joined: Jan 2011
Reputation: 4
Location: Aachen
Post: #301
I don't know if Montellese is happy with the UPnP implementation as it is right now. I recall, he was considering moving the whole thing from platinum SDK to OhNet since platinum isnt really developed anymore.
This seems to be a huge amount of work though.. https://github.com/Montellese/xbmc/commits/ohnet
Maybe something for GSoC?
(This post was last modified: 2017-04-30 11:26 by Mettbrot.)
find quote
Montellese Offline
Team Kodi Developer
Posts: 4,834
Joined: Jan 2009
Reputation: 72
Location: Switzerland
Post: #302
(2017-04-28 15:40)natethomas Wrote:  It seems like this project is pretty far along, montellese. Would it make sense to PR it in and let the team work on any remaining bugs?

There are basically three problems with this right now (apart from any known/unknown bugs):
  1. I most likely won't have time to take care of any bugs and issues this would cause which would result in a huge additional burden on other developers.
  2. The implementation only covers videos and music hasn't been done yet.
  3. Right now the only way to write media imports is in C++. I would prefer it if we had a python add-on interface which would make it a lot easier for other people to write imports for Emby, Plex et al.

(2017-04-30 11:20)Mettbrot Wrote:  I don't know if Montellese is happy with the UPnP implementation as it is right now. I recall, he was considering moving the whole thing from platinum SDK to OhNet since platinum isnt really developed anymore.
This seems to be a huge amount of work though.. https://github.com/Montellese/xbmc/commits/ohnet
Maybe something for GSoC?
Well that's not really a necessity for this work. It would allow a bit more flexibility and additional integration like downloading imported items for offline viewing but the basics needed work fine with the existing platinum SDK.

Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
find quote
jjd-uk Offline
Team-Kodi Member
Posts: 6,192
Joined: Oct 2011
Reputation: 152
Post: #303
For the Media Importers could the python scraper interface be extended to cover this?
find quote
Montellese Offline
Team Kodi Developer
Posts: 4,834
Joined: Jan 2009
Reputation: 72
Location: Switzerland
Post: #304
(2017-04-30 12:20)jjd-uk Wrote:  For the Media Importers could the python scraper interface be extended to cover this?

I don't really know what that interface currently looks like. Right now the interface to be implemented by a media importer is defined by https://github.com/Montellese/xbmc/blob/...mporter.h. The imporant parts are:
  • GetIdentification(): this should be easy as the add-on already has an ID and a name.
  • ProvidesChangeset(): whether the add-on provides a full list of imported items or only a changeset since the last synchronisation.
  • CanImport(): whether the add-on is capable of importing items from a given path.
  • LoadSourceSettings() / LoadImportSettings(): the add-on can provide media provider / import specific settings. This is the reason why I started working on getting add-ons to use the same settings system as kodi again.
  • Import(): the add-on gets a list of already imported items and then more or less returns a full list or a changeset of imported items

Furthermore the add-on would probably need some kind of service component which tells kodi about available media sources which the user can import items from.

Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
find quote
angelblue05 Offline
Senior Member
Posts: 166
Joined: Nov 2014
Reputation: 9
Post: #305
@Montellese

I'd like to help with the python portion if possible. Just let me know what needs to be done and where I should start.

Quick question about paths for items: Let's say the user uses Kodi locally or outside their network. In Emby for Kodi, we use plugin paths to accommodate the scenario where the path of the content may change depending on the user's location. What flexibility do we have in this regard? Does this only support direct paths to content or?
(This post was last modified: 2017-05-22 21:18 by angelblue05.)
find quote
Montellese Offline
Team Kodi Developer
Posts: 4,834
Joined: Jan 2009
Reputation: 72
Location: Switzerland
Post: #306
Right now the UPnP importer simply uses UPnP paths which can already be resolved by Kodi. But this is a problem I'm aware of. We might need some kind of URL resolver plugin infrastructure which would allow a media importer plugin to also provide an URL resolver implementation and then use its own URLs for imported items.

As soon as I've finished my add-on settings work I'll come back to media importing (which should benefit from the add-on settings work) and then I'll look into how this could be done for python add-ons. Most of the things mentioned above should be straight forward but the Import() part requires that Kodi provides the plugin with a list of already imported items and AFAIK this hasn't been done anywhere in the existing plugin API yet. I'll let you know as soon as I've got something to work with / against.

Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
find quote
angelblue05 Offline
Senior Member
Posts: 166
Joined: Nov 2014
Reputation: 9
Post: #307
That's good to hear. I'll be here Smile
find quote
LongMan Offline
Senior Member
Posts: 156
Joined: Apr 2013
Reputation: 0
Thumbs Up  RE: Media importing and library integration (UPnP, Emby, ...)
Post: #308
Big Grin Awesome.
find quote
Montellese Offline
Team Kodi Developer
Posts: 4,834
Joined: Jan 2009
Reputation: 72
Location: Switzerland
Post: #309
I've actually spent quite a bit of time on the python add-on integration in the last few days. It's still highly WIP and my python skills suck (I basically have to look up every other method call) but I've put together a python add-on at https://github.com/Montellese/xbmc/tree/...orter.emby which should basically replace the WIP I wrote in C++ for importing items from Emby. It's still very basic and therefore a lot of things are missing:
  • the new API in the xbmcmediaimport module doesn't support handling media provider and media import settings yet
  • the new API in the xbmcmediaimport module is completely undocumented
  • the new add-on doesn't handle user authentication (it simply uses a hardcoded API key) which requires media provider settings (see above)
  • the new add-on doesn't handle library views and everything is hardcoded

For the new add-on type it basically comes down to
  • providing a service script which is responsible for discovering and registering media providers through the xbmcmediaimport module
  • providing a library script which can handle different actions with the most important ones being "canimport" and "import" where for import you get a path and a list of media types to import and then you can do some magic, create ListItems and pass them back to Kodi which will then properly handle them as imported items.

Does that sound reasonable? I've basically looked at how plugin add-ons work and copied / refactored a lot of that. Once again I am no python developer so I have no idea what a sensible python API looks like Wink

Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
find quote
LongMan Offline
Senior Member
Posts: 156
Joined: Apr 2013
Reputation: 0
Post: #310
I made a post about this in the Emby for Kodi forum. Hopefully one of the devs will respond. Is there a build which I could use to give this a spin?
find quote
Montellese Offline
Team Kodi Developer
Posts: 4,834
Joined: Jan 2009
Reputation: 72
Location: Switzerland
Post: #311
(2017-06-09 18:38)LongMan Wrote:  I made a post about this in the Emby for Kodi forum. Hopefully one of the devs will respond. Is there a build which I could use to give this a spin?

I've triggered a win32 build on jenkins: http://jenkins.kodi.tv/job/WIN-32/4904/

Just remember, as I said this python integration is still very much work in progress Wink

EDIT: And here's the link to the test build installer: http://mirrors.kodi.tv/test-builds/win32...rt-x86.exe

Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
(This post was last modified: 2017-06-09 19:45 by Montellese.)
find quote
LongMan Offline
Senior Member
Posts: 156
Joined: Apr 2013
Reputation: 0
Post: #312
Thanks. I will keep that in mind.
find quote
LongMan Offline
Senior Member
Posts: 156
Joined: Apr 2013
Reputation: 0
Post: #313
A possible description could be;

"Emby Media Importer allows you to import and play media libraries, for movies, tv shows and music videos, from Emby Media Server. Thus using Emby as a metadata manager (server) and Kodi as player (client). In addition playback data can be synced across multiple clients, for each User on Emby."
find quote
LongMan Offline
Senior Member
Posts: 156
Joined: Apr 2013
Reputation: 0
Post: #314
I installed it over the previous build, it pops up the dialog to say it is syncing but nothing syncs. I assume it is using the media import settings, at least a part of it, from the C client. Seeing that there are no settings for the python addon yet.
find quote
Montellese Offline
Team Kodi Developer
Posts: 4,834
Joined: Jan 2009
Reputation: 72
Location: Switzerland
Post: #315
(2017-06-10 02:17)LongMan Wrote:  A possible description could be;

"Emby Media Importer allows you to import and play media libraries, for movies, tv shows and music videos, from Emby Media Server. Thus using Emby as a metadata manager (server) and Kodi as player (client). In addition playback data can be synced across multiple clients, for each User on Emby."
Since I don't really plan on maintaining that add-on it's not really worth having a proper description etc. I'm only writing this as a proof of concept so that other peopel with more python and kodi add-on skills can do something better and have an example of how the API is supposed to be used. But thanks.

(2017-06-10 02:48)LongMan Wrote:  I installed it over the previous build, it pops up the dialog to say it is syncing but nothing syncs. I assume it is using the media import settings, at least a part of it, from the C client. Seeing that there are no settings for the python addon yet.

Yeah because I haven't implemented the whole settings stuff into the python API yet I have hardcoded an Emby API key and don't care about library views etc. Furthermore I have commented the last line of the import logic which would tell Kodi that importing went fine because there is some problem with the ListItem.setInfo() call a few lines further up which is borking some of the properties and I haven't figured out why yet.

Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
find quote
Post Reply