Code Monkey home page Code Monkey logo

traktarr's Introduction

Traktarr

made-with-python License: GPL v3 last commit (master) Discord Contributing Donate



Introduction

Traktarr uses Trakt.tv to find shows and movies to add in to Sonarr and Radarr, respectively.

Types of Trakt lists supported:

  • Official Trakt Lists

    • Trending

    • Popular

    • Anticipated

    • Box Office

    • Most Watched

    • Most Played

  • Public Lists

  • Private Lists*

    • Watchlist

    • Custom List(s)

* Support for multiple (authenticated) users.

Demo

Click to enlarge.

asciicast

Requirements

  1. Debian OS (can work in other operating systems as well).

  2. Python 3.5+

  3. Required Python modules.

Installation

1. Base Install

Installs Traktarr to the system so that it can be ran with the traktarr command.

  1. Clone the Traktarr repo.

    sudo git clone https://github.com/l3uddz/traktarr /opt/traktarr
    
  2. Fix permissions of the traktarr folder (replace user/group with your info; run id to check).

    sudo chown -R user:group /opt/traktarr
    
  3. Go into the traktarr folder.

    cd /opt/traktarr
    
  4. Install Python and PIP.

    sudo apt-get install python3 python3-pip
    
  5. Install the required python modules.

    sudo python3 -m pip install -r requirements.txt
    
  6. Create a shortcut for traktarr.

    sudo ln -s /opt/traktarr/traktarr.py /usr/local/bin/traktarr
    
  7. Generate a basic config.json file.

    traktarr run
    
  8. Configure the config.json file.

    nano config.json
    

2. Create a Trakt Application

  1. Create a Trakt application by going here

  2. Enter a name for your application; for example traktarr

  3. Enter urn:ietf:wg:oauth:2.0:oob in the Redirect uri field.

  4. Click "SAVE APP".

  5. Open the Traktarr configuration file config.json and insert your Trakt Client ID in the client_id and your Trakt Client Secret in the client_secret, like this:

    "trakt": {
        "client_id": "your_trakt_client_id",
        "client_secret": "your_trakt_client_secret"
    }

3. Authenticate User(s) (optional)

For each user you want to access the private lists for (i.e. watchlist and/or custom lists), you will need to to authenticate that user.

Repeat the following steps for every user you want to authenticate:

  1. Run the following command:

    traktarr trakt_authentication
    
  2. You wil get the following prompt:

    - We're talking to Trakt to get your verification code. Please wait a moment...
    - Go to: https://trakt.tv/activate on any device and enter A0XXXXXX. We'll be polling Trakt every 5 seconds for a reply
    
  3. Go to https://trakt.tv/activate.

  4. Enter the code you see in your terminal.

  5. Click Continue.

  6. If you are not logged in to Trakt.tv, login now.

  7. Click Accept.

  8. You will get the message: "Woohoo! Your device is now connected and will automatically refresh in a few seconds.".

You've now authenticated the user.

You can repeat this process for as many users as you like.

Configuration

Sample Configuration

{
  "core": {
    "debug": false
  },
  "automatic": {
    "movies": {
      "anticipated": 3,
      "boxoffice": 10,
      "interval": 24,
      "popular": 3,
      "trending": 2
    },
    "shows": {
      "anticipated": 10,
      "interval": 48,
      "popular": 1,
      "trending": 2
    }
  },
  "filters": {
    "movies": {
      "disabled_for": [],
      "allowed_countries": [
        "us",
        "gb",
        "ca"
      ],
      "allowed_languages": [
        "en"
      ],
      "blacklisted_genres": [
        "documentary",
        "music",
        "animation"
      ],
      "blacklisted_max_runtime": 0,
      "blacklisted_min_runtime": 60,
      "blacklisted_min_year": 2000,
      "blacklisted_max_year": 2019,
      "blacklisted_title_keywords": [
        "untitled",
        "barbie",
        "ufc"
      ],
      "blacklisted_tmdb_ids": [],
      "rotten_tomatoes": ""
    },
    "shows": {
      "disabled_for": [],
      "allowed_countries": [
        "us",
        "gb",
        "ca"
      ],
      "allowed_languages": [],
      "blacklisted_genres": [
        "animation",
        "game-show",
        "talk-show",
        "home-and-garden",
        "children",
        "reality",
        "anime",
        "news",
        "documentary",
        "special-interest"
      ],
      "blacklisted_networks": [
        "twitch",
        "youtube",
        "nickelodeon",
        "hallmark",
        "reelzchannel",
        "disney",
        "cnn",
        "cbbc",
        "the movie network",
        "teletoon",
        "cartoon network",
        "espn",
        "yahoo!",
        "fox sports"
      ],
      "blacklisted_max_runtime": 0,
      "blacklisted_min_runtime": 15,
      "blacklisted_min_year": 2000,
      "blacklisted_max_year": 2019,
      "blacklisted_title_keywords": [],
      "blacklisted_tvdb_ids": []
    }
  },
  "notifications": {
    "pushover": {
      "service": "pushover",
      "app_token": "",
      "user_token": "",
      "priority": 0
    },
    "slack": {
      "service": "slack",
      "webhook_url": ""
    },
    "verbose": true
  },
  "radarr": {
    "api_key": "",
    "minimum_availability": "released",
    "quality": "HD-1080p",
    "root_folder": "/movies/",
    "url": "http://localhost:7878/"
  },
  "sonarr": {
    "api_key": "",
    "language": "English",
    "quality": "HD-1080p",
    "root_folder": "/tv/",
    "season_folder": true,
    "tags": [],
    "url": "http://localhost:8989/"
  },
  "trakt": {
    "client_id": "",
    "client_secret": ""
  },
  "omdb": {
    "api_key": ""
  }
}

Core

"core": {
  "debug": false
},

debug - Toggle debug messages in the log. Default is false.

  • Set to true, if you are having issues and want to diagnose why.

Automatic

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

Used for automatic / scheduled Traktarr tasks.

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

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

Format:

  • "List Name": # of items to add into Radarr/Sonarr.

Note: The number specified is the number of items that will be added into Radarr/Sonarr. It is not a Trakt list limit, i.e. this is not going to lookup Top X items.

Interval

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

  • Setting interval to 0, will skip the schedule for that task.

  • For example, if you only want to add movies and not TV shows, you can set show's interval to 0.

Official Trakt Lists

anticipated - Trakt Anticipated List.

  • Most anticipated movies/shows based on the number of lists a movie/show appears on.

popular - Trakt Popular List.

  • Most popular movies/shows. Popularity is calculated using the rating percentage and the number of ratings.

trending - Trakt Trending List.

  • All movies/shows being watched right now. Movies with the most users are returned first.

boxoffice - Trakt Box Office List. Movies only.

  • Top 10 grossing movies in the U.S. box office last weekend. Updated every Monday morning.

watched - Most watched (unique users) movies in the specified time period.

  • 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 - Most played (a single user can watch multiple times) items in the specified time period.

  • 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).

Custom Lists

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

You can also schedule any number of public or private custom lists.

For both public and private lists you'll need the url to that list. When viewing the list on Trakt, simply copy the url from the address bar of the your browser.

Note: These are for non-watchlist lists. If you want to add a watchlist list, use the next section below.

Public Lists

Public lists can be added by specifying the url and the item limit like this:

"automatic": {
  "movies": {
    "lists": {
        "https://trakt.tv/users/rkerwin/lists/top-100-movies": 10
    }
  },
  "shows": {
    "lists": {
        "https://trakt.tv/users/claireaa/lists/top-100-tv-shows-of-all-time-ign": 10
    }
  }
},

