PHP script to create hard links of TV episode video files that are considered "unwatched" by the website
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Unwatched TV Index Generator

This script is designed to populate a directory with hardlinks to individual episodes of TV shows that have not been marked as "watched" on the TV calendar at How you acquire those TV show episodes is up to you - I'm sure iTunes could help you, there.

 * First you must have an account on and you will probably want to set up a filter list on that site to indicate which TV programmes you actually watch, otherwise this script will attempt to generate hard links for everything.
 * Copy config.php.dist to config.php and edit the configuration constants defined within it. They're all fully documented, so that should be a fairly simple task.
 * Set up a cron job to automatically run this script periodically (the TV calendar data is cached, and deleting files/links while a file is already open is generally safe under Linux, so this script can be safely run very frequently - I have it running every 15 minutes with no noticable performance or other issues:
    */15 * * * * /usr/bin/php /var/www/unwatched-tv.php 2&>1 > /dev/null

There are a few required configuration values that must be set correctly on the TV calendar site in order for this script to work. Here is a copy of the comment at the top of unwatched-tv.php, which explains each of the calendar's options and the values accepted by this script:
   * Your Timezone: Script doesn't really care about air times; thus value is irrelevant
   * Calendar Style: The four styles only change the CSS, not the HTML; thus value is irrelevant
   * Sort Shows By: This script doesn't care about orders; thus value is irrelevant
   * Show Ep Numbers: Required to determine the filename of each episode; thus required to be "On"
   * Show Sunday First: Script doesn't care; thus value is irrelevant
   * Show Ep Names: "On" is preferable, but "Off" is also supported. If "Off", symlinks will be named "~~Unknown Title~~" if the base video filename doesn't contain the episode name
   * Show Airtime: Script doesn't care about air times; both "On" and "Off" are supported
   * Show Network: Script doesn't care about network; both "On" and "Off" are supported
   * Summary Popups: Script doesn't care about popups; both "On" and "Off" are supported
   * Show Watched Arrows: Required to determine what's been watched (which is the entire point of this script); thus required to be "On". This script could technically determine watch status from the CSS classes of each series name, but you would still be unable to mark an episode as being watched, rendering this script useless
   * Time Format: Script supports 12 or 24 hour clocks; thus value is irrelevant
  Therefore, the REQUIRED settings are:
   * Show Ep Numbers: On
   * Show Watched Arrows: On
   * Show Ep Names: On (recommended)