Skip to content

Commit

Permalink
Merge pull request #1628 from NNTmux/settings_change
Browse files Browse the repository at this point in the history
Settings change
  • Loading branch information
DariusIII authored Oct 31, 2024
2 parents 8f73b53 + 4e00db5 commit a0b9ff4
Show file tree
Hide file tree
Showing 72 changed files with 463 additions and 2,084 deletions.
26 changes: 23 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ ELASTICSEARCH_PASS=
ELASTICSEARCH_LOGGING=false
ELASTICSEARCH_ENABLED=false

NNTP_COMPRESSED_HEADERS=false
USE_ALTERNATE_NNTP_SERVER=false

NNTP_USERNAME=
NNTP_PASSWORD=
NNTP_SERVER=
Expand Down Expand Up @@ -110,7 +113,8 @@ ITEMS_PER_PAGE=50
ITEMS_PER_COVER_PAGE=25
MAX_PAGER_RESULTS=125000
ECHOCLI=true
RENAME_PAR2 = false
RENAME_PAR2=false
ADD_PAR2=false
RENAME_MUSIC_MEDIAINFO=true
CACHE_EXPIRY_SHORT=5
CACHE_EXPIRY_MEDIUM=10
Expand Down Expand Up @@ -149,8 +153,8 @@ FANARTTV_APIKEY=
OMDB_APIKEY=
TRAKTTV_APIKEY=

TEMP_UNRAR_PATH=
TEMP_UNZIP_PATH=
TEMP_UNRAR_PATH='/var/www/nntmux/resources/tmp/unrar/'
TEMP_UNZIP_PATH='/var/www/nntmux/resources/tmp/unzip/'

VIEW_COMPILED_PATH=/var/www/NNTmux/storage/framework/views
ASSET_URL=
Expand Down Expand Up @@ -184,3 +188,19 @@ PURGE_INACTIVE_USERS=false
OTP_ENABLED=false

FLARE_KEY=

UNRAR_PATH=
UNZIP_PATH=
CHECK_PASSWORDED_RARS=false
DELETE_PASSWORDED_RELEASES=false
DELETE_POSSIBLE_PASSWORDED_RELEASES=false
EXTRACT_USING_RARINFO=false
PATH_TO_NZBS=
PRIVATE_PROFILES=true
STORE_USER_IP=false
FFMPEG_PATH=
LAME_PATH=
MEDIAINFO_PATH=
TIIMEOUT_PATH=
MAGIC_FILE_PATH=
COVERS_PATH=
8 changes: 4 additions & 4 deletions Blacklight/Backfill.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ public function __construct()

$this->colorCli = new ColorCLI;

$this->_compressedHeaders = (int) Settings::settingValue('..compressedheaders') === 1;
$this->_safeBackFillDate = Settings::settingValue('..safebackfilldate') !== '' ? (string) Settings::settingValue('safebackfilldate') : '2012-08-14';
$this->_safePartRepair = (int) Settings::settingValue('..safepartrepair') === 1 ? 'update' : 'backfill';
$this->_disableBackfillGroup = (int) Settings::settingValue('..disablebackfillgroup') === 1;
$this->_compressedHeaders = config('nntmux_nntp.compressed_headers');
$this->_safeBackFillDate = Settings::settingValue('safebackfilldate') !== '' ? (string) Settings::settingValue('safebackfilldate') : '2012-08-14';
$this->_safePartRepair = (int) Settings::settingValue('safepartrepair') === 1 ? 'update' : 'backfill';
$this->_disableBackfillGroup = (int) Settings::settingValue('disablebackfillgroup') === 1;
}

