npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

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

CircleCI codecov Commitizen friendly

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

src/main/exporter.ts:7-21

Schema for the output csv. Based on https://letterboxd.com/about/importing-data/

defaults

src/main/mapper.ts:11-23

Default values for letterboxd object shape

headers

src/main/fetcher.ts:14-18

HTTP headers to send with our request to trakt's api

traktHistoryToCsv

src/main/index.ts:20-54

Export a trakt user's history to csv to be uploaded to letterboxd

Parameters

  • props Object Properties passed from argv

    • props.userName string The user whose data you want to export
    • props.fileName string The name of the file to output the watchlist to
    • props.watchListFileName

Returns Promise<void> We dont return anything

options

src/main/fetcher.ts:23-25

The fetch options object (only really needs headers)

builder

src/main/exporter.ts:28-28

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

src/main/mapper.ts:31-44

Maps a trakt history entry to a letterboxd history entry

Parameters

  • movie TraktRatingMergedHistoryEntityType A trackt movie history entity
  • isWatchlist boolean Whether to map the history or the watchlist, defaults to the history

Returns LetterboxdHistoryEntityType A letterboxd movie history entity

mergeWatchedWithRatings

src/main/fetcher.ts:34-55

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 for
  • watched TraktMovieHistoryType A list of movies that have been watched

Returns Promise<TraktRatingMergedHistoryType> Promise that resolves to Trakt movie data with merged rating

mapper

src/main/mapper.ts:52-58

Maps an array of trakt history entries to an array of letterboxd history entities

Parameters

  • movieList Array<TraktRatingMergedHistoryEntityType> Trakt History
  • isWatchlist boolean Whether to map the history or the watchlist, defaults to the history (optional, default false)

Returns Array<LetterboxdHistoryEntityType> letterboxd history

fetchMovies

src/main/fetcher.ts:63-88

Fetches the user's history data from the trakt api

Parameters

  • user string The username we're getting data for
  • isWatchlist boolean Whether to fetch the history or the watchlist, defaults to the history (optional, default false)

Returns Promise<Array<LetterboxdHistoryEntityType>> Promise that resolves to mapped Letterboxd data