Browse Source

added ignore torrent label to rTorrent

CauseFX 4 years ago
parent
commit
5ab5e5d892
2 changed files with 5 additions and 3 deletions
  1. 1 0
      api/config/default.php
  2. 4 3
      api/homepage/rtorrent.php

+ 1 - 0
api/config/default.php

@@ -197,6 +197,7 @@ return [
 	'rTorrentSortOrder' => 'datea',
 	'rTorrentReverseSorting' => false,
 	'rTorrentCombine' => false,
+	'rTorrentIgnoreLabel' => '',
 	'rTorrentDisableCertCheck' => false,
 	'rTorrentUseCustomCertificate' => false,
 	'rTorrentLimit' => '200',

+ 4 - 3
api/homepage/rtorrent.php

@@ -66,6 +66,7 @@ trait RTorrentHomepageItem
 					$this->settingsOption('hide-completed', 'rTorrentHideCompleted'),
 					$this->settingsOption('select', 'rTorrentSortOrder', ['label' => 'Order', 'options' => $this->rTorrentSortOptions()]),
 					$this->settingsOption('limit', 'rTorrentLimit'),
+					$this->settingsOption('multiple', 'rTorrentIgnoreLabel', ['label' => 'Ignore Torrent with Label(s)']),
 					$this->settingsOption('refresh', 'rTorrentRefresh'),
 					$this->settingsOption('combine', 'rTorrentCombine'),
 				],
@@ -233,6 +234,8 @@ trait RTorrentHomepageItem
 							//do nothing
 						} elseif ($tempStatus == 'Finished' && $this->config['rTorrentHideCompleted']) {
 							//do nothing
+						} elseif (stripos($this->config['rTorrentIgnoreLabel'], $value[20]) !== false) {
+							//do nothing
 						} else {
 							$torrents[$key] = array(
 								'name' => $value[0],
@@ -266,10 +269,8 @@ trait RTorrentHomepageItem
 						switch ($direction) {
 							case 'a':
 								return $a[$sort] <=> $b[$sort];
-								break;
 							case 'd':
 								return $b[$sort] <=> $a[$sort];
-								break;
 							default:
 								return $b['date'] <=> $a['date'];
 						}
@@ -285,7 +286,7 @@ trait RTorrentHomepageItem
 			$this->setAPIResponse('error', $e->getMessage(), 500);
 			return false;
 		};
-		$api['content'] = isset($api['content']) ? $api['content'] : false;
+		$api['content'] = $api['content'] ?? false;
 		$this->setAPIResponse('success', null, 200, $api);
 		return $api;
 	}