Index: episodes_server.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/episodes/episodes_server.admin.inc,v
retrieving revision 1.1
diff -u -p -r1.1 episodes_server.admin.inc
--- episodes_server.admin.inc	1 Jul 2009 10:39:19 -0000	1.1
+++ episodes_server.admin.inc	6 Apr 2010 03:48:42 -0000
@@ -42,6 +42,22 @@ function episodes_server_admin_settings(
     '#default_value' => variable_get(EPISODES_SERVER_INGESTOR_LOG_FILE_VARIABLE, NULL),
   );
 
+  $form['ingestor'][EPISODES_SERVER_INGESTOR_IGNORE_VARIABLE] = array(
+    '#type'          => 'textarea',
+    '#title'         => t('Episodes to ignore'),
+    '#description'   => t('By default all episodes in the log will be processed, this will allow for certain ones to be ignored.  One episode per line.  The standard SQL wildcard strings may be used, but please <em>be careful</em>.'),
+    '#cols'          => 20,
+    '#rows'          => 4,
+    '#default_value' => variable_get(EPISODES_SERVER_INGESTOR_IGNORE_VARIABLE, EPISODES_SERVER_INGESTOR_IGNORE_DEFAULT),
+  );
+
+  $form['ingestor'][EPISODES_SERVER_INGESTOR_USER_VARIABLE] = array(
+    '#type'          => 'checkbox',
+    '#title'         => t('Episodes User module used?'),
+    '#description'   => t('If the Episodes User module is being used it will record certain extra episodes that may throw off the statistics engines, enabling this option will correctly ignore those values.'),
+    '#default_value' => variable_get(EPISODES_SERVER_INGESTOR_USER_VARIABLE, EPISODES_SERVER_INGESTOR_USER_DEFAULT),
+  );
+
   return system_settings_form($form);
 }
 
Index: episodes_server.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/episodes/episodes_server.module,v
retrieving revision 1.1
diff -u -p -r1.1 episodes_server.module
--- episodes_server.module	1 Jul 2009 10:39:19 -0000	1.1
+++ episodes_server.module	6 Apr 2010 03:48:42 -0000
@@ -18,6 +18,11 @@ define('EPISODES_SERVER_INGESTOR_LOG_FIL
 define('EPISODES_SERVER_INGESTOR_LINES_PER_RUN_VARIABLE', 'episodes_server_num_lines_per_run');
 define('EPISODES_SERVER_INGESTOR_LINES_PER_RUN_DEFAULT', 10000);
 define('EPISODES_SERVER_INGESTOR_LAST_RUN_VARIABLE', 'episodes_server_ingestor_last_run');
+define('EPISODES_SERVER_INGESTOR_IGNORE_VARIABLE', 'episodes_server_ingestor_ignore');
+define('EPISODES_SERVER_INGESTOR_IGNORE_DEFAULT', '');
+define('EPISODES_SERVER_INGESTOR_USER_VARIABLE', 'episodes_server_ingestor_user');
+define('EPISODES_SERVER_INGESTOR_USER_DEFAULT', FALSE);
+define('EPISODES_SERVER_INGESTOR_USERVARS', "user\nuid");
 
 
 //----------------------------------------------------------------------------
Index: episodes_server.reports.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/episodes/episodes_server.reports.inc,v
retrieving revision 1.1
diff -u -p -r1.1 episodes_server.reports.inc
--- episodes_server.reports.inc	1 Jul 2009 10:39:19 -0000	1.1
+++ episodes_server.reports.inc	6 Apr 2010 03:48:43 -0000
@@ -459,8 +459,29 @@ function episodes_server_report_episodes
   $sql = "SELECT name,
                  AVG(duration) AS avg,
                  STD(duration) AS std
-          FROM {episodes_server_episode}
-          GROUP BY name";
+          FROM {episodes_server_episode}\n";
+  // Optional items to ignore - configurable.
+  $ignores = trim(variable_get(EPISODES_SERVER_INGESTOR_IGNORE_VARIABLE, EPISODES_SERVER_INGESTOR_IGNORE_DEFAULT));
+  // Optional items to ignore - from the episodes_user module.
+  $uservars = variable_get(EPISODES_SERVER_INGESTOR_USER_VARIABLE, EPISODES_SERVER_INGESTOR_USER_DEFAULT);
+  if (!empty($ignores) || $uservars) {
+    // Add the user variables?
+    if ($uservars) {
+      $ignores .= "\n". EPISODES_SERVER_INGESTOR_USERVARS;
+    }
+    // Implode the variables.
+    $ignores = explode("\n", str_replace("\n\n", "\n", $ignores));
+    // Compile the conditions.
+    $sql .= " WHERE";
+    foreach ($ignores as $x => $ignore) {
+      if ($x > 0) {
+        $sql .= " AND";
+      }
+      $sql .= " name NOT LIKE '". trim($ignore) ."'";
+    }
+  }
+  // Check if the user fields should be ignored too.
+  $sql .= " GROUP BY name";
   $sql .= tablesort_sql($header);
   $result = db_query($sql);
   while ($row = db_fetch_object($result)) {
