trakt
trakt copied to clipboard
Import From Plex's database to Trakt.
Is there a simple way to sync historical data from Plex's database to Trakt? Plex has all watched data stored in metadata_item_views
table. I am not sure how to extract from that table to format which your script would expect. Seems like something that might have been done before so figured I might ask. Thanks.
I don't use Plex, so it has not been done before at least per me. If Plex use sqlite db the script should be similar to the Kodi export. Ideally you export in a file the IMDB ID. https://github.com/xbgmsharp/trakt/blob/master/KODI.md
Sorry to resurrect this; I am running into this situation now.
Is there a chance you could please post the schema(s) of the .csv file that the import script expects? Then it shouldn't be a problem for me to work out the proper query that will output the necessary data from Plex's SQLite DB to the .csv file correctly.
The import csv file should at least include a least an id, you can also have a rated_at and watched_at column. https://github.com/xbgmsharp/trakt/blob/master/import.md
The import csv file should at least include a list a id, you can also have a rated_at and watched_at column. https://github.com/xbgmsharp/trakt/blob/master/import.md
I assume you meant "at least an id". And I guess the id
would be either imdb, tvdb, etc.? That's fine, I am able to find that info in Plex. Same with watched_at
.
However, I'm curious about adding to Trakt's 'collection' list. There is definitely an added_at
column in one of Plex's db tables, which would be perfect for importing the date/time when a movie or tv show was added to Trakt's 'collection'. How would this be done? I'm guessing that I just need to add the flag -l collection
to the cli command, but should the column name stay added_at
in the csv file?
That is correct the id can be either 'imdb', 'tmdb', 'tvdb', 'tvrage', 'trakt'.
watched_at
and rated_at
are the only additional column supported at the moment.
Feel free to contribute, anyhow I don't see an added_at
in the doc, https://trakt.docs.apiary.io/#reference/sync
But there is an collected_at
when importing collection .
Example integration rated_at
for https://github.com/xbgmsharp/trakt/pull/45/files
Import cvs loop, https://github.com/xbgmsharp/trakt/blob/master/import_trakt.py#L450
Okay, those links help, thank you. I am still missing something, though, as I got the following error message:
Invalid file format, id (row) must exists and is not blank (has a format).
From the following simple csv:
id,collected_at
tt0111282,2020-02-16T17:40:42Z
After exploring the repo more and discovering the proper format at https://github.com/xbgmsharp/trakt/blob/master/import.md, I was finally able to get it to work. And I see that collected_at
isn't, as you said, supported at the moment.
I just might fork the repo and take a stab at it, myself. If it works, I might even see if I can include the other metadata as well, such as resolution
, audio
, etc.