added one more bt site;added the option for choosing a site to search torrents

This commit is contained in:
huangjx
2021-09-17 14:32:22 +08:00
parent 7427f395f5
commit de2afbb0ef
10 changed files with 200 additions and 47 deletions

View File

@@ -5,12 +5,16 @@ namespace OCA\NCDownloader\AppInfo;
use OCA\NCDownloader\Controller\Aria2Controller;
use OCA\NCDownloader\Controller\MainController;
use OCA\NCDownloader\Controller\YoutubeController;
use OCA\NCDownloader\Search\Sites\bitSearch;
use OCA\NCDownloader\Search\Sites\TPB;
use OCA\NCDownloader\Tools\Aria2;
use OCA\NCDownloader\Tools\Helper;
use OCA\NCDownloader\Tools\Settings;
use OCA\NCDownloader\Tools\Youtube;
use OCP\AppFramework\App;
use OCP\IContainer;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\HttpClient\HttpClient;
class Application extends App
{
@@ -71,6 +75,22 @@ class Application extends App
$container->query('Youtube')
);
});
$container->registerService('crawler', function () {
return new Crawler();
});
$container->registerService('httpClient', function () {
return HttpClient::create();
});
$container->registerService(TPB::class, function (IContainer $container) {
$crawler = $container->query('crawler');
$client = $container->query('httpClient');
return new TPB($crawler, $client);
});
$container->registerService(bitSearch::class, function (IContainer $container) {
$crawler = $container->query('crawler');
$client = $container->query('httpClient');
return new bitSearch($crawler, $client);
});
}
private function getRealDownloadDir()