Example #1
0
 /**
  * @returns array $result
  */
 public function queryByEmail($email)
 {
     $process = Process::build($this->daemon, array('query-email', $email))->end();
     if (($exitCode = $process->run()) !== 0) {
         throw new \RuntimeException('Cannot Query Daemon: exit(' . $exitCode . ') ' . $process->getErrorOutput() . ' ' . $process->getOutput() . ' Running ' . $process->getCommandLine());
     }
     $json = $process->getOutput();
     $result = JSONConverter::create()->parse($json);
     return $result;
 }
Example #2
0
    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();
    $log = 'nothing was updated. Hit reload';
}
$episodesJs = array();
foreach ($episodes as $episode) {