trakt-to-letterboxd
v1.1.1
Published
Extract trakt movie history and export to csv for uploading to letterboxd
Downloads
26
Readme
trakt-to-letterboxd
Description
A package to migrate your trakt movie history and ratings to letterboxd. Optionally the trakt Watchlist can also be exported. Currently letterboxd only supports importing from a csv, so thats all this package does at the moment. When a proper API is added, I'll update this to push the data right into your letterboxd history.
Usage
The easiest way to use this currently is with npx. You can install that globally with yarn global add npx
or npm i -g npx
. Once you have that, just run:
npx trakt-to-letterboxd -u username -f filename
where username is the user whose data you want to export, and filename is the name of the csv file you want to output to.
To export your watchlist use
npx trakt-to-letterboxy -u username -w watchListFilename
Both options can also be used together:
npx trakt-to-letterboxd -u username -f filename -w watchListFilename
If only a username is given it will correspond to the following command:
npx trakt-to-letterboxd -u username -f history.csv -w watchlist.csv
API
Table of Contents
- schema
- defaults
- headers
- traktHistoryToCsv
- options
- builder
- mapTraktToLetterboxd
- mergeWatchedWithRatings
- mapper
- fetchMovies
schema
Schema for the output csv. Based on https://letterboxd.com/about/importing-data/
defaults
Default values for letterboxd object shape
headers
HTTP headers to send with our request to trakt's api
traktHistoryToCsv
Export a trakt user's history to csv to be uploaded to letterboxd
Parameters
props
Object Properties passed from argv
Returns Promise<void> We dont return anything
options
The fetch options object (only really needs headers)
builder
The instance of CsvBuilder we'll use to export the data. We need to remap the format of the last watched date to YYYY-MM-DD to comply with letterboxd's formatting
mapTraktToLetterboxd
Maps a trakt history entry to a letterboxd history entry
Parameters
movie
TraktRatingMergedHistoryEntityType A trackt movie history entityisWatchlist
boolean Whether to map the history or the watchlist, defaults to the history
Returns LetterboxdHistoryEntityType A letterboxd movie history entity
mergeWatchedWithRatings
Fetch the ratings of a user and merge them with the movie history based on the movie's Trakt ID
Parameters
user
string The username we're getting data forwatched
TraktMovieHistoryType A list of movies that have been watched
Returns Promise<TraktRatingMergedHistoryType> Promise that resolves to Trakt movie data with merged rating
mapper
Maps an array of trakt history entries to an array of letterboxd history entities
Parameters
movieList
Array<TraktRatingMergedHistoryEntityType> Trakt HistoryisWatchlist
boolean Whether to map the history or the watchlist, defaults to the history (optional, defaultfalse
)
Returns Array<LetterboxdHistoryEntityType> letterboxd history
fetchMovies
Fetches the user's history data from the trakt api
Parameters
user
string The username we're getting data forisWatchlist
boolean Whether to fetch the history or the watchlist, defaults to the history (optional, defaultfalse
)
Returns Promise<Array<LetterboxdHistoryEntityType>> Promise that resolves to mapped Letterboxd data