[Plugin] CentralizedDatabase

Discussion in 'MediaPortal 1 Plugins' started by popy, February 8, 2015.

  1. popy
    • Super User

    popy Super User

    Joined:
    July 3, 2011
    Messages:
    617
    Likes Received:
    83
    Ratings:
    +141 / 2
    Show System Specs
    First!! thx @antihero05 for the idea and the WatchedSyncronizer plugin which is deprecated with the release of CentralizedDatabase. I have ask him for permissions to deprecated WatchedSyncronizer, and he agreed because lack of freetime to work on the plugin. Read the whole story here .


    Description of the plugin:

    CentralizedDatabase is a window plugin that synchronizes several informations across your MediaPortal databases/folders. As the plugin name suggest the plugin focuses on synchronizing the watched status of your media and folders (thumbs) accross several clients.This includes extended information like the time you stopped the playback. This is responsible for the watched percentage displayed in MediaPortal.

    This plugin is intended for setups that have a centrally stored master database and multiple clients with their own databases. It is recommended to configure the master database as an database to be synchronized from each client. If you watch some media on one of the clients the watched status gets synchronized to the master database and is available for all other clients as well. Also there is a feature "Copy at startup" which copies the database/folders on MP client start from the centralized storage to your client. So anytime you start you client all databases are immediately in sync.

    As a result it does not matter on which client you watch some media since the status is always synchronized across other databases. You keep consistent track of what you already watched and have centralized place (server) where you can add movies & series.

    Currently supported Objects for synchronizing:

    • MPVideo database
    • MPTVSeries database
    • MovingPictures database
    • Folders
    • Folders with deletions

    How it works:

    CentralizedDatabase works a little bit different as other solutions.
    It copies every configured databases & folders (thumbs...) at startup of MP from the server (central storage) to the local client. When the user watching a movie/series it listens to the following events:
    • User stopped the movie/series
    • The current movie/series has ended
    • User marking a movie/series as watched/unwatched in the GUI
    Whenever it receives such an event, it writes the nedded information (resume time, watched flag status....) back to the server database. The delay is <1 second.
    Now you can watch a movie in the living room, stop it, go to the bed room and continue watching at the same time you stopped it in the living room.

    Another benefit is, you have a central place (server) where you can administrate your series/movies (configuration tools from the plugins). The new data will be copied over to the clients on every startup (if configured).


    Here is a littel graphic which shows, what i am trying to explane :p :
    en_sync_schema.png

    Unsupported Features of Moving pictures:

    Configuration:


    The configuration is done in an simple manner where you just select the sync object type (database or folder) and specify a file/folder (UNC is of course possible). If you select "SyncFolder" as type, you also must specify an local destination directory. There is currently no verification if the specified file matches the selected database type --> Unhandled crashes are likely on faulty configurations. This will maybe addressed in the future.

    Dample Config of my clients:
    2557.png


    Background for plugin:

    The primary reason why I created the plugin was that I had problems with my environment setup. I have the need for two separate MediaPortal installations. One on my notebook and one on my server which has a beamer connected to a HDMI port and is hosting the TV Server.
    My first attempt was working with a single remote database which both installations work on. This did not work out as it happened quite often that the database went corrupt to some simultanus modifications. The next step was working with separate database which were fetched from a central master on each start of the MediaPortal client. This did work but the watched status got lost since there was no synchronization with the master.



    Since at that time no plugin provided the functionality I required I decided to create one myself. My intention was to hook on the update command executed after a playback was stopped and to send it to multiple databases. Due to my experience I also paid attention to open the databases as short as possible to prevent corruption.

    Download and Source:

    Download

    Source
     
    Last edited: February 9, 2015
    • Like Like x 3
    • Thank You! Thank You! x 3
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. Edalex
    • Premium Supporter

    Edalex Community Plugin Dev

    Joined:
    January 3, 2008
    Messages:
    2,909
    Likes Received:
    713
    Gender:
    Male
    Location:
    Saratov
    Ratings:
    +1,232 / 9
    Home Country:
    Russian Federation Russian Federation
    Show System Specs
  4. popy
    • Super User

    popy Super User

    Joined:
    July 3, 2011
    Messages:
    617
    Likes Received:
    83
    Ratings:
    +141 / 2
    Show System Specs
    Sorry i didnt know about this in area51.
    I have searched for a name which starts lower than "M" in abc, because my plugin must load before MovingPictures and MPTVSeries.
    This was the the name i have choosen which describes what is does and fit my needs regarding first char in name.

    pOpY
     
  5. HomeY
    • Team MediaPortal

    HomeY Test Group

    Joined:
    February 23, 2008
    Messages:
    6,460
    Likes Received:
    2,627
    Gender:
    Male
    Occupation:
    Network Engineer
    Location:
    ::1
    Ratings:
    +4,737 / 16
    Home Country:
    Netherlands Netherlands
    Show System Specs
  6. popy
    • Super User

    popy Super User

    Joined:
    July 3, 2011
    Messages:
    617
    Likes Received:
    83
    Ratings:
    +141 / 2
    Show System Specs
    Hey HomeY (nice word combination :p)

    MPSync tries to sync the whole database with triggers.
    In my case it ended with messed databases everytime i tried it.
    Dont get me wrong, maybe i have done something wrong, or it was just a faulty setup, but it hasnt worked for me.

    CentralizedDatabase works a little bit different (see OP post, i have updated it).
    This way, the chance to get a corrupted database is very very low.

    pOpY
     
    • Thank You! Thank You! x 1
  7. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    9,034
    Likes Received:
    2,881
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,961 / 30
    Home Country:
    Ukraine Ukraine
    Show System Specs
    This plugin does not synchronize data changes on the fly, just at the start. I understand.
     
  8. popy
    • Super User

    popy Super User

    Joined:
    July 3, 2011
    Messages:
    617
    Likes Received:
    83
    Ratings:
    +141 / 2
    Show System Specs
    Data changes: added movies, series, thumbs on the server will be syncronized at client startup of MediaPortal.
    But in my case this is no problem because i am using SSDs in every HTPC so the boot time is really really fast.
    WatchedState Changes will be synced back to the master DB on the fly.
    So the changes are ready for the next client boot ;)
    Please take a look at the graphic i have added to the OP.

    I am also thinking to support standby/resume -> so on resume the data initial datasync is done again....

    pOpY
     
    Last edited: February 9, 2015
  9. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    9,034
    Likes Received:
    2,881
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,961 / 30
    Home Country:
    Ukraine Ukraine
    Show System Specs
    This is inconvenient, when adding a new film, in MyVideo plugin, you must reboot all computers. :(

    Too much action. Ideal. Synchronize all the data as well as you sync status review. :cool:
     
  10. popy
    • Super User

    popy Super User

    Joined:
    July 3, 2011
    Messages:
    617
    Likes Received:
    83
    Ratings:
    +141 / 2
    Show System Specs
    Sorry i meant: But in my case this is no problem because i am using SSDs in every HTPC so the boot time is really really fast. :p
    How do you work: Shutdown or standby and resume?
     
  11. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    9,034
    Likes Received:
    2,881
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,961 / 30
    Home Country:
    Ukraine Ukraine
    Show System Specs
    Or shutdown, or run continuously.

    I have the same SSD, but a reboot is superfluous gesture. So while using MPSync.
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!