VideoDatabaseV5 design issue (1 Viewer)

Anthony Vaughan

MP Donator
  • Premium Supporter
  • June 25, 2015
    474
    234
    Home Country
    United Kingdom United Kingdom
    I believe that the design for VideoDatabaseV5 originated in the Kodi design for a similar database. Somewhere down the line the MP design departed from the original design and, I think, there is a problem with the MP design. I have been a user of MP1 since 1.11 and have had issues with this database on several occasions owing to this flaw.

    Here is an entity diagram of the MP design:

    View attachment VideoDatabaseV5 - now.jpg

    Here is an entity diagram of what I think is the fix and is, in essence, the same as the Kodi design:

    View attachment VideoDatabaseV5 - proposed.jpg


    The MP design has movie linked to path and files linked to path and movie. But, because there is a movie record for every files record, idFile and idMovie in the files table should always have the same value. However, when the data becomes corrupted, these values start to differ and the database becomes unusable. As I say, this has happened to me often over the years and the only solution is to start with a fresh VideoDatabaseV5 file, losing everything. Furthermore, I can't understand why movie would come between path and files when strPath and strFilename are clearly meant to be linked.
    I am suggesting that a change to the second design would eradicate this problem completely.
    Under the MP design there is another problem. The vast majority of files are usually not movies, but a movie record has to be written for every files record, even when the files record is not a movie. Wouldn't is be better to only write movie records when the files record is a movie. I believe that the second design can handle that as well.
    I recognize that this is not trivial and would require a significant change but I think it would result in a more stable, and more logical, system.

    Tony
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    14,138
    8,690
    Kyiv
    Home Country
    Ukraine Ukraine
    In many years of using Mediaportal, I have not received a single database problem, I only use My Video for all my Movies, Series in TV Series, and home videos as part of the My Pictures plugin.
    From the schema in the two different pictures, it's hard to understand the changes. And what should change.
     

    Anthony Vaughan

    MP Donator
  • Premium Supporter
  • June 25, 2015
    474
    234
    Home Country
    United Kingdom United Kingdom
    The difference in the proposed design is that movie would be inherited from files, not from path.

    The change is quite simple:
    a) remove the idMovie column from files;
    b) change the idPath column in movies to idFile.

    Tony
     

    Anthony Vaughan

    MP Donator
  • Premium Supporter
  • June 25, 2015
    474
    234
    Home Country
    United Kingdom United Kingdom
    We lose the simple link Movie, Files.

    We lose the simple connection of Path, Film.

    I don't see the problem with the current scheme and how it can cause disruption.

    The link between movie and files is still there: files is the parent and movie is the child.

    This is a relational database. In the real world, path is the main table and files is a child of path and movie should be a child of files. The existing structure has a redundant relationship where movie has been placed above files and below path - but there is a link between path and files and path > movie > files. Surely, in the real world, a movie is a type of file as opposed to a video or another type of file.

    I'll leave it there. Please bear in mind that I am not just making this up as I go along - Kodi uses the structure I am suggesting (so it really is a working solution).

    For me this is serious enough for me to me looking at other front-ends. The server side is great but I have had numerous problems with the client-side, particularly when adding movies to the database.

    Tony
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    14,138
    8,690
    Kyiv
    Home Country
    Ukraine Ukraine
    The existing structure has a redundant relationship where movie has been placed above files and below path
    This simplifies queries, especially in the Database view mode.
    This is a relational database. In the real world, path is the main table and files is a child of path and movie should be a child of files.
    In the world of Mediaportal the path is secondary, and Movie is primary. We play from the Movie everywhere, and all other tables are attributes.
    I'll leave it there. Please bear in mind that I am not just making this up as I go along - Kodi uses the structure I am suggesting (so it really is a working solution).
    Kodi has its own problems in the structure, but it is as it is, our ideology is a bit different, on the one hand we have the primary Path, but it is primary in the viewer, on the other hand we have the primary Movie, and everything else is secondary attributes, this is true for the viewer mode - database.

    We can change the structure as you ask, but it is a waste of time which will not improve. Because the mechanism of adding information comes from Movie (if my memory serves me right) but not from path or file...
    For me this is serious enough for me to me looking at other front-ends. The server side is great but I have had numerous problems with the client-side, particularly when adding movies to the database.
    We don't have a server part, only a client part, just like Kodi. I am with Mediaportal since version 0.8 (if memory serves me correctly) and now I have more than 500 movies in the Movie Library, and in all that time there was not a single database corruption or database crash. The database gradually migrates from one version to another, on the test computer sometimes goes through a complete re-import, but on the other 3 НТРС database is stable and works like clockwork.
     

    Anthony Vaughan

    MP Donator
  • Premium Supporter
  • June 25, 2015
    474
    234
    Home Country
    United Kingdom United Kingdom
    Well, I'm really perplexed. I was under the impression that MP1 was a client-server model system. See below:

    1625553134659.png

    Please look under TV Setup, because I am seeing entries for 'Server Setup' and 'Client Setup', and I've been using them for years.

    I first spotted this issue when I started to use the system but let it lie, because I suspected my suggestion wouldn't go down well. I, as a developer, tend to push systems to their limits. In this case I use the central configuration paradigm with four clients and one server. I can only say that whenever I use MediaPortal Configuration to add movies to VideoDatabaseV5, I do so with dread, because I can never be sure which file in 'files' the system will add the 'movieinfo' data to. On several occasions it has linked the 'movieinfo' data to TV programs rather than the intended movie. I contend that this is happening because there is a cyclic relationship in the design as the entity model demonstrates.

    I don't expect anyone to change a design when they don't appreciate what is wrong with it in the first place. So, I'll leave it at that.

    Tony
     
    Last edited by a moderator:

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    14,138
    8,690
    Kyiv
    Home Country
    Ukraine Ukraine
    Please look under TV Setup, because I am seeing entries for 'Server Setup' and 'Client Setup', and I've been using them for years.
    Client-Server model only for TVPart, all other part in MP1 Client only ... Except media files ...
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    14,138
    8,690
    Kyiv
    Home Country
    Ukraine Ukraine
    I, as a developer, tend to push systems to their limits.
    The same, but as a developer I know that changing something that works without problems for years is bad luck, because all the edits introduce new problems, internal changes we can do, external (plugins) not always.
    In this case I use the central configuration paradigm with four clients and one server.
    Same thing, I have 4 HTPCs on Mediaportal, 2 HTPCs on Kodi, and one central server that hosts the media files, databases, and all the resources needed in the GUI for both Mediaportal and Kodi. I add movies to the database mostly from the Mediaportal GUI, lately in a semi-automatic or automatic mode, through MyVideoImporter. But before that I was adding and through the Configurator and GUI MyVideo. For all this time there was no problem.
    On the test machine, when I do debugging grabber I can add movies many times a day, I can zero database and add all movies from scratch, and also there was not a single problem, all information gets where it should.

    On several occasions it has linked the 'movieinfo' data to TV programs rather than the intended movie. I contend that this is happening because there is a cyclic relationship in the design as the entity model demonstrates.
    In fact, in Mediaportal everything is simpler, all the source code is available for viewing.
    As a developer, you can analyze not only the database architecture, but also how the database works in all modes. Add, Update, Display in Folder mode, Display in Database mode. And then it will be possible to discuss the architecture of the database, based on the source code that works with it. And after analyzing the necessary changes in the Source Code, Database, All plugins. We will be able to decide whether we can make these changes or not.

    I don't expect anyone to change a design when they don't appreciate what is wrong with it in the first place. So, I'll leave it at that.
    You look from one side, I look from two sides. I am not against changes in the database structure, but these changes can lead to degradation of database runtime, lead to complete inoperability of some plugins, as well as lead to a complete change in the source code on the work and display Movies.

    So before you change something, you need to take a comprehensive approach to the analysis and scope of work, as well as the consequences.
    Although if you have a Pull Request ready, with all the changes, we can include it in the next Pre-release for testing.
     

    Anthony Vaughan

    MP Donator
  • Premium Supporter
  • June 25, 2015
    474
    234
    Home Country
    United Kingdom United Kingdom
    I decided to have a look at the code to see whether I could get things working by myself and, after a couple of hours of working on the Database class, I got the system to work with my proposed design. I still have to write a routine to transfer my existing VideoDatabaseV5 data to the new format and to thoroughly test the code against all incoming requests. There is also the issue of a few fields that need to be moved from the movie table to be handled for all files and to process duration from only one place instead of two.

    So, I have a working solution for me.

    I think it is a testament to the original class design, in that the Database class is properly encapsulated, that I am able to accomplish this without having to delve anywhere else (yet, at least).

    Tony
     

    Users who are viewing this thread

    Similar threads

    Could be that a sudden powercut corrupts the database, or give all your pcs a new ipadres, or several more things that can break up a running mediaportal setup. Without the logs however, I don't have a clue on what exactly is wrong...
    Could be that a sudden powercut corrupts the database, or give all your pcs a new ipadres, or several more things that can break up...
    Hi there, I'm a happy long time user and am currently using MP 1.25. Up until now I had no issues with my setup. Yesterday...
    Replies
    1
    Views
    560
    It is looking and working very well now and I am almost at the point of switching my HTPC to MP2, madvr would definitely push me over the edge for sure.;)
    It is looking and working very well now and I am almost at the point of switching my HTPC to MP2, madvr would definitely push me...
    We are proud to present MediaPortal 2.3 MediaPortal 2.3 is a full-blown media center software that addresses the most common user...
    Replies
    4
    Views
    3K
    Hi CyberSimian I have done a fair bit of testing off MP2. I had to abandon it because the user interface is a bit primitive in its functionality. Namely, the MP2 guide does not scroll perpetually; i.e. when you scroll up and reach BBC1 the scrolling stops. So, to get to the programmes immediately before BBC1, you have to scroll down...
    Hi CyberSimian I have done a fair bit of testing off MP2. I had to abandon it because the user interface is a bit primitive in its...
    Hi CyberSimian I am finding that, for some folders, I get duplicate records created in the file table, and consequently the movie...
    Replies
    6
    Views
    4K
    We are proud to present MediaPortal 2.3.1 MediaPortal 2.3.1 is a full-blown media center software that addresses the most common user requirements out of the box. Aside from its support for Live TV and Radio, it offers a complete media server for music, movies, and TV shows. Info is automatically downloaded from various sources to...
    We are proud to present MediaPortal 2.3.1 MediaPortal 2.3.1 is a full-blown media center software that addresses the most common...
    We are proud to present MediaPortal 2.3.1 MediaPortal 2.3.1 is a full-blown media center software that addresses the most common...
    Replies
    0
    Views
    1K
    Thanks for this new release of MP. The link on the presentation page of the new version is incorrect. It goes on the MP 1.24 thread.
    Thanks for this new release of MP. The link on the presentation page of the new version is incorrect. It goes on the MP 1.24 thread.
    We have just released MediaPortal 1.25 Final - Summer 2020 Edition Highlights of this release Bugfixes: [MP1-4966] - Update...
    Replies
    1
    Views
    3K
    Top Bottom