private TorrentEngine(string host, int port, string username, string password, Backend backend)
        {
            switch (backend)
            {
            case Backend.Azureus:
            {
                _torrentSession = new Sohvaperuna.AzureusEngine.AzureusClient(host, port, username, password);
                break;
            }

            case Backend.uTorrent:
            {
                _torrentSession = new Sohvaperuna.UTorrentEngine.UTorrentClient(host, port, username, password, Configuration.Instance().Settings["Torrent.Timer.Outside"] as string);
                break;
            }

            case Backend.Deluge:
            {
                _torrentSession = new Sohvaperuna.DelugeEngine.DelugeClient(host, port, password, Configuration.Instance().Settings["Torrent.Timer.Outside"] as string);
                break;
            }
            }
            Log.Instance().Print("backend is " + backend.ToString());
            _torrentSession.TorrentAdded     += new TorrentAdded(_torrentSession_TorrentAdded);
            _torrentSession.TorrentRemoved   += new TorrentRemoved(_torrentSession_TorrentRemoved);
            _torrentSession.TorrentCompleted += new TorrentCompleted(_torrentSession_TorrentCompleted);

            _hashQueue    = new List <string>();
            _contentCache = new ContentCache(100, new TimeSpan(0, 30, 0));

            _updateTimer          = new System.Timers.Timer(10 * 1000);
            _updateTimer.Elapsed += new ElapsedEventHandler(_updateTimer_Elapsed);

            _updateTimer.Start();
        }
Beispiel #2
0
 public TorrentStatisticsHarvesterJob(ILogger <TorrentStatisticsHarvesterJob> logger,
                                      IServiceScopeFactory serviceScopeFactory, ITorrentClient torrentClient)
 {
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _serviceScopeFactory = serviceScopeFactory ?? throw new ArgumentNullException(nameof(serviceScopeFactory));
     _torrentClient       = torrentClient ?? throw new ArgumentNullException(nameof(torrentClient));
     _hasher = SHA256.Create();
 }
Beispiel #3
0
        public ServicesAppHost(IEnvironmentDetails environmentDetails, ITorrentClient torrentClient) : base(Assembly.GetExecutingAssembly().FullName, typeof(ServicesAppHost).Assembly)
        {
            // Set the torrent client.
            TorrentClient = torrentClient;

            // Ask OS for port and make the endpoint.
            Endpoint = string.Format("http://*:{0}/", environmentDetails.ServiceDaemonPort);
        }
Beispiel #4
0
 public TorrentService(ILogger <TorrentService> log, ITorrentClient torrentClient, TorrentServiceOptions options, IMessageBroker broker)
 {
     _log                 = log;
     _torrentClient       = torrentClient;
     _downloadTorrentPath = options.DownloadTorrentPath;
     _broker              = broker;
     _broker.DeclareExchange(BrokerExchange);
 }
Beispiel #5
0
        public ServicesAppHost(IEnvironmentDetails environmentDetails, ITorrentClient torrentClient)
            : base(Assembly.GetExecutingAssembly().FullName, typeof (ServicesAppHost).Assembly)
        {
            // Set the torrent client.
            TorrentClient = torrentClient;

            // Ask OS for port and make the endpoint.
            Endpoint = string.Format ("http://*:{0}/", environmentDetails.ServiceDaemonPort);
        }
        private const int UntrackedDelayIntervalMiliseconds   = 126_000;    // 2.1 minutes.

        public DownloaderService(IReadOnlyCollection <IFeed> feeds, ILogger <DownloaderService> log,
                                 TorrentService torrentService, HistoryRepository historyRepo, ITorrentClient torrentClient)
        {
            _feeds          = feeds;
            _log            = log;
            _torrentService = torrentService;
            _historyRepo    = historyRepo;
            _torrentClient  = torrentClient;
        }
        public TorrentProcessor(
            ITorrentClient torrentClient,
            AsyncManualResetEvent torrentClientStatus,
            AsyncCollection <Torrent> input)
        {
            if (torrentClient == null)
            {
                throw new ArgumentNullException(nameof(torrentClient));
            }
            else if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            this.torrentClient       = torrentClient ?? throw new ArgumentNullException(nameof(torrentClient));
            this.torrentClientStatus = torrentClientStatus ?? throw new ArgumentNullException(nameof(torrentClientStatus));
            this.input = input ?? throw new ArgumentNullException(nameof(input));
        }
Beispiel #8
0
        public ITorrentClient Create()
        {
            ITorrentClient torrentClient = (ITorrentClient)null;

            if (this.Type == "uTorrent")
            {
                torrentClient = (ITorrentClient) new uTorrentClient(this.ServerName, this.ServerPort, this.UserName, this.UserPassword);
            }
            else if (this.Type == "Transmission")
            {
                torrentClient = (ITorrentClient) new TransmissionClient(this.ServerName, this.ServerPort, this.UserName, this.UserPassword);
            }
            else if (this.Type == "Vuze (Vuze Web Remote)")
            {
                torrentClient = (ITorrentClient) new TransmissionClient(this.ServerName, this.ServerPort, this.UserName, this.UserPassword);
            }
            return(torrentClient);
        }
Beispiel #9
0
 public TorrentService(ITorrentClient torrentClient, ILogger <TorrentService> logger)
 {
     _logger        = logger;
     _torrentClient = torrentClient ?? throw new ArgumentNullException(nameof(torrentClient));
 }
Beispiel #10
0
 public TixatiClientWithStatus(ITorrentClient client, bool setOnline)
 {
     this.client = client ?? throw new ArgumentNullException(nameof(client));
     this.Status = new AsyncManualResetEvent(setOnline);
 }
Beispiel #11
0
 public TorrentClientService(ITorrentClient torrentClient)
 {
     TorrentClient = torrentClient;
 }
 public TorrentService(ITorrentClient client)
 {
     _client = client;
 }