Sync databases by Media Sync Service (1 Viewer)

ajs

Development Group
  • Team MediaPortal
  • February 29, 2008
    15,492
    10,371
    Kyiv
    Home Country
    Ukraine Ukraine
    • Thread starter
    • Moderator
    • #21
    I need sync all this DBs
    upload_2019-2-14_21-19-45.png
     

    Anthony Vaughan

    MP Donator
  • Premium Supporter
  • June 25, 2015
    566
    292
    Home Country
    United Kingdom United Kingdom
    Hi ajs

    The Media Sync Service does synchronize all movie information in one VideoDatabaseV5.db3 with other VideoDatabaseV5.db3 files; well, it does for me anyway.

    As I said, I am only interested in synchronizing VideoDatabaseV5.db3. It seems like this will not be enough for your needs.

    Sorry about that.

    Tony
     

    Anthony Vaughan

    MP Donator
  • Premium Supporter
  • June 25, 2015
    566
    292
    Home Country
    United Kingdom United Kingdom
    Hi ajs

    I have some time to look at syncing other MediaPortal databases than VideoDatabase5.db3.

    Just to be clear, my syncing app does not simply copy a .db3 file that has been updated in one folder to all other relevant folders. My app programmatically ensures that all of the data in the changed database is up-to-date. This approach takes quite a bit of coding and is not trivial.

    Therefore, I need to know what databases you REALLY need to synchronize because it will take me some time to program.

    I am going to start with the FolderDatabase3.db3 because I only need to update two tables.

    If you want me to have a go at your databases please let me know which ones to look at first and I'll get back to you - don't forget to let me know which app uses each database so I'll know how to load it into my system.

    Update: I forgot to mention that my sync app also maintains the VideoDatabaseV5.db3 database; i.e. when physical video files or folders are deleted, references to those files/folders in the VideoDatabaseV5 database are also deleted. I notice that FolderDatabase3.db3 on my system have many references to non-existent files and folders, so I'll have to ensure that only current files and folders remain in the database. The FanartHandler.db3 database has a similar issue and I also have found numerous images on my hard drives related to films that I have actually watched and deleted.

    Tony
     
    Last edited:

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    15,492
    10,371
    Kyiv
    Home Country
    Ukraine Ukraine
    • Thread starter
    • Moderator
    • #24
    Therefore, I need to know what databases you REALLY need to synchronize because it will take me some time to program.
    It is not strange all the databases. When there are 4 HTPCs, I want flexibility and convenience. :):whistle::coffee:
     

    Anthony Vaughan

    MP Donator
  • Premium Supporter
  • June 25, 2015
    566
    292
    Home Country
    United Kingdom United Kingdom
    I just want to be clear about what I have been saying about synchronizing the SQLite databases in MediaPortal1.

    The easy way to synchronize client databases across more than one client is to use file watchers on the client folders to detect changes to the database last write time and to copy the changed databases to all of the other client folders. This would be fine if MediaPortal1 didn't lock the databases - you could simply code for any databases changed to be passed forward to all clients. This would be simple, easy and quick to code, and will work, so long as you never run more than one client at the same time.

    However, MediaPortal1 locks the VideoDatabaseV5.db3 database for example, once it has been invoked, throughout the entire client session. The effect of this is that, when two or more clients are accessing MediaPortal at the same time, lets call them Client1 and Client2, Client1's changes will be locked when Client2 closes thus preventing Client2's changes being copied to Client1 (because Client1s files are locked). When Client1 closes, its changes will then overwrite the Client2 databases effecting losing all of the changes recently made by Client2.

    My solution to this was to copy all changes made by Client1 and Client 2 to a separate (Sync) database and to copy the changes in the Sync database back to the client databases when the client session closes. If a client is open when another client closes, the changed database files are copied to a queue folder instead of directly to the clients and updates all client databases as soon as no clients are running (i.e. when there are no locks). This solution involves a lot of coding. I've been running my solution for at least a year and a half and it works pretty well. This solution is truly multi-user compliant.

    If there is a better, and easier, way to overcome this multi-user issue then I'm all ears.

    In the meantime, I am going to start using Fanart and intend to extend the databases I will cover in my app from just VideoDatabaseV5 to include FolderDatabase3 and FanartHandler.

    I am happy to use this system just for myself, but I thought I would be friendly and offer it to anyone else who might be interested. I don't need anyone to be a tester. But this will not be a perfect solution for everyone, so please understand that. I will only offer what I am personally interested in using and developing.

    Tony
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    15,492
    10,371
    Kyiv
    Home Country
    Ukraine Ukraine
    • Thread starter
    • Moderator
    • #26
    to detect changes to the database last write time and to copy the changed databases to all of the other client folders
    DB Locked, how copy when all client work, but i add NewMovie to DB?
    My solution to this was to copy all changes made by Client1 and Client 2 to a separate (Sync) database and to copy the changes in the Sync database back to the client databases when the client session closes. If a client is open when another client closes, the changed database files are copied to a queue folder instead of directly to the clients and updates all client databases as soon as no clients are running (i.e. when there are no locks). This solution involves a lot of coding. I've been running my solution for at least a year and a half and it works pretty well. This solution is truly multi-user compliant.
    Like MPSync, but MPSync, sync changes on fly, from master to server and from server to slaves ... But I would like to be from a master and a slave. So that the changes on any computer are immediately synchronized through the database on the server to other computers. :coffee:
     

    Anthony Vaughan

    MP Donator
  • Premium Supporter
  • June 25, 2015
    566
    292
    Home Country
    United Kingdom United Kingdom
    Like MPSync, but MPSync, sync changes on fly, from master to server and from server to slaves ... But I would like to be from a master and a slave. So that the changes on any computer are immediately synchronized through the database on the server to other computers. :coffee:

    That's exactly what my app does. It updates clients in real time. The down-side of that is that you need to have the machine running the sync app up all the time. BTW, I recommend that that machine not be the TV Server machine because the TV Server uses a lot of resources.

    Tony
     

    Users who are viewing this thread

    Top Bottom