private Queue MapMovie(TrackedDownload trackedDownload, Movie movie) { var queue = new Queue { Languages = trackedDownload.RemoteMovie?.ParsedMovieInfo.Languages ?? new List <Language> { Language.Unknown }, Quality = trackedDownload.RemoteMovie?.ParsedMovieInfo.Quality ?? new QualityModel(Quality.Unknown), Title = trackedDownload.DownloadItem.Title, Size = trackedDownload.DownloadItem.TotalSize, Sizeleft = trackedDownload.DownloadItem.RemainingSize, Timeleft = trackedDownload.DownloadItem.RemainingTime, Status = trackedDownload.DownloadItem.Status.ToString(), TrackedDownloadStatus = trackedDownload.Status, TrackedDownloadState = trackedDownload.State, StatusMessages = trackedDownload.StatusMessages.ToList(), ErrorMessage = trackedDownload.DownloadItem.Message, RemoteMovie = trackedDownload.RemoteMovie, DownloadId = trackedDownload.DownloadItem.DownloadId, Protocol = trackedDownload.Protocol, Movie = movie, DownloadClient = trackedDownload.DownloadItem.DownloadClientInfo.Name, Indexer = trackedDownload.Indexer, OutputPath = trackedDownload.DownloadItem.OutputPath.ToString() }; queue.Id = HashConverter.GetHashInt31($"trackedDownload-{trackedDownload.DownloadClient}-{trackedDownload.DownloadItem.DownloadId}"); if (queue.Timeleft.HasValue) { queue.EstimatedCompletionTime = DateTime.UtcNow.Add(queue.Timeleft.Value); } return(queue); }
public List <Queue.Queue> GetPendingQueue() { var queued = new List <Queue.Queue>(); foreach (var pendingRelease in GetPendingReleases()) { foreach (var episode in pendingRelease.RemoteEpisode.Episodes) { var ect = pendingRelease.Release.PublishDate.AddMinutes(GetDelay(pendingRelease.RemoteEpisode)); var queue = new Queue.Queue { Id = HashConverter.GetHashInt31(string.Format("pending-{0}-ep{1}", pendingRelease.Id, episode.Id)), Series = pendingRelease.RemoteEpisode.Series, Episode = episode, Quality = pendingRelease.RemoteEpisode.ParsedEpisodeInfo.Quality, Title = pendingRelease.Title, Size = pendingRelease.RemoteEpisode.Release.Size, Sizeleft = pendingRelease.RemoteEpisode.Release.Size, RemoteEpisode = pendingRelease.RemoteEpisode, Timeleft = ect.Subtract(DateTime.UtcNow), EstimatedCompletionTime = ect, Status = "Pending" }; queued.Add(queue); } } return(queued); }
private ManualImportItem MapItem(ImportDecision <LocalTrack> decision, string downloadId, bool replaceExistingFiles, bool disableReleaseSwitching) { var item = new ManualImportItem(); item.Id = HashConverter.GetHashInt31(decision.Item.Path); item.Path = decision.Item.Path; item.Name = Path.GetFileNameWithoutExtension(decision.Item.Path); item.DownloadId = downloadId; if (decision.Item.Artist != null) { item.Artist = decision.Item.Artist; } if (decision.Item.Album != null) { item.Album = decision.Item.Album; item.Release = decision.Item.Release; } if (decision.Item.Tracks.Any()) { item.Tracks = decision.Item.Tracks; } item.Quality = decision.Item.Quality; item.Size = _diskProvider.GetFileSize(decision.Item.Path); item.Rejections = decision.Rejections; item.Tags = decision.Item.FileTrackInfo; item.AdditionalFile = decision.Item.AdditionalFile; item.ReplaceExistingFiles = replaceExistingFiles; item.DisableReleaseSwitching = disableReleaseSwitching; return(item); }
public static ManualImportResource ToResource(this ManualImportItem model) { if (model == null) { return(null); } return(new ManualImportResource { Id = HashConverter.GetHashInt31(model.Path), Path = model.Path, RelativePath = model.RelativePath, FolderName = model.FolderName, Name = model.Name, Size = model.Size, Movie = model.Movie.ToResource(0), Quality = model.Quality, Languages = model.Languages, ReleaseGroup = model.ReleaseGroup, //QualityWeight DownloadId = model.DownloadId, Rejections = model.Rejections }); }
private Queue MapEpisode(TrackedDownload trackedDownload, Episode episode) { var queue = new Queue { Id = HashConverter.GetHashInt31(string.Format("trackedDownload-{0}-ep{1}", trackedDownload.DownloadItem.DownloadId, episode.Id)), Series = trackedDownload.RemoteEpisode.Series, Episode = episode, Quality = trackedDownload.RemoteEpisode.ParsedEpisodeInfo.Quality, Title = trackedDownload.DownloadItem.Title, Size = trackedDownload.DownloadItem.TotalSize, Sizeleft = trackedDownload.DownloadItem.RemainingSize, Timeleft = trackedDownload.DownloadItem.RemainingTime, Status = trackedDownload.DownloadItem.Status.ToString(), TrackedDownloadStatus = trackedDownload.Status.ToString(), StatusMessages = trackedDownload.StatusMessages.ToList(), RemoteEpisode = trackedDownload.RemoteEpisode, DownloadId = trackedDownload.DownloadItem.DownloadId, Protocol = trackedDownload.Protocol }; if (queue.Timeleft.HasValue) { queue.EstimatedCompletionTime = DateTime.UtcNow.Add(queue.Timeleft.Value); } return(queue); }
private Queue MapQueueItem(TrackedDownload trackedDownload, Episode episode) { var queue = new Queue { Series = trackedDownload.RemoteEpisode?.Series, Episode = episode, Language = trackedDownload.RemoteEpisode?.ParsedEpisodeInfo.Language ?? Language.Unknown, Quality = trackedDownload.RemoteEpisode?.ParsedEpisodeInfo.Quality ?? new QualityModel(Quality.Unknown), Title = Parser.Parser.RemoveFileExtension(trackedDownload.DownloadItem.Title), Size = trackedDownload.DownloadItem.TotalSize, Sizeleft = trackedDownload.DownloadItem.RemainingSize, Timeleft = trackedDownload.DownloadItem.RemainingTime, Status = trackedDownload.DownloadItem.Status.ToString(), TrackedDownloadStatus = trackedDownload.Status, TrackedDownloadState = trackedDownload.State, StatusMessages = trackedDownload.StatusMessages.ToList(), ErrorMessage = trackedDownload.DownloadItem.Message, RemoteEpisode = trackedDownload.RemoteEpisode, DownloadId = trackedDownload.DownloadItem.DownloadId, Protocol = trackedDownload.Protocol, DownloadClient = trackedDownload.DownloadItem.DownloadClientInfo.Name, Indexer = trackedDownload.Indexer, OutputPath = trackedDownload.DownloadItem.OutputPath.ToString() }; queue.Id = HashConverter.GetHashInt31($"trackedDownload-{trackedDownload.DownloadClient}-{trackedDownload.DownloadItem.DownloadId}-ep{episode?.Id ?? 0}"); if (queue.Timeleft.HasValue) { queue.EstimatedCompletionTime = DateTime.UtcNow.Add(queue.Timeleft.Value); } return(queue); }
public static ManualImportResource ToResource(this Core.MediaFiles.EpisodeImport.Manual.ManualImportItem model) { if (model == null) { return(null); } return(new ManualImportResource { Id = HashConverter.GetHashInt31(model.Path), Path = model.Path, RelativePath = model.RelativePath, FolderName = model.FolderName, Name = model.Name, Size = model.Size, Series = model.Series.ToResource(), SeasonNumber = model.SeasonNumber, Episodes = model.Episodes.ToResource(), Quality = model.Quality, //QualityWeight DownloadId = model.DownloadId, Rejections = model.Rejections }); }
public void should_remove_same_release() { AddPending(id: 1, title: "Movie", year: 2001); var queueId = HashConverter.GetHashInt31(string.Format("pending-{0}-movie{1}", 1, _movie.Id)); Subject.RemovePendingQueueItems(queueId); AssertRemoved(1); }
public void should_remove_same_release() { AddPending(id: 1, seasonNumber: 2, episodes: new[] { 3 }); var queueId = HashConverter.GetHashInt31(string.Format("pending-{0}-ep{1}", 1, _episode.Id)); Subject.RemovePendingQueueItems(queueId); AssertRemoved(1); }
public void should_remove_same_release() { AddPending(id: 1, album: "Album"); var queueId = HashConverter.GetHashInt31(string.Format("pending-{0}-book{1}", 1, _album.Id)); Subject.RemovePendingQueueItems(queueId); AssertRemoved(1); }
public void should_not_remove_singleepisodes() { AddPending(id: 1, seasonNumber: 2, episodes: new[] { 1 }); AddPending(id: 2, seasonNumber: 2, episodes: new[] { 1, 2 }); var queueId = HashConverter.GetHashInt31(string.Format("pending-{0}-ep{1}", 2, _episode.Id)); Subject.RemovePendingQueueItems(queueId); AssertRemoved(2); }
public void should_not_remove_diffrent_albums() { AddPending(id: 1, album: "Album 1"); AddPending(id: 2, album: "Album 1"); AddPending(id: 3, album: "Album 2"); AddPending(id: 4, album: "Album 3"); var queueId = HashConverter.GetHashInt31(string.Format("pending-{0}-book{1}", 1, _album.Id)); Subject.RemovePendingQueueItems(queueId); AssertRemoved(1, 2); }
public void should_remove_multiple_releases_release() { AddPending(id: 1, album: "Album 1"); AddPending(id: 2, album: "Album 2"); AddPending(id: 3, album: "Album 3"); AddPending(id: 4, album: "Album 3"); var queueId = HashConverter.GetHashInt31(string.Format("pending-{0}-book{1}", 3, _album.Id)); Subject.RemovePendingQueueItems(queueId); AssertRemoved(3, 4); }
public void should_not_remove_diffrent_season() { AddPending(id: 1, seasonNumber: 2, episodes: new[] { 1 }); AddPending(id: 2, seasonNumber: 2, episodes: new[] { 1 }); AddPending(id: 3, seasonNumber: 3, episodes: new[] { 1 }); AddPending(id: 4, seasonNumber: 3, episodes: new[] { 1 }); var queueId = HashConverter.GetHashInt31(String.Format("pending-{0}-ep{1}", 1, _episode.Id)); Subject.RemovePendingQueueItems(queueId); AssertRemoved(1, 2); }
public void should_remove_multiple_releases_release() { AddPending(id: 1, seasonNumber: 2, episodes: new[] { 1 }); AddPending(id: 2, seasonNumber: 2, episodes: new[] { 2 }); AddPending(id: 3, seasonNumber: 2, episodes: new[] { 3 }); AddPending(id: 4, seasonNumber: 2, episodes: new[] { 3 }); var queueId = HashConverter.GetHashInt31(String.Format("pending-{0}-ep{1}", 3, _episode.Id)); Subject.RemovePendingQueueItems(queueId); AssertRemoved(3, 4); }
public void should_not_remove_diffrent_books() { AddPending(id: 1, book: "Book 1"); AddPending(id: 2, book: "Book 1"); AddPending(id: 3, book: "Book 2"); AddPending(id: 4, book: "Book 3"); var queueId = HashConverter.GetHashInt31(string.Format("pending-{0}-book{1}", 1, _book.Id)); Subject.RemovePendingQueueItems(queueId); AssertRemoved(1, 2); }
private Queue MapQueueItem(TrackedDownload trackedDownload, Album album) { bool downloadForced = false; var history = _historyService.Find(trackedDownload.DownloadItem.DownloadId, HistoryEventType.Grabbed).FirstOrDefault(); if (history != null && history.Data.ContainsKey("downloadForced")) { downloadForced = bool.Parse(history.Data["downloadForced"]); } var queue = new Queue { Artist = trackedDownload.RemoteAlbum?.Artist, Album = album, Quality = trackedDownload.RemoteAlbum?.ParsedAlbumInfo.Quality ?? new QualityModel(Quality.Unknown), Title = Parser.Parser.RemoveFileExtension(trackedDownload.DownloadItem.Title), Size = trackedDownload.DownloadItem.TotalSize, Sizeleft = trackedDownload.DownloadItem.RemainingSize, Timeleft = trackedDownload.DownloadItem.RemainingTime, Status = trackedDownload.DownloadItem.Status.ToString(), TrackedDownloadStatus = trackedDownload.Status, TrackedDownloadState = trackedDownload.State, StatusMessages = trackedDownload.StatusMessages.ToList(), ErrorMessage = trackedDownload.DownloadItem.Message, RemoteAlbum = trackedDownload.RemoteAlbum, DownloadId = trackedDownload.DownloadItem.DownloadId, Protocol = trackedDownload.Protocol, DownloadClient = trackedDownload.DownloadItem.DownloadClientInfo.Name, Indexer = trackedDownload.Indexer, OutputPath = trackedDownload.DownloadItem.OutputPath.ToString(), DownloadForced = downloadForced }; if (album != null) { queue.Id = HashConverter.GetHashInt31(string.Format("trackedDownload-{0}-album{1}", trackedDownload.DownloadItem.DownloadId, album.Id)); } else { queue.Id = HashConverter.GetHashInt31(string.Format("trackedDownload-{0}", trackedDownload.DownloadItem.DownloadId)); } if (queue.Timeleft.HasValue) { queue.EstimatedCompletionTime = DateTime.UtcNow.Add(queue.Timeleft.Value); } return(queue); }
public static ManualImportResource ToResource(this Core.MediaFiles.MovieImport.Manual.ManualImportItem model) { if (model == null) { return(null); } return(new ManualImportResource { Id = HashConverter.GetHashInt31(model.Path), Path = model.Path, RelativePath = model.RelativePath, Name = model.Name, Size = model.Size, Movie = model.Movie.ToResource(), Quality = model.Quality, //QualityWeight DownloadId = model.DownloadId, Rejections = model.Rejections }); }
private int GetQueueId(PendingRelease pendingRelease, Episode episode) { return(HashConverter.GetHashInt31(string.Format("pending-{0}-ep{1}", pendingRelease.Id, episode.Id))); }
private int GetQueueId(PendingRelease pendingRelease, Book book) { return(HashConverter.GetHashInt31(string.Format("pending-{0}-book{1}", pendingRelease.Id, book.Id))); }
private int GetQueueId(PendingRelease pendingRelease, Album album) { return(HashConverter.GetHashInt31(string.Format("pending-{0}-album{1}", pendingRelease.Id, album.Id))); }
private int GetBackupId(NzbDrone.Core.Backup.Backup backup) { return(HashConverter.GetHashInt31($"backup-{backup.Type}-{backup.Name}")); }
private int GetQueueId(PendingRelease pendingRelease, Movie movie) { return(HashConverter.GetHashInt31(string.Format("pending-{0}-movie{1}", pendingRelease.Id, movie.Id))); }