Trakt for MP2 (1 Viewer)

Lehmden

Retired Team Member
  • Premium Supporter
  • December 17, 2010
    12,584
    3,973
    Lehmden
    Home Country
    Germany Germany
    Hi.
    This feature could be implemented in client plugin, sync code could run in background. Not sure how long it would take to submit hundreds of movies or thousands of episodes...
    Done this lately from within MP1 Trakt Plugin. Cleared Trakt Library and resync whole collection. Wasn't successful as I want to get rid of deleted movies and series, but this didn't work completely. But now I have lost my playcount also they are save inside TVSeries. I know why I preferred Follw.it... :mad: There you also can't get rid of deletes series but at least it will sync playcout properly. And you can set episodes to watched/unwatched manually in Webinterface. Didn't find this in Trakt (maybe I'm too blind to find). On Movies you can set this by hand, but on series you only can set a whole series to watched. Not really a desired behaviour. I easily can miss the social functions as they are way less in follw.it, but the main goal is working a lot better in follw.it than trakt. Trakt has way too much stuff I never needed but things I need are hard to find or not even possible at all..
    My Collection (1.150 Movies, 17.500 Episodes) takes about half an hour, probably a bit more but sure below one hour.
    Maybe I delete my account completely and create a new one, hoping then my playcount will be stored properly...
     

    ltfearme

    Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,760
    7,224
    Sydney
    Home Country
    Australia Australia
    Next thing what could be implemented without requiring changes to ML is the "check in" of your movies and episodes. This would required:
    • A query to ML for all Movies
    • Sending a request per item to trakt, incl. play count and "watched" (would be if playcount > 0)
    This way you would have a one-direction sync to trakt already.

    Only problem: this workflow process "all or nothing", as we don't locally save, what is known by trakt, we need to process the whole list at once.

    This feature could be implemented in client plugin, sync code could run in background. Not sure how long it would take to submit hundreds of movies or thousands of episodes...
    I think you mean "seen", "check in" is used to say you're watching something now like scrobble e.g. you check in to a movie at the cinema from your mobile app. I don't think you need to implement checkin's unless you want people to manually enter what they want to checkin to, hopefully you can do everything for the user automatically. Maybe the only place where it would be required is from TVGUIDE where metadata might not be the best.

    When sending "seen" state to trakt, it does not set the playcount online, Playcount is incremented online when you scrobble something (if you delete it online, then you loose it online). As you can see the two methods for syncing seen do not have playcount field:
    * http://trakt.tv/api-docs/movie-seen
    * http://trakt.tv/api-docs/show-episode-seen

    In the next version of the trakt API, it will allow you to send multiple play dates per movie and episode so that will effectively allow you to send the playcount from client to trakt.

    The movie seen sync on a 2000 movies collection will take about 10secs (maybe less), it depends if movies are already available on trakt. You could batch the sync into 500 movies per group. For episode syncing, the current trakt API only supports sync for 1 tvshow at a time (with an array of episodes), in MP1 sync we put a delay of 2secs per show to sync (but you could probably get rid of that). There shouldn't be any noticeable time to sync shows/episodes, so for 200 shows (10000 episodes) maybe estimate 2secs per show i.e. 400 secs.

    The next time you sync, you can first pull what trakt already has seen or in your collection and only sync the difference. Alternatively there is the activity api which allows for better incremental sync's. Getting back your complete data from trakt for seen,watched doesn't take long, I usually see 4secs for all about 2000+ movies. There is activity methods you can use instead for incremental retrieval e.g. only get back what has changed in the last day. I prefer to be more thorough and just get back everything so nothing is missed.

    When getting your current online state (watched, playcount etc) you can set that locally if you want. For movies you can use the following method to get collected, watched, playcount state etc:
    http://trakt.tv/api-docs/user-library-movies-all

    For episodes, you need to make a few calls, one for watched and one for collected (neither have playcount):
    * http://trakt.tv/api-docs/user-library-shows-watched
    * http://trakt.tv/api-docs/user-library-shows-collection

    If you wanted to sync episode playcount back to client then you would need to make an episode detail method call which would be expensive as it would be per episode:
    http://trakt.tv/api-docs/show-episode-summary

    There might be another method available for episode playcounts (not sure), I dont sync playcounts to client in MP1 yet, only let trakt increment it based on how many times you scrobble. Nothing stopping you though ;)

    For ratings sync to client we use the following methods in MP1 to get current ratings:
    * http://trakt.tv/api-docs/user-ratings-shows
    * http://trakt.tv/api-docs/user-ratings-movies
    * http://trakt.tv/api-docs/user-ratings-episodes

    and to send ratings:
    * http://trakt.tv/api-docs/rate-episodes
    * http://trakt.tv/api-docs/rate-movies
    * http://trakt.tv/api-docs/rate-shows

    Again, you can work out the difference of what to send if persisting ratings locally.
     
    Last edited:

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,070
    7,459
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #43
    I think you mean "seen", "check in"
    Yes, you are right. I still need to get used to all terms ;)

    You are right, sync of library is very quick: I just implemented this for movies, it processes ~170 items in under 10 seconds (including media item query from MP2-Server over network).

    [2014-03-11 21:21:57,405] [17298 ] [InputMgr ] [INFO ] - Trakt.tv: Synchronized 'library': 6 inserted, 141 existing, 0 skipped movies.
    [2014-03-11 21:21:58,551] [18443 ] [InputMgr ] [INFO ] - Trakt.tv: Synchronized 'seen': 5 inserted, 3 existing, 0 skipped movies.

    I implemented it this way:
    • For movies I have in ML that are not yet watched (playCount==0), I use "library" call. So that they are made known to trakt.
    • For movies that are watched (playCount > 0), I use "seen" call.

    Is this correct?

    Next thing will be Series, here the match quote will be lower, because we don't store ID fields yet and depend on name. I tested with "Akte X", it was not found (original: "The X Files"). But this will change with upoming aspect reworks.
     

    ltfearme

    Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,760
    7,224
    Sydney
    Home Country
    Australia Australia
    I implemented it this way:
    • For movies I have in ML that are not yet watched (playCount==0), I use "library" call. So that they are made known to trakt.
    • For movies that are watched (playCount > 0), I use "seen" call.

    You want to use the library call to indicate that it's in your collection i.e. you have a physical media item related to it like a Disc, File etc. So library can include items with playcount >= 0. Are you able to get back all media items where file reference is not null? This would be the most ideal query, you dont need to worry about if its watched for the library call.

    You can use the seen call for every item in your database that has a playcount > 0 regardless if it has a local file reference.

    Hopefully that makes sense, maybe in MP2 you don't have a concept of a mediaitem without a file, in which case the query for for library requires no filtering.
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,070
    7,459
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #46
    You want to use the library call to indicate that it's in your collection i.e. you have a physical media item related to it like a Disc, File etc. So library can include items with playcount >= 0.
    Ah, it was late yesterday... ;) The first pass would need to send all local movies using "library" call, only second call would consider "watched" flag to use "seen"...
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,070
    7,459
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #47
    I now also added series support (with mentioned limitations for now). As result my library got registered and what was "seen" is also registered :D

    Another good news: we got an own API key for MP2. Now the world can see MP2 as own product listet (what out the :D):
    07_series_scrobble.png
     

    ltfearme

    Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,760
    7,224
    Sydney
    Home Country
    Australia Australia
    Just out of curiosity does MP2 appear under http://trakt.tv/community/watching/mediaportal when watching? Would be interesting to know if you see the MP2 logo now that trakt.tv have it.

    Note: I noticed you marked your profile as private so I think it might be hidden from that page, I can't recall.

    I'm following you now, feel free to follow me back and become friends...lol.
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,070
    7,459
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #49
    Just out of curiosity does MP2 appear under http://trakt.tv/community/watching/mediaportal when watching?
    No, it's not listed under MP. The link on "MP2" title refers to "http://trakt.tv/downloads/mediaportal-2", which gives a 404. I got an email from Justin where he wrote:
    With the upcoming trakt 2.0 website release this summer, we are still working on the details for how we'll display apps and their dedicated pages. So, I don't know for sure what we're doing just yet. I want to still feature the apps as much as we can and balance that with the work required to maintain custom pages. I'm hoping we can go the route of self service, so you would be able to maintain the info and screenshots for your own app.
    Thanks for working on the new plugin!
    So we probably we will be able to provide content for describing MP2.
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,070
    7,459
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #50
    I changed the synchronizing to Trakt to asynchronous, added status labels and improved the dialog handling. I also inluded trakt status images as preview:
    08_Extended_Setup.jpg

    Not sure what else could be added as this time:

    From the short term list I could implement
    Rate Dialog, automatic after an episode/movie is watched or user invoked.

    Synchronizing back from Trakt to MediaLibrary in principle could be done by a server plugin, but if I do it now it would be obsolete after Importer rework. So I postpone this part.
     

    Users who are viewing this thread

    Top Bottom