Plugin: MP2Extended (3 Viewers)

FreakyJ

Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    an you try to encapsulate errors/exceptions at a high level and log them?
    In fact I already do:
    Code:
    public override bool Process(IHttpRequest request, IHttpResponse response, IHttpSession session)
        {
          var uri = request.Uri;
          Guid mediaItemGuid = Guid.Empty;
          bool bHandled = false;
    
          Logger.Debug("MainRequestHandler: Received request {0}", request.Uri);
    
          try
          {
            response.AddHeader("Server", _serverOsVersion + _product);
            response.AddHeader("Cache-control", "no-cache");
            response.Connection = ConnectionType.Close;
    
            // Check the request path to see if it's for us.
            if (!uri.AbsolutePath.StartsWith(RESOURCE_ACCESS_PATH))
            {
              return false;
            }
    
    
            // Pass the Processing to the right module
            string[] uriParts = uri.AbsolutePath.Split('/');
            Logger.Info("MainRequestHandler: AbsolutePath: {0}, uriParts.Length: {1}", uri.AbsolutePath, uriParts.Length);
            if (uriParts.Length > 2)
            {
              // The URL shoud look like this: /MPExtended/MediaAccessService/json/GetServiceDescription
              IRequestModuleHandler requestModuleHandler;
              if (_requestModuleHandlers.TryGetValue(uriParts[2], out requestModuleHandler))
                requestModuleHandler.Process(request, response, session);
              else
                ServiceRegistration.Get<ILogger>().Warn("RequestModule not found: {0}", uriParts[2]);
            }
          }
          catch (Exception ex)
          {
            throw new InternalServerException("Failed to proccess! - Exception: {0}", ex);
          }
    
          return true;
        }

    As you can see everything is in a Try Catch blog and this is the Main module. So every call to the HTTP Server goes to all registered modules. And inside the try catch this module determined if the request is handled by this module, if not, it returns with false.

    Should there happen something fatal it will delivere an Exception to the user. The "Exception..." page you see it coming from this try catch. So I think it is unlikely that one of the modules is taking the server down. Does that make sense?

    Not sure how much time I will have, maybe a bit this evening but then I'm away Friday and during the weekend.
    Yeah, my dad had birthday, so I won't have too much time over the weekend, too. Big Party :D

    None of the issues we have had so far has been visible in the log
    I just delivere it vie http to the browser, but it might be a good idea to also log it. Will add an Log entry before thrwoing the error ;)

    developing so you both write all requests and also replies for them
    I write all requests as you can see by this two calls:
    Code:
            Logger.Debug("MainRequestHandler: Received request {0}", request.Uri);

    Your debug level is probably set to Info and not to debug :) Here is explained how to change the debug level
    http://wiki.team-mediaportal.com/2_MEDIAPORTAL_2/6_Support/4_Bug_reports_and_log_files

    I can also add the replies to the log file, but this will slow down responses (I experienced that during the MediaServer development). So I can add this, but expect some slower answers.
     

    johanj

    MP Donator
  • Premium Supporter
  • January 31, 2009
    781
    398
    46
    Home Country
    Sweden Sweden
    I haven't changed log level, will try debug and see if I understand more of what fails.

    Please add the possibility to also log the replies, maybe as a setting one define in a XML file. I think this will speed up things since I then hopefully can see the failing requests without having to debug our app. The debugging of MPiV is done through a regular webbrowser and each connect/debug session take time.

    I don't know what happens. But something happens and no request work. After MP2 server restart it works again.
     

    FreakyJ

    Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    @FreakyJ can you add the project references to the NuGet package config? This will resolve build errors in http://teamcity.team-mediaportal.co...ldResultsDiv&buildTypeId=MP2_WifiRemoteForMP2
    You are using the wrong branch :D
    It says:
    refs/heads/FEAT_DLNAv4
    This is the UPnP ContentDirectory Branch on which henso and I worked (and of course you some time ago)

    In the title it says: "WifiRemoteForMP2"
    This branch is not in the main repo, but in my private one over here: https://github.com/FreakyJ/MediaPortal-2/blob/FEAT_WifiRemoteForMP2/
    The name is missleading, because I am developing MP2Extended and WifiRemote in the same branch so that I don't have to switch branches all the time, but I only committed MP2Extended

    can you add the project references to the NuGet package config?
    I will look into it :)

    The audio aspect has a album and album artists attribute. Can they not be used?
    Yes this is possible by iterating though all media items, but the performance won't be that great :/ If the MIA rework shouldn't be in shape after resolving all the other issues, I can do that :)
     

    FreakyJ

    Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    can you add the project references to the NuGet package config?
    To be honest, I don't know how to do it :sick: I can enable AUtomatic Package restore for the whole solution, but I think this is not what you want...
     

    FreakyJ

    Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    with your branch MIA rework? :)
    I like our new build server (y)

    We don't have NugetPckages for the JSon parser yet... so I haven't committed the dll files :/
     

    FreakyJ

    Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    @johanj
    I've implemented the cache:
    Without cache:
    GetArtworkTime: 00:00:01.0078838
    GetArtworkTime: 00:00:00.1338934

    with cache:
    GetArtworkTime: 00:00:00.0541159
    GetArtworkTime: 00:00:00.0020259

    The first value is right after strating the server. Looks not too bad :)
     

    Users who are viewing this thread

    Top Bottom