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:
- Get a list of tv shows of a specific path
Code:
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"
Code:
VideoLibrary.GetTVShows(filter)
- If the result is exactly 1 entry than the KI uses that ID to sync.
TV season:
- Get the tv show ID (see above).
- Get a list of all seasons of a specific tv show by tv show ID
Code:
VideoLibrary.GetSeasons(ShowID)
- Filter the results by season number.
- If now the result is exactly 1 than use that season ID to sync.
TV episode:
- Get the tv show ID (see above).
- Get a list of episodes with ShowID and path filter
Code:
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"
filter.and.Add(filterRule_Path)
filterRule_Filename.field = List.Filter.Fields.Episodes.filename
filterRule_Filename.Operator = List.Filter.Operators.Is
filterRule_Filename.value = "filename.ext"
filter.and.Add(filterRule_Filename)
Code:
VideoLibrary.GetEpisodes(filter, ShowID, Season#)
- 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)
All "PATH" that the KI uses to search in Kodi are based uf the mapping in the KI settings. That means if Kodi merge multiple tv show paths of a single tv show into one/single tv show information with only one (the first added) path then the KI can't get any result if a season is in one of the later added (and different) paths. It's the same with episodes because the KI first search for the tv show ID based on the tv show path. I think it's possible to skip the tv show ID search for an episode because it should by possible to get an episode list based only on EPISODE_PATH and EPISODE_FILENAME. But for season i don't see any way to get a workaround for. Even the tv show sync can run into an issue if you try to sync another "tv show path" than that one that Kodi has added as first.
I had a similar issue after i moved a lot of tv shows from "smb://tv_shows_ended" to "smb://tv_shows" because i havn't first removed the tv shows in Kodi and just rescanned the library. In my case the "tv show path" in Kodi still was the old path and only the episodes paths has been changed. I think i had to remove the tv show in Kodi and even manually removed all old tv show entries in the "tvshow" table.
(2020-06-01, 19:05)Boulder Wrote: but I found out an issue with videos that I have marked as Music Videos in Kodi, such as concert films etc. In EMM, they are in the same category as movies so they are not found when the sync is performed.
Kodi has an own API for movies and music videos. The KI only support movies because Ember does not support music videos atm (maybe added in Ember 2.0). So there is no way to sync a Kodi source that has been added as "content type = music video".
(2020-06-02, 06:32)Boulder Wrote: On my NAS, the TV show Star Trek The Next Generation is split over three drives. In the db table season_view, Kodi shows it being only on one, probably the one where I put the first season and scraped the TV show information which populated all the season fields in EMM and then updated it in Kodi.
I don't understand why scanning failed on the host though, the series folder is at that path.
See above
(2020-06-02, 06:32)Boulder Wrote: Another question: what is the difference between Sync and Sync Full? I tried both but the log doesn't show any differences.
TV Show - Sync = Only the tv show information
TV Show- Sync Full = TV Show, all seasons and all episodes
Season - Sync = Only season information
Season - Sync Full = Season and all episodes of that season