Private Lists

Private lists can be added in two ways:

  1. If there is only one authenticated user, you can add the private list just like any other public list:

    "automatic": {
      "movies": {
        "lists": {
            "https://trakt.tv/users/user/lists/my-private-movies-list": 10
        }
      },
      "shows": {
        "lists": {
            "https://trakt.tv/users/user/lists/my-private-shows-list": 10
        }
      }
    },
  2. If there are multiple authenticated users you want to fetch the lists from, you'll need to specify the username under authenticate_as.

    Note: The user should have access to the list (either own the list or a list that was shared to them by a friend).

    "automatic": {
      "movies": {
        "lists": {
            "https://trakt.tv/users/user/lists/my-private-movies-list": {
                "authenticate_as": "user2",
                "limit": 10
            }
        }
      },
      "shows": {
        "lists": {
            "https://trakt.tv/users/user/lists/my-private-shows-list": {
                "authenticate_as": "user2",
                "limit": 10
            }
        }
      }
    },

Personal Trakt Watchlists

The watchlist task can be scheduled with a different item limit for every (authenticated) user.

So for every user, you will add: "username": limit to the watchlist key. For example:

"automatic": {
  "movies": {
    "watchlist": {
        "user1": 10,
        "user2": 5
    }
  },
  "shows": {
    "watchlist": {
        "user1": 2,
        "user3": 1
    }
  }
},

Filters

Use filters to specify the movie/shows's country of origin or blacklist (i.e. filter-out) certain keywords, genres, years, runtime, or specific movies/shows.

Movies

  "movies": {
    "disabled_for": [],
    "allowed_countries": [
      "us",
      "gb",
      "ca"
    ],
    "allowed_languages": [],
    "blacklisted_genres": [
      "documentary",
      "music",
      "animation"
    ],
    "blacklisted_max_runtime": 0,
    "blacklisted_min_runtime": 60,
    "blacklisted_min_year": 2000,
    "blacklisted_max_year": 2019,
    "blacklisted_title_keywords": [
      "untitled",
      "barbie"
    ],
    "blacklisted_tmdb_ids": [],
    "rotten_tomatoes": ""
  },

disabled_for - Specify for which lists the blacklist is disabled for, when running in automatic mode.

  • This is similar to running --ignore-blacklist via the CLI command.

  • Example:

    "disabled_for": [
        "anticipated",
        "watchlist:user1",
        "list:http://url-to-list"
    ],

allowed_countries - Only add movies from these countries. Listed as two-letter country codes.

  • List of available country codes.

  • Special keywords:

    • Blank list (i.e. []) - Add movies from any country.

    • ignore (i.e. ["ignore"]) - Add movies from any country, including ones with no country specified.

allowed_languages - Only add movies with these languages. Listed as two-letter language codes.

  • Languages are in ISO 639-1 format (e.g. ja for Japanese.)

  • List of available language codes.

  • Special keywords:

    • Blank list (i.e. []) - Add movies with any language.

    • ignore (i.e. ["ignore"]) - Add movies with any language, including ones with no language specified.

blacklisted_genres - Blacklist certain genres.

  • List of available movie genres.

  • For an updated list, visit here.

  • Special Keywords:

    • Blank list (i.e. []) - Add movies from any genre.

    • ignore (i.e. ["ignore"]) - Add movies from any genre, including ones with no genre specified.

blacklisted_min_runtime - Blacklist runtime duration shorter than specified time (in minutes).

blacklisted_max_runtime - Blacklist runtime duration longer than specified time (in minutes).

  • Has to be longer than blacklisted_min_runtime or else it will be ignored.

blacklisted_min_year - Blacklist release dates before specified year. This can be a 4 digit year, 0, or -<number of years to go back> format.

  • If 0, blacklist movies that came out before the current year.

  • If -10, blacklist movies that came out 10 years before the current year.

blacklisted_max_year - Blacklist release dates after specified year. This can be a 4 digit year, 0, or +<number of years to go forward> format.

  • If 0, blacklist movies that are coming out after the current year.

  • If +1, blacklist movies that are coming out after 1 year from current year.

blacklisted_title_keywords - Blacklist certain words in titles.

blacklisted_tmdb_ids - Blacklist certain movies with their TMDB IDs.

  • Example:

    "blacklisted_tmdb_ids": [
      140607,
      181808
    ],

rotten_tomatoes - Only add movies that are equal to or above this Rotten Tomatoes score. Requires an OMDb API Key (see below).

Shows

"shows": {
  "allowed_countries": [
    "us",
    "gb",
    "ca"
  ],
  "allowed_languages": [],
  "blacklisted_genres": [
    "animation",
    "game-show",
    "talk-show",
    "home-and-garden",
    "children",
    "reality",
    "anime",
    "news",
    "documentary",
    "special-interest"
  ],
  "blacklisted_networks": [
    "twitch",
    "youtube",
    "nickelodeon",
    "hallmark",
    "reelzchannel",
    "disney",
    "cnn",
    "cbbc",
    "the movie network",
    "teletoon",
    "cartoon network",
    "espn",
    "yahoo!",
    "fox sports"
  ],
  "blacklisted_max_runtime": 0,
  "blacklisted_min_runtime": 15,
  "blacklisted_min_year": 2000,
  "blacklisted_max_year": 2019,
  "blacklisted_title_keywords": [],
  "blacklisted_tvdb_ids": []
}

disabled_for - Specify for which lists the blacklist is disabled for, when running in automatic mode.

  • This is similar to running --ignore-blacklist via the CLI command.

  • Example:

    "disabled_for": [
        "anticipated",
        "watchlist:user1",
        "list:http://url-to-list"
    ],

allowed_countries - Only add shows from these countries. Listed as two-letter country codes.

  • List of available country codes.

  • Special keywords:

    • Blank list (i.e. []) - Add shows from any country.

    • ignore (i.e. ["ignore"]) - Add shows from any country, including ones with no country specified.

allowed_languages - Only add shows with these languages.

  • Languages are in ISO 639-1 format (e.g. ja for Japanese.)

  • List of available language codes.

  • Special keywords:

    • Blank list (i.e. []) - Add shows with any language.

    • ignore (i.e. ["ignore"]) - Add shows with any language, including ones with no language specified.

blacklisted_genres - Blacklist certain genres.

  • List of available TV show genres.

  • For an updated list, visit here.

  • Special Keywords:

    • Blank list (i.e. []) - Add shows from any genre.

    • ignore (i.e. ["ignore"]) - Add shows from any genre, including ones with no genre specified.

blacklisted_networks - Blacklist certain network.

blacklisted_min_runtime - Blacklist runtime duration shorter than specified time (in minutes).

blacklisted_max_runtime - Blacklist runtime duration longer than specified time (in minutes).

  • Has to be longer than blacklisted_min_runtime or else it will be ignored.

blacklisted_min_year - Blacklist release dates before specified year. This can be a 4 digit year, 0, or -<number of years to go back> format.

  • If 0, blacklist shows that came out before the current year.

  • If -10, blacklist shows that came out 10 years before the current year.

blacklisted_max_year - Blacklist release dates after specified year. This can be a 4 digit year, 0, or +<number of years to go forward> format.

  • If 0, blacklist shows that are coming out after the current year.

  • If +1, blacklist shows that are coming out after 1 year from current year.

blacklisted_title_keywords - Blacklist certain words in titles.

