xbgmsharp / trakt

Import CSV to Trakt.tv list and Export Trakt.tv list into CSV
GNU General Public License v3.0
281 stars 47 forks source link

Episode Import not working #55

Closed akovia closed 2 years ago

akovia commented 2 years ago

I'm finding it difficult to decipher how to import episodes without some example csv files.

The only examples you give don't really tell you how to format the csv that I can see.

Import all episodes with tvshows imdbid from file episodes_views.csv into history and mark as watched using watched_at date in CSV

$ ./import_trakt.py -c config.ini -f imdb -i episodes_views.csv -l history -t episodes -w

to me, this looks like imdb episode watched_at
ttxxxxx 3 2021-08-01T19:43:40.000Z

and do I need a row for each episode, or will it "fill" up to this episode? (episodes 1-3 marked as watched?)

... but further down the page is this example

Episodes as views to history Header line as format 'imdb' or 'tmdb' or 'tvdb' or 'tvrage' or 'trakt'. One 'imdb' or 'tmdb' or 'tvdb' or 'tvrage' or 'trakt' with season and episode

imdb
tt04606XX,3,4

Does this mean it should not have headers for the season and episode/s? so...

imdb watched_at
ttxxxxx 1 3 2021-08-01T19:43:40.000Z

is it episode, episodes, or no header at all?

Everything I have tried has failed, so I'm hoping for some help to format my csv correctly. I've had no issues with movies, or watchlist shows, but episodes have me stumped.

EDIT: I am trying to import shows I've completely watched, and I'd like to import them with the date set by me, and with the rating set by me as well. No matter what combination I try I can't get this to work at all.

I can import just ratings fine, but not the actual show. The only time it appears to work, it dies after the first 10 entries.


$ python import_trakt.py -c config.ini -f imdb -i Trakt-Import-Anime-Shows-Watched.csv -l history -t shows -w -s -V
Options: Namespace(config='config.ini', input=<_io.TextIOWrapper name='Trakt-Import-Anime-Shows-Watched.csv' mode='r' encoding='UTF-8'>, watched_at=True, rated_at=False, format='imdb', type='shows', list='history', seen='2016-01-01T00:00:00.000Z', clean=False, verbose=True)
Config file: config.ini
Config: <configparser.ConfigParser object at 0x7effe16a6230>
Trakt, skipped access token refresh, token is less than 30 days, only 3 days, 15:58:59.310406
Trakt: {'client_id': 'd9d2ccdc53ca3b96de7f3541e320115c2f6352f14d00688c3e53c8b2ccd12f1f', 'client_secret': 'd9b186e9ff9022203701da9dfdf54415dd43b8254025a68217a1ac7012ad9fd5', 'access_token': 'c917e396b225691905339bb037d6b36bc2002c4e492025e370567518dce3c20f', 'refresh_token': '1319ca501dd414615b63a8311eb94fa77b1d6df7f329d92a04b494645e392d76', 'baseurl': 'https://api.trakt.tv'}
Authorization header: Bearer c917e396b225691905339bb037d6b36bc2002c4e492025e370567518dce3c20f
trakt-api-key header: d9d2ccdc53ca3b96de7f3541e320115c2f6352f14d00688c3e53c8b2ccd12f1f
Found 414 items to import
Sending to URL: https://api.trakt.tv/sync/history
('{"shows": [{"ids": {"imdb": "tt1355642"}, "watched_at": '
 '"2016-01-01T00:00:00.000Z"}, {"ids": {"imdb": "tt3741634"}, "watched_at": '
 '"2016-01-01T00:00:00.000Z"}, {"ids": {"imdb": "tt9335498"}, "watched_at": '
 '"2016-01-01T00:00:00.000Z"}, {"ids": {"imdb": "tt2098220"}, "watched_at": '
 '"2016-01-01T00:00:00.000Z"}, {"ids": {"imdb": "tt0994314"}, "watched_at": '
 '"2016-01-01T00:00:00.000Z"}, {"ids": {"imdb": "tt1279024"}, "watched_at": '
 '"2016-01-01T00:00:00.000Z"}, {"ids": {"imdb": "tt1639109"}, "watched_at": '
 '"2016-01-01T00:00:00.000Z"}, {"ids": {"imdb": "tt1910272"}, "watched_at": '
 '"2016-01-01T00:00:00.000Z"}, {"ids": {"imdb": "tt5249462"}, "watched_at": '
 '"2016-01-01T00:00:00.000Z"}, {"ids": {"imdb": "tt2069441"}, "watched_at": '
 '"2016-01-01T00:00:00.000Z"}]}')
Result: {'added': {'movies': 0, 'episodes': 454}, 'not_found': {'movies': [], 'shows': [], 'seasons': [], 'episodes': [], 'people': [], 'users': []}}
Traceback (most recent call last):
  File "/home/akovia/bin/trakt/import_trakt.py", line 512, in <module>
    main()
  File "/home/akovia/bin/trakt/import_trakt.py", line 483, in main
    results['added'] += result['added'][options.type]
KeyError: 'shows'
akovia commented 2 years ago

So I just adjusted number on line 476 for import_trakt.py to get my import done.

Not sure if I was doing anything wrong to cause the error in the first place, but I'm done with importing now. I think the documentation could be a bit more user friendly, but I guess this isn't something that gets used a lot so that explains the lack of support.

Either way, I'm thankful for the tools!