예제 #1
0
/*
 * This script attempts to clean release names using the NFO, file name and release name, Par2 file.
 * A good way to use this script is to use it in this order: php fixReleaseNames.php 3 true other yes
 * php fixReleaseNames.php 5 true other yes
 * If you used the 4th argument yes, but you want to reset the status,
 * there is another script called resetRelnameStatus.php
 */
require_once dirname(__FILE__) . '/../../../www/config.php';
use nzedb\NameFixer;
use nzedb\NNTP;
use nzedb\PreDb;
$n = "\n";
$pdo = new \nzedb\db\Settings();
$namefixer = new NameFixer(['Settings' => $pdo]);
$predb = new PreDb(['Echo' => true, 'Settings' => $pdo]);
if (isset($argv[1]) && isset($argv[2]) && isset($argv[3]) && isset($argv[4])) {
    $update = $argv[2] == "true" ? 1 : 2;
    $other = 1;
    if ($argv[3] === 'all') {
        $other = 2;
    } else {
        if ($argv[3] === 'preid') {
            $other = 3;
        }
    }
    $setStatus = $argv[4] == "yes" ? 1 : 2;
    $show = 2;
    if (isset($argv[5]) && $argv[5] === 'show') {
        $show = 1;
    }
예제 #2
0
파일: predb.php 프로젝트: kaibosh/nZEDb
<?php

use nzedb\PreDb;
if (!$page->users->isLoggedIn()) {
    $page->show403();
}
$predb = new PreDb(['Settings' => $page->settings]);
$offset = isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset']) ? $_REQUEST["offset"] : 0;
if (isset($_REQUEST['presearch'])) {
    $lastSearch = $_REQUEST['presearch'];
    $parr = $predb->getAll($offset, ITEMS_PER_PAGE, $_REQUEST['presearch']);
} else {
    $lastSearch = '';
    $parr = $predb->getAll($offset, ITEMS_PER_PAGE);
}
$page->smarty->assign('pagertotalitems', $parr['count']);
$page->smarty->assign('pageroffset', $offset);
$page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE);
$page->smarty->assign('pagerquerybase', WWW_TOP . "/predb/&amp;offset=");
$page->smarty->assign('pagerquerysuffix', "#results");
$page->smarty->assign('lastSearch', $lastSearch);
$pager = $page->smarty->fetch("pager.tpl");
$page->smarty->assign('pager', $pager);
$page->smarty->assign('results', $parr['arr']);
$page->title = "Browse PreDB";
$page->meta_title = "View PreDB info";
$page->meta_keywords = "view,predb,info,description,details";
$page->meta_description = "View PreDB info";
$page->content = $page->smarty->fetch('predb.tpl');
$page->render();
예제 #3
0
<?php

