damienhaynes / moving-pictures

Moving Pictures is a movies plug-in for the MediaPortal media center application. The goal of the plug-in is to create a very focused and refined experience that requires minimal user interaction. The plug-in emphasizes usability and ease of use in managing a movie collection consisting of ripped DVDs, and movies reencoded in common video formats supported by MediaPortal.
12 stars 6 forks source link

Follwit sets the DBUserMovieSettings.RatingChanged to false #1021

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Install and set up Trakt Plugin (1.0.0.0)
2. Set up Follwit on Moving Pictures and for Moving Pictures to show rate 
dialog on watched
3. Watch a Movie and rate it

What is the expected output? What do you see instead?

Expect to have Trakt plugin receive the database update event with the 
RatingChanged boolean set to true, but instead it gets it as false so the 
rating isn't sent to Trakt.

Moving Pictures 1.1.4
Trakt 1.0.0.0

Original issue reported on code.google.com by onenotto...@gmail.com on 22 Jun 2011 at 2:16

GoogleCodeExporter commented 9 years ago
Problem stems from the fact that RatingChanged is a field of DBUserSettings 
when it really should be a parameter sent along with the event/delegate call 
notifying listeners of a DB update.

One approach for a fix would be to have some DatabaseTable level list of 
changed properties that the subclass is required to populate. Then the 
DatabaseManager when dispatching events could look at this list to provide info 
as a parameter to the listening classes.

Original comment by conrad.john on 22 Jun 2011 at 2:27

GoogleCodeExporter commented 9 years ago
Okay made the changes in r1323. Please take a look at the code changes. Trakt 
plugin should still compile properly against Moving Pictures code, but to get 
proper notifications you will have to make a few changes. Specifically you will 
need to begin listening to the ObjectUpdatedEx event instead of ObjectUpdated. 
This will give you the DBUserMovieSettings object as normal but also a metadata 
object that has info about which fields have changed. The old RatingChanged 
field in DBUserMovieSettings is now deprecated.

Please note the extension methods in TableUpdateInfoExtensions. Making use of 
these, your event handler should be able to work something like this:

private void DatabaseManager_ObjectUpdated(DatabaseTable obj, TableUpdateInfo 
updateInfo) {
    if (obj.GetType() != typeof(DBUserMovieSettings))
        return;

    if(updateInfo.RatingChanged()) {
        // do stuff
    }
}

Original comment by conrad.john on 30 Jul 2011 at 7:51