Installation
go install github.com/mfederowicz/trakt-sync@latest
Configuration
After install, we should create API app and save credentials in config file ($HOME/trakt-sync.toml):
client_id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
client_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
token_path = "~/.config/trakt-sync/token.json"
errorCode = 0
warningCode = 0
per_page = 500
pages_limit = 10
Usage
trakt-sync supports a -config flag whose value should correspond to a TOML file.
If not provided, trakt-sync will try to use a global config file (assumed to be located at $HOME/trakt-sync.toml).
Otherwise, if no configuration TOML file is found then trakt-sync uses a built-in parameters depends on selected module.
Command Line Flags
trakt-sync accepts the following command line parameters:
-config [PATH] - path to config file in TOML format, defaults to $HOME/trakt-sync.toml if present.
-version - get trakt-sync version.
Command Line Commands
trakt-sync accepts the following command line commands/modules:
calendars - By default, the calendar will return all shows or movies for the specified time period and can be global or user specific.
certifications - Certifications list
checkin - Checkin movie,episode,show_episode,delete
collection - Get all collected items in a user's collection.
comments - Comments comments,comment,replies,item,likes,like,trending,recent,updates.
countries - Get a list of all countries, including names and codes.
genres - Get a list of all genres, including names and slugs.
help - Help on the trakt-sync command and subcommands.
history - Returns movies and episodes that a user has watched, sorted by most recent.
languages - Get a list of all laguages, including names and codes.
lists - Returns data about lists: trending, popular, list, likes, like, items, comments.
movies - Returns data about movies: trending, popular, list, likes, like, items, comments etc...
people - Returns all data for selected person.
search - Searches can use queries or ID lookups.
users - Returns all data for a user.
watchlist - Returns all items in a user's watchlist filtered by type.
Sample export usage
Export all tvshows from the watching history:
$ ./trakt-sync history -t shows -> export_history_shows_imdb.json
Export all episodes from the watching history:
$ ./trakt-sync history -t episodes -f tmdb -> export_history_episodes_tmdb.json
$ ./trakt-sync history -t episodes -f imdb -> export_history_episodes_imdb.json
Export all movies from watchlist:
$ ./trakt-sync watchlist -t movies -f tmdb -> export_watchlist_movies_tmdb.json
$ ./trakt-sync watchlist -t movies -f imdb -> export_watchlist_movies_imdb.json
$ ./trakt-sync collection -t movies --ex metadata
$ ./trakt-sync collection -t shows --ex metadata
$ ./trakt-sync comments -a comment -comment_id 779883 -comment "minions,minions,minions movie ever ok"
$ ./trakt-sync comments -a comment -comment_id 779883 -delete
$ ./trakt-sync comments -a comments -t episode -trakt_id 172245 -comment "super episode, interesting plot ok"
$ ./trakt-sync comments -a replies -comment_id 779896 -reply "reply msg min 5 words" -spoiler
$ ./trakt-sync comments -a replies -comment_id 71340
$ ./trakt-sync comments -a item -comment_id 664237 -ex full
$ ./trakt-sync comments -a likes -comment_id 773108 -remove
$ ./trakt-sync comments -a like -comment_id 773108
$ ./trakt-sync comments -a like -comment_id 773108 -remove
$ ./trakt-sync comments -a trending -comment_type reviews
$ ./trakt-sync comments -a recent -include_replies false
$ ./trakt-sync comments -a recent -include_replies true
$ ./trakt-sync comments -a updates -include_replies false
Export countries list for movies or shows:
$ ./trakt-sync countries -> export_countries_movies.json
$ ./trakt-sync countries -t movies -> export_countries_movies.json
$ ./trakt-sync countries -t shows -> export_countries_shows.json
Export languages list for movies or shows:
$ ./trakt-sync languages -> export_languages_movies.json
$ ./trakt-sync languages -t movies -> export_languages_movies.json
$ ./trakt-sync languages -t shows -> export_languages_shows.json
Export genres list for movies or shows:
$ ./trakt-sync genres -> export_genres_movies.json
$ ./trakt-sync genres -t movies -> export_genres_movies.json
$ ./trakt-sync genres -t shows -> export_genres_shows.json
Export movies or shows or episodes from user lists:
$ ./trakt-sync users -a lists -u username -i 123456 -t episodes
$ ./trakt-sync users -a lists -u username -i 123456 -t shows
$ ./trakt-sync users -a lists -u username -i 123456 -t movies
Fetch lists for selected user:
$ ./trakt-sync users -a lists -u username
Fetch saved filters for selected user:
$ ./trakt-sync users -a saved_filters -u username
Fetch stats for selected user:
$ ./trakt-sync users -a stats -u sean
Fetch settings for current user:
$ ./trakt-sync users -a settings
Fetch watched movies for selected user:
$ ./trakt-sync users -a watched -t movies -u sean
Fetch watched shows for selected user:
$ ./trakt-sync users -a watched -t shows -u sean
Fetch watched shows for selected user without seasons:
$ ./trakt-sync users -a watched -t shows -u sean --ex noseasons
Export people data:
$ ./trakt-sync people -a updates -start_date 2024-10-13
$ ./trakt-sync people -a updated_ids -start_date 2024-10-13
$ ./trakt-sync people -a summary -i john-wayne
$ ./trakt-sync people -a movies -i john-wayne
$ ./trakt-sync people -a shows -i john-wayne
$ ./trakt-sync people -a lists -i john-wayne
Export all or my calendars:
$ ./trakt-sync calendars -a all-shows -> export_calendars_shows_20240707_7.json
$ ./trakt-sync calendars -a all-new-shows -> export_calendars_new_shows_20240707_7.json
$ ./trakt-sync calendars -a all-season-premieres -> export_calendars_season_premieres_20240707_7.json
$ ./trakt-sync calendars -a all-finales -> export_calendars_finales_20240707_7.json
$ ./trakt-sync calendars -a all-movies -> export_calendars_movies_20240707_7.json
$ ./trakt-sync calendars -a all-dvd -> export_calendars_dvd_20240707_7.json
Export certifications for movies or shows:
$ ./trakt-sync certifications -> export_certifications_movies.json
$ ./trakt-sync certifications -t movies -> export_certifications_movies.json
$ ./trakt-sync certifications -t shows -> export_certifications_shows.json
Manage checkin:
$ ./trakt-sync checkin -a movie -trakt_id 28 -msg "super movie"
$ ./trakt-sync checkin -a episode -trakt_id 3190486 -msg "super episode"
$ ./trakt-sync checkin -a show_episode -trakt_id 37696 -episode_abs 6 -msg "super episode"
$ ./trakt-sync checkin -a show_episode -trakt_id 136121 -episode_code 1x5 -msg "super episode"
$ ./trakt-sync checkin -a delete
Export search result by Text Query:
$ ./trakt-sync search -a text-query -t movie -q freddy --field title
$ ./trakt-sync search -a text-query -t movie -t show -q freddy --field tagline
$ ./trakt-sync search -a text-query -t movie -t show -t list -q freddy --field name
$ ./trakt-sync search -a text-query -t movie -t show -t list -q freddy --field title
$ ./trakt-sync search -a text-query -t person -t list -q freddy --field name
$ ./trakt-sync search -a text-query -t movie -t show -t list -q freddy --field title
Export search result by Id lookup:
$ ./trakt-sync search -a id-lookup -i 12601 -t movie -t show
$ ./trakt-sync search -a id-lookup --id_type tvdb -i 12601 -t movie -t show
$ ./trakt-sync search -a id-lookup --id_type imdb -i 12601 -t movie
$ ./trakt-sync search -a id-lookup --id_type imdb -i 12601 -t podcast
$ ./trakt-sync search -a id-lookup --id_type imdb -i tt0266697
$ ./trakt-sync search -a id-lookup --id_type tvdb -i 75725
$ ./trakt-sync search -a id-lookup --id_type tvdb -i 75725 -t podcast
$ ./trakt-sync search -a id-lookup -i 75725
$ ./trakt-sync search -a id-lookup -i 75725 -t episode
$ ./trakt-sync search -a id-lookup --id_type tmdb -i 254265
Export lists data:
$ ./trakt-sync lists -a trending
$ ./trakt-sync lists -a popular
$ ./trakt-sync lists -a list -trakt_id 2142753
$ ./trakt-sync lists -a likes -trakt_id 2142753
$ ./trakt-sync lists -a like -trakt_id 2142753
$ ./trakt-sync lists -a like -trakt_id 2142753 -remove
$ ./trakt-sync lists -a items -trakt_id 2142753
$ ./trakt-sync lists -a items -trakt_id 2142753 -t movie,show
-- (temp not working - problems with api endpoint)
$ ./trakt-sync lists -a comments -trakt_id 2142753
Export movies data:
$ ./trakt-sync movies -a trending
$ ./trakt-sync movies -a popular
$ ./trakt-sync movies -a favorited -period daily
$ ./trakt-sync movies -a favorited -period weekly
$ ./trakt-sync movies -a favorited -period monthly
$ ./trakt-sync movies -a favorited -period all
$ ./trakt-sync movies -a played -period daily
$ ./trakt-sync movies -a played -period weekly
$ ./trakt-sync movies -a played -period monthly
$ ./trakt-sync movies -a played -period all
$ ./trakt-sync movies -a watched -period daily
$ ./trakt-sync movies -a watched -period weekly
$ ./trakt-sync movies -a watched -period monthly
$ ./trakt-sync movies -a watched -period all
$ ./trakt-sync movies -a collected -period daily
$ ./trakt-sync movies -a collected -period weekly
$ ./trakt-sync movies -a collected -period monthly
$ ./trakt-sync movies -a collected -period all
$ ./trakt-sync movies -a anticipated
$ ./trakt-sync movies -a boxoffice
$ ./trakt-sync movies -a updates -start_date YYYY-MM-DD
$ ./trakt-sync movies -a updated_ids -start_date YYYY-MM-DD
$ ./trakt-sync movies -a summary -i tron-legacy-2010
$ ./trakt-sync movies -a aliases -i tron-legacy-2010
$ ./trakt-sync movies -a releases -i tron-legacy-2010 -country us
$ ./trakt-sync movies -a translations -i tron-legacy-2010 -language es
$ ./trakt-sync movies -a comments -i tron-legacy-2010 -s newest
$ ./trakt-sync movies -a comments -i tron-legacy-2010 -s oldest
$ ./trakt-sync movies -a comments -i tron-legacy-2010 -s likes
$ ./trakt-sync movies -a comments -i tron-legacy-2010 -s replies
$ ./trakt-sync movies -a comments -i tron-legacy-2010 -s highest
$ ./trakt-sync movies -a comments -i tron-legacy-2010 -s lowest
$ ./trakt-sync movies -a comments -i tron-legacy-2010 -s plays
$ ./trakt-sync movies -a lists -i tron-legacy-2010 -t all -s popular
$ ./trakt-sync movies -a lists -i tron-legacy-2010 -t all -s likes
$ ./trakt-sync movies -a lists -i tron-legacy-2010 -t all -s comments
$ ./trakt-sync movies -a lists -i tron-legacy-2010 -t all -s items
$ ./trakt-sync movies -a lists -i tron-legacy-2010 -t all -s added
$ ./trakt-sync movies -a lists -i tron-legacy-2010 -t all -s updated
$ ./trakt-sync movies -a people -i tron-legacy-2010
$ ./trakt-sync movies -a ratings -i tron-legacy-2010
$ ./trakt-sync movies -a related -i tron-legacy-2010
$ ./trakt-sync movies -a stats -i tron-legacy-2010
$ ./trakt-sync movies -a studios -i tron-legacy-2010
$ ./trakt-sync movies -a watching -i tron-legacy-2010
$ ./trakt-sync movies -a videos -i tron-legacy-2010
$ ./trakt-sync movies -a refresh -i tron-legacy-2010
License
MIT