protected function execute(InputInterface $input, OutputInterface $output)
 {
     list($jdHost, $jdPort) = explode(':', $input->getArgument('jdownloaderRPC'), 2);
     if (empty($jdHost)) {
         $jdHost = 'localhost';
     }
     if (empty($jdPort)) {
         $jdPort = 10025;
     }
     $organizer = new DownloadsOrganizer(new Dir($input->getArgument('downloadsDir')), new Dir($input->getArgument('targetDir')), new Client($input->getArgument('serienLoaderURL')), new JDownloaderRPC($jdHost, $jdPort));
     $hosterPrio = array_filter(array_map('trim', explode(",", $input->getArgument('hoster-prio'))));
     $organizer->setHosterPrio($hosterPrio);
     $organizer->organize($output);
 }
예제 #2
0
    exit;
}
if (!$conf['downloadDir'] || !$conf['targetDir']) {
    print 'Bitte unbedingt die Variablen downloadDir und targetDir in ' . $configFile . ' anpassen!';
    exit;
}
$reload = isset($_GET['reload']);
$update = isset($_GET['update']);
$scan = isset($_GET['scan']);
$client = new Client($conf['serienLoaderURL']);
$log = NULL;
$episodes = array();
if ($reload) {
    $organizer = new DownloadsOrganizer(new Dir($conf['downloadDir']), new Dir($conf['targetDir']), $client, new JDownloaderRPC($conf['jdownloader']['host'], $conf['jdownloader']['port']), $subtitlesManager = NULL, $log = new BufferLogger());
    $organizer->setHosterPrio($conf['hosterPrio']);
    $episodes = $organizer->organize();
} elseif ($update) {
    $root = Dir::factoryTS(__DIR__)->sub('../../../../')->resolvePath();
    $finder = new \Symfony\Component\Process\ExecutableFinder();
    $process = \Psc\System\Console\Process::build($finder->find('composer'))->addOption('working-dir', mb_substr($root, 0, -1))->addOption('prefer-dist')->addOption('v')->addArgument('update')->end();
    $process->run();
    $log = "Running self-update. \n";
    $log .= "run: " . $process->getCommandline() . "\n";
    $log .= $process->getOutput() . "\n";
    $log .= $process->getErrorOutput() . "\n";
} elseif ($scan) {
    $xbmc = new XBMC($conf['xbmc']['username'], $conf['xbmc']['password'], $conf['xbmc']['port']);
    $log = 'Forcing XBMC to scan. Response: ';
    $log .= $xbmc->scan();
} else {
    $episodes = $client->getEpisodes();