Update TV Source to find media files

Updated TV Source to iterate over media files and check each against the
cache to ignore previously seen items.
This commit is contained in:
2011-12-13 01:11:57 +00:00
parent 51ffefa503
commit 0646848193
3 changed files with 47 additions and 13 deletions

View File

@@ -0,0 +1,32 @@
<?php
class DownloadDispatcher_Source_PluginBase extends DownloadDispatcher_PluginBase {
static protected $source_cache = array();
protected function init_cache() {
if ( ! array_key_exists(get_called_class(), static::$source_cache)) {
// TODO - attempt to load data from persistent storage
static::$source_cache[get_called_class()] = array();
}
}
protected function mark_processed($file) {
$this->init_cache();
if ( ! in_array($file, static::$source_cache[get_called_class()])) {
static::$source_cache[get_called_class()][] = $file;
}
// TODO - flush cache to persistent storage
}
protected function check_processed($file) {
$this->init_cache();
return in_array($file, static::$source_cache[get_called_class()]);
}
}
?>