MCPcopy Index your code
hub / github.com/cecobask/imdb-trakt-sync

github.com/cecobask/imdb-trakt-sync @v1.5.6

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.5.6 ↗ · + Follow
201 symbols 417 edges 19 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

sync quality

imdb-trakt-sync

logo

Command line application that can sync IMDb and Trakt user data - watchlist, lists, ratings and history.
To achieve its goals the application is using the Trakt API and web scraping.
Keep in mind that this application is performing one-way sync from IMDb to Trakt. This means that any changes made on IMDb will be reflected on Trakt, but not the other way around.

Configuration

FIELD NAME DEFAULT VALUE ALLOWED VALUES DESCRIPTION
IMDB_AUTH cookies credentials cookies none Authentication method to be used for IMDb: credentials => IMDB_EMAIL + IMDB_PASSWORD fields required cookies => IMDB_COOKIEATMAIN field required none => IMDB_LISTS field required
IMDB_EMAIL - - IMDb account email address. Only required when IMDB_AUTH => credentials
IMDB_PASSWORD - - IMDb account password. Only required when IMDB_AUTH => credentials
IMDB_COOKIEATMAIN - - Cookie value only required when IMDB_AUTH => cookies. Get the following cookie information from your browser: name: at-main | domain: .imdb.com
IMDB_LISTS - - Array of IMDb list IDs that you would like synced to Trakt. If this array is not specified or empty, all IMDb lists on your account will be synced to Trakt. In order to get the ID of an IMDb list, open it from a browser - the ID is in the URL with format ls#########. If provided as GitHub secret or environment variable, define its values as comma-separated list. Keep in mind the Trakt list limits!
IMDB_IGNOREDLISTS - - Array of IMDb list IDs that you do NOT want synced to Trakt. This is useful if you would like to sync all your lists, but ignore some. In order to get the ID of an IMDb list, open it from a browser - the ID is in the URL with format ls#########. If provided as GitHub secret or environment variable, define its values as comma-separated list.
IMDB_TRACE false true false Print tracing logs related to browser activities. Can be useful for debugging purposes
IMDB_HEADLESS true true false Whether to run the browser in headless mode or not. Only set this to false when running the syncer locally
IMDB_BROWSERPATH - - The location of your preferred web browser. If you leave this value empty, the syncer will attempt to lookup common browser locations. You can optionally override its value to use a specific browser
SYNC_MODE dry-run full add-only dry-run Sync mode to be used when running the application: full => add Trakt items that don't exist, delete Trakt items that don't exist on IMDb, update Trakt items by treating IMDb as the source of truth add-only => add Trakt items that do not exist, but do not delete anything dry-run => identify what Trakt items would be added / deleted / updated
SYNC_HISTORY false true false Whether to sync history or not. When IMDB_AUTH => none, history sync will be skipped
SYNC_RATINGS true true false Whether to sync ratings or not. When IMDB_AUTH => none, ratings sync will be skipped
SYNC_WATCHLIST true true false Whether to sync watchlist or not. When IMDB_AUTH => none, watchlist sync will be skipped
SYNC_LISTS true true false Whether to sync lists or not. This provides the option to disable syncing of lists
SYNC_TIMEOUT 15m - Maximum duration to run the syncer. Users with large libraries might have to increase the timeout value accordingly. Valid time units are: ns, us (or µs), ms, s, m, h
TRAKT_CLIENTID - - Trakt app client ID
TRAKT_CLIENTSECRET - - Trakt app client secret
TRAKT_EMAIL - - Trakt account email address (do NOT confuse with username)
TRAKT_PASSWORD - - Trakt account password

Usage

The application can be setup to run automatically, based on a custom schedule (default: once every 12 hours) using GitHub Actions, in a container, or locally on your machine.
Workflow schedules can be tweaked by editing the .github/workflows/sync.yaml file and committing the changes.
Please configure the application to suits your needs, by referring to the Configuration section, before running it.
Follow the relevant section below, based on how you want to use the application.

Run the application using GitHub Actions

  1. Fork the repository to your account
  2. Create a Trakt App. Use urn:ietf:wg:oauth:2.0:oob as redirect uri
  3. Configure the application:
  4. Open your fork repository on GitHub
  5. Create an individual repository secret for each Configuration field you need: Settings > Secrets and variables > Actions > New repository secret
  6. Allow GitHub Actions on your fork repository: Settings > Actions > General > Allow all actions and reusable workflows
  7. Enable the sync workflow: Actions > Workflows > sync > Enable workflow
  8. Run the sync workflow manually: Actions > Workflows > sync > Run workflow
  9. From now on, GitHub Actions will automatically trigger the sync workflow based on your schedule

Run the application in a Docker container

  1. Install Docker
  2. Clone the repository: git clone git@github.com:cecobask/imdb-trakt-sync.git
  3. Create a Trakt App. Use urn:ietf:wg:oauth:2.0:oob as redirect uri
  4. Configure the application:
  5. Create .env file with the same contents as .env.example
  6. Populate the .env file with your own secret values
  7. All secret keys should have ITS_ prefix
  8. Open a terminal window in the repository folder and then:
  9. Build a Docker image: make package
  10. Run the sync workflow in a Docker container: make sync-container

Run the application locally

  1. Install Git and Go
  2. Clone the repository: git clone git@github.com:cecobask/imdb-trakt-sync.git
  3. Create a Trakt App. Use urn:ietf:wg:oauth:2.0:oob as redirect uri
  4. Open a terminal window in the repository folder and then:
  5. Build the syncer: make build
  6. Configure the syncer: make configure
  7. Run the syncer: make sync

Extension points exported contracts — how you extend this code

BrowserClient (Interface)
(no doc) [1 implementers]
internal/trakt/browser.go
API (Interface)
(no doc)
internal/imdb/api.go
API (Interface)
(no doc)
internal/trakt/api.go

Core symbols most depended-on inside this repo

doRequest
called by 23
internal/trakt/browser.go
pointer
called by 12
internal/config/config.go
toListBody
called by 8
internal/trakt/spec.go
isNilOrEmpty
called by 7
internal/config/config.go
navigateAndValidateResponse
called by 6
internal/imdb/api.go
Error
called by 6
internal/trakt/error.go
Error
called by 4
internal/logger/slog.go
GetItemID
called by 4
internal/trakt/spec.go

Shape

Method 104
Function 46
Struct 40
TypeAlias 8
Interface 3

Languages

Go100%

Modules by API surface

internal/imdb/api.go38 symbols
internal/trakt/api.go37 symbols
internal/config/config.go21 symbols
internal/trakt/browser.go16 symbols
internal/trakt/spec.go15 symbols
internal/trakt/auth.go14 symbols
internal/config/tui.go13 symbols
internal/trakt/error.go9 symbols
internal/syncer/syncer.go9 symbols
internal/imdb/spec.go9 symbols
internal/trakt/retry.go6 symbols
internal/syncer/diff.go5 symbols

For agents

$ claude mcp add imdb-trakt-sync \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page