/**
Expand Down
18 changes: 9 additions & 9 deletions Blacklight/Binaries.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,15 @@ public function __construct()
$this->_nntp = new NNTP;
$this->_collectionsCleaning = new CollectionsCleaning;

$this->messageBuffer = Settings::settingValue('..maxmssgs') !== '' ?
(int) Settings::settingValue('..maxmssgs') : 20000;
$this->_compressedHeaders = (int) Settings::settingValue('..compressedheaders') === 1;
$this->_partRepair = (int) Settings::settingValue('..partrepair') === 1;
$this->_newGroupScanByDays = (int) Settings::settingValue('..newgroupscanmethod') === 1;
$this->_newGroupMessagesToScan = Settings::settingValue('..newgroupmsgstoscan') !== '' ? (int) Settings::settingValue('..newgroupmsgstoscan') : 50000;
$this->_newGroupDaysToScan = Settings::settingValue('..newgroupdaystoscan') !== '' ? (int) Settings::settingValue('..newgroupdaystoscan') : 3;
$this->_partRepairLimit = Settings::settingValue('..maxpartrepair') !== '' ? (int) Settings::settingValue('..maxpartrepair') : 15000;
$this->_partRepairMaxTries = (Settings::settingValue('..partrepairmaxtries') !== '' ? (int) Settings::settingValue('..partrepairmaxtries') : 3);
$this->messageBuffer = Settings::settingValue('maxmssgs') !== '' ?
(int) Settings::settingValue('maxmssgs') : 20000;
$this->_compressedHeaders = config('nntmux_nntp.compressed_headers');
$this->_partRepair = (int) Settings::settingValue('partrepair') === 1;
$this->_newGroupScanByDays = (int) Settings::settingValue('newgroupscanmethod') === 1;
$this->_newGroupMessagesToScan = Settings::settingValue('newgroupmsgstoscan') !== '' ? (int) Settings::settingValue('newgroupmsgstoscan') : 50000;
$this->_newGroupDaysToScan = Settings::settingValue('newgroupdaystoscan') !== '' ? (int) Settings::settingValue('newgroupdaystoscan') : 3;
$this->_partRepairLimit = Settings::settingValue('maxpartrepair') !== '' ? (int) Settings::settingValue('maxpartrepair') : 15000;
$this->_partRepairMaxTries = (Settings::settingValue('partrepairmaxtries') !== '' ? (int) Settings::settingValue('partrepairmaxtries') : 3);

$this->blackList = $this->whiteList = [];
}
Expand Down
16 changes: 8 additions & 8 deletions Blacklight/Books.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ public function __construct()

$this->colorCli = new ColorCLI;

$this->pubkey = Settings::settingValue('APIs..amazonpubkey');
$this->privkey = Settings::settingValue('APIs..amazonprivkey');
$this->asstag = Settings::settingValue('APIs..amazonassociatetag');
$this->bookqty = Settings::settingValue('..maxbooksprocessed') !== '' ? (int) Settings::settingValue('..maxbooksprocessed') : 300;
$this->sleeptime = Settings::settingValue('..amazonsleep') !== '' ? (int) Settings::settingValue('..amazonsleep') : 1000;
$this->pubkey = Settings::settingValue('amazonpubkey');
$this->privkey = Settings::settingValue('amazonprivkey');
$this->asstag = Settings::settingValue('amazonassociatetag');
$this->bookqty = Settings::settingValue('maxbooksprocessed') !== '' ? (int) Settings::settingValue('maxbooksprocessed') : 300;
$this->sleeptime = Settings::settingValue('amazonsleep') !== '' ? (int) Settings::settingValue('amazonsleep') : 1000;
$this->imgSavePath = storage_path('covers/book/');
$result = Settings::settingValue('..book_reqids');
$this->bookreqids = $result ?? Category::BOOKS_EBOOK;
$this->renamed = (int) Settings::settingValue('..lookupbooks') === 2 ? 'AND isrenamed = 1' : '';

$this->bookreqids = Category::BOOKS_EBOOK;
$this->renamed = (int) Settings::settingValue('lookupbooks') === 2 ? 'AND isrenamed = 1' : '';

$this->failCache = [];
}
Expand Down
4 changes: 2 additions & 2 deletions Blacklight/Categorize.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class Categorize
*/
public function __construct()
{
$this->categorizeForeign = (bool) Settings::settingValue('indexer.categorise.categorizeforeign');
$this->catWebDL = (bool) Settings::settingValue('indexer.categorise.catwebdl');
$this->categorizeForeign = (bool) Settings::settingValue('categorizeforeign');
$this->catWebDL = (bool) Settings::settingValue('catwebdl');
}

