Skip to main content

Command-line tools for Trakt.tv.

Project description

https://img.shields.io/travis/fuzeman/trakt-tools.svg?maxAge=2592000?style=flat-square https://img.shields.io/github/release/fuzeman/trakt-tools.svg?maxAge=2592000?style=flat-square https://img.shields.io/pypi/v/trakt-tools.svg?maxAge=2592000?style=flat-square

Command-line tools for Trakt.tv.

I’ve done my best to ensure there isn’t any critical bugs in this application, but please ensure your Trakt.tv profile has been backed up before running any operations with this application.

If you are concerned about data-loss: I would suggest reviewing the created backups yourself, they are simple JSON files that can be opened in any text editor. Backup files are structured exactly how they are returned from the Trakt.tv API.

Note: Backups can’t be applied to profiles yet, this feature will be available soon.

Install

pip install trakt-tools

Usage

>From a command-line, either run:

trakt_tools [COMMAND] [ARGS]

or:

python -m trakt_tools.runner.main [COMMAND] [ARGS]

Commands

Usage: trakt_tools [OPTIONS] COMMAND [ARGS]...

Options:
  --debug / --no-debug  Display debug messages. (default: disabled)
  --rate-limit INTEGER  Maximum number of requests per minute. (default: 20)
  --help                Show this message and exit.

history:duplicates:merge

Usage: trakt_tools history:duplicates:merge [OPTIONS]

  Merge duplicate history records

Options:
  --token TEXT            Trakt.tv authentication token. (default: prompt)
  --backup-dir TEXT       Directory that backups should be stored in. (default: "./backups")
  --delta-max INTEGER     Maximum delta between history records to consider as duplicate (in seconds). (default: 600)
  --per-page INTEGER      Request page size. (default: 1000)
  --backup / --no-backup  Backup profile before applying any changes. (default: prompt)
  --review / --no-review  Review each action before applying them. (default: prompt)
  --help                  Show this message and exit.

history:duplicates:scan

Usage: trakt_tools history:duplicates:scan [OPTIONS]

  Scan for duplicate history records

Options:
  --token TEXT         Trakt.tv authentication token. (default: prompt)
  --delta-max INTEGER  Maximum delta between history records to consider as duplicate (in seconds). (default: 600)
  --per-page INTEGER   Request page size. (default: 1000)
  --help               Show this message and exit.

profile:backup:apply (coming soon)

Usage: trakt_tools profile:backup:apply [OPTIONS]

  Apply backup to a Trakt.tv profile

Options:
  --help  Show this message and exit.

profile:backup:create

Usage: trakt_tools profile:backup:create [OPTIONS]

  Create backup of a Trakt.tv profile

Options:
  --token TEXT        Trakt.tv authentication token. (default: prompt)
  --backup-dir TEXT   Directory that backups should be stored in. (default: "./backups")
  --per-page INTEGER  Request page size. (default: 1000)
  --help              Show this message and exit.

Examples

Delete duplicate history record(s):

$ trakt_tools history:duplicates:merge
Navigate to https://trakt.tv/pin/10248
Pin: <Type PIN, ENTER>

Requesting profile...
Logged in as u'fuzeman'

Would you like to continue? [yes]: <ENTER>

Create profile backup? [yes]: <ENTER>

Collection
 - Received 248 movie(s)
 - Writing to "collection\movies.json"...
 - Received 377 show(s)
 - Writing to "collection\shows.json"...

History
 - Received 1000 item(s) (page 1 of 16)
 - Received 1000 item(s) (page 2 of 16)
 - Received 1000 item(s) (page 3 of 16)
 - Received 1000 item(s) (page 4 of 16)
 - Received 1000 item(s) (page 5 of 16)
 - Received 1000 item(s) (page 6 of 16)
 - Received 1000 item(s) (page 7 of 16)
 - Received 1000 item(s) (page 8 of 16)
 - Received 1000 item(s) (page 9 of 16)
 - Received 1000 item(s) (page 10 of 16)
 - Received 1000 item(s) (page 11 of 16)
 - Received 1000 item(s) (page 12 of 16)
 - Received 1000 item(s) (page 13 of 16)
 - Received 1000 item(s) (page 14 of 16)
 - Received 1000 item(s) (page 15 of 16)
 - Received 665 item(s) (page 16 of 16)
 - Writing to "history.json"...

