Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

importing ratings does not seem to work #52

Open
mkarikom opened this issue Apr 4, 2022 · 1 comment
Open

importing ratings does not seem to work #52

mkarikom opened this issue Apr 4, 2022 · 1 comment

Comments

@mkarikom
Copy link

mkarikom commented Apr 4, 2022

intended behavior

import_trakt should update my profile with ratings for movies in the csv

actual behavior and steps to reproduce

  1. I have the following subset of a large list of ratings, with themoviedb.org ids
# trakt_import_subset.csv
,tmdb,rating
1,109091,4
2,113833,3
3,12690,4
  1. I attempt to upload these with the following command
python ./import_trakt.py -c config.ini -f tmdb -i trakt_import_subset.csv -l ratings -t movies
  1. The following output indicates no ratings were added to my profile
Options: Namespace(config='config.ini', input=<_io.TextIOWrapper name='trakt_import_subset.csv' mode='r' encoding='UTF-8'>, watched_at=False, rated_at=False, format='tmdb', type='movies', list='ratings', seen=False, clean=False, verbose=True)
Config file: config.ini
Config: <configparser.ConfigParser object at 0x10c83dc10>
Trakt, skipped access token refresh, token is less than 30 days, only 8:32:52.358093
Trakt: {'client_id': 'a secret string', 'client_secret': 'another secret string', 'access_token': '5ba5115ef46356883bea8cb2f09a20a9760a2cfd8bf38ad780e27463a68e69f6', 'refresh_token': '0d7035c30ba110dbb320f4c76d144783ecaf74fef5242c68c07307a62525397a', 'baseurl': 'https://api-v2launch.trakt.tv'}
Authorization header: Bearer 5ba5115ef46356883bea8cb2f09a20a9760a2cfd8bf38ad780e27463a68e69f6
trakt-api-key header: afd6aae0f9c9066c836b23722e10e6fac01f7b49edba0882d5804bfd9f4d6bd3
Found 3 items to import
Sending to URL: https://api-v2launch.trakt.tv/sync/ratings
('{"movies": [{"ids": {"tmdb": 109091}}, {"ids": {"tmdb": 113833}}, {"ids": '
 '{"tmdb": 12690}}]}')
Result: {'added': {'movies': 0, 'shows': 0, 'seasons': 0, 'episodes': 0}, 'not_found': {'movies': [], 'shows': [], 'seasons': [], 'episodes': [], 'people': [], 'users': []}}
Overall imported 3 movies, results added:0, existing:0, not_found:0
@peteschaffner
Copy link

@mkarikom I just ran into this too, and it seems the -r (--rated_at) flag is required, which means you also need said column.

Here is an example of the CSV I got to successfully import:

tmdb,rated_at,rating
290250,2016-09-20T18:20:12Z,8.0
76341,2016-09-20T18:38:18Z,8.0

Given the exported ratings data from TMDb, I was able to quickly get that CSV file into the required format above by running this regex search/replace:

  • search: ^(\d+),[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,([^,]*),(.*)$
  • replace: $1,$3,$2

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants