Updated scripts, fixing stuff i previously edited.

This commit is contained in:
Darko
2014-09-17 10:51:42 +02:00
parent b1bd8900c0
commit a24f1beaae
8 changed files with 73 additions and 69 deletions
+10 -8
View File
@@ -153,17 +153,19 @@ class Film
$options += $defaults;
$this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB());
$s = new Sites();
$this->site = $s->get();
$this->releaseImage = ($options['ReleaseImage'] instanceof \ReleaseImage ? $options['ReleaseImage'] : new \ReleaseImage($this->pdo));
$this->imdbLanguage = ($this->pdo->getSetting('imdblanguage') != '') ? (string)$this->pdo->getSetting('imdblanguage') : 'en';
$this->imdbLanguage = ($this->site->imdblanguage != '') ? (string)$this->site->imdblanguage : 'en';
$this->tmdb = ($options['TMDb'] instanceof \TMDb ? $options['TMDb'] : new \TMDb($this->pdo->getSetting('tmdbkey'), $this->imdbLanguage));
$this->tmdb = ($options['TMDb'] instanceof \TMDb ? $options['TMDb'] : new \TMDb($this->site->tmdbkey, $this->imdbLanguage));
$this->fanartapikey = $this->pdo->getSetting('fanarttvkey');
$this->imdburl = ($this->pdo->getSetting('imdburl') == 0 ? false : true);
$this->movieqty = ($this->pdo->getSetting('maximdbprocessed') != '') ? $this->pdo->getSetting('maximdbprocessed') : 100;
$this->fanartapikey = $this->site->fanarttvkey;
$this->imdburl = ($this->site->imdburl == 0 ? false : true);
$this->movieqty = ($this->site->maximdbprocessed != '') ? $this->site->maximdbprocessed : 100;
$this->searchEngines = true;
$this->showPasswords = ($this->pdo->getSetting('showpasswordedrelease') != '') ? $this->pdo->getSetting('showpasswordedrelease') : 0;
$this->showPasswords = ($this->site->showpasswordedrelease != '') ? $this->site->showpasswordedrelease : 0;
$this->debug = NN_DEBUG;
$this->echooutput = ($options['Echo'] && NN_ECHOCLI);
@@ -809,7 +811,7 @@ class Film
$buffer =
getUrl([
'url' => 'http://' . ($this->imdburl === false ? 'www' : 'akas') . '.imdb.com/title/tt' . $imdbId . '/',
'language' => (($this->pdo->getSetting('imdblanguage') != '') ? $this->pdo->getSetting('imdblanguage') : 'en'),
'language' => (($this->site->imdblanguage != '') ? $this->site->imdblanguage : 'en'),
'useragent' => 'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) ' .
'Version/4.0.4 Mobile/7B334b Safari/531.21.102011-10-16 20:23:10', 'foo=bar'
]
@@ -1319,7 +1321,7 @@ class Film
{
$this->pdo->log->doEcho($this->pdo->log->header('Updating movie schedule using rotten tomatoes.'));
$rt = new \RottenTomato($this->pdo->getSetting('rottentomatokey'));
$rt = new \RottenTomato($this->site->rottentomatokey);
if ($rt instanceof \RottenTomato) {
+5 -5
View File
@@ -88,14 +88,14 @@ class Info
$this->echo = ($options['Echo'] && NN_ECHOCLI);
$this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB());
$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->nzbs = ($this->site->('maxnfoprocessed') != '') ? (int)$this->site->('maxnfoprocessed') : 100;
$this->maxsize = ($this->site->('maxsizetoprocessnfo') != '') ? (int)$this->site->('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->site->('minsizetoprocessnfo') != '') ? (int)$this->site->('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 = (int)($this->site->('maxnforetries') >= 0 ? -((int)$this->site->('maxnforetries') + 1) : self::NFO_UNPROC);
$this->maxRetries = ($this->maxRetries < -8 ? -8 : $this->maxRetries);
$this->tmpPath = (string)$this->pdo->getSetting('tmpunrarpath');
$this->tmpPath = (string)$this->site->('tmpunrarpath');
if (!preg_match('/[\/\\\\]$/', $this->tmpPath)) {
$this->tmpPath .= DS;
}
+12 -12
View File
@@ -122,8 +122,8 @@ class PProcess
//\\
//\\ Site settings.
$this->addpar2 = ($this->pdo->getSetting('addpar2') == 0) ? false : true;
$this->alternateNNTP = ($this->pdo->getSetting('alternate_nntp') == 1 ? true : false);
$this->addpar2 = ($this->site->('addpar2') == 0) ? false : true;
$this->alternateNNTP = ($this->site->('alternate_nntp') == 1 ? true : false);
//\\
}
@@ -156,7 +156,7 @@ class PProcess
*/
public function processAnime()
{
if ($this->pdo->getSetting('lookupanidb') == 1) {
if ($this->site->('lookupanidb') == 1) {
$anidb = new AniDB(['Echo' => $this->echooutput, 'Settings' => $this->pdo]);
$anidb->animetitlesUpdate();
$anidb->processAnimeReleases();
@@ -170,7 +170,7 @@ class PProcess
*/
public function processBooks()
{
if ($this->pdo->getSetting('lookupbooks') != 0) {
if ($this->site->('lookupbooks') != 0) {
(new Books(['Echo' => $this->echooutput, 'Settings' => $this->pdo, ]))->processBookReleases();
}
}
@@ -182,7 +182,7 @@ class PProcess
*/
public function processConsoles()
{
if ($this->pdo->getSetting('lookupgames') != 0) {
if ($this->site->('lookupgames') != 0) {
(new Console(['Settings' => $this->pdo, 'Echo' => $this->echooutput]))->processConsoleReleases();
}
}
@@ -194,7 +194,7 @@ class PProcess
*/
public function processGames()
{
if ($this->pdo->getSetting('lookupgames') != 0) {
if ($this->site->('lookupgames') != 0) {
(new Games(['Echo' => $this->echooutput, 'Settings' => $this->pdo]))->processGamesReleases();
}
}
@@ -211,7 +211,7 @@ class PProcess
*/
public function processMovies($groupID = '', $guidChar = '', $processMovies = '')
{
$processMovies = (is_numeric($processMovies) ? $processMovies : $this->pdo->getSetting('lookupimdb'));
$processMovies = (is_numeric($processMovies) ? $processMovies : $this->site->('lookupimdb'));
if ($processMovies > 0) {
(new Movie(['Echo' => $this->echooutput, 'Settings' => $this->pdo]))->processMovieReleases($groupID, $guidChar, $processMovies);
}
@@ -224,7 +224,7 @@ class PProcess
*/
public function processMusic()
{
if ($this->pdo->getSetting('lookupmusic') != 0) {
if ($this->site->('lookupmusic') != 0) {
(new Music(['Echo' => $this->echooutput, 'Settings' => $this->pdo]))->processMusicReleases();
}
}
@@ -240,8 +240,8 @@ class PProcess
*/
public function processNfos(&$nntp, $groupID = '', $guidChar = '')
{
if ($this->pdo->getSetting('lookupnfo') == 1) {
$this->Nfo->processNfoFiles($nntp, $groupID, $guidChar, (int)$this->pdo->getSetting('lookupimdb'), (int)$this->pdo->getSetting('lookuptvrage'));
if ($this->site->('lookupnfo') == 1) {
$this->Nfo->processNfoFiles($nntp, $groupID, $guidChar, (int)$this->site->('lookupimdb'), (int)$this->site->('lookuptvrage'));
}
}
@@ -267,7 +267,7 @@ class PProcess
*/
public function processTv($groupID = '', $guidChar = '', $processTV = '')
{
$processTV = (is_numeric($processTV) ? $processTV : $this->pdo->getSetting('lookuptvrage'));
$processTV = (is_numeric($processTV) ? $processTV : $this->site->('lookuptvrage'));
if ($processTV > 0) {
(new TvAnger(['Echo' => $this->echooutput, 'Settings' => $this->pdo]))->processTvReleases($groupID, $guidChar, $processTV);
}
@@ -278,7 +278,7 @@ class PProcess
*/
public function processXXX()
{
if ($this->pdo->getSetting('lookupxxx') == 1) {
if ($this->site->('lookupxxx') == 1) {
(new XXX(['Echo' => $this->echooutput, 'Settings' => $this->pdo]))->processXXXReleases();
}
}
+36 -36
View File
@@ -316,33 +316,33 @@ Class ProcessAdditional
$this->_par2Info = new Par2Info();
$this->_nfo = ($options['Nfo'] instanceof Info ? $options['Nfo'] : new Info(['Echo' => $this->_echoCLI, 'Settings' => $this->pdo]));
$this->_innerFileBlacklist = ($this->pdo->getSetting('innerfileblacklist') == '' ? false : $this->pdo->getSetting('innerfileblacklist'));
$this->_maxNestedLevels = ($this->pdo->getSetting('maxnestedlevels') == 0 ? 3 : $this->pdo->getSetting('maxnestedlevels'));
$this->_extractUsingRarInfo = ($this->pdo->getSetting('extractusingrarinfo') == 0 ? false : true);
$this->_innerFileBlacklist = ($this->site->('innerfileblacklist') == '' ? false : $this->site->('innerfileblacklist'));
$this->_maxNestedLevels = ($this->site->('maxnestedlevels') == 0 ? 3 : $this->site->('maxnestedlevels'));
$this->_extractUsingRarInfo = ($this->site->('extractusingrarinfo') == 0 ? false : true);
$this->_7zipPath = false;
$this->_unrarPath = false;
// Pass the binary extractors to ArchiveInfo.
$clients = array();
if ($this->pdo->getSetting('unrarpath') != '') {
$clients += array(ArchiveInfo::TYPE_RAR => $this->pdo->getSetting('unrarpath'));
$this->_unrarPath = $this->pdo->getSetting('unrarpath');
if ($this->site->('unrarpath') != '') {
$clients += array(ArchiveInfo::TYPE_RAR => $this->site->('unrarpath'));
$this->_unrarPath = $this->site->('unrarpath');
}
if ($this->pdo->getSetting('zippath') != '') {
$clients += array(ArchiveInfo::TYPE_ZIP => $this->pdo->getSetting('zippath'));
$this->_7zipPath = $this->pdo->getSetting('zippath');
if ($this->site->('zippath') != '') {
$clients += array(ArchiveInfo::TYPE_ZIP => $this->site->('zippath'));
$this->_7zipPath = $this->site->('zippath');
}
$this->_archiveInfo->setExternalClients($clients);
$this->_hasGNUFile = (Utility::hasCommand('file') === true ? true : false);
$this->_killString = '"';
if ($this->pdo->getSetting('timeoutpath') != '' && $this->pdo->getSetting('timeoutseconds') > 0) {
if ($this->site->('timeoutpath') != '' && $this->site->('timeoutseconds') > 0) {
$this->_killString = (
'"' . $this->pdo->getSetting('timeoutpath') .
'"' . $this->site->('timeoutpath') .
'" --foreground --signal=KILL ' .
$this->pdo->getSetting('timeoutseconds') . ' "'
$this->site->('timeoutseconds') . ' "'
);
}
@@ -350,48 +350,48 @@ Class ProcessAdditional
// Maximum amount of releases to fetch per run.
$this->_queryLimit =
($this->pdo->getSetting('maxaddprocessed') != '') ? (int)$this->pdo->getSetting('maxaddprocessed') : 25;
($this->site->('maxaddprocessed') != '') ? (int)$this->site->('maxaddprocessed') : 25;
// Maximum message ID's to download per file type in the NZB (video, jpg, etc).
$this->_segmentsToDownload =
($this->pdo->getSetting('segmentstodownload') != '') ? (int)$this->pdo->getSetting('segmentstodownload') : 2;
($this->site->('segmentstodownload') != '') ? (int)$this->site->('segmentstodownload') : 2;
// Maximum message ID's to download for a RAR file.
$this->_maximumRarSegments =
($this->pdo->getSetting('maxpartsprocessed') != '') ? (int)$this->pdo->getSetting('maxpartsprocessed') : 3;
($this->site->('maxpartsprocessed') != '') ? (int)$this->site->('maxpartsprocessed') : 3;
// Maximum RAR files to check for a password before stopping.
$this->_maximumRarPasswordChecks =
($this->pdo->getSetting('passchkattempts') != '') ? (int)$this->pdo->getSetting('passchkattempts') : 1;
($this->site->('passchkattempts') != '') ? (int)$this->site->('passchkattempts') : 1;
$this->_maximumRarPasswordChecks = ($this->_maximumRarPasswordChecks < 1 ? 1 : $this->_maximumRarPasswordChecks);
// Maximum size of releases in GB.
$this->_maxSize =
(string)($this->pdo->getSetting('maxsizetopostprocess') != '') ? $this->pdo->getSetting('maxsizetopostprocess') : 100;
(string)($this->site->('maxsizetopostprocess') != '') ? $this->site->('maxsizetopostprocess') : 100;
$this->_maxSize = ($this->_maxSize === 0 ? '' : 'AND r.size < ' . ($this->_maxSize * 1073741824));
// Minimum size of releases in MB.
$this->_minSize =
(string)($this->pdo->getSetting('minsizetopostprocess') != '') ? $this->pdo->getSetting('minsizetopostprocess') : 1;
(string)($this->site->('minsizetopostprocess') != '') ? $this->site->('minsizetopostprocess') : 1;
$this->_minSize = ($this->_minSize === 0 ? '' : 'AND r.size > ' . ($this->_minSize * 1048576));
// Use the alternate NNTP provider for downloading Message-ID's ?
$this->_alternateNNTP = ($this->pdo->getSetting('alternate_nntp') == 1 ? true : false);
$this->_alternateNNTP = ($this->site->('alternate_nntp') == 1 ? true : false);
$this->_ffMPEGDuration = ($this->pdo->getSetting('ffmpeg_duration') != '') ? (int)$this->pdo->getSetting('ffmpeg_duration') : 5;
$this->_ffMPEGDuration = ($this->site->('ffmpeg_duration') != '') ? (int)$this->site->('ffmpeg_duration') : 5;
$this->_addPAR2Files = ($this->pdo->getSetting('addpar2') === '0') ? false : true;
$this->_addPAR2Files = ($this->site->('addpar2') === '0') ? false : true;
$this->_processSample = ($this->pdo->getSetting('ffmpegpath') == '' ? false : true);
$this->_processVideo = ($this->pdo->getSetting('processvideos') == 0) ? false : true;
$this->_processJPGSample = ($this->pdo->getSetting('processjpg') == 0) ? false : true;
$this->_processAudioSample = ($this->pdo->getSetting('processaudiosample') == 0) ? false : true;
$this->_processMediaInfo = ($this->pdo->getSetting('mediainfopath') == '') ? false : true;
$this->_processSample = ($this->site->('ffmpegpath') == '' ? false : true);
$this->_processVideo = ($this->site->('processvideos') == 0) ? false : true;
$this->_processJPGSample = ($this->site->('processjpg') == 0) ? false : true;
$this->_processAudioSample = ($this->site->('processaudiosample') == 0) ? false : true;
$this->_processMediaInfo = ($this->site->('mediainfopath') == '') ? false : true;
$this->_processAudioInfo = $this->_processMediaInfo;
$this->_processPasswords = (
((($this->pdo->getSetting('checkpasswordedrar') == 0) ? false : true)) &&
(($this->pdo->getSetting('unrarpath') == '') ? false : true)
((($this->site->('checkpasswordedrar') == 0) ? false : true)) &&
(($this->site->('unrarpath') == '') ? false : true)
);
$this->_audioSavePath = NN_COVERS . 'audiosample' . DS;
@@ -455,7 +455,7 @@ Class ProcessAdditional
protected function _setMainTempPath(&$groupID = '', &$guidChar)
{
// Set up the temporary files folder location.
$this->_mainTmpPath = (string)$this->pdo->getSetting('tmpunrarpath');
$this->_mainTmpPath = (string)$this->site->('tmpunrarpath');
// Check if it ends with a dir separator.
if (!preg_match('/[\/\\\\]$/', $this->_mainTmpPath)) {
@@ -1652,7 +1652,7 @@ Class ProcessAdditional
// Get the media info for the file.
$xmlArray = runCmd(
$this->_killString . $this->pdo->getSetting('mediainfopath') . '" --Output=XML "' . $fileLocation . '"'
$this->_killString . $this->site->('mediainfopath') . '" --Output=XML "' . $fileLocation . '"'
);
if (is_array($xmlArray)) {
@@ -1739,7 +1739,7 @@ Class ProcessAdditional
// Create an audio sample.
runCmd(
$this->_killString .
$this->pdo->getSetting('ffmpegpath') .
$this->site->('ffmpegpath') .
'" -t 30 -i "' .
$fileLocation .
'" -acodec libvorbis -loglevel quiet -y "' .
@@ -1842,7 +1842,7 @@ Class ProcessAdditional
// Get the real duration of the file.
$time = runCmd(
$this->_killString .
$this->pdo->getSetting('ffmpegpath') .
$this->site->('ffmpegpath') .
'" -i "' . $videoLocation .
'" -vcodec copy -y 2>&1 "' .
$tmpVideo . '"',
@@ -1888,7 +1888,7 @@ Class ProcessAdditional
// Create the image.
runCmd(
$this->_killString .
$this->pdo->getSetting('ffmpegpath') .
$this->site->('ffmpegpath') .
'" -i "' .
$fileLocation .
'" -ss ' . ($time === '' ? '00:00:03.00' : $time) .
@@ -1979,7 +1979,7 @@ Class ProcessAdditional
// Try to get the sample (from the end instead of the start).
runCmd(
$this->_killString .
$this->pdo->getSetting('ffmpegpath') .
$this->site->('ffmpegpath') .
'" -i "' .
$fileLocation .
'" -ss ' . $lowestLength .
@@ -1996,7 +1996,7 @@ Class ProcessAdditional
// If longer than 60 or we could not get the video length, run the old way.
runCmd(
$this->_killString .
$this->pdo->getSetting('ffmpegpath') .
$this->site->('ffmpegpath') .
'" -i "' .
$fileLocation .
'" -vcodec libtheora -filter:v scale=320:-1 -t ' .
@@ -2070,7 +2070,7 @@ Class ProcessAdditional
// Run media info on it.
$xmlArray =runCmd(
$this->_killString . $this->pdo->getSetting('mediainfopath') . '" --Output=XML "' . $fileLocation . '"'
$this->_killString . $this->site->('mediainfopath') . '" --Output=XML "' . $fileLocation . '"'
);
// Check if we got it.
+1 -1
View File
@@ -42,7 +42,7 @@ class TvAnger
$options += $defaults;
$this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB());
$this->rageqty = ($this->pdo->getSetting('maxrageprocessed') != '') ? $this->pdo->getSetting('maxrageprocessed') : 75;
$this->rageqty = ($this->site->('maxrageprocessed') != '') ? $this->site->('maxrageprocessed') : 75;
$this->echooutput = ($options['Echo'] && NN_ECHOCLI);
+1 -1
View File
@@ -126,7 +126,7 @@ class Games
if ($this->site->lookupgames == 2) {
$this->renamed = 'AND isrenamed = 1';
}
//$this->cleangames = ($this->pdo->getSetting('lookupgames') == 2) ? 'AND isrenamed = 1' : '';
//$this->cleangames = ($this->site->('lookupgames') == 2) ? 'AND isrenamed = 1' : '';
}
public function getGamesInfo($id)
+2 -2
View File
@@ -71,8 +71,8 @@ class XXX
$this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB());
$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 = ($this->pdo->getSetting('showpasswordedrelease') != '') ? $this->pdo->getSetting('showpasswordedrelease') : 0;
$this->movieqty = ($this->site->('maxxxxprocessed') != '') ? $this->site->('maxxxxprocessed') : 100;
$this->showPasswords = ($this->site->('showpasswordedrelease') != '') ? $this->site->('showpasswordedrelease') : 0;
$this->debug = NN_DEBUG;
$this->echooutput = ($options['Echo'] && NN_ECHOCLI);
$this->imgSavePath = NN_COVERS . 'xxx' . DS;
+6 -4
View File
@@ -114,6 +114,8 @@ class NNTP extends Net_NNTP_Client
$this->_echo = ($options['Echo'] && NN_ECHOCLI);
$this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB());
$s = new Sites();
$this->site = $s->get();
$this->_debugBool = (NN_LOGGING || NN_DEBUG);
if ($this->_debugBool) {
@@ -124,7 +126,7 @@ class NNTP extends Net_NNTP_Client
}
}
$this->_nntpRetries = ($this->pdo->getSetting('nntpretries') != '') ? (int)$this->pdo->getSetting('nntpretries') : 0 + 1;
$this->_nntpRetries = ($this->site->nntpretries != '') ? (int)$this->site->nntpretries : 0 + 1;
$this->_initiateYEncSettings();
}
@@ -278,7 +280,7 @@ class NNTP extends Net_NNTP_Client
// If we are connected and authenticated, try enabling compression if we have it enabled.
if ($connected === true && $authenticated === true) {
// Check if we should use compression on the connection.
if ($compression === false || $this->pdo->getSetting('compressedheaders') == 0) {
if ($compression === false || $this->site->compressedheaders == 0) {
$this->_compressionSupported = false;
}
if ($this->_debugBool) {
@@ -351,7 +353,7 @@ class NNTP extends Net_NNTP_Client
*/
public function enableCompression()
{
if (!$this->pdo->getSetting('compressedheaders') == 1) {
if (!$this->site->compressedheaders == 1) {
return;
}
$this->_enableCompression();
@@ -1157,7 +1159,7 @@ class NNTP extends Net_NNTP_Client
protected function _initiateYEncSettings()
{
// Check if the user wants to use yyDecode or the simple_php_yenc_decode extension.
$this->_yyDecoderPath = ($this->pdo->getSetting('yydecoderpath') != '') ? (string)$this->pdo->getSetting('yydecoderpath') : false;
$this->_yyDecoderPath = ($this->site->yydecoderpath != '') ? (string)$this->site->yydecoderpath : false;
if (strpos((string)$this->_yyDecoderPath, 'simple_php_yenc_decode') !== false) {
if (extension_loaded('simple_php_yenc_decode')) {
$this->_yEncExtension = true;