= 4; // Expecting at least four lines of output from flexget'); $output = array_slice($output, 2, -2); // Each new entry has one line with the identifier, then one line per version seen /* * S01E01 * Human Target 2010 S01E01 HDTV XviD-NoTV(www.usabit.com)... hdtv * * Human.Target.2010.S01E01.720p.HDTV.[KvadratMalevicha.ru... 720p * human.target.s01e01.webdl.rus.novafilm.tv.avi [15/3] unknown */ $matches = array(); $identifier = null; foreach ($output as $line) { if (preg_match('/^\s(s\d\de\d\d|\d+)( - ([0-9dhms ]+))?\s*$/i', $line, $matches)) { # This line is an identifier $identifier = $matches[1]; $currentEpisodes[$identifier] = array(); } else { # This line is an entry for the current identifier if (!preg_match('/^\s+(\*?)\s+(.{1,64}?)\s+(\S+)\s*$/', $line, $matches)) { $errors[] = "Ignored unmatched line '$line'"; continue; } $currentEpisodes[$identifier][] = array( 'downloaded' => ($matches[1] == '*'), 'title' => $matches[2], 'quality' => $matches[3], ); } } ksort($currentEpisodes); } break; } } } # Grab the up-to-date list of tv series for display $runCmd = "{$flexgetCmd} --series"; $output = ''; $returnValue = 0; exec($runCmd, $output, $returnValue); if (!$returnValue) { // Ignore the first and last two lines from the output assert('count($output) >= 4; // Expecting at least four lines of output from flexget'); $output = array_slice($output, 2, -2); /* * Name Latest Status * ------------------------------------------------------------------------------- * Castle S03E24 - 49d 7h *720p * */ foreach ($output as $line) { $matches = array(); if (!preg_match('/^\s(?P.{1,30})\s+(?P.{1,20}?)( - (?P[0-9dhms ]+))?\s+(?P.*)\s+/', $line, $matches)) { $errors[] = "Failed to parse '$line'"; continue; } $currentSeries[trim($matches['series'])] = array( 'episode' => trim($matches['episode']), 'quality' => trim($matches['quality']), ); } ksort($currentSeries); } else { $errors[] = 'Unable to get the current series/episode list. (Maybe flexget is currently running?)'; } ?> Sihnon bittorrent utilities

Sihnon bittorrent utilities

Inject a seen episode title into the flexget seen list

Inject an entry into the list of seen TV episodes, and optionally download it

If an URL is provided, the episode will be injected into the list of seen episodes, and also downloaded immediately. If the URL is left blank, the episode will be learned only.

Forget about an already seen episode

Forget about an already seen episode

'' Episode List

Details of each episode for '' $episodes) { $entryCount = count($episodes); $rowspan = $entryCount ? " rowspan=\"{$entryCount}\"" : ''; $rowIndex = 0; foreach ($episodes as $details) { ?> > >
Episode Downloaded Title Quality Operations

Currently known series/episodes

Details for most recent episode of each series $details) { ?>
Series Name Current episode Qualities seen Operations