Giter Site home page Giter Site logo

trakt-to-letterboxd's Introduction

trakt-to-letterboxd

Build, Test & Publish Main 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

trakt-to-letterboxd's People

Contributors

baswag avatar bbeesley avatar dependabot-preview[bot] avatar dependabot[bot] avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

trakt-to-letterboxd's Issues

Produces empty .csv

Hello,
the programm doesn't throw an error or anything, but it unfortunately only produces and completely empty .csv file

Here's my terminal:

npx trakt-to-letterboxd -u username pamerlaedschn -f trakt.csv
[14:41:39.659] [log] Complete!

I'm on Ubuntu 22.04

Unable to connect to Trakt API?

npx trakt-to-letterboxd -u ioncewasacat -f cat.csv

results in:

npx: installed 58 in 54.014s
request to https://api.trakt.tv/users/ioncewasacat/watched/movies failed, reason: read ECONNRESET { FetchError: request to https://api.trakt.tv/users/ioncewasacat/watched/movies failed, reason: read ECONNRESET
at ClientRequest. (/root/.npm/_npx/6048/lib/node_modules/trakt-to-letterboxd/node_modules/node-fetch/lib/index.js:1444:11)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at TLSSocket.socketErrorListener (_http_client.js:387:9)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
message: 'request to https://api.trakt.tv/users/ioncewasacat/watched/movies failed, reason: read ECONNRESET',
type: 'system',
errno: 'ECONNRESET',
code: 'ECONNRESET' }
Complete!

Install for [ 'trakt-to-letterboxd@latest' ] failed with code 1

Seems hard to mess up instructions this simple. Heres the error I receive.

administrator@PINGU:~$ npx trakt-to-letterboxd -u <USERNAME> -f test.csv

npm ERR! cb.apply is not a function

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/administrator/.npm/_logs/2023-11-06T01_18_25_708Z-debug.log
Install for [ 'trakt-to-letterboxd@latest' ] failed with code 1

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Can't make it work - npm not able to find a file

Yo there,
I can't make it work somehow, do you have any idea why?
The console log is:

➜  ~ sudo npx trakt-to-letterboxd -u cangoktas -f loglar
npm ERR! path /Users/cangoktas/.npm/_npx/7768/lib/node_modules/trakt-to-letterboxd/dist/ttl.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/Users/cangoktas/.npm/_npx/7768/lib/node_modules/trakt-to-letterboxd/dist/ttl.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/cangoktas/.npm/_logs/2018-10-14T01_19_40_465Z-debug.log
Install for trakt-to-letterboxd@latest failed with code 254

"Unexpected end of JSON input" from Trakt API when username doesn't exist

Trying trakt-to-letterboxd for the first time, this is what I'm getting:

$ npx trakt-to-letterboxd -u redacted
npx: installed 22 in 3.853sinvalid json response body at https://api.trakt.tv/users/redacted/watched/movies reason: Unexpected end of JSON input FetchError: invalid json response body at https://api.trakt.tv/users/redacted/watched/movies reason: Unexpected end of JSON input
at /Users/redacted/.npm/_npx/75163/lib/node_modules/trakt-to-letterboxd/node_modules/node-fetch/lib/index.js:272:32
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async fetchMovies (/Users/redacted/.npm/_npx/75163/lib/node_modules/trakt-to-letterboxd/dist/main/fetcher.js:75:23)
at async traktHistoryToCsv (/Users/redacted/.npm/_npx/75163/lib/node_modules/trakt-to-letterboxd/dist/main/index.js:40:25) {
type: 'invalid-json'
}
invalid json response body at https://api.trakt.tv/users/redacted/watchlist/movies reason: Unexpected end of JSON input FetchError: invalid json response body at https://api.trakt.tv/users/redacted/watchlist/movies reason: Unexpected end of JSON input
at /Users/redacted/.npm/_npx/75163/lib/node_modules/trakt-to-letterboxd/node_modules/node-fetch/lib/index.js:272:32
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async fetchMovies (/Users/redacted/.npm/_npx/75163/lib/node_modules/trakt-to-letterboxd/dist/main/fetcher.js:75:23)
at async traktHistoryToCsv (/Users/redacted/.npm/_npx/75163/lib/node_modules/trakt-to-letterboxd/dist/main/index.js:49:25) {
type: 'invalid-json'
}
Complete!

I can crack open the Node debugger to inspect the JSON responses if necessary, but I thought I'd make sure I'm not missing anything obvious.

Support multiple dates for WatchedDate

Is it possible for the WatchedDate to be a list of dates so that multiple entries could be exported instead of just a single watched date (the latest one)?

Error: Not supported

Hi!

I'm having this error:

$ npx trakt-to-letterboxd -u lucas_marx -f export.csv

{ error:
Error: Not supported
at /home/lucas/trakt-to-letterboxd/bin/ttl.cjs:6:5
at Object. (/home/lucas/trakt-to-letterboxd/bin/ttl.cjs:10:3)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at findNodeScript.then.existing (/usr/share/nodejs/libnpx/index.js:268:14) }

am I doing something wrong?

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two Factor Authentication for your account, set its level to "Authorization only" in your account settings. semantic-release cannot publish with the default "
Authorization and writes" level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.