Add Path variable and infer Library accordingly#313
Add Path variable and infer Library accordingly#313qaz741wsd856 wants to merge 3 commits intojellyfin:masterfrom
Conversation
| if (dataObject.TryGetValue("Path", out var pathObject) && | ||
| pathObject is string path) |
There was a problem hiding this comment.
Should just get the path from the item instead of casting from the data object
| string maxMatchLibraryId = string.Empty; | ||
| string maxMatchLibraryName = string.Empty; | ||
| string minMatchLibraryId = string.Empty; | ||
| string minMatchLibraryName = string.Empty; |
There was a problem hiding this comment.
Jellyfin doesn't support nested libraries so this can be simplified to just a singular match
There was a problem hiding this comment.
I thought so before, but the movies library does support such nested libraries.
There was a problem hiding this comment.
And some users might add their top folder to Mixed Movies and Shows library and add particular sub folders to more specific libraries. So I prefer to infer the library by the longest path prefix matching if you think just one group of LibraryName and LibraryId is enough.
There was a problem hiding this comment.
Jellyfin has never supported nested libraries, and anyone doing this is relying on undefined behavior.
Added
PathvariableInfer the associated library based on storage path matching. Request #303 #114
Added 4 variables:
LibraryIdByMaxPath,LibraryNameByMaxPath: Returns the library with the longest matching path prefix.LibraryIdByMinPath,LibraryIdByMinPath: Returns the library with the shortest matching path prefix.Example:
Consider two libraries:
/media/media/subFor a media file located at
/media/sub/xxxx/xxx.mkv:LibraryNameByMaxPathwill always return "SubMedia"LibraryNameByMinPathwill always return "Media"This is regardless of whether the media file is actually included in either library.
While this simple identification method should handle most use cases, I personally don't recommend using such nested library structures.