OnlineVideos JSON parsing | Page 2

Discussion in 'OnlineVideos' started by howudodat, December 6, 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
    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:
    So sorry for that...
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. doskabouter
    • Premium Supporter

    doskabouter Community Plugin Dev

    Joined:
    September 27, 2009
    Messages:
    2,803
    Likes Received:
    757
    Location:
    Nuenen
    Ratings:
    +1,122 / 1
    Home Country:
    Netherlands Netherlands
    Show System Specs
    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
     
    • Like Like x 1
  4. Quarter
    • Super User

    Quarter Super User

    Joined:
    June 21, 2010
    Messages:
    722
    Likes Received:
    110
    Gender:
    Male
    Location:
    Queenstown
    Ratings:
    +141 / 2
    Home Country:
    New Zealand New Zealand
    Show System Specs
    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
     
  5. howudodat

    howudodat Portal Pro

    Joined:
    February 20, 2007
    Messages:
    75
    Likes Received:
    2
    Ratings:
    +2 / 0
    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
     
    • Like Like x 1
  6. Quarter
    • Super User

    Quarter Super User

    Joined:
    June 21, 2010
    Messages:
    722
    Likes Received:
    110
    Gender:
    Male
    Location:
    Queenstown
    Ratings:
    +141 / 2
    Home Country:
    New Zealand New Zealand
    Show System Specs
    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
     
  7. Quarter
    • Super User

    Quarter Super User

    Joined:
    June 21, 2010
    Messages:
    722
    Likes Received:
    110
    Gender:
    Male
    Location:
    Queenstown
    Ratings:
    +141 / 2
    Home Country:
    New Zealand New Zealand
    Show System Specs
    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
     
  8. howudodat

    howudodat Portal Pro

    Joined:
    February 20, 2007
    Messages:
    75
    Likes Received:
    2
    Ratings:
    +2 / 0
    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?
     
  9. Quarter
    • Super User

    Quarter Super User

    Joined:
    June 21, 2010
    Messages:
    722
    Likes Received:
    110
    Gender:
    Male
    Location:
    Queenstown
    Ratings:
    +141 / 2
    Home Country:
    New Zealand New Zealand
    Show System Specs
    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
     
  10. doskabouter
    • Premium Supporter

    doskabouter Community Plugin Dev

    Joined:
    September 27, 2009
    Messages:
    2,803
    Likes Received:
    757
    Location:
    Nuenen
    Ratings:
    +1,122 / 1
    Home Country:
    Netherlands Netherlands
    Show System Specs
    If language should be a saveable option, then perhaps it's better to treat it that way:
    add
    Code (Text):
    1.  
    2. [Category("OnlineVideosUserConfiguration"), Description("The language")]
    3. string language = null;
    4.  
    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...)
     
  11. howudodat

    howudodat Portal Pro

    Joined:
    February 20, 2007
    Messages:
    75
    Likes Received:
    2
    Ratings:
    +2 / 0
    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?
     
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!