Closed juanma-cvega closed 3 years ago
How are these stored in the library? Are there just two identical entries of the same movie/episode but linking to different files?
I have an idea for movies to create a player using things already built in but I'm not sure if the same approach will work for episodes. I'll get back to you on this.
I just checked the Kodi folder but I don't see any files inside the Emby addon userdata folder. In Kodi, sources are split based on the Emby libraries (there are different folders depending on the language of the videos). I tried searching for the path to the videos inside Kodi but it seems they are pointing directly to an internet location (the protocol for each file is http instead of file).
My guess is that the Emby addon adds the information about the files directly to the database but I don't know the internals of Kodi so I cannot be sure.
The http path is different for each duplicated video as it includes the file name which normally includes some information on it like language, resolution and so on.
I just mean when you browse the kodi library are there two entries for the same movie side by side and each is a different source? Are both entries identical or are they named differently to differentiate?
Eg say you've got a 720p and 1080p version of the movie Batman. When you browse the library, I'm assuming you see something like Alien / Batman / Batman / Cars. With the first being the 720 and the second being the 1080. If so how do you tell them apart? Or are they named differently? I'm just trying to understand how the library itself is layed out when there's multiple versions of a file because it seems like it would be confusing to navigate. I've never had a setup like that because I only ever keep the highest quality version of a video I have.
I just checked with TV shows but I remember looking into it in the past for movies as well. Entries are just duplicated (same name and movie/TV show metadata). The only difference is the information about the video itself.
So in your example, you would see 2 Batman movies with the same name one next to the other and they both would use the same movie metadata (or at least the same information is stored twice). But for each one you would see different video attributes like 720 vs 1080, audio tracks available, etc. (with Estuary for instance you see these attributes at the bottom when moving from one file to the other).
In my mind, the solution, at a functionality level, would just look for elements with the same name and show a list containing, for each element, the video attributes. That's how the Emby player works currently. And with Emby it's even more complicated than that because it shows first elements that match the name sent that are on different Emby libraries. But then, for each one of them, there may be more than one file in the library so you get a second list to choose from. In this case, it's the Emby addon who returns the lists of results, nothing to do with how Kodi handles the library. But it's just an example of how it would look like.
Ah okay, that's how I thought it might be laid out - it would just change my approach if it was done differently.
The player file below should work. It will give you a dialog pop-up of all matching items. For movies it gives a dialog of all items in your library containing the movie title. For episodes it gives all episodes of tvshows in your library containing the show name that match the season/episode number.
Basically all I'm doing is creating a smart playlist on the fly using a kodi library path and then showing all the items in the playlist in the dialog.
{
"name" : "Library Matcher",
"plugin" : "xbmc.core",
"icon" : "{}/resources/icons/other/kodi.png",
"priority" : 100,
"is_resolvable" : "true",
"play_movie" : [
"videodb://movies/titles/?xsp=%7b%22rules%22%3a%7b%22and%22%3a%5b%7b%22field%22%3a%22title%22%2c%22operator%22%3a%22contains%22%2c%22value%22%3a%5b%22{title_url}%22%5d%7d%5d%7d%2c%22type%22%3a%22movies%22%7d",
{"dialog": "True"}
],
"play_episode" : [
"videodb://tvshows/titles/-1/-1/-1/-1/?xsp=%7b%22rules%22%3a%7b%22and%22%3a%5b%7b%22field%22%3a%22tvshow%22%2c%22operator%22%3a%22contains%22%2c%22value%22%3a%5b%22{showname_url}%22%5d%7d%2c%7b%22field%22%3a%22season%22%2c%22operator%22%3a%22is%22%2c%22value%22%3a%5b%22{season}%22%5d%7d%2c%7b%22field%22%3a%22episode%22%2c%22operator%22%3a%22is%22%2c%22value%22%3a%5b%22{episode}%22%5d%7d%5d%7d%2c%22type%22%3a%22episodes%22%7d",
{"dialog": "True"}
]
}
I was finally able to test your player yesterday and it works but it seems there is something in the request that makes it find some results from series named similar. For instance, I tried with the anime "Attack On Titan" and I got the right episode for that one but also for "Attack On Titan: Junior High"
Yeah it is going to match anything that "contains" the search term. If you want perfect matches change "contains" to "is".
BTW, you can read it better by passing it through a url decoder: https://www.url-encode-decode.com/ e.g. the episodes path is actually the following but just percent encoded (and without the line breaks)
videodb://tvshows/titles/-1/-1/-1/-1/?xsp={
"rules":{"and":[
{"field":"tvshow","operator":"contains","value":["{showname_url}"]},
{"field":"season","operator":"is","value":["{season}"]},
{"field":"episode","operator":"is","value":["{episode}"]}
]},
"type":"episodes"}
You just have to be mindful when converting back that the TMDb key in {curly braces}
doesn't have the braces percent encoded -- i.e. the {title_url}
{showname_url}
{season}
{episode}
bits you would want to replace with a placeholder word that you can swap out for the key after percent encoding.
Sorry I didn't answer before, I've been travelling. Just one question, are you planning on adding this player to the addon at some point or is it up to each one to add it manually? I don't know if the player with the strict condition would defer from the normal behaviour when playing local files when there is a single file but it would be great to have the option to look for all matches by default. Otherwise, having at least the option to have the player as part of the bundled ones so anyone can use it would work as well unless that causes a conflict with the normal functioning.
Is there any way to create a player that shows a list of available local files for a given item? I would like to be able to keep more than one file for a video locally (i.e. 2 files with different resolutions, different languages, normal or extended version,...)
I tried with a clean install, just having local files (actually they are links to Emby created with the Emby for Kodi addon with synchronisation to the library) and it just picked one of the files available. Ideally the list would show some information about the file, like resolution, available languages, HDR vs SDR, available subtitles or file size.