Database: Refactor MP1 database for multi seat usage (2 Viewers)

CyberSimian

Test Group
  • Team MediaPortal
  • June 10, 2013
    2,974
    1,854
    Southampton
    Home Country
    United Kingdom United Kingdom
    This does not make sense to me, we have a setting when to count video watched, and by default it is either 80% or 90%
    - Someone watched video > watched set to true only after 80% of film watched (from settings), times the some, percentage
    I just can't see the logic in that.
    Interesting discussion. I don't know what the right answer is, but I just wanted to mention that not everyone uses a threshhold of 80% or 90% to denote "watched". In particular, I use this property to identify the recordings that I have started watching, not the recordings that I have finished watching. So I have this threshhold set to 5%. :eek:

    I don't see much value in the "number of times watched", and the MP skin that I use (my own :D ) does not display this value. But I practise "record, watch, delete", and only occasionally keep a recording after I have watched it.

    -- from CyberSimian in the UK
     

    Anthony Vaughan

    MP Donator
  • Premium Supporter
  • June 25, 2015
    584
    292
    Home Country
    United Kingdom United Kingdom
    That's helpful to know.

    Of course, we are dependent upon what the skins do to determine what we see.

    But I think the underlying database should reflect the real world and the skins can manipulate what the database holds and what we see - rather than the database being manipulated (because we can't get the real world back once it's changed). Do you see where I am coming from?

    I see what you mean about the times watched field being, perhaps, unnecessary. But while it's there, I think it should do what it says - tell you how many times the video has been watched. When you reset the status all of the fields (times watched, percentage watched and watch status) are changed back to the default values. When you look at the list of videos, the underline shows you how far you are through the video. That value is the percentage watched and I cannot see the value in playing with the actual value in the database to be anything other than the real world. If it is decided that the skin should follow other rules, that's fine, but I strongly disagree with changing the data itself.

    Anyway, that's how I feel. What I have been doing is to get the database side of things to work in a multi-user environment - in a separate layer from the skin. I have done this for all of the main databases - FolderDatabase, MusicDatabase, PictureDatabase and VideoDatabase. I update the FanartHandler database when videos are deleted. I have done my utmost to separate the back-end (data) from the front-end (skin) so that you can manipulate how MP looks without affecting the underlying data.

    I have brought the database technology right up-to-date using Entity Framework and LINQ for the most part and the data is fully object-oriented. I have only used the old code where dynamic queries are essential. This means that I've been able to cache the data throughout and makes the application run very smoothly and efficiently. It has been a tremendous relief to me not to have to worry about synchronizing databases or not being able to resume from where I last left off watching a video. That issue has simply gone away.

    Obviously, if you want to adopt this code, this version will need thorough testing. I can test what I use, but I assume that there will be things other people do that I don't touch. There is no such thing as bug free code so I expect there will be issues for me to fix, though I've done my best to capture the main ones already. I am happy to fix any issues you come up with.

    So far, it looks like the extensions will only need to be recompiled against the new code - databases.dll and EntityFramework.dll and a few other DLLs that are LINQ related. I've also added a few NuGet packages. I will leave it to you to decide whether the extensions for which you no longer have code are of real importance to your users as against the advantages of this version. It might be best for me to recompile the extensions and for someone at your end to build the MPE1 files because that is beyond my competence. I think you'll be more likely to get them right than I would.

    Tony
     

    Anthony Vaughan

    MP Donator
  • Premium Supporter
  • June 25, 2015
    584
    292
    Home Country
    United Kingdom United Kingdom
    Hi CyberSimian

    It completely passed me by that the last message was from you. Good to hear from you and I value you user experience.

    I remember you saying there was a shortage of developers and, in the end, I decided to deal with the issues I had reported, myself - one of which was to make the database processing truly multi-user. Of course, I'm sort of doing this blind because I can't talk directly to the original developers. I've had to work out how the system works and guess at why it does what it does, by going through the code step by step. It's taken me about six months to arrive at a working solution.

    At the same time, I've changed some of the existing behavior to match what I had expected to see. For example, now, when I've started to watch a video, I have the color of the video in the list changing to white (which it didn't do before). Now I understand about the threshold I can change the code back and set the threshold to very low value. Honestly, I cannot see the point of a threshold (why wouldn't you want to know when you are half-way through a video?). But I'll stick with it.

    Like you, I tend to record, watch and delete. So, I've tightened up the back-end to get rid of any database records for videos that no longer exist as well as deleting records when you delete a video. This is all done in the background so you, as a user, don't notice it's happening.

    Would it be okay to ask you questions from time to time so I get this right?

    Tony
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    16,062
    11,143
    Kyiv
    Home Country
    Ukraine Ukraine
    Interesting discussion. I don't know what the right answer is, but I just wanted to mention that not everyone uses a threshhold of 80% or 90% to denote "watched". In particular, I use this property to identify the recordings that I have started watching, not the recordings that I have finished watching. So I have this threshhold set to 5%
    That's why there's a setting, and as soon as we've watched more than the specified percentage, we get the status that it's watched. And the percentage viewed is visible anyway.
    Why not just show what has actually happened?
    Well, I started watching the movie, I was interrupted in the middle. I didn't see the movie, but I got the status of having seen it. That's not right, because I didn't watch it. And when they went credits, it is already and will be 80-90% and here you can put a sign watched as this is the fact of viewing. For those who need a mark immediately, put 1% or 5% and get it when this threshold will be exceeded. All the more, the viewing status is synchronized with other services like Trakt.

    So far, it looks like the extensions will only need to be recompiled against the new code - databases.dll and EntityFramework.dll and a few other DLLs that are LINQ related. I've also added a few NuGet packages. I will leave it to you to decide whether the extensions for which you no longer have code are of real importance to your users as against the advantages of this version. It might be best for me to recompile the extensions and for someone at your end to build the MPE1 files because that is beyond my competence. I think you'll be more likely to get them right than I would.
    We could always include this or in a separate test release, put it in Area 51, but I'm not sure we'll find many people willing. Or include it in the PreRelease ...
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    16,062
    11,143
    Kyiv
    Home Country
    Ukraine Ukraine
    I remember you saying there was a shortage of developers and, in the end, I decided to deal with the issues I had reported, myself - one of which was to make the database processing truly multi-user. Of course, I'm sort of doing this blind because I can't talk directly to the original developers. I've had to work out how the system works and guess at why it does what it does, by going through the code step by step. It's taken me about six months to arrive at a working solution.
    As you give the final decision, then I can offer you to become a developer MP1, but here decides the team, not me, so the result is unknown.
    And I think we should move our discussion to another thread. Just haven't figured out which one yet... :)
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,974
    1,854
    Southampton
    Home Country
    United Kingdom United Kingdom
    I think that application design is partly based on what one would use oneself, and partly on how one thinks other people would use it. In the case of the watched threshhold, I think that the original designers of MP provided that for use with the "clean-up" action, where one of the choices is "delete all watched recordings". With pre-padding and post-padding on recordings, a fully-watched programme is never going to be 100% of the recording, but of course the exact amount that represents fully-watched will depend on how much pre-padding and post-padding the user has specified.

    I don't always watch a recording in one sitting, and I find it helpful to have an indication of which recordings I have started watching -- hence my use of a low watched-threshhold of 5%. But the consequence of this choice is that I can never use the "delete all watched recordings" action, because it will delete the partially watched recordings too. The original MP designers probably did not anticipate my use of watched threshhold, but that does not invalidate my use --- it just means that the original designers don't always think of everything.

    In an open-source application staffed by volunteers, it is inevitable that developers will join and later depart the development team, and the knowledge of why a particular feature was implemented in a particular way departs with them. Us Johnny-come-latelies then have to try to work out why some feature behaves the way that it does, and decide whether that behaviour was intentional or an accident. Although we may not be able currently to think of the intended use case, we need to be very careful about making an incomptible change. Improving the implementation in a way that does not change the externals is fine, but making incompatible changes to the externals requires great care, otherwise we risk annoying existing users who value the existing behaviour.

    I have never done any database programming. and I have no doubt that creating an optimal database design requires considerable expertise. It looks like we now have a contributor who has that expertise. (y)
    But we need to be sure that the benefits of the improved design do not remove or alter features that users value.

    I would be prepared to trial your new implementation, but although I am a "tester", I use none of the extensions that @ajs has been concerned about, and have only a single-seat installation, so my testing would be very "one-dimensional".

    -- from CyberSimian in the UK
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    16,062
    11,143
    Kyiv
    Home Country
    Ukraine Ukraine
    I have started watching -- hence my use of a low watched-threshhold of 5%
    But we have a progress bar.
    1635241079706.png
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,974
    1,854
    Southampton
    Home Country
    United Kingdom United Kingdom
    But we have a progress bar.
    But the progress bar in that skin is visible only for the item that has the focus. My skin shows this as a numeric percent (I have highlighted it with the red oval):

    watched_percent.jpg

    The different colour used for items where the watched percent exceeds the threshhold applies to all items in the list.

    -- from CyberSimian in the UK
     

    Users who are viewing this thread

    Top Bottom