blacklisted_tvdb_ids - Blacklist certain shows with their TVDB IDs.

  • Example:

    "blacklisted_tvdb_ids": [
      79274,
      85287,
      71256,
      194751,
      76733,
      336238
    ],

Notifications

"notifications": {
  "Apprise": {
    "service": "apprise",
    "url": "",
    "title": ""
  },
  "verbose": false
},

Notification alerts for Traktarr tasks.

For auto (i.e. scheduled) runs, notifications are enabled automatically when notification services are listed in this section.

For manual (i.e. CLI) commands, you need to add the --notifications flag.

Supported services:

  • apprise
  • pushover
  • slack

Note: The key name can be anything, but the service key must be must be the exact service name (e.g. pushover). See below for example.

"notifications": {
  "anyname": {
    "service": "pushover",
  }
},

General

verbose - Toggle detailed notifications.

  • Default is true.

  • Set to false if you want to reduce the amount of detailed notifications (e.g. just the total vs the names of the movies/shows added).

"notifications": {
  "verbose": true
},

Apprise

"notifications": {
  "Apprise": {
    "service": "apprise",
    "url": "",
    "title": ""
  },
  "verbose": false
},

url - Apprise service URL (see here).

  • Required.

title - Notification Title.

  • Optional.

  • Default is Traktarr.

Pushover

"notifications": {
  "pushover": {
    "service": "pushover",
    "app_token": "",
    "user_token": "",
    "priority": 0
  },
  "verbose": false
},

app_token - App Token from Pushover.net.

  • Required.

user_token - User Token from Pushover.net.

  • Required.

priority - Priority of the notifications.

  • Optional.

  • Choices are: -2, -1, 0, 1, 2.

  • Values are not quoted.

  • Default is 0.

Slack

"notifications": {
  "slack": {
    "service": "slack",
    "webhook_url": "",
    "channel": "",
    "sender_name": "Traktarr",
    "sender_icon": ":movie_camera:"
  },
  "verbose": false
},

webhook_url - Webhook URL.

  • Required.

channel - Slack channel to send the notifications to.

  • Optional.

  • Default is blank.

sender_name - Sender's name for the notifications.

  • Optional.

  • Default is Traktarr.

sender_icon - Icon to use for the notifications.

  • Optional.

  • Default is :movie_camera:

Radarr

Radarr configuration.

"radarr": {
  "api_key": "",
  "minimum_availability": "released",
  "quality": "HD-1080p",
  "root_folder": "/movies/",
  "url": "http://localhost:7878"
},

api_key - Radarr's API Key.

quality - Quality Profile that movies are assigned to.

minimum_availability - The minimum availability the movies are set to.

  • Choices are announced, in_cinemas or released (Physical/Web).

  • Default is released (Physical/Web).

root_folder - Root folder for movies.

url - Radarr's URL.

  • Note: If you have URL Base enabled in Radarr's settings, you will need to add that into the URL as well.

Sonarr

Sonarr configuration.

"sonarr": {
  "api_key": "",
  "language": "English",
  "quality": "HD-1080p",
  "root_folder": "/tv/",
  "season_folder": true,
  "tags": [],
  "url": "http://localhost:8989"
},

api_key - Sonarr's API Key.

language - Language Profile that TV shows are assigned to. Only applies to Sonarr v3.

quality - Quality Profile that TV shows are assigned to.

root_folder - Root folder for TV shows.

season_folder - Sort episodes into season folders.

tags - Assign tags to shows. Tags need to be created in Sonarr first.

  • Examples:

    "tags": ["anime"]
    "tags": ["anime", "jap"]
    "tags": [
      "anime", 
      "jap"
    ]

url - Sonarr's URL.

  • Note: If you have URL Base enabled in Sonarr's settings, you will need to add that into the URL as well.

Trakt

Trakt Authentication info:

"trakt": {
  "client_id": "",
  "client_secret": ""
}

client_id - Your Trakt API Key (Client ID).

client_secret - Your Trakt Secret Key (Client Secret).

OMDb

OMDb Authentication info.

"omdb": {
  "api_key":""
}

api_key - Your OMDb API Key.

  • This is only needed if you wish to use a minimum Rotten Tomatoes score to filter out movies.

  • Use rotten_tomatoes in config for automatic scheduling or --rotten_tomatoes as an argument for CLI.

Usage

Automatic (Scheduled)

Setup

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

  1. sudo cp /opt/traktarr/systemd/traktarr.service /etc/systemd/system/

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

  3. sudo systemctl daemon-reload

  4. sudo systemctl enable traktarr.service

  5. sudo systemctl start traktarr.service

Customize

You can customize how the scheduled Traktarr is ran by editing the traktarr.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.

traktarr run --help
Usage: traktarr 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 - Traktarr 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 traktarr.service file that will always add from the most recent releases matched:

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

Manual (CLI)

General

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

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

Options:
  --version         Show the version and exit.
  --config PATH     Configuration file  [default: /Users/macuser/Documents/Git
                    Hub/l3uddz/traktarr/config.json]
  --cachefile PATH  Cache file  [default:
                    /Users/macuser/Documents/GitHub/l3uddz/traktarr/cache.db]
  --logfile PATH    Log file  [default: /Users/macuser/Documents/GitHub/l3uddz
                    /traktarr/activity.log]
  --help            Show this message and exit.

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

Movie (Single Movie)

traktarr movie --help
Usage: traktarr 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.
  -ma, --minimum-availability [announced|in_cinemas|released]
                        Add movies with this minimum availability to Radarr.
  --no-search           Disable search when adding movie to Radarr.
  --help                Show this message and exit.

-id, --movie-id - ID/slug of the movie to add to Radarr. Supports both Trakt and IMDB IDs. This arguent is required.

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

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

minimum_availability - The minimum availability the movies are set to.

  • Choices are announced, in_cinemas or released (Physical/Web).

  • Default is released (Physical/Web).

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

Movies (Multiple Movies)

traktarr movies --help
Usage: traktarr movies [OPTIONS]

  Add multiple movies to Radarr.

Options:
  -t, --list-type TEXT            Trakt list to process. For example, 'anticipated', 'trending',
                                  'popular', 'person', 'watched', 'played', 'recommended',
                                  'watchlist', or any URL to a list.  [required]
  -l, --add-limit INTEGER         Limit number of movies added to Radarr.
  -d, --add-delay FLOAT           Seconds between each add request to Radarr.  [default: 2.5]
  -s, --sort [rating|release|votes]
                                  Sort list to process.  [default: votes]
  -rt, --rotten_tomatoes INTEGER  Set a minimum Rotten Tomatoes score.
  -y, --year, --years TEXT        Can be a specific year or a range of years to search. For
                                  example, '2000' or '2000-2010'.
  -g, --genres TEXT               Only add movies from this genre to Radarr. Multiple genres are
                                  specified as a comma-separated list. Use 'ignore' to add movies
                                  from any genre, including ones with no genre specified.
  -f, --folder TEXT               Add movies with this root folder to Radarr.
  -ma, --minimum-availability [announced|in_cinemas|released]
                                  Add movies with this minimum availability to Radarr. Default is
                                  'released'.
  -p, --person TEXT               Only add movies from this person (e.g. actor) to Radarr. Only
                                  one person can be specified. Requires the 'person' list type.
  --include-non-acting-roles      Include non-acting roles such as 'Director', 'As Himself',
                                  'Narrator', etc. Requires the 'person' list type with the
                                  'person' argument.
  --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.
                                  Defaults to first user in the config.
  --ignore-blacklist              Ignores the blacklist when running the command.
  --remove-rejected-from-recommended
                                  Removes rejected/existing movies from recommended.
  --help                          Show this message and exit.

