[Pending] Extend TVServer database types to allow SQLite via Gentle Framework (1 Viewer)

grahamd

Portal Member
March 24, 2008
6
4
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:

grahamd

Portal Member
March 24, 2008
6
4
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.
 

Attachments

  • tvserver-sqlite.patch
    2.7 MB

morpheus_xx

Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    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).
     

    grahamd

    Portal Member
    March 24, 2008
    6
    4
    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?
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    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.
     

    grahamd

    Portal Member
    March 24, 2008
    6
    4
    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
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    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?
     

    FreakyJ

    Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    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....
     

    Users who are viewing this thread

    Top Bottom