OnlineVideos in MP2Ext, some discussion needed (1 Viewer)

FreakyJ

Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    @offbyone I think the title says it all. johanj requested that I add OnlineVideos Support to MP2Ext. I already did this and it looks like it is working great as a server plugin. :)

    I had only a few problems which I would like to discuss with you:

    1) In the 3rd Party folder of the OnlineVideos.dll was the whole src of the Newtonsoft.Json parser. This is a problem because I am importing it as a NugetPackage which leads to Namespace conflicts with the OnlineVideos.dll.

    I deleted it from the Project and also imported the Nuget package. This is working for the OnlineVideos.dll but not for the SiteUtils. Some of them are now failing because they can't find the Json parser inside the OnlineVideos.dll.

    Do you think we could add some kind of proxy to the onlinevideos.dll? I don't know how many functions are used inside the siteUtils, but most likely only JsonConvert.DeserializeObject, right?

    Or do you have a better idea?

    2) FileUtils.cs internal static DateTime RetrieveLinkerTimestamp(string filePath) @ Line 67

    There is a Try{}finally block, but the Catch block is missing, so it was always throwing an unhanled exception, I've changed it to:
    Code:
    try
              {
                s = new FileStream(filePath, FileMode.Open, FileAccess.Read);
                s.Read(b, 0, 2048);
              }
              catch (Exception e)
              {
                Log.Error("Couldn't retrieve Linker Timestamp: {0}", e.Message);
              }
                finally
                {
                    if (s != null)
                    {
                        s.Close();
                    }
                }
    Could you add it to the Mainversion?
    The cause of this is Problem 3)

    3) PluginLoader.cs internal void LoadAllSiteUtilDlls(string path) @ Line: 35 or 36 (I added a Log Line locally)
    Code:
    Log.Info("ExecutingAssembly: {0} - Code Base: {1} - Uri: {2}", Assembly.GetExecutingAssembly(), Assembly.GetExecutingAssembly().CodeBase, new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);

    Why do you use new Uri? Is there a reason for that?

    I've added this log line:
    Code:
    Log.Info("ExecutingAssembly: {0} - Code Base: {1} - Uri: {2}", Assembly.GetExecutingAssembly(), Assembly.GetExecutingAssembly().CodeBase, new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
    The result is:
    [2015-11-26 21:42:20,620] [2933 ] [Main ] [INFO ] - [OnlineVideos] ExecutingAssembly: OnlineVideos, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null - Code Base: file:///M:/Programmieren/C#/MediaPortal 2/MediaPortal/Bin/MP2-Server/bin/x86/Debug/Plugins/MP2Extended/OnlineVideos.DLL - Uri: M:\Programmieren\C

    As you can see new Uri() cuts of the path because of "#" in the file path. So is it really needed?

    It would be great if we could resolve these three issues and I am looking forward to hear back from you.
     

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    Hi!
    I just fixed 2) and with it 3) and pushed to git.

    For 1) we need to discuss a little further ;)

    I have included all kinds of external libs as code on purpose. All SiteUtil dlls should only reference the OnlineVideos.dll and have access to only the types it provides (+ .net framework core ofc). This way I enforce no other dependencies are required to run OV, no matter if as MP1 Plugin or Standalone or MP2 Plugin or what's to come ;) It makes deployment a lot easier. And I can treat a siteutil dll by any author as single dll that is updateable via our webservice.

    If the siteutil dll does not reference the newtonsoft dll, there shouldn't be any compilation or runtime problems?
     

    FreakyJ

    Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    If the siteutil dll does not reference the newtonsoft dll, there shouldn't be any compilation or runtime problems?
    The problem is that the MP2Ext plugin includes the Newtonsoft Json parser as a Nuget Package. Therefore I get a namespace conflict if I try to reference the onlineVideos.dll.
    I just read today that it is possible to give a referenced dll an external alias. So I might just give the OnlineVideos dll an external alias.
    If taht doesn't work I will come back to you :ROFLMAO:

    I just fixed 2) and with it 3) and pushed to git.
    Thank you very much!! I will run the compiler :cool:

    Another question:
    Is there a nuget package for the onlineVideos.dll? I couldn't find one. Just for the URLSourceFilter.
     

    FreakyJ

    Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    Looks like I could resolve the issue by using an external alias (y)
    Couldn't test any further because your server seems to be down oO

    [2015-12-09 22:01:00,900] [44514 ] [34 ] [WARN ] - [OnlineVideos] Error on getting sites overview from server: System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 178.77.70.160:80
    at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
    at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
    --- End of inner exception stack trace ---
    at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
    at System.Net.HttpWebRequest.GetRequestStream()
    at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
    at OnlineVideos.OnlineVideosWebservice.OnlineVideosService.GetSitesOverview() in m:\Programmieren\C#\OnlineVideos\OnlineVideos\Web References\OnlineVideosWebservice\Reference.cs:line 312
    at OnlineVideos.Sites.Updater.GetRemoteOverviews(Boolean force) in m:\Programmieren\C#\OnlineVideos\OnlineVideos\Sites\Updater.cs:line 330
    Also can't reach it with the webbrowser: 178.77.70.160:80
    also a ping to nocrosshair.de times out :)

    Once you've done the NugetPackage I am ready to push the src. Really thank you for fixing the bugs so quickly ;)
     

    Users who are viewing this thread

    Top Bottom