Intelligently fill gaps in your Trakt.tv watch history
Features β’ Installation β’ Quick Start β’ Usage β’ Examples
Ever manually marked some episodes as watched on Trakt and now have gaps in your watch history? This tool intelligently fills those gaps by:
- π§ Analyzing your actual viewing patterns
- π Using proportional time distribution
- π‘οΈ Respecting episode air dates (never marks before it aired)
- β° Using precise timestamps (hours/minutes, not just dates)
- π― Giving you full control over what to fill
You watched episodes 1, 2, 5, 6, and 7 of a show, but forgot to mark episodes 3 and 4. Your Trakt history looks incomplete.
This script intelligently marks episodes 3 and 4 as watched using realistic dates based on:
- When you actually watched episodes 2 and 5
- The episode air dates
- Your viewing patterns for that show
The result looks natural and maintains the integrity of your watch history! β¨
- π Gap Filling: Fills missing episodes between your first and last watched episode
- β¬ οΈ Beginning Filling: Marks episodes before your first watched episode
- β‘οΈ Ending Filling: Marks episodes after your last watched episode
- π― Selective Processing: Choose exactly which shows to process
- π Pattern Analysis: Learns your viewing habits per show
- β±οΈ Proportional Distribution: Spreads episodes across actual time gaps
- πΊ Air Date Validation: Never marks episodes as watched before they aired
- π Time Precision: Uses hours and minutes for binge-watching scenarios
- π Safety Buffer: Adds 12-hour buffer after air date for realism
- π Progress Tracking: Visual progress bar during analysis
- ποΈ Flexible Selection: Multiple selection methods with modifiers
- β Confirmation: Shows exactly what will change before proceeding
- π Secure Credentials: Stores API credentials in separate file
- π Detailed Output: Clear feedback on what was processed
- Python 3.6 or higher
- A Trakt.tv account
- Trakt API application credentials
git clone https://github.com/Judzim/Trakt-filler.git
cd Trakt-fillerpip install requestsThat's it! No other dependencies required.
- Go to Trakt API Applications
- Click "New Application"
- Fill in the form:
- Name: Trakt Gap Filler (or any name)
- Redirect uri:
urn:ietf:wg:oauth:2.0:oob
- Mark both permissions (checkin, scrobble)
- Click "Save App"
- Copy your Client ID and Client Secret
python trakt_authenticate.pyFollow the prompts to:
- Enter your Client ID and Secret
- Authorize the application in your browser
- Automatically save credentials to
trakt_credentials.txt
python trakt_gap_filler.pyThat's it! The script will analyze your watch history and guide you through filling gaps.
- Analysis: Script analyzes all your watched shows
- Display: Shows you which shows have missing episodes
- Selection: You choose which shows to process
- Confirmation: Review what will be changed
- Processing: Episodes are marked with intelligent dates
- No modifier (e.g.,
1): Fill gaps only (default) b(e.g.,1b): Fill beginning + gapse(e.g.,1e): Fill gaps + endingbe(e.g.,1be): Fill beginning + gaps + ending (complete)
| Input | Description |
|---|---|
1 3 5 |
Fill gaps in shows 1, 3, and 5 |
1b |
Fill beginning and gaps for show 1 |
1e |
Fill gaps and ending for show 1 |
1be |
Complete fill for show 1 |
1-3 |
Fill gaps for shows 1, 2, and 3 |
1-3b |
Fill beginning + gaps for shows 1, 2, and 3 |
1b 3e 5be |
Mixed: show 1 (beginning+gaps), show 3 (gaps+ending), show 5 (complete) |
all |
Fill gaps for all shows |
allbe |
Complete fill for all shows |
- The episodes before your first recorded scrobble and after your last one might be filled a bit sporadically. I recommend manually marking your first and last watched episodes, then use gap mode to automatically fill any missing episodes between them.
Your Watch History:
- Breaking Bad: Watched S01E01, S01E02, S01E05, S01E06
- Missing: S01E03, S01E04
Script Output:
[1] πΊ Breaking Bad
Watched: 60/62 episodes
Missing: 2 gaps
Your selection: 1
Result: S01E03 and S01E04 are marked as watched with dates distributed between when you watched S01E02 and S01E05.
Your Watch History:
- The Office: Started watching at S02E05, stopped at S05E10
- Missing: S01-S02E04 (beginning) and S05E11-S09E23 (ending)
Script Output:
[1] πΊ The Office
Watched: 87/201 episodes
Missing: 34 before first, 8 gaps, 72 after last
Your selection: 1be
Result: All episodes are marked as watched:
- Beginning episodes use your viewing pattern, working backward from S02E05
- Gaps are filled proportionally
- Ending episodes use your pattern, working forward from S05E10
[1] πΊ Breaking Bad
Missing: 4 gaps
[2] πΊ Game of Thrones
Missing: 15 before first, 3 gaps
[3] πΊ Friends
Missing: 8 gaps, 20 after last
Your selection: 1 2b 3e
Result:
- Breaking Bad: Gaps only
- Game of Thrones: Beginning + gaps
- Friends: Gaps + ending
Your Watch History:
- Stranger Things S01E01 watched at 2:00 PM
- Stranger Things S01E08 watched at 10:30 PM same day
- Missing: S01E02 through S01E07
Script Behavior:
- Detects 8.5-hour gap
- Distributes 6 episodes across that time
- Results in realistic hourly intervals:
S01E02: 3:15 PM S01E03: 4:30 PM S01E04: 5:45 PM S01E05: 7:00 PM S01E06: 8:15 PM S01E07: 9:30 PM
- Fetch Watch History: Gets your actual watch timestamps from Trakt
- Analyze Patterns: Calculates your average viewing interval per show
- Identify Missing: Categorizes episodes as beginning/gaps/ending
- Calculate Dates:
- Gaps: Proportional distribution between boundaries
- Beginning: Work backward from first watched
- Ending: Work forward from last watched
- Validate Air Dates: Ensures no episode is marked before it aired + 12h buffer
- Submit: Batch uploads to Trakt with precise timestamps
if calculated_date < (air_date + 12_hours):
use air_date + 12_hours insteadThis ensures your watch history is always realistic and possible.
GET /users/{user}/watched/shows- Fetch watched showsGET /users/{user}/history/shows- Fetch detailed watch history with timestampsGET /shows/{id}/seasons?extended=episodes- Fetch episode metadata including air datesPOST /sync/history- Submit watched episodes with custom timestamps
All dates use ISO 8601 format with UTC timezone:
2025-11-06T20:30:15Z
Trakt API allows 1000 requests per 5 minutes for authenticated users. This script is designed to stay well within these limits.
trakt-gap-filler/
βββ trakt_gap_filler.py # Main script
βββ trakt_authenticate.py # Authentication helper
βββ trakt_credentials.txt # Your credentials (auto-generated)
βββ .gitignore # Excludes credentials from git
βββ README.md # This file
- Credentials are stored in
trakt_credentials.txt(not in the code) - File is automatically excluded from git via
.gitignore - Never commit your credentials file to version control
- Don't share your
trakt_credentials.txtfile - If credentials are compromised, revoke them at Trakt Applications
- Consider using environment variables in production environments
Problem: Access token expired or invalid
Solution: Run python trakt_authenticate.py to get a new token
Problem: Username incorrect or profile not public
Solution:
- Check your username in
trakt_credentials.txt - Ensure your watch history is public or you're properly authenticated