Jump to content

MediaBrowser.ApiClient and MediaPortal client progress


Armand

Recommended Posts

Armand

I made some small changes and additions to the MediaBrowser.ApiClient regarding the WebSocket handling and the default NewtonSoft serializer implementation.

From the looks of the "old" code the WebSocket implementation did not work correctly before (without passing in a custom serializer) is this correct? Also the message handling in the BaseWebSocketApi was failing when the serializer would not deserialize WebSocketMessage when the expected type was WebSocketMessage.

 

I also ported and created some code for the net35 implementation as that is the implementation i'm using for the MediaPortal client. I already have a functional client able to authenticate users, browse collections and view details (including) playback. Last step before i release the beta client for MediaPortal is some minimal functionality using the WebSocketAPI for notifications and remote control. I am already able to connect the socket and receive messages but for some reason the MediaPortal session is not showing up yet when i check the sessions in the browser.

Link to comment
Share on other sites

Armand

i resolved the issue i had with the session not showing up. The net35 httpclient didn't set the authorization header yet :)

 

edit: i committed the changes, can someone push a new nuget package for apiclient net35?

Link to comment
Share on other sites

Armand

Just committed minor update to the authorization header when user changes.

I expect the MediaPortal client beta to be ready in a couple of days ;)

Link to comment
Share on other sites

When that happens we can help get you some testers. I'm sure there will be some volunteers both here and on the CT. This way you can get feedback from both the viewpoints of MB and MP users if you wish.

Link to comment
Share on other sites

Armand

after the latest nuget updates (Common and Apiclient for net35) i get the following error:

 

The following error was encountered while reading module 'MediaBrowser.ApiInteraction.net35': Assembly reference cannot be resolved: MediaBrowser.Model.net35, Version=3.0.4950.16798, Culture=neutral, PublicKeyToken=6cde51960597a7f9. [Errors and Warnings] (Global)

 

the dll for model (MediaBrowser.Model.net35.dll) the package installs is actually .4951.22014.

Somehow MediaBrowser.ApiInteraction.net35 tries to load an older one.

 

edit: after i updated the ApiInteraction source and used the build output as a reference (instead of the ApiInteraction package it worked).

Link to comment
Share on other sites

Armand
i will push another one shortly. let me know how that goes.

 

i just checked in 3 changes of which 2 unrelated to the fix. I think it was just the latest common components package update that was missing.

Link to comment
Share on other sites

done. please also review the changes i made in BaseApiWebSocket.

 

If you can remove the messy try/catch in GetMessageType that would be nice, although if it has to be there, so be it.

Link to comment
Share on other sites

Armand

I think if we would make a new base class called WebSocketMessage with only the message type property and let WebSocketMessage derive from it you can deserialize it without trouble.

The events that need the payload will have to deserialize it again (as it is now) with the expected payload through WebSocketMessage. I will try it and if it works that should allow us to remove the try/catch :)

 

something like in the model lib:

 

public class WebSocketMessage
   {
       public WebSocketMessage();

       public virtual string MessageType { get; set; }
   }


public class WebSocketMessage : WebSocketMessage
   {
       public WebSocketMessage() : base()

       public T Data { get; set; }
   }

Link to comment
Share on other sites

I see what you're saying. There doesn't even need to be a base class for that. Just create a private class with a single MessageType property. Deserialize to that. Then use WebSocketMessage against the whole payload once we know what it is.

Link to comment
Share on other sites

Great work. Let me know what your comfort level is and I'll put feelers out on our channels looking for MB users who may want to try it out. I'm checking with you first because I don't want you to get overwhelmed when you're not prepared for it.

Link to comment
Share on other sites

Armand

My comfort zone can be seen from space so bring it on ;) I am already answering private messages on the mediaportal forum where i redirect people to you or the community.

 

edit: i already had a talk with the lead maintainer of the MediaPortal TVseries plugin, it's one of the most feature complete plugins MP has to offer and he told me he was thinking about moving across because he has to deal with a lot of legacy code. The beauty of the situation in my opinion is that we can turn MediaPortal into a thinner client because the heavy lifting is on the MB side.

We also both have a lot of experience in the metadata process so we can also bring in the tips and tricks we used in the local plugin versions if MB should fall short. I think this is going to be a sweet ride :)

Link to comment
Share on other sites

Armand

Aboder, configure _debug_ logging in MediaPortal and create an issue on the github page for my plugin (https://github.com/apondman/MediaBrowser/issues) attaching that log.

That way i can keep all the issues in one place. I will also inform people to not report issues in the forum topics itself to keep conversation clean.

Link to comment
Share on other sites

Aboder, configure _debug_ logging in MediaPortal and create an issue on the github page for my plugin (https://github.com/apondman/MediaBrowser/issues) attaching that log.

That way i can keep all the issues in one place. I will also inform people to not report issues in the forum topics itself to keep conversation clean.

 

Sorry regarding the MP forum issue, but what file you want exactly? I have like 3 logs error for MP and for it 2 for Configuration at:

 

C:\ProgramData\Team MediaPortal\MediaPortal\log

Link to comment
Share on other sites

Armand

The MediaPortal.log (when MediaPortal has his log level set to debug) is the one i need for now. Excuse me for the lack of details surrounding issue reports but most of it has been common practise in the MediaPortal community. I will add more information along the way but i have to start somewhere :)

Link to comment
Share on other sites

Armand

can you push a new nuget package i have implemented the ReportPlayback methods

Link to comment
Share on other sites

now that i'm getting deep into mbt, i'm also a consumer of apiclient. i'll improve the image methods next week.

 

most of the getitemimageurl, getgenreimageurl, etc methods accept both the item id/name, or the item itself.

 

i think all of the methods that accept the item can be consolidated into one. this way you can pass anything into it, item, genre, studio, etc, and the method will figure it out rather than forcing each consumer to do it.

 

the other methods that just work off of the name/id will stay the way they are.

Link to comment
Share on other sites

Armand

Good, would also be nice to use only the ItemQuery model for all the item related queries.

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...