Playback Progress
 - Received 92 item(s)
 - Writing to "playback.json"...

Ratings
 - Received 352 item(s)
 - Writing to "ratings.json"...

Watchlist
 - Received 161 item(s)
 - Writing to "watchlist.json"...

Compressing backup...
Cleaning up...
Backup has been saved to: ".\backups\fuzeman\2016-09-15_05-16-27.639000.zip"

Scanning for duplicates...
 - Processing 1000 items... (page 1 of 16)
 - Processing 1000 items... (page 2 of 16)
 - Processing 1000 items... (page 3 of 16)
 - Processing 1000 items... (page 4 of 16)
 - Processing 1000 items... (page 5 of 16)
 - Processing 1000 items... (page 6 of 16)
 - Processing 1000 items... (page 7 of 16)
 - Processing 1000 items... (page 8 of 16)
 - Processing 1000 items... (page 9 of 16)
 - Processing 1000 items... (page 10 of 16)
 - Processing 1000 items... (page 11 of 16)
 - Processing 1000 items... (page 12 of 16)
 - Processing 1000 items... (page 13 of 16)
 - Processing 1000 items... (page 14 of 16)
 - Processing 1000 items... (page 15 of 16)
 - Processing 665 items... (page 16 of 16)

Found 2 show(s) and 2 movie(s) with duplicates

Review every action? [yes]: <ENTER>

"Breaking Bad" (2008)
        S01E01 - 4 plays -> 3 plays
                Jan 21, 2008 03:00 PM NZDT (2008-01-21T02:00:00+00:00)
                Sep 26, 2011 10:18 PM NZDT (2011-09-26T09:18:20+00:00)
                Oct 06, 2013 04:47 PM NZDT (2013-10-06T03:47:08+00:00)

Remove 1 duplicate history record(s) for "Breaking Bad" (2008)? [yes]: <ENTER>
Removed 1 episode record(s) from history

----------------------------------------------------------------------

"Orphan Black" (2013)
        S01E01 - 3 plays -> 2 plays
                Mar 31, 2013 03:00 PM NZDT (2013-03-31T02:00:00+00:00)
                Apr 08, 2013 01:23 AM NZST (2013-04-07T13:23:52+00:00)

Remove 1 duplicate history record(s) for "Orphan Black" (2013)? [yes]: <ENTER>
Removed 1 episode record(s) from history

----------------------------------------------------------------------

"Inception" (2010) - 4 plays -> 3 plays
        Sep 14, 2016 10:15 PM NZST (2016-09-14T10:15:00+00:00)
        Jul 16, 2010 10:00 PM NZST (2010-07-16T10:00:00+00:00)
        Oct 26, 2011 07:07 PM NZDT (2011-10-26T06:07:25+00:00)

Remove 1 duplicate history record(s) for "Inception" (2010)? [yes]: <ENTER>
Removed 1 movie record(s) from history

----------------------------------------------------------------------

"The Matrix" (1999) - 3 plays -> 2 plays
        Mar 30, 1999 10:00 PM NZST (1999-03-30T10:00:00+00:00)
        Aug 20, 2011 12:04 PM NZST (2011-08-20T00:04:30+00:00)

Remove 1 duplicate history record(s) for "The Matrix" (1999)? [yes]: <ENTER>
Removed 1 movie record(s) from history

----------------------------------------------------------------------

Done

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trakt-tools-0.1.4.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trakt_tools-0.1.4-py2.py3-none-any.whl (29.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file trakt-tools-0.1.4.tar.gz.

File metadata

  • Download URL: trakt-tools-0.1.4.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for trakt-tools-0.1.4.tar.gz
Algorithm Hash digest
SHA256 add4edd6aef812f1749af3632ef7c80194075355efe2f78d5e5eb3341eff536f
MD5 e620745bf228adb981ddf0426b7a1a9f
BLAKE2b-256 f1283773ba7ebf3edd7930f0be7742311a492de575b00ac6a64d33b5c5a4710f

See more details on using hashes here.

File details

Details for the file trakt_tools-0.1.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for trakt_tools-0.1.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3eb9616c6c427d9d4ed7e764be7c45a47e79b2180baa91d7399523e12e401c33
MD5 b9ec94e06dae04420ef691e3b83558fc
BLAKE2b-256 6bfd03a3da9fed133c6d78a11e205cc0259f866a4456bfa5641188367de1cefe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page