コード例 #1
0
ファイル: TorznabRssParser.cs プロジェクト: Djohnnie/Sonarr
        protected override ReleaseInfo ProcessItem(XElement item, ReleaseInfo releaseInfo)
        {
            var torrentInfo = base.ProcessItem(item, releaseInfo) as TorrentInfo;

            torrentInfo.TvdbId = GetTvdbId(item);
            torrentInfo.TvRageId = GetTvRageId(item);

            return torrentInfo;
        }
コード例 #2
0
ファイル: NewznabRssParser.cs プロジェクト: Djohnnie/Sonarr
        protected override ReleaseInfo ProcessItem(XElement item, ReleaseInfo releaseInfo)
        {
            releaseInfo = base.ProcessItem(item, releaseInfo);

            releaseInfo.TvdbId = GetTvdbId(item);
            releaseInfo.TvRageId = GetTvRageId(item);

            return releaseInfo;
        }
コード例 #3
0
        protected override ReleaseInfo PostProcessor(XElement item, ReleaseInfo currentResult)
        {
            var torrentInfo = (TorrentInfo)currentResult;

            torrentInfo.MagnetUrl = MagnetUrl(item);
            torrentInfo.InfoHash = InfoHash(item);

            return torrentInfo;
        }
コード例 #4
0
ファイル: TorrentInfo.cs プロジェクト: Djohnnie/Sonarr
        public static int? GetSeeders(ReleaseInfo release)
        {
            var torrentInfo = release as TorrentInfo;

            if (torrentInfo == null)
            {
                return null;
            }
            return torrentInfo.Seeders;
        }
コード例 #5
0
ファイル: TorznabRssParser.cs プロジェクト: Djohnnie/Sonarr
        protected override ReleaseInfo PostProcess(XElement item, ReleaseInfo releaseInfo)
        {
            var enclosureType = item.Element("enclosure").Attribute("type").Value;
            if (!enclosureType.Contains("application/x-bittorrent"))
            {
                throw new UnsupportedFeedException("Feed contains {0} instead of application/x-bittorrent", enclosureType);
            }

            return base.PostProcess(item, releaseInfo);
        }
コード例 #6
0
        protected override ReleaseInfo PostProcess(XElement item, ReleaseInfo releaseInfo)
        {
            var verified = item.FindDecendants("verified").SingleOrDefault();

            if (Settings != null && Settings.VerifiedOnly && (string)verified == "0")
            {
                return null;
            }

            return base.PostProcess(item, releaseInfo);
        }
コード例 #7
0
ファイル: TorrentRssParser.cs プロジェクト: Djohnnie/Sonarr
        protected override ReleaseInfo ProcessItem(XElement item, ReleaseInfo releaseInfo)
        {
            var result = base.ProcessItem(item, releaseInfo) as TorrentInfo;

            result.InfoHash = GetInfoHash(item);
            result.MagnetUrl = GetMagnetUrl(item);
            result.Seeders = GetSeeders(item);
            result.Peers = GetPeers(item);

            return result;
        }
コード例 #8
0
        protected override ReleaseInfo PostProcess(XElement item, ReleaseInfo releaseInfo)
        {
            var verified = item.FindDecendants("verified").SingleOrDefault();

            if (Settings != null && Settings.VerifiedOnly && (string)verified == "0")
            {
                return null;
            }

            // Atm, Kickass supplies 0 as seeders and leechers on the rss feed for recent releases, so set it to null if there aren't any peers.
            // But only for releases younger than 12h (the real number seems to be close to 14h, but it depends on a number of factors).
            var torrentInfo = releaseInfo as TorrentInfo;
            if (torrentInfo.Peers.HasValue && torrentInfo.Peers.Value == 0 && torrentInfo.PublishDate > DateTime.UtcNow.AddHours(-12))
            {
                torrentInfo.Seeders = null;
                torrentInfo.Peers = null;
            }

            return base.PostProcess(item, releaseInfo);
        }
