Skip to content

trakts CLI Reference

Krut Patel edited this page Aug 2, 2022 · 8 revisions

All commands have descriptive help messages available. So in case of doubt, simply add --help to the (sub)command to see the help docs (Example: trakts autostart --help and trakts --help). For reference, the various available commands are:

auth

Shows the status of the trakt authentication. If no token is found, or if the token in expired, it runs the authentication flow for trakt.tv.

$ trakts auth

Options

  • --force: Ignore the existing token, and force the authentication again.

autostart

Controls the autostart behaviour of the scrobbler.

$ trakts autostart <subcommand>

Subcommands

enable

Registers the app to be started automatically with computer startup.

disable

Disables app autostart.

backlog

Manage the backlog of watched media yet to be synced with trakt servers (mostly due to internet connectivity issues). Read this for more info.

$ trakts backlog <subcommand>

Subcommands

list

Lists all the files in the backlog.

clear

Try to add the unsynced files to trakt history.

config

Edits the scrobbler config settings. See Configuration section for more details.

$ trakts config <subcommand>

Subcommands

list

This command will list the parameters in the config, along with their current values.

$ trakts config list
players.monitored = ['mpv', 'vlc']
players.skip_interval = 5
general.enable_notifs = True
fileinfo.whitelist = ['/path/to/movies', '/path/to/anime', '/path/to/TV']
Options
  • --all: List ALL the config parameters, including those not overriden by the user.

set

Set the value for a config parameter, overriding the previous value.

  • Separate multiple values with spaces.
$ trakts config set players.monitored mpv vlc mpc-be
User config updated with 'players.monitored = ['mpv', 'vlc', 'mpc-be']'
  • For values containing space(s), surround them with double-quotes.
$ trakts config set fileinfo.whitelist D:\Media\Movies "C:\Users\My Name\Shows"
User config updated with 'fileinfo.whitelist = ['D:\\Media\\Movies', 'C:\\Users\\My Name\\Shows']'
Options
  • --add: Avoid overwriting the previous list values (whitelist, monitored, etc.).
$ trakts config set players.monitored mpv vlc
User config updated with 'players.monitored = ['mpv', 'vlc']'
$ trakts config set --add players.monitored plex mpc-hc  # NOTE "--add" used here
User config updated with 'players.monitored = ['mpv', 'vlc', 'plex', 'mpc-hc']'

unset

Reset a config value to its default.

$ trakts config unset players.mpc-hc.poll_interval
Successfully unset players.mpc-hc.poll_interval

init

Runs the initial setup of the scrobbler.

$ trakts init

log

Access the log file, mainly for debugging purposes.

$ trakts log <subcommand>

Subcommands

open

Opens the latest log file in your default editor. If this doesn't work, use the path command and open the file yourself.

path

Prints the location of the log file.

lookup

Searches for the given name on Trakt.

$ trakts lookup Breaking Bad
  • You can specify a year to limit the results
$ trakts lookup Inglorious Basterds --year 2009
  • You can specify the type (movie/show)
$ trakts lookup --type show Breaking Bad
  • By default, only the top 3 results are fetched. Use a combination of --limit (number of results per page) and --page (page number) options to get more results.

plex

Command to run the auth flow for Plex.

$ trakts plex
Options
  • --force: Ignore the existing token, and force the authentication again.

run

Run the scrobbler in the foreground. Mainly needed in case you have disabled the autostart service, and want to run the app manually.

$ trakts run

start

Starts the trakt-scrobbler service. If already running, does nothing.

$ trakts start
Options
  • --restart: Force restart the service.

status

Shows the status of trakt-scrobbler service.

$ trakts status

stop

Stops the trakt-scrobbler service.

$ trakts stop

test

Tests the connection with a player.

$ trakts test vlc
  • Start the player and load some whitelisted media file into it.
  • Add -vvv at the end to get detailed debug info for troubleshooting.
$ trakts test mpv -vvv

whitelist

Shortcut command to add folder(s) to whitelist in config.

$ trakts whitelist <subcommand>

Subcommands

add

Add a path to whitelist. Don't forget to restart the scrobbler after this.

$ trakts whitelist add D:\Media\My Movies
  • You can add only one path at a time, and it is ok to have spaces in the path
  • It is recommended to surround the path with double quotes
$ trakts whitelist add "D:\Media\My Movies"
Remote URL patterns
  • For remote urls, we only support http(s) for now, and they can be of the form https://www.example.org/path/to/directory and this will match all files under this directory. Example: https://www.example.org/path/to/directory/Season 1/S01E03.mp4

  • You can also specify a * to enable wildcard matching:

    • https://www.example.org/path/*
    • https://*.example.org/path
    • *://www.example.org/path
    • https://*.example.org/* will all match the url https://www.example.org/path/to/directory/Season 1/S01E03.mp4
    • Please note that a pattern with a / at the end (https://example.org/directory/) will not match any files under that directory. If you need to match any subpath, you need to have a *: https://example.org/directory/*.
  • Finally, we also allow http authentication fields in the url pattern: https://username:password@example.org/path is ok (useful for some self-hosted servers).

  • See https://github.com/jessepollak/urlmatch#examples for more examples.

  • For extracting media info, we use the path portion of the url only, ignoring the domain name. So in the above example, we use path/to/directory/Season 1/S01E03.mp4 for figuring out the media info.

show

List the current folders in whitelist.

$ trakts whitelist show

remove

Interactively remove folder(s) from whitelist.

$ trakts whitelist remove
# follow the on screen instructions now

test

Check whether the given file/folder is in the whitelist.

$ trakts whitelist test D:\Media\Movies
Clone this wiki locally