OnlineVideos in MP2Ext, some discussion needed

Discussion in 'OnlineVideos' started by FreakyJ, November 29, 2015.

  1. FreakyJ
    • Team MediaPortal

    FreakyJ Development Group

    Joined:
    July 25, 2010
    Messages:
    4,021
    Likes Received:
    839
    Gender:
    Male
    Ratings:
    +1,424 / 1
    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 (C):
    1. try
    2.           {
    3.             s = new FileStream(filePath, FileMode.Open, FileAccess.Read);
    4.             s.Read(b, 0, 2048);
    5.           }
    6.           catch (Exception e)
    7.           {
    8.             Log.Error("Couldn't retrieve Linker Timestamp: {0}", e.Message);
    9.           }
    10.             finally
    11.             {
    12.                 if (s != null)
    13.                 {
    14.                     s.Close();
    15.                 }
    16.             }
    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 (Text):
    1. 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 (Text):
    1. Log.Info("ExecutingAssembly: {0} - Code Base: {1} - Uri: {2}", Assembly.GetExecutingAssembly(), Assembly.GetExecutingAssembly().CodeBase, new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
    The result is:
    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.
     
    • Like Like x 1
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. offbyone
    • Team MediaPortal

    offbyone Development Group

    Joined:
    April 26, 2008
    Messages:
    3,981
    Likes Received:
    2,704
    Gender:
    Male
    Location:
    Stuttgart
    Ratings:
    +3,303 / 3
    Home Country:
    Germany Germany
    Show System Specs
    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?
     
  4. FreakyJ
    • Team MediaPortal

    FreakyJ Development Group

    Joined:
    July 25, 2010
    Messages:
    4,021
    Likes Received:
    839
    Gender:
    Male
    Ratings:
    +1,424 / 1
    Home Country:
    Germany Germany
    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:

    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.
     
  5. offbyone
    • Team MediaPortal

    offbyone Development Group

    Joined:
    April 26, 2008
    Messages:
    3,981
    Likes Received:
    2,704
    Gender:
    Male
    Location:
    Stuttgart
    Ratings:
    +3,303 / 3
    Home Country:
    Germany Germany
    Show System Specs
    Didn't create a nuget for the API dll yet. If I get a little time off, I'll make one!
     
    • Thank You! Thank You! x 1
  6. FreakyJ
    • Team MediaPortal

    FreakyJ Development Group

    Joined:
    July 25, 2010
    Messages:
    4,021
    Likes Received:
    839
    Gender:
    Male
    Ratings:
    +1,424 / 1
    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

    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 ;)
     
  7. offbyone
    • Team MediaPortal

    offbyone Development Group

    Joined:
    April 26, 2008
    Messages:
    3,981
    Likes Received:
    2,704
    Gender:
    Male
    Location:
    Stuttgart
    Ratings:
    +3,303 / 3
    Home Country:
    Germany Germany
    Show System Specs
    • Thank You! Thank You! x 1
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!