MP2 WebServer - Configure MP2, Browse, Edit & Play MediaLibrary, ... (1 Viewer)

Status
Not open for further replies.

Lehmden

Retired Team Member
  • Premium Supporter
  • December 17, 2010
    12,553
    3,934
    Lehmden
    Home Country
    Germany Germany
    .: Introduction to this thread :.
    This thread is read-only for the public.
    Team Members are still able to make new posts.
    This is the first internal-thread which we would like to discuss in public to give you an idea what's going on behind the scene. In case you want to give and feedback and/or offer support feel free to start a new thread for discussion or to contact us.

    Hi.
    inspired by the great post of Michael I want to try to build a tool for editing Media Item Database entries:
    You want an easy way to edit your Metadata of your media files? Well, either write a separate application or again make use of the inbuilt http-server and implement a rich web interface to edit albums, artist, covers, etc. which will then show up in MP2 client.
    First I was thinking about an AutoIt Tool as AutoIT has inbuild support for SQLite. But this is not that good if others are using other providers, so I'm thinking about the Webserver solution as this should work with any DB provider... But I can't find any information about the http server and how to access it.

    In earlier days I've done database Webinterfaces quite often (in PHP) but there I had Apache, MySQL and PHP... What do I need (to know) to access MP2 Server DB via HTTP? Can I use PHP (don't think so)? Or are there anything like an API which delivers xml content? How did this work?

    If we decide to use SQLite as default after the problems with TVE 3.5 are solved, than the AutoIT tool would make sense also. So I need a complete overview about DB structure as well. (is good for http too)
     
    Last edited by a moderator:

    MJGraf

    Retired Team Member
  • Premium Supporter
  • January 13, 2006
    2,478
    1,385
    Hi Lehmden!

    Thanks a lot for the initiative!
    First of all, it is IMHO not a good idea to access the Database directly. As you already mentioned, the database itself may change by just exchanging the database plugin and if we have a solution which requires a certain database, it would obviously not work anymore as soon as another database is used. That would somehow break the "I-don't-know-but-MP2-just-works-feeling" ;)

    What this tool wants to do is modify Media Item Aspects (MIAs) and to do so, we should make use of the respective interfaces and their implementation in MP2. This ensures that the tool will still work if there are changes to the database system or to the database itself.

    Now it mainly depends on which rout we should go there:

    If we want to have a standalone application, we should use the implementation of the IContentDirectory (https://github.com/MediaPortal/Medi...mmon/SystemCommunication/IContentDirectory.cs), which is the UPnPContentDirectoryServiceProxy (https://github.com/MediaPortal/Medi...unication/UPnPContentDirectoryServiceProxy.cs). Using this, you can query MediaItems and their MIAs as well as make changes to the MIAs. And the good thing is: You could start the application on any client on your network and it would nevertheless immediately talk to your MP2 Server and initiate changes in the MP2 Server database.

    If we go the WebClient route (i.e. a MP2 server plugin, which provides access to MIAs via a WebInterface), we need two things:
    First we need access to the MIAs, Since this would take place on the MP2 Server side, we could use a more direct approach (don't need UPnP here, since the access to the MIAs happens locally on the server. Not sure, yet, which service would be the right one, maybe directly access the MediaLibrary (https://github.com/MediaPortal/Medi...Backend/Services/MediaLibrary/MediaLibrary.cs)
    But then - and this is the challenge - we need to provide a http-server plugin, which provides the web-interface. The best way to get an overview on how to make use of the inbuilt http-server is probably by having a look at Morpheus' FanArtService - in particular: https://github.com/MediaPortal/Medi...Incubator/FanArtService/FanartAccessModule.cs
    There you see that you can quite easily parse the URL from the browser and depending on that return data from the server to the browser.
    My problem is that I have no clue about http, PHP, whatever. So I can help with the background - but I would not know what http-code to return...

    Hope that helps a bit for the beginning!
    Michael
     

    Lehmden

    Retired Team Member
  • Premium Supporter
  • December 17, 2010
    12,553
    3,934
    Lehmden
    Home Country
    Germany Germany
    Hi.
    My problem is that I have no clue about http, PHP, whatever. So I can help with the background - but I would not know what http-code to return...
    For me it's exactly the other way round. I have no clue about the background here (I could not even read the *.cs) but can build something around the http code...
    I can tell you how this would work with "normal" Web- DB access (the "famous" WAMP or LAMP way, W=Windows, L= Linux, A= Apache, M=MySQL and P=PHP) if this is helpful.

    As I've learned coding BASIC in the 80th (on Commodore C64 and later Amiga) and after that a lot of HTML, PHP and some Javascript I saw that I easily can learn nearly all languages so called "procedural". They differ not that much. Some has other syntax, other coding styles but all are following similar logics. The only similar programming language I could find working on modern Windows systems is AutoIT, that's why I've done my tools in AutoIt. Didn't even touched the borders of it. As example, in AutoIT you can use Windows DLL similar as in C#, C++ or something like that. I never needed this up to now, but I'm sure I can learn this real fast if necessary.

    But ever I try to get a clue about some "modern", "Object Oriented" language I'll fail completely. This is nothing I'm able to learn any more, I fear. That's why I'm limited to AutoIt.
     

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    To bridge the two of you ;) - As far as I know, the build-in HTTP Server of the MP2 server is a pure HTTP only server. It cannot be used to execute php or asp.net or any other server side scripting language.
    Please correct me if I am wrong @morpheus_xx
     

    Lehmden

    Retired Team Member
  • Premium Supporter
  • December 17, 2010
    12,553
    3,934
    Lehmden
    Home Country
    Germany Germany
    Hi.
    the build-in HTTP Server of the MP2 server is a pure HTTP only server. It cannot be used to execute php or asp.net or any other server side scripting language.
    I thought so too, that's why I'm asking myself how dynamical content could be displayed with it...
     

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    What we can do is create and host a Webservice (WCF) on the MP2 Server (additionally), which could be accessed via JavaScript on the client Browser. The Webservice could offer all the methods you need.
     

    Lehmden

    Retired Team Member
  • Premium Supporter
  • December 17, 2010
    12,553
    3,934
    Lehmden
    Home Country
    Germany Germany
    Hi.
    Yep, this would do the trick.
     

    Valk

    Portal Pro
    February 25, 2006
    302
    108
    Home Country
    Australia Australia
    Last edited:

    MJGraf

    Retired Team Member
  • Premium Supporter
  • January 13, 2006
    2,478
    1,385
    Well guys, you got me :confused:
    As metnioned, I have no clue about WebAPI, WCF, php, asp.net and what it may be called... I just have some c# and database knowledge as well as very little c++ (back from the old days when "Web" was still something strange - or #Neuland as we call it in Germany now ;) )
    I know that the inbuilt webserver is just a plain http-server. What I understand we can do there is parse the URI from the brwoser and depending on that uri return some http code to the browser so that we would abviously have to "include" the data we want to display (songs, artists, etc.) in the returned http-code. But there the problem starts for me because I don't see a way to return data to the server...
    Regarding the Webservice to be accessed by JavaScript: I don't get why we need an "additional" WebService. We already have our UPnP server offering access to everything we need - just the way MP2 clients access the server. If we have JavaScript on the client-side why can't we just access the server via UPnP instead of a Webservice? Is that not possible with JavaScript?
    Finally, I saw that there is a branch about integrating Griffin.Webserver into MP2 by @morpheus_xx. Morph, can you explain a bit about the background? What Webserver do we use now? Was it built from scratch by Albert? Wouldn't a fully fledged solution like Griffin (via NuGet) be the better alternative?
    Michael
     
    Status
    Not open for further replies.

    Users who are viewing this thread

    Top Bottom