WIP Ember Media Manager 1.9.x - Download & Discussion Thread
(2020-06-02, 11:01)DanCooper Wrote: First of all: The Kodi Interface (KI) does not access the Kodi database directly, but uses the JSON-RPC API (v10 ATM in KI): Link
That means that i don't have access to tables or views like "episode_view" or "season_view".

If you want to test the API you can use the default Kodi webinterface. On the bottom right corner is a button with 3 dots and a "The Lab" menu. In the lab is an "API browser" that allows you to send any API call to check what Kodi sends back as information (and thus to the KI).

How the KI sync tv shows elements:

TV show:
  1. Get a list of tv shows of a specific path
    List.Filter.Rule.TVShows.field = List.Filter.Fields.TVShows.path
    List.Filter.Rule.TVShows.Operator = List.Filter.Operators.Is
    List.Filter.Rule.TVShows.value = "smb://TVSHOW_PATH"
  2. If the result is exactly 1 entry than the KI uses that ID to sync.
TV season:
  1. Get the tv show ID (see above).
  2. Get a list of all seasons of a specific tv show by tv show ID
  3. Filter the results by season number.
  4. If now the result is exactly 1 than use that season ID to sync.
TV episode:
  1. Get the tv show ID (see above).
  2. Get a list of episodes with ShowID and path filter
    filter = New List.Filter.EpisodesAnd

    filterRule_Path.field = List.Filter.Fields.Episodes.path
    filterRule_Path.Operator = List.Filter.Operators.Is
    filterRule_Path.value = "smb://EPISODE_PATH"

    filterRule_Filename.field = List.Filter.Fields.Episodes.filename
    filterRule_Filename.Operator = List.Filter.Operators.Is
    filterRule_Filename.value = "filename.ext"
    VideoLibrary.GetEpisodes(filter, ShowID, Season#)
  3. If the result is exactly 1 than use this ID to sync.
    If the result is more than one than try to filter by episode number (multi-episode handling)
I've noticed that the new API version didn't bring up any improvements regarding the case where you have a TV show spread over multiple paths. I was just thinking if it was possible to find the episode ID by some other way.

For example, my Star Trek TNG episodes are on four different volumes on my NAS. I can get the TV Show ID from the API, it's '9'. Then, using the id as a parameter, get a full list of episodes with VideoLibrary.GetEpisodes. You get the labels, which you can then use to find out the correct episode ID (by just using the episode season+order number information you have in EMM) to use it in VideoLibrary.SetEpisodeDetails.

Messages In This Thread
RE: Ember Media Manager 1.5.x - Download & Discussion Thread - by Boulder - 2021-03-14, 17:40
Miscellaneous > Media List Editor - by pstrg - 2020-06-09, 02:38
MovieSets - by pstrg - 2020-06-11, 22:01
Logout Mark Read Team Forum Stats Members Help
Ember Media Manager 1.9.x - Download & Discussion Thread2
This forum uses Lukasz Tkacz MyBB addons.