Skip to content

PGTrakt Commands

Kieran McEniff edited this page Mar 23, 2020 · 24 revisions

📂 Click Here - Sign up for Google's Suite for Business - Unlimited Space

📂 Click Here - NZB's with from NewsHost - PG Members Receive a 58% Discount


Before reading this, please view how to configure PGTrakt via - click here

pgtrakt uses Trakt to add new shows into Sonarr and new movies into Radarr.

Types of Trakt lists supported:

  • Official Trakt Lists

    • Trending

    • Popular

    • Anticipated

    • Boxoffice

    • Most Watched

    • Most Played

  • Public Lists

  • Private Lists*

    • Watchlist

    • Custom List(s)


Originally Written By: https://github.com/l3uddz/traktarr


Quick Commands

Once deployed, it's recommend to type pgtrakt on time and then proceed onward!

Before through the complex and well established guide, there are 4 commands that are very well utilized to stuff your server to the brink! Defiently with PG Blitz!

  • sudo pgtrakt shows -t popular

  • sudo pgtrakt shows -t trending

  • sudo pgtrakt movies -t popular

  • sudo pgtrakt movies -t trending

  • Want to advance edit the file? A user can, but DO NOT redeploy! Just follow the current steps

    1. sudo systemctl stop pgtrakt
    2. sudo nano /opt/appdata/pgtrakt/config.json
    3. sudo systemctl restart pgtrakt

Usage Manual

Usage: sudo pgtrakt run [OPTIONS]

  Run in automatic mode.

Options:
  -d, --add-delay FLOAT           Seconds between each add request to Sonarr /
                                  Radarr.  [default: 2.5]
  -s, --sort [votes|rating|release]
                                  Sort list to process.
  --no-search                     Disable search when adding to Sonarr /
                                  Radarr.
  --run-now                       Do a first run immediately without waiting.
  --no-notifications              Disable notifications.
  --ignore-blacklist              Ignores the blacklist when running the
                                  command.
  --help                          Show this message and exit.

-d, --add-delay - Add seconds delay between each add request to Sonarr / Radarr. Default is 2.5 seconds.

  • Example: -d 5

-s, --sort - Sort list by highest votes, highest rating, or the latest release dates. Default is highest votes.

  • Example: -s release

--no-search - Tells Sonarr / Radarr to not automatically search for added shows / movies.

--run-now - PGTrakt will run first automated search on start, without waiting for next interval.

--no-notifications - Disable notifications. Default is enabled.

--ignore-blacklist - Ignores blacklist filtering. Equivalent of disabled_for in config.json.

Example of a modified line from the pgtrakt.service file that will always add from the most recent releases matched:

ExecStart=/usr/bin/python3 /opt/appdata/pgtrakt/pgtrakt.py run -s release

Manual (CLI)

General

pgtrakt
Usage: sudo pgtrakt [OPTIONS] COMMAND [ARGS]...

  Add new shows & movies to Sonarr/Radarr from Trakt.

Options:
  --version       Show the version and exit.
  --config PATH   Configuration file  [default: /opt/appdata/pgtrakt/config.json]
  --logfile PATH  Log file  [default: /opt/appdata/pgtrakt/activity.log]
  --help          Show this message and exit.

Commands:
  movie                 Add a single movie to Radarr.
  movies                Add multiple movies to Radarr.
  run                   Run in automatic mode.
  show                  Add a single show to Sonarr.
  shows                 Add multiple shows to Sonarr.
  trakt_authentication  Authenticate pgtrakt.

Movie (Single Movie)

pgtrakt movie --help
Usage: sudo pgtrakt movie [OPTIONS]

  Add a single movie to Radarr.

Options:
  -id, --movie_id TEXT  Trakt movie_id.  [required]
  -f, --folder TEXT     Add movie with this root folder to Radarr.
  --no-search           Disable search when adding movie to Radarr.
  --help                Show this message and exit.

Note: This command only works with -id or --show_id specified (i.e. not with lists), and supports both Trakt IDs and IMDB IDs.

Movies (Multiple Movies)

sudo pgtrakt movies --help
Usage: sudo pgtrakt movies [OPTIONS]

  Add multiple movies to Radarr.

Options:
  -t, --list-type TEXT            Trakt list to process. For example,
                                  anticipated, trending, popular, boxoffice,
                                  watched, played, watchlist or any URL to a
                                  list  [required]
  -l, --add-limit INTEGER         Limit number of movies added to Radarr.
                                  [default: 0]
  -d, --add-delay FLOAT           Seconds between each add request to Radarr.
                                  [default: 2.5]
  -s, --sort [votes|rating|release]
                                  Sort list to process.
  -r, --rating INTEGER            Only add movies above this rating according to Rotten Tomatoese Score
                                  [default: 0]
  -g, --genre TEXT                Only add movies from this genre to Radarr.
  -f, --folder TEXT               Add movies with this root folder to Radarr.
  --no-search                     Disable search when adding movies to Radarr.
  --notifications                 Send notifications.
  --authenticate-user TEXT        Specify which user to authenticate with to
                                  retrieve Trakt lists. Default: first user in
                                  the config.
  --ignore-blacklist              Ignores the blacklist when running the
                                  command.
  --help                          Show this message and exit.