/**
Expand Down
14 changes: 7 additions & 7 deletions Blacklight/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ public function __construct()

$this->colorCli = new ColorCLI;

$this->pubkey = Settings::settingValue('APIs..amazonpubkey');
$this->privkey = Settings::settingValue('APIs..amazonprivkey');
$this->asstag = Settings::settingValue('APIs..amazonassociatetag');
$this->gameqty = (Settings::settingValue('..maxgamesprocessed') !== '') ? (int) Settings::settingValue('..maxgamesprocessed') : 150;
$this->sleeptime = (Settings::settingValue('..amazonsleep') !== '') ? (int) Settings::settingValue('..amazonsleep') : 1000;
$this->imgSavePath = storage_path('covers/console/');
$this->renamed = (int) Settings::settingValue('..lookupgames') === 2;
$this->pubkey = Settings::settingValue('amazonpubkey');
$this->privkey = Settings::settingValue('amazonprivkey');
$this->asstag = Settings::settingValue('amazonassociatetag');
$this->gameqty = (Settings::settingValue('maxgamesprocessed') !== '') ? (int) Settings::settingValue('maxgamesprocessed') : 150;
$this->sleeptime = (Settings::settingValue('amazonsleep') !== '') ? (int) Settings::settingValue('amazonsleep') : 1000;
$this->imgSavePath = config('nntmux_settings.covers_path').'/console/';
$this->renamed = (int) Settings::settingValue('lookupgames') === 2;

$this->failCache = [];
}
Expand Down
8 changes: 4 additions & 4 deletions Blacklight/Games.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ public function __construct()
$this->colorCli = new ColorCLI;

$this->publicKey = config('nntmux_api.giantbomb_api_key');
$this->gameQty = Settings::settingValue('..maxgamesprocessed') !== '' ? (int) Settings::settingValue('..maxgamesprocessed') : 150;
$this->imgSavePath = storage_path('covers/games/');
$this->renamed = (int) Settings::settingValue('..lookupgames') === 2 ? 'AND isrenamed = 1' : '';
$this->gameQty = Settings::settingValue('maxgamesprocessed') !== '' ? (int) Settings::settingValue('maxgamesprocessed') : 150;
$this->imgSavePath = config('nntmux_settings.covers_path').'/games/';
$this->renamed = (int) Settings::settingValue('lookupgames') === 2 ? 'AND isrenamed = 1' : '';
$this->matchPercentage = 60;
$this->maxHitRequest = false;
$this->catWhere = 'AND categories_id = '.Category::PC_GAMES.' ';
Expand Down Expand Up @@ -678,7 +678,7 @@ public function processGamesReleases(): void
->where('nzbstatus', '=', 1)
->where('gamesinfo_id', '=', 0)
->where('categories_id', '=', Category::PC_GAMES);
if ((int) Settings::settingValue('..lookupgames') === 2) {
if ((int) Settings::settingValue('lookupgames') === 2) {
$query->where('isrenamed', '=', 1);
}
$query->select(['searchname', 'id'])
Expand Down
6 changes: 3 additions & 3 deletions Blacklight/Movie.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function __construct()
$this->omdbApi = new OMDbAPI($this->omdbapikey);
}

$this->lookuplanguage = Settings::settingValue('indexer.categorise.imdblanguage') !== '' ? (string) Settings::settingValue('indexer.categorise.imdblanguage') : 'en';
$this->lookuplanguage = Settings::settingValue('imdblanguage') !== '' ? (string) Settings::settingValue('imdblanguage') : 'en';
$this->config = new Config;
$this->config->language = $this->lookuplanguage;
$this->config->throwHttpExceptions = false;
Expand All @@ -142,8 +142,8 @@ public function __construct()
}
$this->config->cachedir = $cacheDir;

$this->imdburl = (int) Settings::settingValue('indexer.categorise.imdburl') !== 0;
$this->movieqty = Settings::settingValue('..maximdbprocessed') !== '' ? (int) Settings::settingValue('..maximdbprocessed') : 100;
$this->imdburl = (int) Settings::settingValue('imdburl') !== 0;
$this->movieqty = Settings::settingValue('maximdbprocessed') !== '' ? (int) Settings::settingValue('maximdbprocessed') : 100;
$this->showPasswords = (new Releases)->showPasswords();

$this->echooutput = config('nntmux.echocli');
Expand Down
14 changes: 7 additions & 7 deletions Blacklight/Music.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ public function __construct()

$this->colorCli = new ColorCLI;

$this->pubkey = Settings::settingValue('APIs..amazonpubkey');
$this->privkey = Settings::settingValue('APIs..amazonprivkey');
$this->asstag = Settings::settingValue('APIs..amazonassociatetag');
$this->musicqty = Settings::settingValue('..maxmusicprocessed') !== '' ? (int) Settings::settingValue('..maxmusicprocessed') : 150;
$this->sleeptime = Settings::settingValue('..amazonsleep') !== '' ? (int) Settings::settingValue('..amazonsleep') : 1000;
$this->imgSavePath = storage_path('covers/music/');
$this->renamed = (int) Settings::settingValue('..lookupmusic') === 2 ? 'AND isrenamed = 1' : '';
$this->pubkey = Settings::settingValue('amazonpubkey');
$this->privkey = Settings::settingValue('amazonprivkey');
$this->asstag = Settings::settingValue('amazonassociatetag');
$this->musicqty = Settings::settingValue('maxmusicprocessed') !== '' ? (int) Settings::settingValue('maxmusicprocessed') : 150;
$this->sleeptime = Settings::settingValue('amazonsleep') !== '' ? (int) Settings::settingValue('amazonsleep') : 1000;
$this->imgSavePath = config('nntmux_settings.covers_path').'/music/';
$this->renamed = (int) Settings::settingValue('lookupmusic') === 2 ? 'AND isrenamed = 1' : '';

$this->failCache = [];
}
Expand Down
18 changes: 10 additions & 8 deletions Blacklight/NNTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function __construct()

$this->_echo = config('nntmux.echocli');
$this->_tmux = new Tmux;
$this->_nntpRetries = Settings::settingValue('..nntpretries') !== '' ? (int) Settings::settingValue('..nntpretries') : 0 + 1;
$this->_nntpRetries = Settings::settingValue('nntpretries') !== '' ? (int) Settings::settingValue('nntpretries') : 0 + 1;
$this->colorCli = new ColorCLI;
$this->_currentPort = config('nntmux_nntp.port');
$this->_currentServer = config('nntmux_nntp.server');
Expand Down Expand Up @@ -261,7 +261,7 @@ public function doConnect(bool $compression = true, bool $alternate = false): mi
// If we are connected and authenticated, try enabling compression if we have it enabled.
if ($connected && $authenticated) {
// Check if we should use compression on the connection.
if (! $compression || (int) Settings::settingValue('..compressedheaders') === 0) {
if (! $compression || config('nntmux_nntp.compressed_headers') === false) {
$this->_compressionSupported = false;
}

Expand Down Expand Up @@ -325,7 +325,7 @@ protected function _resetProperties(): void
*/
public function enableCompression(): void
{
if ((int) Settings::settingValue('..compressedheaders') !== 1) {
if (config('nntmux_nntp.compressed_headers') === false) {
return;
}
$this->_enableCompression();
Expand All @@ -340,7 +340,7 @@ public function enableCompression(): void
* @throws \Exception
* On failure : (object) PEAR_Error.
*/
public function selectGroup($group, $articles = false, $force = false)
public function selectGroup(string $group, bool $articles = false, bool $force = false)
{
$connected = $this->_checkConnection(false);
if ($connected !== true) {
Expand Down Expand Up @@ -489,7 +489,7 @@ public function getXOVER(string $range)
*
* @throws \Exception
*/
public function getGroups($wildMat = null)
public function getGroups(?string $wildMat = null)
{
// Enabled header compression if not enabled.
$this->_enableCompression();
Expand Down Expand Up @@ -554,8 +554,9 @@ public function getMessages(string $groupName, mixed $identifiers, bool $alterna
// If there is an error try the alternate provider or return the PEAR error.
} elseif ($alternate) {
if (! $aConnected) {
$compressedHeaders = config('nntmux_nntp.compressed_headers');
// Check if the current connected server is the alternate or not.
$aConnected = $this->_currentServer === config('nntmux_nntp.server') ? $nntp->doConnect(true, true) : $nntp->doConnect();
$aConnected = $this->_currentServer === config('nntmux_nntp.server') ? $nntp->doConnect($compressedHeaders, true) : $nntp->doConnect();
}
// If we connected successfully to usenet try to download the article body.
if ($aConnected === true) {
Expand Down Expand Up @@ -590,7 +591,8 @@ public function getMessages(string $groupName, mixed $identifiers, bool $alterna
} elseif (\is_string($identifiers) || is_numeric($identifiers)) {
$body = $this->_getMessage($groupName, $identifiers);
if ($alternate && self::isError($body)) {
$nntp->doConnect(true, true);
$compressedHeaders = config('nntmux_nntp.compressed_headers');
$nntp->doConnect($compressedHeaders, true);
$body = $nntp->_getMessage($groupName, $identifiers);
$aConnected = true;
}
Expand Down Expand Up @@ -1283,7 +1285,7 @@ protected function _handleErrorResponse(int $response): object
* @return mixed (bool) On success: True when posting allowed, otherwise false.
* (object) On failure: pear_error
*/
public function connect($host = null, $encryption = null, $port = null, $timeout = 15, $socketTimeout = 120)
public function connect(?string $host = null, $encryption = null, ?int $port = null, int $timeout = 15, int $socketTimeout = 120)
{
if ($this->_isConnected()) {
return $this->throwError('Already connected, disconnect first!', null);
Expand Down
4 changes: 2 additions & 2 deletions Blacklight/NZB.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ class NZB
*/
public function __construct()
{
$nzbSplitLevel = (int) Settings::settingValue('..nzbsplitlevel');
$nzbSplitLevel = (int) Settings::settingValue('nzbsplitlevel');
$this->nzbSplitLevel = $nzbSplitLevel ?? 1;
$this->siteNzbPath = (string) Settings::settingValue('..nzbpath');
$this->siteNzbPath = config('nntmux_settings.path_to_nzbs');
if (! Str::endsWith($this->siteNzbPath, '/')) {
$this->siteNzbPath .= '/';
}
Expand Down
4 changes: 2 additions & 2 deletions Blacklight/NZBContents.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public function __construct()
$this->nfo = new Nfo;
$this->pp = new PostProcess;
$this->nzb = new NZB;
$this->lookuppar2 = (int) Settings::settingValue('..lookuppar2') === 1;
$this->alternateNNTP = (int) Settings::settingValue('..alternate_nntp') === 1;
$this->lookuppar2 = (int) Settings::settingValue('lookuppar2') === 1;
$this->alternateNNTP = config('nntmux_nntp.use_alternate_nntp_server');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Blacklight/NZBImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function __construct(array $options = [])
$this->nzb = new NZB;
$this->releaseCleaner = new ReleaseCleaning;
$this->colorCli = new ColorCLI;
$this->crossPostt = Settings::settingValue('..crossposttime') !== '' ? Settings::settingValue('..crossposttime') : 2;
$this->crossPostt = Settings::settingValue('crossposttime') !== '' ? Settings::settingValue('crossposttime') : 2;

// Set properties from options
$this->browser = isset($options['Browser']) ? $options['Browser'] : '';
Expand Down
14 changes: 7 additions & 7 deletions Blacklight/Nfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ class Nfo
public function __construct()
{
$this->echo = config('nntmux.echocli');
$this->nzbs = Settings::settingValue('..maxnfoprocessed') !== '' ? (int) Settings::settingValue('..maxnfoprocessed') : 100;
$this->maxRetries = (int) Settings::settingValue('..maxnforetries') >= 0 ? -((int) Settings::settingValue('..maxnforetries') + 1) : self::NFO_UNPROC;
$this->nzbs = Settings::settingValue('maxnfoprocessed') !== '' ? (int) Settings::settingValue('maxnfoprocessed') : 100;
$this->maxRetries = (int) Settings::settingValue('maxnforetries') >= 0 ? -((int) Settings::settingValue('maxnforetries') + 1) : self::NFO_UNPROC;
$this->maxRetries = $this->maxRetries < -8 ? -8 : $this->maxRetries;
$this->maxSize = (int) Settings::settingValue('..maxsizetoprocessnfo');
$this->minSize = (int) Settings::settingValue('..minsizetoprocessnfo');
$this->maxSize = (int) Settings::settingValue('maxsizetoprocessnfo');
$this->minSize = (int) Settings::settingValue('minsizetoprocessnfo');
$this->colorCli = new ColorCLI;

$this->tmpPath = config('nntmux.tmp_unrar_path');
Expand Down Expand Up @@ -388,9 +388,9 @@ public function processNfoFiles($nntp, string $groupID = '', string $guidChar =
*/
public static function NfoQueryString(): string
{
$maxSize = (int) Settings::settingValue('..maxsizetoprocessnfo');
$minSize = (int) Settings::settingValue('..minsizetoprocessnfo');
$dummy = (int) Settings::settingValue('..maxnforetries');
$maxSize = (int) Settings::settingValue('maxsizetoprocessnfo');
$minSize = (int) Settings::settingValue('minsizetoprocessnfo');
$dummy = (int) Settings::settingValue('maxnforetries');
$maxRetries = ($dummy >= 0 ? -($dummy + 1) : self::NFO_UNPROC);

return sprintf(
Expand Down
Loading

0 comments on commit a0b9ff4

Please sign in to comment.