Jump to content

Unexplained outcome, help!


Angelblue05

Recommended Posts

Angelblue05

In kodi, we use the following query: 

"{server}/mediabrowser/Users/{UserId}/Items?Sortby=SortName&format=json"

Nothing fancy, just getting the library sections. Now we depend on CollectionType to know what item type is contained in each view: movies, tvshows and so on. One user's server returns the following without the CollectionType key. How is that possible? What explains this result? Is it a bug?

u'Name': u'Kids TV Shows', u'PlayAccess': u'Full', u'HasDynamicCategories': False, u'RecursiveItemCount': 293, u'IsFolder': True, u'ChildCount': 13, u'ImageTags': {u'Primary': u'38c993314af61852f7644824e76f3e8d'}, u'LocationType': u'FileSystem', u'ServerId': u'2e88aa4c34cb44f0983bf2855de4362b', u'Type': u'CollectionFolder', u'Id': u'dcc7cc4d6f4e9d40f590145a4868f17a', u'BackdropImageTags': []}, {u'UserData': {u'IsFavorite': False, u'Played': False, u'PlayedPercentage': 20.723684210526301, u'UnplayedItemCount': 241, u'PlaybackPositionTicks': 0, u'Key': u'7c6b1294-b30d-4c72-2993-e4036d0425ac', u'PlayCount': 0}, u'Name': u'TV', u'PlayAccess': u'Full', u'HasDynamicCategories': False, u'RecursiveItemCount': 304, u'IsFolder': True, u'ChildCount': 14, u'ImageTags': {u'Primary': u'96bea4974547fd67efdf92acaec3ee34'}, u'LocationType': u'FileSystem', u'ServerId': u'2e88aa4c34cb44f0983bf2855de4362b', u'Type': u'CollectionFolder', u'Id': u'7c6b1294b30d4c722993e4036d0425ac', u'BackdropImageTags': []}]

The full result:

 

 

{u'Items': [{u'UserData': {u'IsFavorite': False, u'Played': False, u'PlayedPercentage': 0.011608071657966601, u'UnplayedItemCount': 35, u'PlaybackPositionTicks': 0, u'Key': u'384fe71b-d5db-8c0c-97c6-b356a93be6d8', u'PlayCount': 0}, u'CollectionType': u'boxsets', u'Name': u'Collections', u'PlayAccess': u'Full', u'HasDynamicCategories': False, u'RecursiveItemCount': 35, u'IsFolder': True, u'ChildCount': 6, u'ImageTags': {}, u'LocationType': u'FileSystem', u'ServerId': u'2e88aa4c34cb44f0983bf2855de4362b', u'Type': u'CollectionFolder', u'Id': u'384fe71bd5db8c0c97c6b356a93be6d8', u'BackdropImageTags': []}, {u'UserData': {u'IsFavorite': False, u'Played': False, u'PlayedPercentage': 5.4545454545454497, u'UnplayedItemCount': 52, u'PlaybackPositionTicks': 0, u'Key': u'57703e1c-ea52-9d7d-07ec-197b8fb217ef', u'PlayCount': 0}, u'Name': u'Kids Movies', u'PlayAccess': u'Full', u'HasDynamicCategories': False, u'RecursiveItemCount': 55, u'IsFolder': True, u'ChildCount': 56, u'ImageTags': {u'Primary': u'f55f9108b87bb571ec19e2fba8b83d9c'}, u'LocationType': u'FileSystem', u'ServerId': u'2e88aa4c34cb44f0983bf2855de4362b', u'Type': u'CollectionFolder', u'Id': u'57703e1cea529d7d07ec197b8fb217ef', u'BackdropImageTags': []}, {u'UserData': {u'IsFavorite': False, u'Played': False, u'PlayedPercentage': 1.06508875739645, u'UnplayedItemCount': 1672, u'PlaybackPositionTicks': 0, u'Key': u'60c6bb24-1c91-95d4-b536-e84e02b31783', u'PlayCount': 0}, u'CollectionType': u'music', u'Name': u'Music', u'PlayAccess': u'Full', u'HasDynamicCategories': False, u'RecursiveItemCount': 1690, u'IsFolder': True, u'ChildCount': 241, u'ImageTags': {u'Primary': u'4ba23c9d082969a7391613455af3266d'}, u'LocationType': u'FileSystem', u'ServerId': u'2e88aa4c34cb44f0983bf2855de4362b', u'Type': u'CollectionFolder', u'Id': u'60c6bb241c9195d4b536e84e02b31783', u'BackdropImageTags': []}, {u'UserData': {u'IsFavorite': False, u'Played': False, u'PlayedPercentage': 0.0077811580243985204, u'UnplayedItemCount': 255, u'PlaybackPositionTicks': 0, u'Key': u'c8ca023c-dbb9-6c78-e4de-5fcb477df512', u'PlayCount': 0}, u'CollectionType': u'movies', u'Name': u'Movies', u'PlayAccess': u'Full', u'HasDynamicCategories': False, u'RecursiveItemCount': 255, u'IsFolder': True, u'ChildCount': 254, u'ImageTags': {u'Primary': u'3e8d6b55e58cf1fae7f4728d75f173eb'}, u'LocationType': u'FileSystem', u'ServerId': u'2e88aa4c34cb44f0983bf2855de4362b', u'Type': u'CollectionFolder', u'Id': u'c8ca023cdbb96c78e4de5fcb477df512', u'BackdropImageTags': []}, {u'UserData': {u'IsFavorite': False, u'Played': False, u'PlayedPercentage': 0.34289638041204401, u'UnplayedItemCount': 292, u'PlaybackPositionTicks': 0, u'Key': u'dcc7cc4d-6f4e-9d40-f590-145a4868f17a', u'PlayCount': 0}, u'Name': u'Kids TV Shows', u'PlayAccess': u'Full', u'HasDynamicCategories': False, u'RecursiveItemCount': 293, u'IsFolder': True, u'ChildCount': 13, u'ImageTags': {u'Primary': u'38c993314af61852f7644824e76f3e8d'}, u'LocationType': u'FileSystem', u'ServerId': u'2e88aa4c34cb44f0983bf2855de4362b', u'Type': u'CollectionFolder', u'Id': u'dcc7cc4d6f4e9d40f590145a4868f17a', u'BackdropImageTags': []}, {u'UserData': {u'IsFavorite': False, u'Played': False, u'PlayedPercentage': 20.723684210526301, u'UnplayedItemCount': 241, u'PlaybackPositionTicks': 0, u'Key': u'7c6b1294-b30d-4c72-2993-e4036d0425ac', u'PlayCount': 0}, u'Name': u'TV', u'PlayAccess': u'Full', u'HasDynamicCategories': False, u'RecursiveItemCount': 304, u'IsFolder': True, u'ChildCount': 14, u'ImageTags': {u'Primary': u'96bea4974547fd67efdf92acaec3ee34'}, u'LocationType': u'FileSystem', u'ServerId': u'2e88aa4c34cb44f0983bf2855de4362b', u'Type': u'CollectionFolder', u'Id': u'7c6b1294b30d4c722993e4036d0425ac', u'BackdropImageTags': []}], u'TotalRecordCount': 6}

 

 

 

