OnlineVideos JSON parsing (1 Viewer)

FreakyJ

Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    Or is it just study code and hack?
    I guess exactly this :) There doesn't seem to be any docs. I would just take a look at other plugins.

    The onlineVideos FAQ says:
    • The playback urls are hidden very good and need some tricky logic or the site offers an open API you can base your site on -> you'll have to create a new siteutil in C# (look at the code there are enough utils to use as sample)
    So sorry for that...
     

    doskabouter

    Development Group
  • Team MediaPortal
  • September 27, 2009
    4,566
    2,938
    Nuenen
    Home Country
    Netherlands Netherlands
    I guess (this is what I do) get as far as you reasonably/comfortably can with regexes and override the problematic methods in your siteutil class (derived from GenericSite).
    As I have now posted in this thread, I will get informed too of new questions, and I'll be able to help out too.

    And most importantly: Welcome to the club!

    When you're ready and content with your util, you can publish it (after some formalities) so the whole world can benefit from your work
     

    Quarter

    MP Donator
  • Premium Supporter
  • June 21, 2010
    722
    138
    Queenstown
    Home Country
    New Zealand New Zealand
    Hi I've got a few examples of using it in my TMDB check out my utility and see if it helps. It's under davidcalder.sites


    Sent from my iPhone using Tapatalk
     

    howudodat

    Portal Pro
    February 20, 2007
    75
    2
    Home Country
    United States of America United States of America
    ok, I am finally able to devote the time needed to get this done. As there is no real documentation, I will try to keep concise notes and contribute them back. The first thing I notice is there are 4 projects in the root of onlinevideos: onlinevideos.MediaPortal1 and 2, those are obvious. There is also Standalone and WebService. Just curious what those 2 are for? Also next step is creating my own so here are the immediate questions:
    1. Steps to create a new project?
      1. copy an existing project and edit the xml in the .sln file?
      2. File->New in visual studio? If so what are the settings needed to get started?
    2. Steps to debug in the debugger?
      1. Do I need to build mp from source to be able to debug in the debugger?
    3. In building the onlinevideos.mediaportal1 project, I get 212 errors, almost all are related to Http* (Http does not exist in namespace System.Net, HttpRequestMessage, HttpClient...). This could be a missing dependency, or target .net version (or something else that I am not immediately considering). However I would have imagined that the project build file (or solution in M$ speak) would have all the needed settings.
    Peter
     

    Quarter

    MP Donator
  • Premium Supporter
  • June 21, 2010
    722
    138
    Queenstown
    Home Country
    New Zealand New Zealand
    You just have to create a class project, add the references and deferred class of (I think site utility) you don't even need to build online videos project . For debugging I just set my site utility to start an external program "mediaportal.exe" and build only my site project


    Sent from my iPhone using Tapatalk
     

    Quarter

    MP Donator
  • Premium Supporter
  • June 21, 2010
    722
    138
    Queenstown
    Home Country
    New Zealand New Zealand
    Project needs to be built against .net 3 I think from memory make sure your project is the same.


    *standalone is a Windows application independent of Mediaportal.


    Sent from my iPhone using Tapatalk
     

    howudodat

    Portal Pro
    February 20, 2007
    75
    2
    Home Country
    United States of America United States of America
    ok, very good. Now I am off to the races :). Next batch of questions. My site is quite simple and everything comes in as JSON. The basic layout is:
    <list of categories>
    [static buton: "Language"]​
    The list of categories will expand either to a list of videos, or another list of categories. The current layout has the list of categories potentially 3 layers deep, some are 1 some are 2 and some are 3, before you get a list of videos. (For now I will just hard code a few entries to test with)
    The language button will show a list of languages and should save that as a preference

    if it is easier I can make language the first category and not keep it as a setting.

    So lets start with the categories and videos. I assume Initialize() is the first function called, after that, what functions are called next and in what order?
     

    Quarter

    MP Donator
  • Premium Supporter
  • June 21, 2010
    722
    138
    Queenstown
    Home Country
    New Zealand New Zealand
    If you have a site.xml set up your first point of call would be discoverDynamicCategories. I am unfamiliar how to fully create a site in c# only.


    Sent from my iPhone using Tapatalk
     

    doskabouter

    Development Group
  • Team MediaPortal
  • September 27, 2009
    4,566
    2,938
    Nuenen
    Home Country
    Netherlands Netherlands
    If language should be a saveable option, then perhaps it's better to treat it that way:
    add
    Code:
    [Category("OnlineVideosUserConfiguration"), Description("The language")] 
    string language = null;

    to the beginning of the class (see f.e. eurosport) so that automatically creates an entry for that site in the onlinevideosconfiguration .

    Fisrt one to override is indeed the discoverdynamiccategories
    there you can load the root-json and start adding subcategories, and if present subsubcategories etc for as long as you have the info present in the root-json.
    Extra properties you want to set for the categories: hassubcategories=true, subcategories and subcategoriesdiscoverd
    And for the subcategories: parent, hassubcategories, subcategoriesdiscovered.

    If the videos are also present in the root-json then I'd mostly set the property Other of that subcategory to the List<VideoInfo> that you have to parse out of the json-node and override getvideos to check if the other is of type List<VideoInfo> and if so just return that.
    Another way to do this is to assign the json node to Other, and parse that node in getvideourl.

    Note: this is all typed without syntaxchecking, so there may be one or two typos...

    Anyway, if you have something (partly) working than I'm more than happy to take a peek at it, see if you've missed something.

    For debugging I usually use a very simple console application with creates a SiteUtil (f.e. site=new EuroSportUtil() and calls some methods. thats the fastest way for me to get things done. (Mostly I don't have the patience to wait for mediaportal to start...)
     

    howudodat

    Portal Pro
    February 20, 2007
    75
    2
    Home Country
    United States of America United States of America
    do I need to put anything in OnlineVideoSites.xml, or is that just so I dont have to hard code site parsing information into the code?
     

    Users who are viewing this thread

    Top Bottom