Add --skip-sync cli option to sort already-downloaded files without downloading new ones
This commit is contained in:
@@ -4,7 +4,7 @@ define('DD_File', 'dispatcher');
|
|||||||
|
|
||||||
$options = array();
|
$options = array();
|
||||||
if (isset($_SERVER['argv'])) {
|
if (isset($_SERVER['argv'])) {
|
||||||
$options = getopt('c:', array('config:'));
|
$options = getopt('c:', array('config:','skip-sync'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($options['config'])) {
|
if (isset($options['config'])) {
|
||||||
@@ -26,6 +26,10 @@ try {
|
|||||||
$main = DownloadDispatcher_Main::instance();
|
$main = DownloadDispatcher_Main::instance();
|
||||||
DownloadDispatcher_LogEntry::setLocalProgname('download-dispatcher');
|
DownloadDispatcher_LogEntry::setLocalProgname('download-dispatcher');
|
||||||
|
|
||||||
|
if (isset($options['skip-sync'])) {
|
||||||
|
$main->config()->set('sync.skip', true, false);
|
||||||
|
}
|
||||||
|
|
||||||
// Download Dispatcher entry point
|
// Download Dispatcher entry point
|
||||||
DownloadDispatcher_Processor::run();
|
DownloadDispatcher_Processor::run();
|
||||||
|
|
||||||
|
|||||||
@@ -13,18 +13,21 @@ class DownloadDispatcher_Processor {
|
|||||||
$config = $main->config();
|
$config = $main->config();
|
||||||
$log = $main->log();
|
$log = $main->log();
|
||||||
|
|
||||||
// Find the list of available Sync plugins
|
|
||||||
$sync_plugins = $config->get('sync');
|
|
||||||
foreach ($sync_plugins as $plugin_name) {
|
|
||||||
// Get a list of all the instances of this plugin to be used
|
|
||||||
$instances = $config->get("sync.{$plugin_name}");
|
|
||||||
foreach ($instances as $instance) {
|
|
||||||
try {
|
|
||||||
$plugin = DownloadDispatcher_Sync_PluginFactory::create($plugin_name, $config, $log, $instance);
|
|
||||||
$plugin->run();
|
|
||||||
|
|
||||||
} catch(SihnonFramework_Exception_PluginException $e) {
|
if (! $config->get('sync.skip', false)) {
|
||||||
SihnonFramework_LogEntry::warning($log, $e->getMessage());
|
// Find the list of available Sync plugins
|
||||||
|
$sync_plugins = $config->get('sync');
|
||||||
|
foreach ($sync_plugins as $plugin_name) {
|
||||||
|
// Get a list of all the instances of this plugin to be used
|
||||||
|
$instances = $config->get("sync.{$plugin_name}");
|
||||||
|
foreach ($instances as $instance) {
|
||||||
|
try {
|
||||||
|
$plugin = DownloadDispatcher_Sync_PluginFactory::create($plugin_name, $config, $log, $instance);
|
||||||
|
$plugin->run();
|
||||||
|
|
||||||
|
} catch(SihnonFramework_Exception_PluginException $e) {
|
||||||
|
SihnonFramework_LogEntry::warning($log, $e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user