-t, --list-type - Trakt list to process. Choices are: anticipated, trending, popular, boxoffice, watched, played, URL (trakt list).

  • Watched Lists: Movies that are the most watched by unique Trakt users (mutliple viewings excluded).

    • watched / watched_weekly - Most watched in the week.

    • watched_monthly - Most watched in the month.

    • watched_yearly - Most watched in the year.

    • watched_all - Most watched of all time.

  • Played Lists: Movies that are the most played by Trakt users (mutliple viewings included).

    • played / played_weekly - Most played in the week.

    • played_monthly - Most played in the month.

    • played_yearly - Most played in the year.

    • played_all Most played of all time.

-l, --add-limit - Limit number of movies added to Radarr.

-d, --add-delay - Add seconds delay between each add request to Radarr. Default is 2.5 seconds.

  • Example: -d 5

-s, --sort - Sort list by highest votes, highest rating, or the latest release dates. Default is highest votes.

  • Example: -s release

-r, --rating - Only add movies above this Rotten Tomatoes score.

  • Example: -r 75

-g, --genre - Only add movies from this genre to Radarr.

  • Can find a list here.

-f, --folder - Add shows to a specific root folder in Radarr.

  • Example: -f /mnt/unionfs/Media/Movies/Movies-Kids/

--no-search - Tells Radarr to not automatically search for added movies.

--notifications - To enable notifications. Default is disabled.

--ignore-blacklist - Ignores blacklist filtering. Equivalent of disabled_for in config.json.

Show (Single Show)

sudo pgtrakt show --help
Usage: sudo pgtrakt show [OPTIONS]

  Add a single show to Sonarr.

Options:
  -id, --show_id TEXT  Trakt show_id.  [required]
  -f, --folder TEXT    Add show with this root folder to Sonarr.
  --no-search          Disable search when adding show to Sonarr.
  --help               Show this message and exit.

Note: This command only works with -id or --show_id specified (i.e. not with lists), and supports both Trakt IDs and IMDB IDs.

Shows (Multiple Shows)

sudo pgtrakt shows --help
Usage: sudo pgtrakt shows [OPTIONS]

  Add multiple shows to Sonarr.

Options:
  -t, --list-type TEXT            Trakt list to process. For example,
                                  anticipated, trending, popular, watched,
                                  played, watchlist or any URL to a list
                                  [required]
  -l, --add-limit INTEGER         Limit number of shows added to Sonarr.
                                  [default: 0]
  -d, --add-delay FLOAT           Seconds between each add request to Sonarr.
                                  [default: 2.5]
  -s, --sort [votes|rating|release]
                                  Sort list to process.
  -g, --genre TEXT                Only add shows from this genre to Sonarr.
  -f, --folder TEXT               Add shows with this root folder to Sonarr.
  --no-search                     Disable search when adding shows to Sonarr.
  --notifications                 Send notifications.
  --authenticate-user TEXT        Specify which user to authenticate with to
                                  retrieve Trakt lists. Default: first user in
                                  the config
  --ignore-blacklist              Ignores the blacklist when running the
                                  command.
  --help                          Show this message and exit.

-t, --list-type - Trakt list to process. Choices are: anticipated, trending, popular, watched, played, URL (trakt list).

  • Watched Lists: Shows that are the most watched by unique Trakt users (mutliple viewings excluded).

    • watched / watched_weekly - Most watched in the week.

    • watched_monthly - Most watched in the month.

    • watched_yearly - Most watched in the year.

    • watched_all - Most watched of all time.

  • Played Lists: Shows that are the most played by Trakt users (mutliple viewings included).

    • played / played_weekly - Most played in the week.

    • played_monthly - Most played in the month.

    • played_yearly - Most played in the year.

    • played_all Most played of all time.

-l, --add-limit - Limit number of shows added to Sonarr.

-d, --add-delay - Add seconds delay between each add request to Sonarr. Default is 2.5 seconds.

  • Example: -d 5

-s, --sort - Sort list by highest votes, highest rating, or the latest release dates. Default is highest votes.

  • Example: -s release

-g, --genre - Only add shows from this genre to Sonarr.

  • Can find a list here.

-f, --folder - Add shows to a specific root folder in Sonarr.

  • Example: -f /mnt/unionfs/Media/Shows/Shows-Kids/

--no-search - Tells Sonarr to not automatically search for added shows.

--notifications - To enable notifications. Default is disabled.

--ignore-blacklist - Ignores blacklist filtering. Equivalent of disabled_for in config.json.

