示例#1
0
 /**
  * Get list of contents inside a release's NZB file.
  *
  * @return bool
  */
 protected function _getNZBContents()
 {
     $nzbPath = $this->_nzb->NZBPath($this->_release['guid']);
     if ($nzbPath === false) {
         $this->_echo('NZB not found for GUID: ' . $this->_release['guid'], 'warning');
         // The nzb was not located. decrement the password status.
         $this->pdo->queryExec(sprintf('UPDATE releases SET passwordstatus = passwordstatus - 1 WHERE id = %d', $this->_release['id']));
         return false;
     }
     $nzbContents = \nzedb\utility\Utility::unzipGzipFile($nzbPath);
     // Get a list of files in the nzb.
     $this->_nzbContents = $this->_nzb->nzbFileList($nzbContents);
     if (count($this->_nzbContents) === 0) {
         $this->_echo('NZB is empty or broken for GUID: ' . $this->_release['guid'], 'warning');
         // There does not appear to be any files in the nzb, decrement password status.
         $this->pdo->queryExec(sprintf('UPDATE releases SET passwordstatus = passwordstatus - 1 WHERE id = %d', $this->_release['id']));
         return false;
     }
     // Sort the files inside the NZB.
     usort($this->_nzbContents, ['\\nzedb\\processing\\post\\ProcessAdditional', '_sortNZB']);
     return true;
 }
示例#2
0
 /**
  * Get list of contents inside a release's NZB file.
  *
  * @return bool
  */
 protected function _getNZBContents()
 {
     $nzbPath = $this->_nzb->getNZBPath($this->_release['guid']);
     if ($nzbPath === false) {
         $this->_echo('NZB not found for GUID: ' . $this->_release['guid'], 'warning');
         return $this->_decrementPasswordStatus();
     }
     $nzbContents = Utility::unzipGzipFile($nzbPath);
     if (!$nzbContents) {
         $this->_echo('NZB is empty or broken for GUID: ' . $this->_release['guid'], 'warning');
         return $this->_decrementPasswordStatus();
     }
     // Get a list of files in the nzb.
     $this->_nzbContents = $this->_nzb->nzbFileList($nzbContents);
     if (count($this->_nzbContents) === 0) {
         $this->_echo('NZB is potentially broken for GUID: ' . $this->_release['guid'], 'warning');
         return $this->_decrementPasswordStatus();
     }
     // Sort keys.
     ksort($this->_nzbContents, SORT_NATURAL);
     return true;
 }
示例#3
0
<?php

/*
Filesize Fix Script
If after import you have a bunch of zero sized releases run this
Author: lordgnu <*****@*****.**>
*/
require_once dirname(__FILE__) . '/../../www/config.php';
use newznab\db\Settings;
$pdo = new Settings();
$nzb = new NZB();
$items = $pdo->query("SELECT id,guid FROM releases WHERE size = 0");
$total = count($items);
$compl = 0;
echo "Updating file size for " . count($items) . " release(s)\n";
while ($item = array_pop($items)) {
    $nzbpath = $nzb->getNZBPath($item['guid'], $pdo->getSetting('nzbpath'));
    ob_start();
    @readgzfile($nzbpath);
    $nzbfile = ob_get_contents();
    ob_end_clean();
    $ret = $nzb->nzbFileList($nzbfile);
    $filesize = '0';
    foreach ($ret as $file) {
        $filesize = bcadd($filesize, $file['size']);
    }
    $pdo->queryExec("UPDATE releases SET size = '{$filesize}' WHERE id = '{$item['id']}' LIMIT 1");
    $compl++;
    echo sprintf("[%6d / %6d] %0.2f", $compl, $total, $compl / $total * 100) . '%' . "\n";
}
示例#4
0
<?php

require_once './config.php';
$page = new AdminPage();
if (!$page->users->isLoggedIn()) {
    $page->show403();
}
if (isset($_GET['id'])) {
    $releases = new Releases(['Settings' => $page->settings]);
    $release = $releases->getByGuid($_GET['id']);
    if ($release === false) {
        $page->show404();
    }
    $nzb = new NZB($page->settings);
    $nzbPath = $nzb->getNZBPath($_GET['id']);
    if (!file_exists($nzbPath)) {
        $page->show404();
    }
    $nzbFile = nzedb\utility\Utility::unzipGzipFile($nzbPath);
    $files = $nzb->nzbFileList($nzbFile);
    $page->smarty->assign('release', $release);
    $page->smarty->assign('files', $files);
    $page->title = "File List";
    $page->meta_title = "View Nzb file list";
    $page->meta_keywords = "view,nzb,file,list,description,details";
    $page->meta_description = "View Nzb File List";
    $page->content = $page->smarty->fetch('release-files.tpl');
    $page->render();
}