mine returns like this, CollectionType being tvshows:

u'CollectionType': u'tvshows', u'Name': u'TV', u'PlayAccess': u'Full', u'HasDynamicCategories': False, u'RecursiveItemCount': 5874, u'IsFolder': True, u'ChildCount': 116, u'ImageTags': {u'Primary': u'daa67b96c3ec70a860370d1311a995e1', u'Thumb': u'ae91e10d71c0d024cea065ec85b1e96e'}, u'LocationType': u'FileSystem', u'ServerId': u'7e3d7e2ac0e54624829ac4e63ca067ff', u'Type': u'CollectionFolder', u'Id': u'df71f15b6993e315c5932b5fb2939e2e', u'BackdropImageTags': []}, {u'UserData': {u'IsFavorite': False, u'Played': False, u'PlayedPercentage': 47.5237683252433, u'UnplayedItemCount': 996, u'PlaybackPositionTicks': 0, u'Key': u'06a832af-5a4f-1088-404f-d18c51578a89', u'PlayCount': 0}, u'CollectionType': u'tvshows', u'Name': u'Anime', u'PlayAccess': u'Full', u'HasDynamicCategories': False, u'RecursiveItemCount': 1898, u'IsFolder': True, u'ChildCount': 53, u'ImageTags': {u'Primary': u'4f2ea46b710b1abd89b507f10b791330', u'Thumb': u'343dcb53a4ce7b7627853910fee8d720'}, u'LocationType': u'FileSystem', u'ServerId': u'7e3d7e2ac0e54624829ac4e63ca067ff', u'Type': u'CollectionFolder', u'Id': u'06a832af5a4f1088404fd18c51578a89', u'BackdropImageTags': []}

Their library section content type are declared as TV so I'm pretty much at a lost here. Thanks for the input.

Edited by Angelblue05
Link to comment
Share on other sites

if they have disabled enhanced views it will be null, meaning, it should just be a plain folder presentation.

Link to comment
Share on other sites

Angelblue05

The content type is set to TV. I'll ask him about the plain presentation. Thanks!

Edited by Angelblue05
Link to comment
Share on other sites

Angelblue05

We don't process mixed content lol. :) Kodi doesn't support it, on the to do list, with the hopes of being able to achieve something.

 

Thanks anyway, it does explain it....we'll have to find a different way.

Link to comment
Share on other sites

Angelblue05

@@Luke

 

Is there any way to get the content type of a library section in the api? It's kind of silly to not have access to this information if View styles for the section is disabled. There should be a place where it gives us the library sections (their label, id and content type regardless of any settings in webclient? It could be added to the specialview api (it would seem most appropriate there)

Link to comment
Share on other sites

yes look at the preferences pages to see what the web client is doing. when you're dealing with lots of apps and lots of developers, practicality becomes very important so that's why it was done this way. 

Link to comment
Share on other sites

Angelblue05

I don't understand how this helps me know that the folder is set as TV.... :)

      "PlainFolderViews": [
        "e37dbdc0c2792ea77cbe3ed77cb4466c"
      ],

It gives the id, but when I query the id, it still doesn't give me the collectionType. What I'm asking is, is there a way to get the content type from the library section somewhere in the api (something that would appear at all times in the API)?

Even if the view style is disabled, the content type is still TV. We just need a way to make sure we can validate the content type to be imported in Kodi because only the following categories are supported: movies, tv shows, music videos, music. If not, then I'm unsure what we can do here. I'll bring it up to the other devs.

 

55de7dc87067c_library.png

Link to comment
Share on other sites

i mean the user preference pages. check the call that is made to fill the View Styles list. that might help.

Link to comment
Share on other sites

Angelblue05

@@Luke

 

I am convinced this used to work previously (before the latest beta updates). I've always had my Netflix TV as plain folders and they were getting imported in Kodi (I just didn't realize until last night, Netflix TV was missing last time I synced my database).

 

Before I start changing our code, can you validate this is intended behavior and not an unintentional bug? Thanks.

Link to comment
Share on other sites

the view styles toggle was only introduced in the last release (or two maybe, don't remember). so it's a pretty recent thing. the reason for doing it this way is that it allowed it to be done without any affect to app developers, with Kodi being the exception. I am going to look at adding the original content type in another property so that you can get that.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...