コード例 #9
0
ファイル: NewznabParser.cs プロジェクト: peterlandry/NzbDrone
        protected override ReleaseInfo PostProcessor(XElement item, ReleaseInfo currentResult)
        {
            if (currentResult != null)
            {
                var attributes = item.Elements("attr").ToList();

                var rageIdElement = attributes.SingleOrDefault(e => e.Attribute("name").Value.Equals("rageid", StringComparison.CurrentCultureIgnoreCase));

                if (rageIdElement != null)
                {
                    int tvRageId;

                    if (Int32.TryParse(rageIdElement.Attribute("value").Value, out tvRageId))
                    {
                        currentResult.TvRageId = tvRageId;
                    }
                }
            }

            return currentResult;
        }
コード例 #10
0
        public static ReleaseInfo ToModel(this ReleaseResource resource)
        {
            ReleaseInfo model;

            if (resource.Protocol == DownloadProtocol.Torrent)
            {
                model = new TorrentInfo
                {
                    MagnetUrl = resource.MagnetUrl,
                    InfoHash = resource.InfoHash,
                    Seeders = resource.Seeders,
                    Peers = (resource.Seeders.HasValue && resource.Leechers.HasValue) ? (resource.Seeders + resource.Leechers) : null
                };
            }
            else
            {
                model = new ReleaseInfo();
            }

            model.Guid = resource.Guid;
            model.Title = resource.Title;
            model.Size = resource.Size;
            model.DownloadUrl = resource.DownloadUrl;
            model.InfoUrl = resource.InfoUrl;
            model.CommentUrl = resource.CommentUrl;
            model.IndexerId = resource.IndexerId;
            model.Indexer = resource.Indexer;
            model.DownloadProtocol = resource.DownloadProtocol;
            model.TvdbId = resource.TvdbId;
            model.TvRageId = resource.TvRageId;
            model.PublishDate = resource.PublishDate;

            return model;
        }
コード例 #11
0
ファイル: RssParserBase.cs プロジェクト: peterlandry/NzbDrone
 protected virtual ReleaseInfo PostProcessor(XElement item, ReleaseInfo currentResult)
 {
     return currentResult;
 }
コード例 #12
0
        protected override ReleaseInfo PostProcess(XElement item, ReleaseInfo releaseInfo)
        {
            var enclosureType = GetEnclosure(item).Attribute("type").Value;
            if (enclosureType.Contains("application/x-bittorrent"))
            {
                throw new UnsupportedFeedException("Feed contains {0}, did you intend to add a Torznab indexer?", enclosureType);
            }

            return base.PostProcess(item, releaseInfo);
        }
コード例 #13
0
ファイル: RssParser.cs プロジェクト: nnic/Sonarr
        protected virtual ReleaseInfo ProcessItem(XElement item, ReleaseInfo releaseInfo)
        {
            releaseInfo.Guid = GetGuid(item);
            releaseInfo.Title = GetTitle(item);
            releaseInfo.PublishDate = GetPublishDate(item);
            releaseInfo.DownloadUrl = GetDownloadUrl(item);
            releaseInfo.InfoUrl = GetInfoUrl(item);
            releaseInfo.CommentUrl = GetCommentUrl(item);

            try
            {
                releaseInfo.Size = GetSize(item);
            }
            catch (Exception)
            {
                throw new SizeParsingException("Unable to parse size from: {0}", releaseInfo.Title);
            }

            return releaseInfo;
        }
コード例 #14
0
ファイル: RssParser.cs プロジェクト: nnic/Sonarr
 protected virtual ReleaseInfo PostProcess(XElement item, ReleaseInfo releaseInfo)
 {
     return releaseInfo;
 }
コード例 #15
0
 public ReleaseDownloadException(ReleaseInfo release, String message, params Object[] args)
     : base(message, args)
 {
     Release = release;
 }
コード例 #16
0
 public ReleaseDownloadException(ReleaseInfo release, string message, Exception innerException)
     : base(message, innerException)
 {
     Release = release;
 }
コード例 #17
0
 public ReleaseDownloadException(ReleaseInfo release, string message, Exception innerException, params object[] args)
     : base(message, innerException, args)
 {
     Release = release;
 }
コード例 #18
0
 public ReleaseDownloadException(ReleaseInfo release, string message)
     : base(message)
 {
     Release = release;
 }