Examples (CLI)

Example Movies

  • Add the movie "Black Panther (2018)":

    pgtrakt movie -id black-panther-2018
    
  • Add movies, from the popular list, labeled with the thriller genre, limited to 5 items, and sorted by latest release date.

    pgtrakt movies -t popular -g thriller -l 5 -s release
    
  • Add movies, from the boxoffice list, labeled with the comedy genre, limited to 10 items, and send notifications:

    pgtrakt movies -t boxoffice -g comedy -l 10 --notifications
    
  • Add movies, from a list of most watched played this week, and limited to 5 items.

    pgtrakt movies -t watched -l 5
    
  • Add movies, from a list of most played movies this month, and limited to 5 items.

    pgtrakt movies -t played_monthly -l 5
    
  • Add (all) movies from the public list https://trakt.tv/users/rkerwin/lists/top-100-movies:

    pgtrakt movies -t https://trakt.tv/users/rkerwin/lists/top-100-movies
    
  • Add movies, from the trending list, with a minimum rating of 80% on Rotten Tomatoes.

    pgtrakt movies -t trending -r 80
    

Example Shows

  • Add the show "The 100":

    pgtrakt show -id the-100
    
  • Add shows, from the popular list, limited to 5 items, and sorted by highest ratings.

    pgtrakt shows -t popular -l 5 -s rating
    
  • Add shows, from the popular list, limited to 2 items, and add them but don't search for episodes in Sonarr:

    pgtrakt shows -t popular -l 2 --no-search
    
  • Add shows, from a list of most watched shows this year, and limited to 5 items.

    pgtrakt shows -t watched_yearly -l 5
    
  • Add shows, from a list of most played shows this week, and limited to 5 items.

    pgtrakt shows -t played -l 5
    
  • Add shows, from a list of most played shows of all time, and limited to 5 items.

    pgtrakt shows -t played_all -l 5
    

Automatic

  • Want to advance edit the file? A user can, but DO NOT redeploy! Just follow the current steps

    1. sudo systemctl stop pgtrakt
    2. nano /opt/appdata/pgtrakt/config.json
    3. sudo systemctl restart pgtrakt

Used for automatic / scheduled pgtrakt tasks.

Movies can be run on a separate schedule then from Shows.

Note: These settings are only needed if you plan to use pgtrakt on a schedule (vs just using it as a CLI command only; see Usage).

"automatic": {
  "movies": {
    "anticipated": 3,
    "boxoffice": 10,
    "interval": 24,
    "popular": 3,
    "trending": 2,
    "watched": 2,
    "played_all": 2,
    "watchlist": {},
    "lists": {},
  },
  "shows": {
    "anticipated": 10,
    "interval": 48,
    "popular": 1,
    "trending": 2,
    "watched_monthly": 2,
    "played": 2,
    "watchlist": {},
    "lists": {}
  }
},

interval - Specify how often (in hours) to run pgtrakt task.

anticipated, popular, trending, boxoffice (movies only) - Specify how many items from each Trakt list to find.

watched - Adds items that are the most watched by unique Trakt users (mutliple viewings excluded).

  • watched / watched_weekly - Most watched in the week.

  • watched_monthly - Most watched in the month.

  • watched_yearly - Most watched in the year.

  • watched_all - Most watched of all time.

played - Adds items that are most the played items by Trakt users (mutliple viewings included).

  • played / played_weekly - Most played in the week.

  • played_monthly - Most played in the month.

  • played_yearly - Most played in the year.

  • played_all Most played of all time.

watchlist - Specify which watchlists to fetch (see explanation below).

lists - Specify which custom lists to fetch (see explanation below).

Usage Automated

Automatic (Scheduled)

Setup

  • Want to advance edit the file? A user can, but DO NOT redeploy! Just follow the current steps

    1. sudo systemctl stop pgtrakt
    2. nano /opt/appdata/pgtrakt/config.json
    3. sudo systemctl restart pgtrakt

To have pgtrakt get Movies and Shows for you automatically, on set interval, do the following:

  1. sudo cp /opt/appdata/pgtrakt/systemd/pgtrakt.service /etc/systemd/system/

  2. sudo nano /etc/systemd/system/pgtrakt.service and edit user/group to match yours' (run id to check).

  3. sudo systemctl daemon-reload

  4. sudo systemctl enable pgtrakt.service

  5. sudo systemctl start pgtrakt.service

Customize

You can customize how the scheduled pgtrakt is ran by editing the pgtrakt.service file and adding any of the following options:

* Remember, other configuration options need to go into the config.json file under the Automatic section.

pgtrakt run --help

Installing PlexGuide

  1. PlexGuide Install Information

Preplanning & Information

  1. PG Folder Structure

Domain and Port Control

  1. CloudFlare Tunnel

Primary Applications

  1. Plex

Useful Links

  1. PG YouTube Channel
Clone this wiki locally