[Deprecated] WatchedSynchronizer (1 Viewer)

popy

MP Donator
  • Premium Supporter
  • July 3, 2011
    617
    141
    THX for this.
    MPSync also hasnt worked for me and always destroyed my DBs.
    My setup is the same as yours and also i am coping the DBs from the server to the clients on boot.
    Would be really nice if ill could use this and remove trakt.

    Will test it and report back.

    pOpY[DOUBLEPOST=1422258562][/DOUBLEPOST]Just on question:

    Do you "buffer" watched-flags/time changes and sync it again if the server db was locked the first time?
    If not this would be nice. Just an idea:

    • 1. Buffer the changes in an concurrent queue (thread safe)
    • 2. a worker thread syncs the changes to the master
    • 3. if master db is not locked -> lock it -> sync open changes -> release the lock -> remove it from concurrent queue
    • or 4. if master db is locked -> wait a few seconds -> try again 3.
    will the changes be synced also on shutdown?
    I am thinking on this scenario:

    • master db is locked -> changes will be sheduled a few seconds back
    • User is pressing shutdown -> will changes be lost?
    Another question: will Moving Pictures supported :rolleyes:

    Thanks for bringing this plugin, after the shutdown of follw.it i have waited long for this, because trakt isnt working stable (dont get me wrong,
    ltfearme is doing a great job, but the trakt api v2 and servers are unstable).
    This is what MP is missing....

    thx
    pOpY
     
    Last edited:

    antihero05

    Portal Member
    January 12, 2015
    9
    17
    Home Country
    Germany Germany
    Hi popy,

    here the answer regarding your questions:

    Regarding the caching:
    This is currently only in use for the TVSeries database since I needed to create the SQL statements on my own. The idea behind the cache is to reduce the number of database queries.
    For example I get the unique_id of the episode,season and series by the filepath of the video file. If you now for example stop playback an event is triggered which writes the watched information and related to the database. If you now continue and stop again or finish the playback it is not necessary to access the database to get the unique_id again. This unique_id does not change during playback so I cached it.
    Writes are currently done immediatly - So no problems with the shutdown scenario you were thinking about.

    When accessing the video database there is no caching since I just "injected" a other database and use the default methods of the respective classes.

    Regarding the locking I am more or less relying on the SQLlite library.
    Your suggestion of implementing some sort if queue which is handled by a separate thread is something I already thought about during my initial coding. The issue I need to investigate on is the lock detection of the database since sqlite is not the best regarding that. Well my databases did not get corrupt since I use the plugin so I have it not done yet. But this is something I absolutely want to do in the future, but at the moment and next few weeks I am very busy at work so hardly time for coding in the freetime.

    Regarding Moving Pictures:
    I don't use that plugin so I did not have a look at it yet. When I have more time I will definetly have a look at it and take steps to support it but handling the synchronizing in separate threads will be coming first.

    Hope this answers your question.

    Best Regards,
    Max
     

    popy

    MP Donator
  • Premium Supporter
  • July 3, 2011
    617
    141
    Hi popy,

    here the answer regarding your questions:

    Regarding the caching:
    This is currently only in use for the TVSeries database since I needed to create the SQL statements on my own. The idea behind the cache is to reduce the number of database queries.
    For example I get the unique_id of the episode,season and series by the filepath of the video file. If you now for example stop playback an event is triggered which writes the watched information and related to the database. If you now continue and stop again or finish the playback it is not necessary to access the database to get the unique_id again. This unique_id does not change during playback so I cached it.
    Writes are currently done immediatly - So no problems with the shutdown scenario you were thinking about.

    When accessing the video database there is no caching since I just "injected" a other database and use the default methods of the respective classes.

    Regarding the locking I am more or less relying on the SQLlite library.
    Your suggestion of implementing some sort if queue which is handled by a separate thread is something I already thought about during my initial coding. The issue I need to investigate on is the lock detection of the database since sqlite is not the best regarding that. Well my databases did not get corrupt since I use the plugin so I have it not done yet. But this is something I absolutely want to do in the future, but at the moment and next few weeks I am very busy at work so hardly time for coding in the freetime.

    Regarding Moving Pictures:
    I don't use that plugin so I did not have a look at it yet. When I have more time I will definetly have a look at it and take steps to support it but handling the synchronizing in separate threads will be coming first.

    Hope this answers your question.

    Best Regards,
    Max

    thx max for clearing things up!!!!!!!
    Will try your plugin as soon as possible. and report back.

    pOpY
     

    popy

    MP Donator
  • Premium Supporter
  • July 3, 2011
    617
    141
    Have tested the plugin and ill must say, this is the only feature i am missing in MP :p
    no syncing with any online DB, just sync the watched states locally on my server/clients!

    This are my results (just tested from one client):
    • Play episode on MPTVSeries on client, press stop -> server db gets updates with watched state and "stoptime", nice
      • QUestion: Are you able to resume from the last position in MPTVSERIES?
        I havent found no option in the MP config tool nor in the MPTVSERIES config tool, It also doesnt work for me.
        Dont get me wrong the stoptime is saved locally by the MPTVSERIES plugin and synced to master DB on server with your plugin.

        Ex.: When ill press "enter" again on the same episode which i have stopped at ~15:00 minutes before, it just starts from the beginning @ 00:00.
    • When ill set an epsiode as unwatched/watched (toggle the flag) in the GUI it doesnt get synced to the master DB. I am using this often to toggle watched states when i was sleeping last night at some episodes :ROFLMAO::sleep: To reproduce just right click on an episode (or use remote submenu button) in MPTVSERIES to get the little popup menu and there you can toggle the watched state.

      I have found a plugin called MyShows on googlecode. In there is an hook to get the toggle event from MPTVSERIES.
      Link: https://code.google.com/p/mptvseries/issues/detail?id=578
      At the bottom is the source code.
      With this example it should be possibe to get the series ID and data to toggle the wacthed flag in the masterdb ;)

      Would be nice if this also gets implemented into your plugin
    Keep up the good work!
    pOpY
     

    antihero05

    Portal Member
    January 12, 2015
    9
    17
    Home Country
    Germany Germany
    Hi you two,

    regarding MovingPictures I will just quote another post from me:
    Regarding Moving Pictures:
    I don't use that plugin so I did not have a look at it yet. When I have more time I will definetly have a look at it and take steps to support it but handling the synchronizing in separate threads will be coming first.

    regarding the issues mentioned by popy:
    1. Yes I am able to resume TVSeries I stopped some time. When I try to (re)start the playback it get a dialogbox asking if I want to resume or start from the beginning. This is also working with databases I synchronise using WatchedSynchronizer.
    The behaviour you describes seems strange. I can't remember doing any special configuration and got the experience I described by default.
    2. I did not think of the possibility to set media files watched/unwatched when I created the plugin. To be honest I was not even aware of that functionality when I created the plugin. Just discovered the feature about a month ago.

    I enhanced WatchedSynchronizer to handle these events triggered by MPTVSeries and did some smaller bugfixes regarding MPTVSeries.

    But I have to admit the issue still persists with MPVideo database as well. I hope to find some time fixing it for the MPVideo database as well during next week. Should be possible because it is presumably be done in a few hours including testing.

    Best Regards,
    Max
     
    Last edited:

    popy

    MP Donator
  • Premium Supporter
  • July 3, 2011
    617
    141
    thx max for the quick update.

    1. will look at it ... really strange .. there is no popup for me.
    2. will test and report back

    pOpY
     

    popy

    MP Donator
  • Premium Supporter
  • July 3, 2011
    617
    141
    Update: Have tested it with two clients and it works now!!!! big THX

    Is there anything in the pipeline regarding threading?
    I am asking because i am thinking of support this great plugin and have a look at the source and try to implement it ;)

    Now the plugin will run on my 4 clients in an test -> also the WAF will be analysed :D

    pOpY
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    15,496
    10,377
    Kyiv
    Home Country
    Ukraine Ukraine
    As the plugin name suggest the plugin focuses on synchronizing the watched status of your media accross several databases.
    Did not plan to make the improved analogue MPSync? To synchronize fully all databases that are in the folder media portal for all HTPC?
     

    popy

    MP Donator
  • Premium Supporter
  • July 3, 2011
    617
    141
    As the plugin name suggest the plugin focuses on synchronizing the watched status of your media accross several databases.
    Did not plan to make the improved analogue MPSync? To synchronize fully all databases that are in the folder media portal for all HTPC?

    MPSync does work in an other way.
    Comparisation (please correct me max if i am wrong):

    • MPsync
      • Works with triggers and own tables to completely sync all data in the selected dbs
      • Suppports folders (thumbs)
      • in my case the dbs was corrupted after some time and it doesnt work stable
    • WatchSyncronizer
      • It hooks the stop and toggle watchedflags events of videos/tvseries and directly open the dbs on the server and set/reset the watched flag.
        It doesnt touch any other data!
      • The folder syncronisation (thumbs & dbs) you have todo manually at boot of the htpc
        • in my case i am using syncbackse to copy over the thumbs, dbs from the server to client at boot.
      • Watched syncronizer works for me ;)
    pOpY
     

    Users who are viewing this thread

    Top Bottom