本文整理汇总了PHP中newznab\db\Settings::getSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::getSetting方法的具体用法?PHP Settings::getSetting怎么用?PHP Settings::getSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类newznab\db\Settings
的用法示例。
在下文中一共展示了Settings::getSetting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Default constructor
*
* @param bool $echooutput
*/
public function __construct($echooutput = false)
{
$this->echooutput = NN_ECHOCLI && $echooutput;
$this->pdo = new Settings();
$this->pubkey = $this->pdo->getSetting('amazonpubkey');
$this->privkey = $this->pdo->getSetting('amazonprivkey');
$this->asstag = $this->pdo->getSetting('amazonassociatetag');
$this->imgSavePath = WWW_DIR . 'covers/console/';
}
示例2: __construct
/**
* @param array $options Class instances / Echo to CLI.
*/
public function __construct(array $options = [])
{
$defaults = ['Echo' => false, 'Settings' => null];
$options += $defaults;
$this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
$this->rageqty = $this->pdo->getSetting('maxrageprocessed') != '' ? $this->pdo->getSetting('maxrageprocessed') : 75;
$this->echooutput = $options['Echo'] && NN_ECHOCLI;
$this->xmlEpisodeInfoUrl = "http://services.tvrage.com/myfeeds/tvrageepisodes.php?key=" . TvAnger::APIKEY;
}
示例3: __construct
/**
* @param array $options Class instances / Echo to cli.
*/
public function __construct(array $options = array())
{
$defaults = ['Echo' => false, 'Settings' => null];
$options += $defaults;
$this->echooutput = $options['Echo'] && NN_ECHOCLI;
$this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
$qty = $this->pdo->getSetting('maxanidbprocessed');
$this->aniqty = !empty($qty) ? $qty : 100;
$this->status = 'NULL';
}
示例4: __construct
/**
* Default constructor.
*
* @param newznab\db\Settings $pdo
*
* @access public
*/
public function __construct(&$pdo = null)
{
$this->pdo = $pdo instanceof Settings ? $pdo : new Settings();
$this->tablePerGroup = $this->pdo->getSetting('tablepergroup') == 0 ? false : true;
$nzbSplitLevel = $this->pdo->getSetting('nzbsplitlevel');
$this->nzbSplitLevel = empty($nzbSplitLevel) ? 1 : $nzbSplitLevel;
$this->siteNzbPath = (string) $this->pdo->getSetting('nzbpath');
if (substr($this->siteNzbPath, -1) !== DS) {
$this->siteNzbPath .= DS;
}
}
示例5: __construct
/**
* Construct.
*
* @param array $options
* array(
* 'Echo' => bool ; To echo to CLI or not.
* 'NNTP' => NNTP ; Class NNTP.
* 'Nfo' => Nfo ; Class Nfo.
* 'NZB' => NZB ; Class NZB.
* 'Settings' => DB ; Class newznab\db\Settings.
* 'PostProcess' => PostProcess ; Class PostProcess.
* )
*
* @access public
*/
public function __construct(array $options = [])
{
$defaults = ['Echo' => false, 'NNTP' => null, 'Nfo' => null, 'NZB' => null, 'Settings' => null, 'PostProcess' => null];
$options += $defaults;
$this->echooutput = $options['Echo'] && NN_ECHOCLI;
$this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
$this->nntp = $options['NNTP'] instanceof \NNTP ? $options['NNTP'] : new \NNTP(['Echo' => $this->echooutput, 'Settings' => $this->pdo]);
$this->nfo = $options['Nfo'] instanceof \Nfo ? $options['Nfo'] : new \Nfo(['Echo' => $this->echooutput, 'Settings' => $this->pdo]);
$this->pp = $options['PostProcess'] instanceof PostProcess ? $options['PostProcess'] : new PostProcess(['Echo' => $this->echooutput, 'Nfo' => $this->nfo, 'Settings' => $this->pdo]);
$this->nzb = $options['NZB'] instanceof \NZB ? $options['NZB'] : new \NZB($this->pdo);
$t = new Tmux();
$this->tmux = $t->get();
$this->lookuppar2 = $this->tmux->lookuppar2 == 1 ? true : false;
$this->alternateNNTP = $this->pdo->getSetting('alternate_nntp') == 1 ? true : false;
}
示例6: updateUpcoming
/**
* Retrieve upcoming movie data from rottentomatoes API.
*/
public function updateUpcoming()
{
$rtkey = $this->pdo->getSetting('rottentomatokey');
if (isset($rtkey)) {
$rt = new RottenTomato($this->pdo->getSetting('rottentomatokey'));
$ret = $rt->getBoxOffice();
if ($ret != "") {
$this->updateInsUpcoming('rottentomato', Movie::SRC_BOXOFFICE, $ret);
}
$ret = $rt->getInTheaters();
if ($ret != "") {
$this->updateInsUpcoming('rottentomato', Movie::SRC_INTHEATRE, $ret);
}
$ret = $rt->getOpening();
if ($ret != "") {
$this->updateInsUpcoming('rottentomato', Movie::SRC_OPENING, $ret);
}
$ret = $rt->getUpcoming();
if ($ret != "") {
$this->updateInsUpcoming('rottentomato', Movie::SRC_UPCOMING, $ret);
}
$ret = $rt->getDvdReleases();
if ($ret != "") {
$this->updateInsUpcoming('rottentomato', Movie::SRC_DVD, $ret);
}
}
}
示例7: _getMediaInfo
/**
* Try to get media info xml from a video file.
*
* @param string $fileLocation
*
* @return bool
*/
protected function _getMediaInfo($fileLocation)
{
if (!$this->_processMediaInfo) {
return false;
}
// Look for the video file.
if (is_file($fileLocation)) {
// Run media info on it.
$xmlArray = Utility::runCmd($this->_killString . $this->pdo->getSetting('mediainfopath') . '" --Output=XML "' . $fileLocation . '"');
// Check if we got it.
if (is_array($xmlArray)) {
// Convert it to string.
$xmlArray = implode("\n", $xmlArray);
if (!preg_match('/<track type="(Audio|Video)">/i', $xmlArray)) {
return false;
}
// Insert it into the DB.
$this->_releaseExtra->addFull($this->_release['id'], $xmlArray);
$this->_releaseExtra->addFromXml($this->_release['id'], $xmlArray);
if ($this->_echoCLI) {
$this->_echo('m', 'primaryOver', false);
}
return true;
}
}
return false;
}
示例8: getAniDbAPI
/**
* Retrieves supplemental anime info from the AniDB API
*
* @param int $id The AniDB id to be inserted
* @param string $type The title type
* @param string $lang The title language
* @param string $title The title of the Anime
*
* @return array|bool
*/
private function getAniDbAPI()
{
$timestamp = $this->pdo->getSetting('banned') + 90000;
if ($timestamp > time()) {
echo "Banned from AniDB lookups until " . date('Y-m-d H:i:s', $timestamp) . "\n";
return false;
}
$apiresponse = $this->getAniDbResponse();
$AniDBAPIArray = array();
if (!$apiresponse) {
echo "AniDB: Error getting response." . PHP_EOL;
} elseif (preg_match("/\\<error\\>Banned\\<\\/error\\>/", $apiresponse)) {
$this->banned = true;
$time = time();
$this->pdo->queryExec(sprintf('UPDATE settings SET VALUE = %s WHERE setting = banned', $time));
} elseif (preg_match("/\\<error\\>Anime not found\\<\\/error\\>/", $apiresponse)) {
echo "AniDB : Anime not yet on site. Remove until next update.\n";
} elseif ($AniDBAPIXML = new \SimpleXMLElement($apiresponse)) {
$AniDBAPIArray['similar'] = $this->processAPIResponceElement($AniDBAPIXML->similaranime, 'anime');
$AniDBAPIArray['related'] = $this->processAPIResponceElement($AniDBAPIXML->relatedanime, 'anime');
$AniDBAPIArray['creators'] = $this->processAPIResponceElement($AniDBAPIXML->creators);
$AniDBAPIArray['characters'] = $this->processAPIResponceElement($AniDBAPIXML->characters);
$AniDBAPIArray['categories'] = $this->processAPIResponceElement($AniDBAPIXML->categories);
if ($AniDBAPIXML->episodes && $AniDBAPIXML->episodes[0]->attributes()) {
$i = 1;
foreach ($AniDBAPIXML->episodes->episode as $episode) {
$titleArray = array();
$episodeArray = array();
$episodeArray[$i]['episode_id'] = (int) $episode->attributes()->id[0];
$episodeArray[$i]['episode_no'] = (int) $episode->epno;
$episodeArray[$i]['airdate'] = (string) $episode->airdate;
if ($AniDBAPIXML->title && $AniDBAPIXML->title[0]->attributes()) {
foreach ($AniDBAPIXML->title->children() as $title) {
$xmlAttribs = $title->attributes('xml', true);
// only english, x-jat imploded episode titles for now
if (in_array($xmlAttribs->lang, ['en', 'x-jat'])) {
$titleArray[] = $title[0];
}
}
}
$episodeArray[$i]['episode_title'] = empty($titleArray) ? '' : implode(', ', $titleArray);
$i++;
}
}
$episodeArray = [];
//start and end date come from AniDB API as date strings -- no manipulation needed
$AniDBAPIArray['startdate'] = isset($AniDBAPIXML->startdate) ? $AniDBAPIXML->startdate : '0000-00-00';
$AniDBAPIArray['enddate'] = isset($AniDBAPIXML->enddate) ? $AniDBAPIXML->enddate : '0000-00-00';
if (isset($AniDBAPIXML->ratings->permanent)) {
$AniDBAPIArray['rating'] = $AniDBAPIXML->ratings->permanent;
} else {
$AniDBAPIArray['rating'] = isset($AniDBAPIXML->ratings->temporary) ? $AniDBAPIXML->ratings->temporary : ($AniDBAPIArray['rating'] = '');
}
$AniDBAPIArray += array('type' => isset($AniDBAPIXML->type[0]) ? (string) $AniDBAPIXML->type : '', 'description' => isset($AniDBAPIXML->description) ? (string) $AniDBAPIXML->description : '', 'picture' => isset($AniDBAPIXML->picture[0]) ? (string) $AniDBAPIXML->picture : '', 'epsarr' => $episodeArray);
return $AniDBAPIArray;
}
return false;
}
示例9: __construct
/**
* Default constructor.
*
* @param array $options Class instance / echo to cli.
*
* @access public
*/
public function __construct(array $options = [])
{
$defaults = ['Echo' => false, 'Settings' => null];
$options += $defaults;
$this->echo = $options['Echo'] && NN_ECHOCLI;
$this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
$this->nzbs = $this->pdo->getSetting('maxnfoprocessed') != '' ? (int) $this->pdo->getSetting('maxnfoprocessed') : 100;
$this->maxsize = $this->pdo->getSetting('maxsizetoprocessnfo') != '' ? (int) $this->pdo->getSetting('maxsizetoprocessnfo') : 100;
$this->maxsize = $this->maxsize > 0 ? 'AND size < ' . $this->maxsize * 1073741824 : '';
$this->minsize = $this->pdo->getSetting('minsizetoprocessnfo') != '' ? (int) $this->pdo->getSetting('minsizetoprocessnfo') : 100;
$this->minsize = $this->minsize > 0 ? 'AND size > ' . $this->minsize * 1048576 : '';
$this->maxRetries = (int) ($this->pdo->getSetting('maxnforetries') >= 0 ? -((int) $this->pdo->getSetting('maxnforetries') + 1) : self::NFO_UNPROC);
$this->maxRetries = $this->maxRetries < -8 ? -8 : $this->maxRetries;
$this->tmpPath = (string) $this->pdo->getSetting('tmpunrarpath');
if (!preg_match('/[\\/\\\\]$/', $this->tmpPath)) {
$this->tmpPath .= DS;
}
}
示例10: nzpreUpdate
/**
* Get nzpre data from usenet and parse.
*/
public function nzpreUpdate()
{
if (empty($this->pdo->getSetting('nzpregroup')) || empty($this->pdo->getSetting('nzpresubject')) || empty($this->pdo->getSetting('nzpreposter')) || empty($this->pdo->getSetting('nzprefield')) || empty($this->pdo->getSetting('nzprekey'))) {
return false;
}
if ($this->echooutput) {
echo "Predb : Checking for new pre data ";
}
$nntp = new NNTP();
if (!$nntp->doConnect()) {
echo "Failed to get NNTP connection\n";
return false;
}
$ret = $groupData = $nntp->selectGroup($this->pdo->getSetting('nzpregroup'));
if ($nntp->isError($ret)) {
echo "Predb : Error " . $ret->getMessage() . "\n";
return false;
}
$ret = $groupMsgs = $nntp->getOverview($groupData['last'] - (!empty($this->pdo->getSetting('nzprearticles')) ? $this->pdo->getSetting('nzprearticles') : 500) . '-' . $groupData['last']);
if ($nntp->isError($ret)) {
echo "Predb : Error " . $ret->getMessage() . "\n";
return false;
}
$added_updated = 0;
$nzprekey = $this->pdo->getSetting('nzprekey');
while (strlen($nzprekey) < 1024) {
$nzprekey = $nzprekey . $nzprekey;
}
$cnt = !empty($this->pdo->getSetting('nzprearticles')) ? $this->pdo->getSetting('nzprearticles') : 500;
foreach ($groupMsgs as $groupMsg) {
if ($cnt % 50 == 0 && $cnt != 0 && $this->echooutput) {
echo $cnt . "..";
}
$cnt--;
if (preg_match('/^' . $this->pdo->getSetting('nzpresubject') . '$/', $groupMsg['Subject']) && preg_match('/^' . $this->pdo->getSetting('nzpreposter') . '/', $groupMsg['From'])) {
$ret = $msgHeader = $nntp->getHeader($groupMsg['Message-ID']);
if ($nntp->isError($ret)) {
continue;
}
for ($i = 0; $i < count($msgHeader); $i++) {
if (preg_match('/^' . $this->pdo->getSetting('nzprefield') . ': /', $msgHeader[$i])) {
if ($nzpreParse = $this->nzpreParse(str_replace($this->pdo->getSetting('nzprefield') . ': ', '', $msgHeader[$i]), $nzprekey)) {
if ($this->updatePreDB($this->pdo, $nzpreParse)) {
$added_updated++;
}
}
break;
}
}
}
}
$nntp->disconnect();
if ($this->echooutput) {
echo "\nPredb : Added/Updated " . $added_updated . " records\n";
}
}
示例11: __construct
/**
* @param array $options Class instances / Echo to cli.
*/
public function __construct(array $options = array())
{
$defaults = ['Echo' => false, 'ColorCLI' => null, 'Settings' => null];
$options += $defaults;
$this->echoOutput = $options['Echo'] && NN_ECHOCLI;
$this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
$this->publicKey = $this->pdo->getSetting('giantbombkey');
$this->gameQty = $this->pdo->getSetting('maxgamesprocessed') != '' ? $this->pdo->getSetting('maxgamesprocessed') : 150;
$this->sleepTime = $this->pdo->getSetting('amazonsleep') != '' ? $this->pdo->getSetting('amazonsleep') : 1000;
$this->imgSavePath = NN_COVERS . 'games' . DS;
$this->renamed = '';
$this->matchPercentage = 60;
$this->maxHitRequest = false;
$this->cookie = NN_TMP . 'xxx.cookie';
if ($this->pdo->getSetting('lookupgames') == 2) {
$this->renamed = 'AND isrenamed = 1';
}
//$this->cleangames = ($this->site->('lookupgames') == 2) ? 'AND isrenamed = 1' : '';
}
示例12: __construct
/**
* @param array $options Echo to cli / Class instances.
*/
public function __construct(array $options = [])
{
$defaults = ['Echo' => false, 'ReleaseImage' => null, 'Settings' => null];
$options += $defaults;
$this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
$this->releaseImage = $options['ReleaseImage'] instanceof ReleaseImage ? $options['ReleaseImage'] : new ReleaseImage($this->pdo);
$this->movieqty = $this->pdo->getSetting('maxxxxprocessed') != '' ? $this->pdo->getSetting('maxxxxprocessed') : 100;
$this->showPasswords = Releases::showPasswords($this->pdo);
$this->debug = NN_DEBUG;
$this->echooutput = $options['Echo'] && NN_ECHOCLI;
$this->imgSavePath = NN_COVERS . 'xxx' . DS;
$this->cookie = NN_TMP . 'xxx.cookie';
if (NN_DEBUG || NN_LOGGING) {
$this->debug = true;
try {
$this->debugging = new \Logger();
} catch (\LoggerException $error) {
$this->_debug = false;
}
}
}
示例13: processMusicFromMediaInfo
/**
* Process untagged music releases using information from mediainfo if config permits.
*/
public function processMusicFromMediaInfo()
{
$processMediainfo = $this->pdo->getSetting('mediainfopath') != '' ? true : false;
$processAudioSample = $this->pdo->getSetting('saveaudiopreview') == 1 ? true : false;
$processMusic = $this->pdo->getSetting('lookupmusic') == 1 ? true : false;
if ($processMusic && $processMediainfo && $processAudioSample) {
$music = new Music($this->echooutput);
$ret = $music->processMusicReleaseFromMediaInfo();
return $ret;
}
return false;
}
示例14: addComment
/**
* Add a release_comments row.
*/
public function addComment($id, $gid, $text, $userid, $host)
{
if (strlen(trim($text)) == 0) {
return false;
}
if ($this->pdo->getSetting('storeuserips') != "1") {
$host = "";
}
$comid = $this->pdo->queryInsert(sprintf("INSERT INTO release_comments (releaseid, gid, text, userid, createddate, host) VALUES (%d, %s, %s, %d, now(), %s)", $id, $this->pdo->escapeString($gid), $this->pdo->escapeString($text), $userid, $this->pdo->escapeString($host)));
$this->updateReleaseCommentCount($gid);
return $comid;
}
示例15: __construct
/**
* @param array $options Class instances/ echo to CLI.
*/
public function __construct(array $options = [])
{
$defaults = ['Echo' => false, 'Settings' => null];
$options += $defaults;
$this->echooutput = $options['Echo'] && NN_ECHOCLI;
$this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
$this->pubkey = $this->pdo->getSetting('amazonpubkey');
$this->privkey = $this->pdo->getSetting('amazonprivkey');
$this->asstag = $this->pdo->getSetting('amazonassociatetag');
$this->musicqty = $this->pdo->getSetting('maxmusicprocessed') != '' ? $this->pdo->getSetting('maxmusicprocessed') : 150;
$this->sleeptime = $this->pdo->getSetting('amazonsleep') != '' ? $this->pdo->getSetting('amazonsleep') : 1000;
$this->imgSavePath = NN_COVERS . 'music' . DS;
$this->renamed = '';
if ($this->pdo->getSetting('lookupmusic') == 2) {
$this->renamed = 'AND isrenamed = 1';
}
$this->failCache = [];
}