コード例 #1
0
        private static TrackedDownloadState GetStateFromHistory(NzbDrone.Core.History.History history)
        {
            switch (history.EventType)
            {
            case HistoryEventType.AlbumImportIncomplete:
                return(TrackedDownloadState.ImportFailed);

            case HistoryEventType.DownloadImported:
                return(TrackedDownloadState.Imported);

            case HistoryEventType.DownloadFailed:
                return(TrackedDownloadState.DownloadFailed);

            case HistoryEventType.DownloadIgnored:
                return(TrackedDownloadState.Ignored);
            }

            // Since DownloadComplete is a new event type, we can't assume it exists for old downloads
            if (history.EventType == HistoryEventType.TrackFileImported)
            {
                return(DateTime.UtcNow.Subtract(history.Date).TotalSeconds < 60 ? TrackedDownloadState.Importing : TrackedDownloadState.Imported);
            }

            return(TrackedDownloadState.Downloading);
        }
コード例 #2
0
        protected HistoryResource MapToResource(NzbDrone.Core.History.History model, bool includeArtist, bool includeAlbum, bool includeTrack)
        {
            var resource = model.ToResource();

            if (includeArtist)
            {
                resource.Artist = model.Artist.ToResource();
            }
            if (includeAlbum)
            {
                resource.Album = model.Album.ToResource();
            }
            if (includeTrack)
            {
                resource.Track = model.Track.ToResource();
            }


            if (model.Artist != null)
            {
                resource.QualityCutoffNotMet = _upgradableSpecification.QualityCutoffNotMet(model.Artist.QualityProfile.Value, model.Quality);
            }

            return(resource);
        }
コード例 #3
0
ファイル: HistoryResource.cs プロジェクト: tripps82/Readarr
        public static HistoryResource ToResource(this NzbDrone.Core.History.History model)
        {
            if (model == null)
            {
                return(null);
            }

            return(new HistoryResource
            {
                Id = model.Id,

                BookId = model.BookId,
                AuthorId = model.AuthorId,
                SourceTitle = model.SourceTitle,
                Quality = model.Quality,

                //QualityCutoffNotMet
                Date = model.Date,
                DownloadId = model.DownloadId,

                EventType = model.EventType,

                Data = model.Data

                       //Episode
                       //Series
            });
        }
コード例 #4
0
ファイル: RetrySpecification.cs プロジェクト: BO45/NzbDrone
        private bool HasSamePublishedDate(History.History item, DateTime publishedDate)
        {
            DateTime itemsPublishedDate;

            if (!DateTime.TryParse(item.Data.GetValueOrDefault("PublishedDate", null), out itemsPublishedDate)) return true;

            return itemsPublishedDate.AddDays(-2) <= publishedDate && itemsPublishedDate.AddDays(2) >= publishedDate;
        }
コード例 #5
0
ファイル: HistoryModule.cs プロジェクト: russischeap/Readarr
        protected HistoryResource MapToResource(NzbDrone.Core.History.History model, bool includeAuthor, bool includeBook)
        {
            var resource = model.ToResource();

            if (includeAuthor)
            {
                resource.Author = model.Author.ToResource();
            }

            if (includeBook)
            {
                resource.Book = model.Book.ToResource();
            }

            if (model.Author != null)
            {
                resource.QualityCutoffNotMet = _upgradableSpecification.QualityCutoffNotMet(model.Author.QualityProfile.Value, model.Quality);
            }

            return(resource);
        }
コード例 #6
0
        protected HistoryResource MapToResource(NzbDrone.Core.History.History model, bool includeSeries, bool includeEpisode)
        {
            var resource = model.ToResource();

            if (includeSeries)
            {
                resource.Series = model.Series.ToResource();
            }

            if (includeEpisode)
            {
                resource.Episode = model.Episode.ToResource();
            }

            if (model.Series != null)
            {
                resource.QualityCutoffNotMet  = _upgradableSpecification.QualityCutoffNotMet(model.Series.QualityProfile.Value, model.Quality);
                resource.LanguageCutoffNotMet = _upgradableSpecification.LanguageCutoffNotMet(model.Series.LanguageProfile, model.Language);
            }

            return(resource);
        }
コード例 #7
0
        public static HistoryResource ToResource(this NzbDrone.Core.History.History model)
        {
            if (model == null)
            {
                return(null);
            }

            return(new HistoryResource
            {
                Id = model.Id,

                IndexerId = model.IndexerId,

                //QualityCutoffNotMet
                Date = model.Date,
                DownloadId = model.DownloadId,
                Successful = model.Successful,

                EventType = model.EventType,

                Data = model.Data
            });
        }
コード例 #8
0
        protected HistoryResource MapToResource(NzbDrone.Core.History.History model)
        {
            var resource = model.ToResource();

            return(resource);
        }