-t, --list-type - Trakt list to process.

Choices are: anticipated, trending, popular, boxoffice, watched, played, URL (Trakt list), or person (used with -p/--person argument).

  • Top Watched List options:

    • 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.

  • Top Played List options:

    • 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.

  • Note: This is a limit on how many items are added into Radarr. Not a limit on how many items to retrieve from Trakt.

-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

-rt, --rotten_tomatoes - Only add movies equal to or above this Rotten Tomatoes score.

  • Example: -rt 75

-y, --year, --years - Only add movies from from a specific year or range of years.

  • Examples: -y 2010, --years 2010-2020

-g, --genres - Only add movies from these genre(s) to Radarr.

  • Multiple genres are passed as comma-separated lists. The effect of this is equivalent of boolean OR. (ie. include items from any of these genres).

  • Can find a list here.

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

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

minimum_availability - The minimum availability the movies are set to.

  • Choices are announced, in_cinemas or released (Physical/Web).

  • Default is released (Physical/Web).

-p, --person - Only add movies with a specific person to Radarr.

  • Requires the list type person.

--include-non-acting-roles - Include non-acting roles of the specified person.

  • Requires the list type person used with the -p/--person option.

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

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

--authenticate-user - Specify which authenticated user to retrieve Trakt lists as. Default is the first user in the config.

--ignore-blacklist - Ignores blacklist filtering.

  • Equivalent of disabled_for in config.json.

--remove-rejected-from-recommended - Removes rejected/existing shows from the recommended list, so that it will be removed from further recommendations.

Show (Single Show)

traktarr show --help
Usage: traktarr 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.

-id, --show-id - ID/slug of the show to add to Sonarr. Supports both Trakt and IMDB IDs. This argument is required.

Shows (Multiple Shows)

traktarr shows --help
Usage: traktarr shows [OPTIONS]

  Add multiple shows to Sonarr.

Options:
  -t, --list-type TEXT            Trakt list to process. For example, 'anticipated', 'trending',
                                  'popular', 'person', 'watched', 'played', 'recommended',
                                  'watchlist', or any URL to a list.  [required]
  -l, --add-limit INTEGER         Limit number of shows added to Sonarr.
  -d, --add-delay FLOAT           Seconds between each add request to Sonarr.  [default: 2.5]
  -s, --sort [rating|release|votes]
                                  Sort list to process.  [default: votes]
  -y, --year, --years TEXT        Can be a specific year or a range of years to search. For
                                  example, '2000' or '2000-2010'.
  -g, --genres TEXT               Only add shows from this genre to Sonarr. Multiple genres are
                                  specified as a comma-separated list. Use 'ignore' to add shows
                                  from any genre, including ones with no genre specified.
  -f, --folder TEXT               Add shows with this root folder to Sonarr.
  -p, --person TEXT               Only add shows from this person (e.g. actor) to Sonarr. Only one
                                  person can be specified. Requires the 'person' list type.
  --include-non-acting-roles      Include non-acting roles such as 'Director', 'As Himself',
                                  'Narrator', etc. Requires the 'person' list type with the
                                  'person' argument.
  --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.
                                  Defaults to first user in the config
  --ignore-blacklist              Ignores the blacklist when running the command.
  --remove-rejected-from-recommended
                                  Removes rejected/existing shows from recommended.
  --help                          Show this message and exit.

-t, --list-type - Trakt list to process.

Choices are: anticipated, trending, popular, watched, played, URL (Trakt list), or person (used with -p/--person argument).

  • Top Watched List options:

    • 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.

  • Top Played List options:

    • 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.

  • Note: This is a limit on how many items are added into Sonarr. Not a limit on how many items to retrieve from Trakt.

-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

-y, --year, --years - Only add shows from from a specific year or range of years.

  • Examples: -y 2010, --years 2010-2020

-g, --genres - Only add shows from this genre(s) to Sonarr.

  • Multiple genres are passed as comma-separated lists. The effect of this is equivalent of boolean OR. (ie. include items from any of these genres).

  • Can find a list here.

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

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

-p, --person - Only add shows with a specific person to Sonarr.

  • Requires the list type person.

--include-non-acting-roles - Include non-acting roles of the specified person.

  • Requires the list type person used with the -p/--person option.

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

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

--authenticate-user - Specify which authenticated user to retrieve Trakt lists as. Default is the first user in the config.

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

--remove-rejected-from-recommended - Removes rejected/existing shows from the recommended list, so that it will be removed from further recommendations.

Examples (CLI)

Movies

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

    traktarr 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.

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

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

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

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

    traktarr movies -t https://trakt.tv/users/rkerwin/lists/top-100-movies
    
  • Add (all) movies from the private list https://trakt.tv/users/user1/lists/private-movies-list of user1:

    traktarr movies -t https://trakt.tv/users/user1/lists/private-movies-list --authenticate-user=user1
    
  • Add movies, from the trending list, with a minimum Rotten Tomatoes score of 80%.

    traktarr movies -t trending -rt 80
    
  • Add movies, from the trending list, from the year 2020.

    traktarr movies -t trending -y 2020
    
  • Add movies, with actor 'Keanu Reeves', limited to 10 items.

    traktarr movies -t person -p 'keanu reeves' -l 10
    
  • Add movies, with actor 'Tom Cruise', including movies where he has non-acting roles, limited to 10 items.

    traktarr movies -t person -p 'tom cruise' --include-non-acting-roles -l 10
    

Shows

  • Add the show "The 100":

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

    traktarr 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:

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

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

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

    traktarr shows -t played_all -l 5
    
  • Add (all) shows from the watchlist of user1:

    traktarr shows -t watchlist --authenticate-user user1
    

traktarr's People

Contributors

chazlarson avatar daghaian avatar desimaniac avatar horjulf avatar l3uddz avatar mitchellklijs avatar nemchik avatar owine avatar saltydk avatar z3t avatar zenjabba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

traktarr's Issues

traktarr.service error.

Hi team,

Getting this error when trying to run traktarr as a systemd service.