use nzedb\PreDb;
if (!$page->users->isLoggedIn()) {
    $page->show403();
}
if (!isset($_REQUEST["id"])) {
    $page->show404();
}
$pre = new PreDb(['Settings' => $page->settings]);
$predata = $pre->getOne($_REQUEST["id"]);
if (!$predata) {
    print "No pre info";
} else {
    print "<table>\n";
    if (isset($predata['nuked'])) {
        $nuked = '';
        switch ($predata['nuked']) {
            case PreDb::PRE_NUKED:
                $nuked = 'NUKED';
                break;
            case PreDb::PRE_MODNUKE:
                $nuked = 'MODNUKED';
                break;
            case PreDb::PRE_OLDNUKE:
                $nuked = 'OLDNUKE';
                break;
            case PreDb::PRE_RENUKED:
                $nuked = 'RENUKE';
                break;
            case PreDb::PRE_UNNUKED:
예제 #4
0
    /**
     * Create releases from complete collections.
     *
     * @param int|string $groupID (optional)
     *
     * @return int
     * @access public
     */
    public function createReleases($groupID)
    {
        $startTime = time();
        $group = $this->groups->getCBPTableNames($this->tablePerGroup, $groupID);
        $categorize = new Categorize(['Settings' => $this->pdo]);
        $returnCount = $duplicate = 0;
        if ($this->echoCLI) {
            $this->pdo->log->doEcho($this->pdo->log->header("Process Releases -> Create releases from complete collections."));
        }
        $this->pdo->ping(true);
        $collections = $this->pdo->queryDirect(sprintf('
				SELECT SQL_NO_CACHE %s.*, groups.name AS gname
				FROM %s
				INNER JOIN groups ON %s.group_id = groups.id
				WHERE %s %s.filecheck = %d
				AND filesize > 0 LIMIT %d', $group['cname'], $group['cname'], $group['cname'], !empty($groupID) ? ' group_id = ' . $groupID . ' AND ' : ' ', $group['cname'], self::COLLFC_SIZED, $this->releaseCreationLimit));
        if ($this->echoCLI && $collections !== false) {
            echo $this->pdo->log->primary($collections->rowCount() . " Collections ready to be converted to releases.");
        }
        if ($collections instanceof \Traversable) {
            $preDB = new PreDb(['Echo' => $this->echoCLI, 'Settings' => $this->pdo]);
            foreach ($collections as $collection) {
                $cleanRelName = $this->pdo->escapeString(utf8_encode(str_replace(['#', '@', '$', '%', '^', '§', '¨', '©', 'Ö'], '', $collection['subject'])));
                $fromName = $this->pdo->escapeString(utf8_encode(trim($collection['fromname'], "'")));
                // Look for duplicates, duplicates match on releases.name, releases.fromname and releases.size
                // A 1% variance in size is considered the same size when the subject and poster are the same
                $dupeCheck = $this->pdo->queryOneRow(sprintf("\n\t\t\t\t\t\tSELECT SQL_NO_CACHE id\n\t\t\t\t\t\tFROM releases\n\t\t\t\t\t\tWHERE name = %s\n\t\t\t\t\t\tAND fromname = %s\n\t\t\t\t\t\tAND size BETWEEN '%s'\n\t\t\t\t\t\tAND '%s'", $cleanRelName, $fromName, $collection['filesize'] * 0.99, $collection['filesize'] * 1.01));
                if ($dupeCheck === false) {
                    $cleanedName = $this->releaseCleaning->releaseCleaner($collection['subject'], $collection['fromname'], $collection['filesize'], $collection['gname']);
                    if (is_array($cleanedName)) {
                        $properName = $cleanedName['properlynamed'];
                        $preID = isset($cleanerName['predb']) ? $cleanerName['predb'] : false;
                        $isReqID = isset($cleanerName['requestid']) ? $cleanerName['requestid'] : false;
                        $cleanedName = $cleanedName['cleansubject'];
                    } else {
                        $properName = true;
                        $isReqID = $preID = false;
                    }
                    if ($preID === false && $cleanedName !== '') {
                        // try to match the cleaned searchname to predb title or filename here
                        $preMatch = $preDB->matchPre($cleanedName);
                        if ($preMatch !== false) {
                            $cleanedName = $preMatch['title'];
                            $preID = $preMatch['preid'];
                            $properName = true;
                        }
                    }
                    $releaseID = $this->releases->insertRelease(['name' => $cleanRelName, 'searchname' => $this->pdo->escapeString(utf8_encode($cleanedName)), 'totalpart' => $collection['totalfiles'], 'group_id' => $collection['group_id'], 'guid' => $this->pdo->escapeString($this->releases->createGUID($cleanRelName)), 'postdate' => $this->pdo->escapeString($collection['date']), 'fromname' => $fromName, 'size' => $collection['filesize'], 'categoryid' => $categorize->determineCategory($collection['group_id'], $cleanedName), 'isrenamed' => $properName === true ? 1 : 0, 'reqidstatus' => $isReqID === true ? 1 : 0, 'preid' => $preID === false ? 0 : $preID, 'nzbstatus' => NZB::NZB_NONE]);
                    if ($releaseID !== false) {
                        // Update collections table to say we inserted the release.
                        $this->pdo->queryExec(sprintf('
								UPDATE %s
								SET filecheck = %d, releaseid = %d
								WHERE id = %d', $group['cname'], self::COLLFC_INSERTED, $releaseID, $collection['id']));
                        $returnCount++;
                        if ($this->echoCLI) {
                            echo "Added {$returnCount} releases.\r";
                        }
                    }
                } else {
                    // The release was already in the DB, so delete the collection.
                    $this->pdo->queryExec(sprintf('
							DELETE c, b, p FROM %s c
							INNER JOIN %s b ON(c.id=b.collection_id)
							STRAIGHT_JOIN %s p ON(b.id=p.binaryid)
							WHERE c.collectionhash = %s', $group['cname'], $group['bname'], $group['pname'], $this->pdo->escapeString($collection['collectionhash'])));
                    $duplicate++;
                }
            }
        }
        if ($this->echoCLI) {
            $this->pdo->log->doEcho($this->pdo->log->primary(PHP_EOL . number_format($returnCount) . ' Releases added and ' . number_format($duplicate) . ' duplicate collections deleted in ' . $this->consoleTools->convertTime(time() - $startTime)), true);
        }
        return ['added' => $returnCount, 'dupes' => $duplicate];
    }
예제 #5
0
파일: details.php 프로젝트: sebst3r/nZEDb
 }
 if ($data['consoleinfoid'] != '') {
     $c = new Console(['Settings' => $page->settings]);
     $con = $c->getConsoleInfo($data['consoleinfoid']);
 }
 if ($data['gamesinfo_id'] != '') {
     $g = new Games(['Settings' => $page->settings]);
     $game = $g->getgamesInfo($data['gamesinfo_id']);
 }
 if ($data['bookinfoid'] != '') {
     $b = new Books(['Settings' => $page->settings]);
     $boo = $b->getBookInfo($data['bookinfoid']);
 }
 $rf = new ReleaseFiles($page->settings);
 $releasefiles = $rf->get($data['id']);
 $predb = new PreDb(['Settings' => $page->settings]);
 $pre = $predb->getForRelease($data['preid']);
 $user = $page->users->getById($page->users->currentUserId());
 $page->smarty->assign('cpapi', $user['cp_api']);
 $page->smarty->assign('cpurl', $user['cp_url']);
 $page->smarty->assign('releasefiles', $releasefiles);
 $page->smarty->assign('release', $data);
 $page->smarty->assign('reVideo', $reVideo);
 $page->smarty->assign('reAudio', $reAudio);
 $page->smarty->assign('reSubs', $reSubs);
 $page->smarty->assign('nfo', $nfo);
 $page->smarty->assign('rage', $rage);
 $page->smarty->assign('movie', $mov);
 $page->smarty->assign('xxx', $xxx);
 $page->smarty->assign('anidb', $ani);
 $page->smarty->assign('music', $mus);