示例#1
0
        protected override OsPath GetOutputPath(OsPath outputPath, TransmissionTorrent torrent)
        {
            // Vuze has similar behavior as uTorrent:
            // - A multi-file torrent is downloaded in a job folder and 'outputPath' points to that directory directly.
            // - A single-file torrent is downloaded in the root folder and 'outputPath' poinst to that root folder.
            // We have to make sure the return value points to the job folder OR file.
            if (outputPath == default || outputPath.FileName == torrent.Name || torrent.FileCount > 1)
            {
                _logger.Trace("Vuze output directory: {0}", outputPath);
            }
            else
            {
                outputPath = outputPath + torrent.Name;
                _logger.Trace("Vuze output file: {0}", outputPath);
            }

            return(outputPath);
        }
示例#2
0
        public void Setup()
        {
            _settings = new TransmissionSettings
            {
                Host     = "127.0.0.1",
                Port     = 2222,
                Username = "******",
                Password = "******"
            };

            Subject.Definition          = new DownloadClientDefinition();
            Subject.Definition.Settings = _settings;

            _queued = new TransmissionTorrent
            {
                HashString    = "HASH",
                IsFinished    = false,
                Status        = TransmissionTorrentStatus.Queued,
                Name          = _title,
                TotalSize     = 1000,
                LeftUntilDone = 1000,
                DownloadDir   = "somepath"
            };

            _downloading = new TransmissionTorrent
            {
                HashString    = "HASH",
                IsFinished    = false,
                Status        = TransmissionTorrentStatus.Downloading,
                Name          = _title,
                TotalSize     = 1000,
                LeftUntilDone = 100,
                DownloadDir   = "somepath"
            };

            _failed = new TransmissionTorrent
            {
                HashString    = "HASH",
                IsFinished    = false,
                Status        = TransmissionTorrentStatus.Stopped,
                Name          = _title,
                TotalSize     = 1000,
                LeftUntilDone = 100,
                ErrorString   = "Error",
                DownloadDir   = "somepath"
            };

            _completed = new TransmissionTorrent
            {
                HashString    = "HASH",
                IsFinished    = true,
                Status        = TransmissionTorrentStatus.Stopped,
                Name          = _title,
                TotalSize     = 1000,
                LeftUntilDone = 0,
                DownloadDir   = "somepath"
            };

            Mocker.GetMock <ITorrentFileInfoReader>()
            .Setup(s => s.GetHashFromTorrentFile(It.IsAny <Byte[]>()))
            .Returns("CBC2F069FE8BB2F544EAE707D75BCD3DE9DCF951");

            Mocker.GetMock <IHttpClient>()
            .Setup(s => s.Get(It.IsAny <HttpRequest>()))
            .Returns <HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new Byte[0]));

            _transmissionConfigItems = new Dictionary <String, Object>();

            _transmissionConfigItems.Add("download-dir", @"C:/Downloads/Finished/transmission");
            _transmissionConfigItems.Add("incomplete-dir", null);
            _transmissionConfigItems.Add("incomplete-dir-enabled", false);

            Mocker.GetMock <ITransmissionProxy>()
            .Setup(v => v.GetConfig(It.IsAny <TransmissionSettings>()))
            .Returns(_transmissionConfigItems);
        }
示例#3
0
        protected override OsPath GetOutputPath(OsPath outputPath, TransmissionTorrent torrent)
        {
            _logger.Debug("Vuze output directory: {0}", outputPath);

            return(outputPath);
        }