Dec 07 20:12:11 LanBOX python3[38656]: 2018-12-07 20:12:11,149 - ERROR      - traktarr                            - run                                 - Unhandled exception occurred while processing scheduled tasks: unsupported operand type(s) for -: 'NoneType' and 'datetime.datetime'
Dec 07 20:12:11 LanBOX python3[38656]: Traceback (most recent call last):
Dec 07 20:12:11 LanBOX python3[38656]:   File "/opt/traktarr/traktarr.py", line 846, in run
Dec 07 20:12:11 LanBOX python3[38656]:     time.sleep(max(schedule.idle_seconds(), 0))
Dec 07 20:12:11 LanBOX python3[38656]:   File "/usr/local/lib/python3.6/dist-packages/schedule/__init__.py", line 528, in idle_seconds
Dec 07 20:12:11 LanBOX python3[38656]:     return default_scheduler.idle_seconds
Dec 07 20:12:11 LanBOX python3[38656]:   File "/usr/local/lib/python3.6/dist-packages/schedule/__init__.py", line 152, in idle_seconds
Dec 07 20:12:11 LanBOX python3[38656]:     return (self.next_run - datetime.datetime.now()).total_seconds()
Dec 07 20:12:11 LanBOX python3[38656]: TypeError: unsupported operand type(s) for -: 'NoneType' and 'datetime.datetime'```

Second Radarr instance

Hi
Recently setup traktarr. Working great adding to Radarr and Sonarr. Thanks very much!

My current setup currently involves a second instance of Radarr purely for 4K material. Is it possible to add this to traktarr also (separate radarr instance in the config json)? Or is a separate instance of traktarr required with a different config?

Appreciate your time.

Aborting due to failure to retrieve movie exclusion list from Radarr

Don’t know why this is happening. I don’t have any exclusions setup in radarr.

2019-10-06 11:17:10,736 - INFO - Traktarr - validate_trakt - ...Validated Trakt API Key.
2019-10-06 11:17:10,742 - DEBUG - media.pvr - validate_api_key - Request Response: 200
2019-10-06 11:17:10,742 - INFO - Traktarr - validate_pvr - Validated Radarr URL & API Key.
2019-10-06 11:17:10,750 - DEBUG - media.pvr - get_quality_profile_id - Request URL: http://192.168.2.232:7878/radarr/api/profile
2019-10-06 11:17:10,750 - DEBUG - media.pvr - get_quality_profile_id - Request Response: 200
2019-10-06 11:17:10,750 - DEBUG - media.pvr - get_quality_profile_id - Found Quality Profile ID for 'HD - 720p/1080p': 6
2019-10-06 11:17:10,750 - INFO - Traktarr - get_quality_profile_id - Retrieved Quality Profile ID for 'HD - 720p/1080p': 6
2019-10-06 11:17:13,000 - DEBUG - media.pvr - _get_objects - Request URL: http://192.168.2.232:7878/radarr/api/movie
2019-10-06 11:17:13,000 - DEBUG - media.pvr - _get_objects - Request Response: 200
2019-10-06 11:17:13,132 - DEBUG - media.pvr - _get_objects - Found 3463 objects
2019-10-06 11:17:13,132 - INFO - Traktarr - get_objects - Retrieved Radarr movies list, movies found: 3463
2019-10-06 11:17:13,145 - DEBUG - media.pvr - _get_objects - Request URL: http://192.168.2.232:7878/radarr/api/exclusions
2019-10-06 11:17:13,145 - DEBUG - media.pvr - _get_objects - Request Response: 200
2019-10-06 11:17:13,145 - DEBUG - media.pvr - _get_objects - Found 0 objects
2019-10-06 11:17:13,145 - ERROR - Traktarr - get_exclusions - Aborting due to failure to retrieve movie exclusion list from Radarr

Ability to remove existing radarr/sonarr media after limit

Describe the problem
At the moment, existing media from radarr/sonarr is removed, then the program loops through trakt list until the limit is reached.

It would be great to have the ability to limit the list. e.g. so I could set 250 most watched of all time, and it only adds media from the top 250, not 250 more every run.

Limit to only "top X results"

Is there no filter to limit to just the top X shows in the list?

Say I only want to monitor for the top 10 trending movies?

TV Shows Skipped

Describe the bug
I started grabbing from a trakt list of TV-Shows and noticed my root_folder for Sonarr was incorrect. I stopped traktarr service, stopped Plex, stopped Sonarr.
I then went into Sonarr's DB file with SQlite Viewer and removed all the items that Traktarr added where it had the incorrect path.

I edited my traktarr config file, started all the services I stopped and ran the command again -
traktarr shows - t link

Now, as I'm running that same list again, traktarr is skipping all the TV shows and none are being added back into Sonarr.

2019-11-19 13:01:41,227 - INFO       - Traktarr                            - shows                               - Retrieved Trakt 'Https://trakt.tv/users/drew-casteo/lists/disney-tv-shows' shows list, shows found: 173
2019-11-19 13:01:41,227 - INFO       - Traktarr                            - shows                               - Removed existing Sonarr shows from Trakt shows list, shows left to process: 160
2019-11-19 13:01:41,228 - INFO       - Traktarr                            - shows                               - Sorted shows list to process by highest 'votes'.
2019-11-19 13:01:41,228 - INFO       - Traktarr                            - shows                               - Processing list now...
2019-11-19 13:01:42,006 - INFO       - Traktarr                            - shows                               - SKIPPED: 'The Simpsons (1989)'
2019-11-19 13:01:42,767 - INFO       - Traktarr                            - shows                               - SKIPPED: 'Gravity Falls (2012)'
2019-11-19 13:01:43,560 - INFO       - Traktarr                            - shows                               - SKIPPED: 'Star Wars: The Clone Wars (2008)'
2019-11-19 13:01:44,392 - INFO       - Traktarr                            - shows                               - SKIPPED: 'Star Wars Rebels (2014)'
2019-11-19 13:01:45,220 - INFO       - Traktarr                            - shows                               - SKIPPED: 'Boy Meets World (1993)'
2019-11-19 13:01:45,910 - INFO       - Traktarr                            - shows                               - SKIPPED: 'X-Men: The Animated Series (1992)'
2019-11-19 13:01:46,623 - INFO       - Traktarr                            - shows                               - SKIPPED: 'Phineas and Ferb (2007)'
2019-11-19 13:01:47,390 - INFO       - Traktarr                            - shows                               - SKIPPED: 'DuckTales (1987)'

To Reproduce
Steps to reproduce the behavior:

  1. Use an incorrect root_folder for traktarr's Sonarr setting
  2. Run the command traktarr shows -t LINK
  3. Let the command finish or stop once a few shows have been added to Sonarr
  4. Stop Sonarr, Traktarr and Plex services
  5. Go into Sonarr's DB file and remove all shows that was added that has the wrong path from the Series folder. Save the DB
  6. Restart services that was stopped
  7. Run the command in steps 2 again

Expected behavior
Since the shows were no longer in Sonarr, Traktarr should be adding it into Sonarr but instead, it skips the shows.

System Information

  • Traktarr, version 1.2.5
  • Operating System: Ubuntu 18.04

Additional context
I am using Traktarr with CloudBox. Installed Traktarr using CloudBox's command.
I did the same for Radarr and had the same results.

Addings shows without a country

Adding shows that do not have a country set in trakt results in an error and it ignores the show.

Traceback (most recent call last):
  File "/usr/local/bin/traktarr", line 306, in shows
    series['show']['country'].upper())
AttributeError: 'NoneType' object has no attribute 'upper'

This is while using the --ignore-blacklist command aswell.

Suggested Documentation Addition - systemd Environment locales

Describe the bug
It took me several days to create a valid systemd file that Python3 was happy with. I'd recommend updating the documentation and adding these two lines to the [Service] block of the service file, in case any other Ubuntu 16.04 users encounter the same complaints from Python3 about locales not being exported.

Environment=LC_ALL=C.UTF-8
Environment=LANG=C.UTF-8

To Reproduce
Steps to reproduce the behavior:

  1. enable the currently provided systemd service file on Ubuntu 16.04
  2. systemctl start traktarr.service
  3. Service doesn't start, citing exit code=1
  4. journalctl -xe provides the following:
Traceback (most recent call last):
  File "/usr/local/bin/traktarr", line 951, in <module>
    app()
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 676, in main
    _verify_python3_env()
  File "/usr/local/lib/python3.5/dist-packages/click/_unicodefun.py", line 118, in _verify_python3_env
    'for mitigation steps.' + extra)
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult http://click.pocoo.org/python3/for mitigation steps.

This system supports the C.UTF-8 locale which is recommended.
You might be able to resolve your issue by exporting the
following environment variables:

    export LC_ALL=C.UTF-8
    export LANG=C.UTF-8

System Information

  • Traktarr Version: v1.2.4
  • Operating System: Ubuntu Server 16.04 LTS running in Proxmox LXC

Additional context
running each export [locale] command also works, but it's not permanent. The locales aren't retained after reboot.

notifications to telegram?

Hi,

I would like to ask if its possible to implement telegram notifications, as its a really good messenger with a public API.

Or maybe document how to write a custom notification plugin.

Cant add anything

ERROR - traktarr - show - FAILED adding The 100 (2014) with tags: None
ERROR - traktarr - movies - FAILED adding Moana (2016)

Everything I try to add gives me an error.

I'm using version 1.2.1

"filters": {
"movies": {
"allowed_countries": ["us"],
"allowed_languages": [],
"blacklist_title_keywords": ["barbie"],
"blacklisted_genres": [],
"blacklisted_max_year": 2019,
"blacklisted_min_runtime": 30,
"blacklisted_min_year": 1950,
"blacklisted_tmdb_ids": []
},
"shows": {
"allowed_countries": ["us"],
"allowed_languages": [],
"blacklisted_genres": ["talk-show", "anime", "news"],
"blacklisted_max_year": 2019,
"blacklisted_min_runtime": 15,
"blacklisted_min_year": 1950,
"blacklisted_networks": [],
"blacklisted_tvdb_ids": []
}
},
"notifications": {
"verbose": true
},
"radarr": {
"api_key": "XXXX",
"profile": "HD-1080p",
"root_folder": "XXXXX",
"url": "http://localhost:7878/"
},
"sonarr": {
"api_key": "XXXXX",
"profile": "HD-1080p",
"root_folder": "XXXX",
"tags": {},
"url": "http://localhost:8989/"
},
"trakt": {
"client_id": "XXXXX",
"client_secret": "XXXX"
}
}

UNC Path Not Working

I entered the root folder as \fileserver1.skynet.com\Media\TV Shows. When it was entered into Sonarr, the show had the root path as C:\fileserver1.skynet.com\Media\TV Shows.

The same happened for Radarr

Blacklist shows based on rating

Most categories are covered for blacklisting, but it’s surprising being able to blacklist based on rating isn’t an option.

Medusa support

Hi, great project. Are there any plans for supporting medusa ? (sickchill fork) who is gaining support in the community as an alternative to sonar/radarr. They also have a easy api.

Disabled_for

Traktarr seems to be ignoring my disabled_for settings.

Ignore tags when adding from watchlist

Any blacklist tag should be ignored when adding new shows/movies from a trakt watchlist. Since it's on your watchlist you'd want it anyway, whether it's not the correct country or language according to your settings.

New features, do they belong in traktarr?

Hey there l3uddz, in a private fork of this repo, I've added a few features. Maybe you'd accept PRs for them? They expand what traktarr does, so maybe you're not comfortable with that.

I've already coded up:

  • Add the collection tag to movies in Plex based off a Trakt list
    The idea is to watch a Trakt list and automatically tag the matching Plex films with a collection that is the name of the Trakt list. This complements the original traktarr feature of adding a list to radarr nicely. You can use Traktarr to add a James Bond list, then create a "James Bond" collection in Plex.
    traktarr tagmovies -t "https://trakt.tv/users/danio1972/lists/james-bond-series"
    This uses the plexapi module.

  • Import a text or csv file of movie names and years into a Trakt list
    Once I had Trakt list downloading and collection tagging, I needed a way to make lists easily. My workflow now is to troll the web for lists like this one for example, use some simple scraping (like [...document.querySelectorAll('h4[data-tag=subhead]')].map(n => n.innerHTML).join('\n') to create a list of title year pairs, then run traktarr newlist -f movies.txt --name "Classic Blaxploitation"
    This uses the the tmdbsimple module to map names to tmdb ids and trakt.py to write to Trakt. I could drop the trakt.py dependency and implement it manually like you have in media/trakt.py

Would you accept a PR with these features?

SeriesType not set correctly for anime

When adding Anime using CLI traktarr does not change the SeriesType to Anime. You still have to go into Sonarr and manually change the series type from standard to anime

Automatic - Diffrent settings

Been reading up on the config and it looks promising for a fully automatic server.

Just one question tough, is it possible to set up different rules for different root folders.

i.e. ../tv/reality only adds new shows within that genre. And /tv/hd excludes reality, docu, etc?

Or do I have run run different instances of traktarr? :)

Thanks!

Ability to add tv show with more then x episodes

Describe the problem
Traktarr is adding every tv show, also shows with only 1 episode which I want to remove

Describe any solutions you think might work
We should have the function to set, how much episodes a tv show minimum have to add.

Additional context
.

json error

I'm getting this error when I try to run pgtrakt:

obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 758775 (char 758774) 2019-04-20 17:59:32,260 - WARNING - helpers.misc - backoff_handler - Backing off 0.6 seconds afters 2 tries calling function <function Trakt._make_items_request at 0x7f4c72c9ea60> with args (<media.trakt.Trakt object at 0x7f4c751264e0>,) and kwargs {'url': 'https://api.trakt.tv/movies/played/all', 'limit': 1000, 'languages': (), 'object_name': 'movies', 'type_name': 'played', 'genres': None} 2019-04-20 17:59:32,854 - INFO - media.trakt - _headers - No user 2019-04-20 17:59:32,927 - INFO - media.trakt - _make_items_request - There are 131 pages left to retrieve results from 2019-04-20 17:59:37,932 - INFO - media.trakt - _headers - No user 2019-04-20 17:59:38,054 - INFO - media.trakt - _make_items_request - There are 130 pages left to retrieve results from 2019-04-20 17:59:43,058 - INFO - media.trakt - _headers - No user 2019-04-20 17:59:43,240 - INFO - media.trakt - _make_items_request - There are 129 pages left to retrieve results from 2019-04-20 17:59:48,246 - INFO - media.trakt - _headers - No user 2019-04-20 17:59:48,312 - ERROR - media.trakt - _make_items_request - Exception retrieving played movies: Traceback (most recent call last): File "/opt/appdata/pgtrakt/media/trakt.py", line 87, in _make_items_request resp_json = req.json() File "/usr/local/lib/python3.6/dist-packages/requests/models.py", line 897, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib/python3.6/json/__init__.py", line 354, in loads return _default_decoder.decode(s) File "/usr/lib/python3.6/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.6/json/decoder.py", line 355, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 758775 (char 758774) 2019-04-20 17:59:48,319 - WARNING - helpers.misc - backoff_handler - Backing off 0.4 seconds afters 3 tries calling function <function Trakt._make_items_request at 0x7f4c72c9ea60> with args (<media.trakt.Trakt object at 0x7f4c751264e0>,) and kwargs {'url': 'https://api.trakt.tv/movies/played/all', 'limit': 1000, 'languages': (), 'object_name': 'movies', 'type_name': 'played', 'genres': None} 2019-04-20 17:59:48,720 - INFO - media.trakt - _headers - No user 2019-04-20 17:59:48,799 - INFO - media.trakt - _make_items_request - There are 131 pages left to retrieve results from 2019-04-20 17:59:53,804 - INFO - media.trakt - _headers - No user 2019-04-20 17:59:53,923 - INFO - media.trakt - _make_items_request - There are 130 pages left to retrieve results from 2019-04-20 17:59:58,928 - INFO - media.trakt - _headers - No user 2019-04-20 17:59:59,109 - INFO - media.trakt - _make_items_request - There are 129 pages left to retrieve results from 2019-04-20 18:00:04,115 - INFO - media.trakt - _headers - No user 2019-04-20 18:00:04,176 - ERROR - media.trakt - _make_items_request - Exception retrieving played movies: Traceback (most recent call last): File "/opt/appdata/pgtrakt/media/trakt.py", line 87, in _make_items_request resp_json = req.json() File "/usr/local/lib/python3.6/dist-packages/requests/models.py", line 897, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib/python3.6/json/__init__.py", line 354, in loads return _default_decoder.decode(s) File "/usr/lib/python3.6/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.6/json/decoder.py", line 355, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 758775 (char 758774) 2019-04-20 18:00:04,185 - ERROR - backoff - _log_giveup - Giving up _make_items_request(...) after 4 tries (None) 2019-04-20 18:00:04,186 - ERROR - pgtrack - movies - Aborting due to failure to retrieve Trakt played_all movies list

Any idea whats wrong here?

Support for full movie names via command line

IMDbPY seems to offer a simple way for you to bring name into imdb id

# Search for a movie (get a list of Movie objects).
s_result = ia.search_movie('The Untouchables')

# Print the long imdb canonical title and movieID of the results.
for item in s_result:
   print(item['long imdb canonical title'], item.movieID)

Couple Questions.

Ran across this when searching for a new trakt to sonarr option since flexget seems to have died on me for that purpose.. I haven't started using this yet as I have a few questions about a couple things..

  1. Is there any way to disable the whole removal of shows/movies from trakt lists when adding them sonarr? I prefer to keep everything in my trakt lists well in my trakt lists as I usually go to said trakt list and sort by random when I am stuck on trying to figure out something to watch.

Or does this not remove them from the trakt lists but keeps a cache of shows/movies it's added and that's what I'm seeing from the demo thing when it says something like "removed existing radarr movies from trakt movies list"

  1. Is there an option to set shows/movies to unmonitored (especially shows)? I sometimes prefer to have a show unmonitored until I at least see at least 1-2 episodes of a new show to determine if I'm going to watch it.

  2. Ontop of the unmonitored option thing, is there a way to set up multiple sonarr/radarr options for seperate trakt lists?

Example:

"sonarr": {
    "api_key": "",
    "profile": "HD-1080p",
    "root_folder": "/tv/",
    "tags": {},
    "url": "http://localhost:8989/"
  },
"sonarr": {
    "api_key": "",
    "profile": "HD-1080p",
    "root_folder": "/anime/",
    "tags": {anime},
    "url": "http://localhost:8989/"
  }

as I have seperate trakt lists for shows and anime, and movies and anime movies, and I would want to set up the tagging for the anime lists while not having the tag set for normal shows.

3.5 Do tags have to have the whole "networks" thing with them, as like with 3 I'd like for it to just tag a whole list with that tag, and not just specific networks..

or would I have to go about setting up 4 seperate .config files for 3 and 3.5

  1. Could this potentially work for windows? or is there specific things in the code that work only for Ubuntu/Debian

Add a collection?

Is it possible to make it so you can add a collection and then have it search for that?

2018-09-26 03:50:15,785 - ERROR - helpers.trakt - extract_list_user_and_key_from_url - The URL "https://trakt.tv/users/teravault/collection/movies/" is not in the correct format

If so, awesome, if not thats okay. I'll just manually add them as I have time.

Not able to add movies/shows

Hi,

i am trying to get this running. it fails if a new item should be added:

image
it doesn't matter if it's a tv show or a movie.

This is my config file:

  {
  "automatic": {
    "movies": {
      "anticipated": 3,
      "boxoffice": 10,
      "interval": 20,
      "popular": 3,
      "trending": 3
    },
    "shows": {
      "anticipated": 10,
      "interval": 48,
      "popular": 1,
      "trending": 1
    }
  },
  "core": {
    "debug": false
  },
  "filters": {
    "movies": {
      "allowed_countries": ["us", "gb", "de", "ca"],
      "blacklist_title_keywords": ["barbie"],
      "blacklisted_genres": ["music"],
      "blacklisted_max_year": 2019,
      "blacklisted_min_runtime": 60,
      "blacklisted_min_year": 2018,
      "blacklisted_tmdb_ids": []
    },
    "shows": {
      "allowed_countries": ["us", "gb", "de", "ca"],
      "blacklisted_genres": [
        "animation",
        "game-show",
        "talk-show",
        "home-and-garden",
        "children",
        "reality",
        "anime",
        "news",
        "documentary",
        "special-interest"
],
      "blacklisted_max_year": 2019,
      "blacklisted_min_runtime": 15,
      "blacklisted_min_year": 2018,
      "blacklisted_networks": [
        "twitch",
        "youtube",
        "nickelodeon",
        "hallmark",
        "reelzchannel",
        "disney",
        "cnn",
        "cbbc",
        "the movie network",
        "teletoon",
        "cartoon network",
        "espn",
        "yahoo!",
        "fox sports"
],
      "blacklisted_tvdb_ids": []
    }
  },
  "notifications": {
    "verbose": true
  },
  "radarr": {
    "api_key": "XXX",
    "profile": "GER - HD 720/1080",
    "root_folder": "/home/plex/media/movies/",
    "url": "XXX"
  },
  "sonarr": {
    "api_key": "XXX",
    "profile": "HD - 720p/1080p",
    "root_folder": "/home/plex/media/tv/",
    "tags": {},
    "url": "XXX"
  },
  "trakt": {
    "api_key": "XXX"
  }
}

What am i doing wrong? :/

P.S. Using latest Release

Cheers

way to disable radarr but keep sonarr?

I've been running traktarr for about 24 hours now, really enjoying it. I use sonarr but not radarr and I'd like to disable the radarr section so I can stop getting "connection refused" errors in my logs. I've tried deleting the options in config.json but traktarr just adds them back in. Any ideas? Running traktarr, version 1.2.3

Movie skipped

Hello,
i cannot understand why this movie is skipped.
Looking at the debug it is because it has no runtime spefified, but if i watch on tmdb or on imdb there is a runtime.
What can i do?
I tried to put 0 or [] in config.json on the option "blacklisted_min_runtime": 60, but nothing changed.
Can someone help me?
or is there a way to skip runtime check?

2019-10-30 15:07:44,959 - DEBUG - helpers.tmdb - verify_movie_exists_on_tmdb - 'Midway (2019)' [TMDb ID: 522162] exists on TMDb.
2019-10-30 15:07:44,960 - DEBUG - helpers.trakt - blacklisted_movie_id - 'Midway' | Blacklisted IDs Check | Passed.
2019-10-30 15:07:44,960 - DEBUG - helpers.trakt - blacklisted_movie_title - 'Midway' | Blacklisted Titles Check | Passed.
2019-10-30 15:07:44,960 - DEBUG - helpers.trakt - blacklisted_movie_year - 'Midway' | Blacklisted Years Check | Passed.
2019-10-30 15:07:44,960 - DEBUG - helpers.trakt - blacklisted_movie_country - 'Midway' | Blacklisted Countries Check | Ignoring valid countries check.
2019-10-30 15:07:44,960 - DEBUG - helpers.trakt - blacklisted_movie_country - 'Midway' | Blacklisted Countries Check | Passed.
2019-10-30 15:07:44,960 - DEBUG - helpers.trakt - blacklisted_movie_language - 'Midway' | Blacklisted Languages Check | Ignoring valid languages check.
2019-10-30 15:07:44,960 - DEBUG - helpers.trakt - blacklisted_movie_language - 'Midway' | Blacklisted Languages Check | Passed.
2019-10-30 15:07:44,961 - DEBUG - helpers.trakt - blacklisted_movie_genre - 'Midway' | Blacklisted Genres Check | Skipping blacklisted genres check.
2019-10-30 15:07:44,961 - DEBUG - helpers.trakt - blacklisted_movie_genre - 'Midway' | Blacklisted Genres Check | Passed.
2019-10-30 15:07:44,961 - DEBUG - helpers.trakt - blacklisted_movie_runtime - 'Midway' | Blacklisted Runtime Check | Blacklisted because it had no runtime specified.
2019-10-30 15:07:44,961 - INFO - Traktarr - movies - SKIPPED: 'Midway (2019)'

Changing "blacklisted_min_runtime" causes unexpected results when using CLI.

Changing "blacklisted_min_runtime" causes unexpected results when using CLI to import movies.

When running the following command we see unexpected output based on blacklisted_min_runtime:
traktarr movies -t trending -l 100 -s votes
With blacklisted_min_runtime set at 40 we see:
Retrieved Trakt 'Trending' movies list, movies found: 1285
and with it set to 1 we see:
Retrieved Trakt 'Trending' movies list, movies found: 993

I would expect the list to be the same each time, or at most movies found to increase as we decrease blacklisted minimum runtime. We are seeing the opposite here.

I also observed no more movies being imported when blacklist runtime was set to 40. Strangely, I observed movies being imported with runtimes over 40 minutes when blacklist runtime was set to 1.

Reproducible with Master (latest)

Near the time of writing this trakt.tv had:
1002 in trending
1436 in anticipated

Using CLI with debug enabled uses wrong list type. Expected trending, seen anticipated.

Enabling debug in the traktarr config causes unexpected results when importing movies with CLI. With debug enabled it will use the list type anticipated even though you specified trending.

Steps to reproduce the behavior:
Run with debug set as false:
traktarr movies -t trending -l 100 -s votes
and as expected it'll import movies from the trending list with output:
Retrieved Trakt 'Trending' movies list, movies found: 1285

Run with debug set as true:
traktarr movies -t trending -l 100 -s votes
and it'll unexpectedly import movies from the anticipated list type with output:

Request URL: https://api.trakt.tv/shows/anticipated
Retrieved Trakt 'Trending' movies list, movies found: 1017

Note: it says shows and not movies, and anticipated and not trending
I think it is still using the trending list but I cannot explain why the amount of movies found decreases when debug is enabled and more movies are imported.

Reproducible using Master (latest).

Near the time of writing this trakt.tv had:
1002 in trending
1436 in anticipated

Only add currently running shows?

I've installed traktarr and it's running wonderfully. However, I have two separate sonarrs, one for currently running tv shows, and ended shows.

I only have traktarr running on the airing tv shows as it's just to keep up with newly released shows, however I have some instances where traktarr will add ended tv shows from trakt. Is there a way to only add currently airing shows with traktarr via filtering?

Thanks!

seasons and episodes?

Currently if you just add a season of a show via trakt, traktarr doesn't pick it up via the shows command.

the api suggests:

Possible values: 

    movies , shows , seasons , episodes

as values for the call, but traktarr only uses shows for now.

is that something that would be easy to add?

Minimum Availability not adhering to config

Describe the bug
If you use the CLI and set --minimum-availability it'll work.
If you set your minimum_availability in the config, it will not work.

System Information

  • Traktarr Version: Develop (Latest)

Cannot run Traktarr

I am using Raspberry Pi 4 with everything updated. I followed the instructions to install by the letter and did some setting up to my /opt/traktarr/config.json. After that I created the automatic script and rebooted the Pi. When I try "traktarr run" I get the following:

Traceback (most recent call last):
File "/usr/local/bin/traktarr", line 1291, in
app()
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1063, in invoke
Command.invoke(self, ctx)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/bin/traktarr", line 52, in app
cfg = Config(configfile=config, cachefile=cachefile, logfile=logfile).cfg
File "/opt/traktarr/misc/config.py", line 127, in cfg
tmp = self.load_config()
File "/opt/traktarr/misc/config.py", line 165, in load_config
return AttrConfig(json.load(fp))
File "/usr/lib/python3.7/json/init.py", line 296, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/usr/lib/python3.7/json/init.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 29 column 31 (char 532)

Seems like a python issue but I have no idea what this all means... I double checked if I had installed python and all the requirements + all user permissions.

Docker - Container stuck in restart

Like the title describe the container is stuck in restarting in the latest version of traktarr. Expect the system to stay on "Up" so I can attach it and start writing commands but the container keeps restarting.

Download container from cloudb0x/traktarr
Create the config file at volume destination /config
Check status using docker-compose ps
Check logs using docker container logs [container]

Settings:

traktarr:
image: cloudb0x/traktarr
network_mode: host
container_name: trakt-tv
environment:
- TRAKTARR_CONFIG=/config/config.json
- TRAKTARR_CACHEFILE=/config/cache.db
- TRAKTARR_LOGFILE=/config/traktarr.log
volumes:
- /opt/appdata/traktarr:/config
cap_add:
- NET_ADMIN
restart: always

Automatic Traktlist breaking Traktarr

So I installed the Traktarr Docker on my unRAID server Today and I got it working just using the CLI but wanted to try out the "Automatic" setting so I could just leave it and let it do it's thing. This is the config I am using when trying to use the Automatic mode https://pastebin.com/Es9Ut1ww and this is the error that that console gives me https://i.imgur.com/DJsap0z.png. I can use Traktarr fine when I don't input the "Lists" line but that seems to break it. Any ideas? Thanks guys

Only Sonarr and Shows

Hi,
I just ran with docker compose and woke fine but I only want to keep shows and sonarr part from the conf file. Shall I delete the other lines? As Radarr already have Trakt list. And I also don't want the automatic list I only personal list? Thanks

Option to not import movies with broken TMDB URL.

Describe the problem

Often Trakt has entries with broken TMDB URLs. Radarr doesn't like having these imported.

Describe any solutions you think might work

Introduce an option to check if TMDB URL returns 404, if it does, don't import the movie.

Additional context

We can request these links are fixed on Trakt, but it takes a long time to have that happen. It would be best to not add them to Radarr. In the future Trakt may offer a better way to fix broken URLs but until then it would be easier to ignore all broken URLs.

Language support for sonarr v3

Describe the problem
Sonarr v3 took the languages out of the quality profile and put them into a seperate profile, this isnt supported by traktarr at the moment. When adding a series automated by traktarr, it is added as the default language, which is english and i dont want english, i want german.

Describe any solutions you think might work
Add an option to set the language profile

Additional context
Ombi has the same problem: Ombi-app/Ombi#2359
Currently, the v3 API is backwards compatible and takes the first language profile if none is specified.
As a workaround, i changed the language profiles so that german is the first

Create a release?

I'm exploring creating an AUR package for traktarr and it would be super keen if it could be based on an actual release. Is that something you'd consider? :)

Please consider adding a max search depth option

Love the service this provides, but one problem I frequently come across is at some point I feel like my automatic search for shows & movies is "scraping the bottom of the barrel" and adding low quality content that I would never add and likewise never watch. I've adjusted my intervals accordingly to try and avoid this problem, but it would be really nice to have a depth option so I can keep my intervals low and searches regular in case something new starts to trend or become popular.

For example:
Currently, when Traktarr is searching for popular movies and I already have the first 500 in Trakt's list, it will download the 501st most popular movie. With a depth option of 100, if the first 100 results doesn't yield anything that I don't already have then it stops searching.

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.