[Pending] - Extend TVServer database types to allow SQLite via Gentle Framework

Discussion in 'Submit: code patches (MediaPortal/TV-Server/etc.)' started by grahamd, April 4, 2016.

  1. grahamd

    grahamd Portal Member

    Joined:
    March 24, 2008
    Messages:
    6
    Likes Received:
    2
    Occupation:
    .NET developer
    Ratings:
    +3 / 0
    Home Country:
    United Kingdom United Kingdom
    I'm scratching my own itch here, but being a long time TVServer user I would like to see if there's any interest in TVServer being extended to support SQLite as a database as well as the MySQL/SQLServer options? Is there any technical reason why that's not been done before?



    I'm preparing a patch for the changes, however I'd like to know whether this is worth continuing with before I go much further.
     
    Last edited: April 4, 2016
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. grahamd

    grahamd Portal Member

    Joined:
    March 24, 2008
    Messages:
    6
    Likes Received:
    2
    Occupation:
    .NET developer
    Ratings:
    +3 / 0
    Home Country:
    United Kingdom United Kingdom
    And here's the patch. I've made this change because I think it will be valuable not to have to install a full db server just to run TVServer.

    Note: I've not been able to test it fully yet as I could do with some hints on how to build MP in such a way that it resembles the standard deployment package. I will test it however as soon as I can get it up and running in that state (or learn how to run the service in debug)..

    In summary, my changes are these:

    Gentle.Framework

    • Changed Gentle.Provider.SQLite to use NuGet and the latest SQLite package (1.0.99)
    • Changed the PostBuild.bat to copy the correct file to the references directory under TVDatabase (and allow spaces in paths)
    • Removed the old reference to System.Data.SQLite referenced by Gentle
    SetupTv
    • Uncommented the SQLite provider in the default Gentle.config so it becomes available to Gentle
    • Added a reference to Gentle.Provider.SQLite and System.Data.SQLite pointing at the TVDatabase\references directory
    • App.config: Allowed .NET 2.0 assemblies to be loaded under 4.0 (Gentle is .NET 2.0)
    • Created a create_sqlite_database.sql script to create the basic tables in a SQLite database
    • Created each of the upgrade scripts (39-61) so they work with SQLite
    • Added SQLite as a selection in the SetupDatabaseForm next to SQLServer and MySQL
    • Used the server textbox for the path to the database, and defaulted it to the same location as Gentle.config (could be made clearer)
    • Modified various locations where the ProviderType enum is referenced to add SQLite and make the associated code (test, save, upgrade) work.
    TvService
    • App.config: Allowed .NET 2.0 assemblies to be loaded under 4.0 (Gentle is .NET 2.0)
    • Referenced Gentle.Provider.SQLite and System.Data.SQLite from the TVDatabase/references location
    The extent of my testing so far is to start with the default Gentle.config and run SetupTv in interactive mode. It allows me to select and create a SQLite db, which is then upgraded to the latest DB schema using the scripts. I can then run TVServer in debug without errors. I need however to run the two together so that they can communicate using remoting and scan for channels for example, which I might need some help on.

    Happy to answer any questions about these changes.
     

    Attached Files:

    • Like Like x 2
    • Thank You! Thank You! x 1
  4. morpheus_xx
    • Team MediaPortal

    morpheus_xx Lead Dev MP2

    Joined:
    March 24, 2007
    Messages:
    11,017
    Likes Received:
    4,750
    Ratings:
    +6,796 / 11
    Home Country:
    Germany Germany
    Show System Specs
    Thanks for your contribution! I'm afraid you did the same things as me one year before when I created the TVE3 plugin for MP2. I also needed Sqlite support and developed it in my branch:
    https://github.com/morpheusxx/MediaPortal-1/commits/FEAT_TVE3_Sqlite?page=12

    Please also notice some fixes and reworks for incompatibilities with SQLite, i.e.
    There are more commits by me in this branch, all other changes are merged from upstream (MP1 master).
     
  5. grahamd

    grahamd Portal Member

    Joined:
    March 24, 2008
    Messages:
    6
    Likes Received:
    2
    Occupation:
    .NET developer
    Ratings:
    +3 / 0
    Home Country:
    United Kingdom United Kingdom
    You beat me to it! Your changes look great and go further than mine have. Any reason why these have not made it into the main branch of TVE yet?
     
  6. morpheus_xx
    • Team MediaPortal

    morpheus_xx Lead Dev MP2

    Joined:
    March 24, 2007
    Messages:
    11,017
    Likes Received:
    4,750
    Ratings:
    +6,796 / 11
    Home Country:
    Germany Germany
    Show System Specs
    Yes, the main reason is that TVE3 is in code freeze since long time and the changes would be not compatible with the upcoming TVE3.5 (because it does use EntityFramework where SQLite is already supported).

    Our primary motivation for the changes was to bring the matured and stable TVE3 as plugin into MP2, where SQLite is the default engine. But on the other hand there was no focus on support of MP1. I.e. the TvPlugin there does a direct access to the database, which is a bad design and would lead to issues with multi-seat systems: the client would need to access local sqlite db of the server, which could be solved by UNC network shares. But sqlite over network had some issues with possible data corruptions before, so for MP1 I'd not recomment it for multi-seat setups.

    MP2 in contrast only uses UPnP for communication and no direct DB access, so this issue doesn't exists here.
     
  7. grahamd

    grahamd Portal Member

    Joined:
    March 24, 2008
    Messages:
    6
    Likes Received:
    2
    Occupation:
    .NET developer
    Ratings:
    +3 / 0
    Home Country:
    United Kingdom United Kingdom
    That makes sense, I completely agree about accessing SQLite over the network.

    In my very specific case, I use TVE only, and stream to VLC or similar player. I have put a website and webservice in front of it to expose it to other machines so the DB will only be accessed by the webserver.

    I'll grab some of your changes and see if I can get it working just for me, until TVE3.5 is available perhaps! Thanks
     
  8. morpheus_xx
    • Team MediaPortal

    morpheus_xx Lead Dev MP2

    Joined:
    March 24, 2007
    Messages:
    11,017
    Likes Received:
    4,750
    Ratings:
    +6,796 / 11
    Home Country:
    Germany Germany
    Show System Specs
    Good luck, please keep us updated about your progress!

    Btw, there is already a plugin under development for MP2 which integrates a webserver and allows streaming of media to network. @henso or @FreakyJ can you comment on the status of current development, please? Is streaming of TV already possible?

    Would this be of interest for you as well?
     
  9. 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
    Streaming of Tv is possible with MP2Ext and by using the DLNA Server. MP2Web doesn't support it and won't support it until the streaming service gets part of mainstream MP2 or we have a pluginmanager with plugin dependency management. Same applies for all other Media items :)
    I don't know if you plan to have MP2Web as a core feature in the future or what your plan is. Basically it comes down to what you allow to go into main MP2....
     
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!