fuzeman / trakt.py

Python interface for the Trakt.tv API

Home Page:http://traktpy.readthedocs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I add an episode/movie to history with `watched_at='released'`?

mrmachine opened this issue · comments

I'm struggling to decipher how to use this library from the API docs.

I had to dig into the examples module just to find out how to authenticate, and copy/paste the examples.helpers.authenticate function somewhere locally to do it. Not sure why this helper isn't included in the main package, and mentioned in the README which only configures the client?

But that's a side issue. Now that I'm authenticated, I'm looking for a way to "add" a "play" to my trakt history, specifically with watched_at='released'. I don't see any examples for Trakt['sync/history'].add() in the examples package.

After getting an episode that I want to add (as e), I tried the following:

In [25]: Trakt['sync/history'].add({'shows': [{'ids': {'trakt': e.id}}]})                                                                                   
Out[25]: 
{'added': {'movies': 0, 'episodes': 0},
 'not_found': {'movies': [],
  'shows': [{'ids': {'trakt': 5885625430}}],
  'seasons': [],
  'episodes': [],
  'people': []}}

It says zero episodes added. So I tried:

In [31]: Trakt['sync/history'].add({'shows': [e.to_dict()]})                                                                                                
Out[31]: 
{'added': {'movies': 0, 'episodes': 24},
 'not_found': {'movies': [],
  'shows': [],
  'seasons': [],
  'episodes': [],
  'people': []}}

This says 24 epsodes added, but no corresponding play for the single episode I tried to add is showing up at trakt.tv.

Ideally, what I want to do is loop over my existing history and replace all duplicate and non-release plays with a single play at release.

Thanks.

commented

I had to dig into the examples module just to find out how to authenticate, and copy/paste the examples.helpers.authenticate function somewhere locally to do it. Not sure why this helper isn't included in the main package, and mentioned in the README which only configures the client?

This function isn't included in the main package as applications would typically handle this themselves so they can save the token to disk and restore it for future use without needing to re-authenticate with another pin.

This says 24 epsodes added, but no corresponding play for the single episode I tried to add is showing up at trakt.tv.

Try:

Trakt['sync/history'].add({'shows': [{'watched_at': 'released', 'ids': {'trakt': e.id}}]})