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

Anthony Vaughan

MP Donator
  • Premium Supporter
  • June 25, 2015
    584
    292
    Home Country
    United Kingdom United Kingdom
    I don't even know how to explain it. The symlink/hardlink to the file is described in the Microsoft knowledge base.
    But the folder can look like this:
    file1.avi
    file2.avi
    file3.cd1.avi
    file3.cd2.avi
    file3.cd3.avi
    file4.avi ---> symlink/hardlink ---> other HDD, or network drive on other host
    file5.avi
    I think we may be talking at cross-purposes here. Are you saying there can be .avi files in the movies table of the VideoDatabaseV5.db3, because I've never seen anything like that there.
    You keep talking about folders, but I am talking about database records where the original file no longer exists and this only deletes only happen when you go into Videos in MP1 and they only happen to database records, not disk files.

    Here it is difficult to provide for all options, so just delete what is not there at the moment is a bad solution, you have to do a lot of checks, etc. That's why automatic deletion is not the best solution. And the easiest solution is to let the user delete it himself. By hand.
    The deletes are not automatic.

    I am mystified by the confusion here. I am talking about deleting redundant database data and only when you go into a folder using MP1.
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    16,060
    11,141
    Kyiv
    Home Country
    Ukraine Ukraine
    You keep talking about folders, but I am talking about database records where the original file no longer exists and this only deletes only happen when you go into Videos in MP1 and they only happen to database records, not disk files.
    That's what I'm talking about, going into Video, analyzing the files, and deleting the database entries. But if the file is just not available at the moment, then we deleted the necessary data. This is not exactly what the user expects. It seems to me that there should be a setting here for the user to decide for himself whether it suits him or not.
    I think we may be talking at cross-purposes here. Are you saying there can be .avi files in the movies table of the VideoDatabaseV5.db3, because I've never seen anything like that there.
    File extensions in the database can be any, firstly it is configurable, and secondly .avi still occur, in home archives
    I am mystified by the confusion here. I am talking about deleting redundant database data and only when you go into a folder using MP1.
    That's what I'm talking about. The absence of a file does not always mean that its entry must be deleted.

    Example:
    1. The file was received via torrent. Name is file.mkv
    2. The torrent has updated this file (added subtitles or something else).
    3. 3. The file starts updating and the name is: file.mkv.process or file.mkv.parted or file.mkv.something
    4. We went into plugin MyVideo, and since there is no file named file.mkv, we deleted its entry.
    5. The file is updated, and its name is again file.mkv, but there is no record, so we have to scan again to add this file, but in this case we lose the number of views, viewing status and other information.
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    16,060
    11,141
    Kyiv
    Home Country
    Ukraine Ukraine
    This can also be the case with files that are added via a link (symlink/hardlink).
    Example:
    1. File is added via a link and has the name file.mkv
    2. We reboot remote computer with this file.
    3. The system detects that it is not available and hides it from the listing.
    4. We went into plugin MyVideo, and since there is no file named file.mkv, we deleted its entry.
    5. The computer restarted and the file is in the listing again, but there is no record, so we have to scan again to add this file, but we lose the number of views, viewing status and other information.
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    16,060
    11,141
    Kyiv
    Home Country
    Ukraine Ukraine
    By the way, are movies with files in the stack handled normally?
    Ie Some Movie -> some.movie.file.CD1.mkv, some.movie.file.CD2.mkv, some.movie.file.CD3.mkv ...
     

    doskabouter

    Development Group
  • Team MediaPortal
  • September 27, 2009
    4,656
    3,124
    Nuenen
    Home Country
    Netherlands Netherlands
    Here's an example of what I mean using SQLClient:

    SQLiteResultSet resultSet;

    using (m_db = new SQLiteClient(GetDatabaseName()))
    {
    resultSet = m_db.Execute(strSql);
    }

    return resultSet;

    At the end of the using scope, the connection is released.

    That does not mean that m_db is closed it just means that any locks are released.

    I don't know anyone nowadays that doesn't think that this is the way to go.

    Google it :)
    Not wanting to be a nuisance but I couldn't help myself creating a small testcase
    1000 queries with using new sqlite: 2 seconds (db on a fast local ssd), 1000 queries inside the using
    Code:
                    using (var sql = new SQLite.NET.SQLiteClient(@"D:\klad\sqlitetest\sqlitetest\PictureDatabaseV3_1.db3"))
                    {
                        for (int i = 0; i < 1000; i++)
                        {
                            var res = sql.Execute("select * from picturedata where idpicture=3856");
                        }
                    }
    half a second.
    So I can imagine that there could be some systems (slow spinning rust f.e.) where this is could be slow...

    Edit: and I can remember (was it you @ajs with your enormous picturedatabase or was it that guy with the large music) that we even had to cut off queries halfway because they took too long...
     

    Anthony Vaughan

    MP Donator
  • Premium Supporter
  • June 25, 2015
    584
    292
    Home Country
    United Kingdom United Kingdom
    Wouldn't the simplest way to deal with this be for you, at some point, to test the app for those scenarios - to confirm, or otherwise what you are worrying about.

    I'm not understanding the issue because I need to see a concrete example of what you are describing; as I've never come across anything like it. Then I'll understand how to deal with the issue. There is always a solution that works well for everyone. I just need to get my head around all of the possibilities :)

    The same goes for stacking. I have never used stacking so I don't understand how it works and why you need it. The code still does what it always did but it would be helpful for me to understand stacking because I suspect it is not being handled as efficiently as it should be.
     

    Anthony Vaughan

    MP Donator
  • Premium Supporter
  • June 25, 2015
    584
    292
    Home Country
    United Kingdom United Kingdom
    Support for this feature probably affects the recordings database, which I think is separate from the video database? If so, it does not directly affect the design or processing of the video database, unless you were anticipating using the same database structure for both databases.
    Can I just check. Are you familiar with DB Browser for SQLite? This is a free tool you can use to look at the data in your client databases.
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    16,060
    11,141
    Kyiv
    Home Country
    Ukraine Ukraine
    The same goes for stacking. I have never used stacking so I don't understand how it works and why you need it.
    A single movie can consist of multiple DVDs, Blu-Rays, or files. Therefore, a mechanism for processing such information is made. There is only one movie in the database, but the file table contains all its files from 1 to H. And MP1 counts the duration and other data for these files. At the beginning of viewing there is a choice from which part to watch, etc.
    Many people use this, and it cannot be broken. You can experiment yourself by making 2 files for the movie.
     

    Users who are viewing this thread

    Top Bottom