public Interval(double lowerBound, double upperBound) { Debug.Assert(!double.IsNaN(lowerBound), "Interval lower bound is not a number"); Debug.Assert(!double.IsNaN(upperBound), "Interval upper bound is not a number"); Debug.Assert(!double.IsPositiveInfinity(lowerBound), "Interval lower bound cannot be positive infinity"); Debug.Assert(!double.IsNegativeInfinity(upperBound), "Interval lower bound cannot be negative infinity"); Lower = lowerBound; Upper = upperBound; #if SearchHints SearchHint = SearchHint.None; #endif }
private void SetBackdropImageInfo(SearchHint hint, BaseItem item) { var itemWithImage = (item.HasImage(ImageType.Backdrop) ? item : null) ?? GetParentWithImage <BaseItem>(item, ImageType.Backdrop); if (itemWithImage != null) { var tag = _imageProcessor.GetImageCacheTag(itemWithImage, ImageType.Backdrop); if (tag != null) { hint.BackdropImageTag = tag; hint.BackdropImageItemId = itemWithImage.Id.ToString("N", CultureInfo.InvariantCulture); } } }
public void UpdateList(string Search = "") { try { SearchEnabled = true; if (this.ResetSearch) { ResetSearch = false; List = ConfigList.OrderByDescending(x => x.ID).ToList(); Entries.Children.Clear(); SearchHint.AnimateFade <StackPanel>(1, 0, new Duration(TimeSpan.FromMilliseconds(1000))); } else if (Search != "") { ResetSearch = false; Entries.Children.Clear(); List = ConfigList.Where(x => x.LegendaryItemName.ToLower().Contains(Search.ToLower())).OrderByDescending(x => x.ID).ToList(); SearchHint.AnimateFade <StackPanel>(0, 1, new Duration(TimeSpan.FromMilliseconds(1000))); SearchCount.Text = List.Count.ToString(); } IEnumerable <FKTracker.LegendaryItems> Temp = List.Take(10).ToList(); Listed.AddRange(Temp); foreach (var x in Temp.ToList()) { List.Remove(x); } foreach (FKTracker.LegendaryItems Item in Temp) { Paint(Item); } SearchEnabled = false; } catch (Exception e) { MessageBox.Show(e.ToString()); } }
private void SetBackdropImageInfo(SearchHint hint, BaseItem item) { var itemWithImage = item.HasImage(ImageType.Backdrop) ? item : null; if (itemWithImage == null) { itemWithImage = GetParentWithImage <BaseItem>(item, ImageType.Backdrop); } if (itemWithImage != null) { var tag = _imageProcessor.GetImageCacheTag(itemWithImage, ImageType.Backdrop); if (tag.HasValue) { hint.BackdropImageTag = tag.Value; hint.BackdropImageItemId = itemWithImage.Id.ToString("N"); } } }
private void SetThumbImageInfo(SearchHint hint, BaseItem item) { var itemWithImage = item.HasImage(ImageType.Thumb) ? item : null; if (itemWithImage == null && item is Episode) { itemWithImage = GetParentWithImage <Series>(item, ImageType.Thumb); } itemWithImage ??= GetParentWithImage <BaseItem>(item, ImageType.Thumb); if (itemWithImage != null) { var tag = _imageProcessor.GetImageCacheTag(itemWithImage, ImageType.Thumb); if (tag != null) { hint.ThumbImageTag = tag; hint.ThumbImageItemId = itemWithImage.Id.ToString("N", CultureInfo.InvariantCulture); } } }
/// <summary> /// Gets the search hint result. /// </summary> /// <param name="hintInfo">The hint info.</param> /// <returns>SearchHintResult.</returns> private SearchHint GetSearchHintResult(SearchHintInfo hintInfo) { var item = hintInfo.Item; var result = new SearchHint { Name = item.Name, IndexNumber = item.IndexNumber, ParentIndexNumber = item.ParentIndexNumber, ItemId = _dtoService.GetDtoId(item), Type = item.GetClientTypeName(), MediaType = item.MediaType, MatchedTerm = hintInfo.MatchedTerm, DisplayMediaType = item.DisplayMediaType, RunTimeTicks = item.RunTimeTicks, ProductionYear = item.ProductionYear }; var primaryImageTag = _imageProcessor.GetImageCacheTag(item, ImageType.Primary); if (primaryImageTag.HasValue) { result.PrimaryImageTag = primaryImageTag.Value; } SetThumbImageInfo(result, item); SetBackdropImageInfo(result, item); var episode = item as Episode; if (episode != null) { result.Series = episode.Series.Name; } var season = item as Season; if (season != null) { result.Series = season.Series.Name; result.EpisodeCount = season.GetRecursiveChildren(i => i is Episode).Count; } var series = item as Series; if (series != null) { result.EpisodeCount = series.GetRecursiveChildren(i => i is Episode).Count; } var album = item as MusicAlbum; if (album != null) { var songs = album.GetRecursiveChildren().OfType <Audio>().ToList(); result.SongCount = songs.Count; result.Artists = songs.SelectMany(i => i.AllArtists) .Distinct(StringComparer.OrdinalIgnoreCase) .ToArray(); result.AlbumArtist = songs.Select(i => i.AlbumArtist).FirstOrDefault(i => !string.IsNullOrEmpty(i)); } var song = item as Audio; if (song != null) { result.Album = song.Album; result.AlbumArtist = song.AlbumArtist; result.Artists = song.Artists.ToArray(); } return(result); }
/// <summary> /// Gets the search hint result. /// </summary> /// <param name="hintInfo">The hint info.</param> /// <returns>SearchHintResult.</returns> private SearchHint GetSearchHintResult(SearchHintInfo hintInfo) { var item = hintInfo.Item; var result = new SearchHint { Name = item.Name, IndexNumber = item.IndexNumber, ParentIndexNumber = item.ParentIndexNumber, ItemId = _dtoService.GetDtoId(item), Type = item.GetClientTypeName(), MediaType = item.MediaType, MatchedTerm = hintInfo.MatchedTerm, DisplayMediaType = item.DisplayMediaType, RunTimeTicks = item.RunTimeTicks, ProductionYear = item.ProductionYear }; result.ChannelId = item.ChannelId; var primaryImageTag = _imageProcessor.GetImageCacheTag(item, ImageType.Primary); if (primaryImageTag != null) { result.PrimaryImageTag = primaryImageTag; result.PrimaryImageAspectRatio = _dtoService.GetPrimaryImageAspectRatio(item); } SetThumbImageInfo(result, item); SetBackdropImageInfo(result, item); var hasSeries = item as IHasSeries; if (hasSeries != null) { result.Series = hasSeries.SeriesName; } var season = item as Season; if (season != null) { result.EpisodeCount = season.GetRecursiveChildren(i => i is Episode).Count; } var series = item as Series; if (series != null) { result.EpisodeCount = series.GetRecursiveChildren(i => i is Episode).Count; } var album = item as MusicAlbum; if (album != null) { result.SongCount = album.Tracks.Count(); result.Artists = album.Artists.ToArray(); result.AlbumArtist = album.AlbumArtist; } var song = item as Audio; if (song != null) { result.Album = song.Album; result.AlbumArtist = song.AlbumArtists.FirstOrDefault(); result.Artists = song.Artists.ToArray(); } if (!string.IsNullOrWhiteSpace(item.ChannelId)) { var channel = _libraryManager.GetItemById(item.ChannelId); result.ChannelName = channel == null ? null : channel.Name; } return(result); }
/// <summary> /// Gets the search hint result. /// </summary> /// <param name="hintInfo">The hint info.</param> /// <returns>SearchHintResult.</returns> private SearchHint GetSearchHintResult(SearchHintInfo hintInfo) { var item = hintInfo.Item; var result = new SearchHint { Name = item.Name, IndexNumber = item.IndexNumber, ParentIndexNumber = item.ParentIndexNumber, Id = item.Id, Type = item.GetClientTypeName(), MediaType = item.MediaType, MatchedTerm = hintInfo.MatchedTerm, RunTimeTicks = item.RunTimeTicks, ProductionYear = item.ProductionYear, ChannelId = item.ChannelId, EndDate = item.EndDate }; // legacy result.ItemId = result.Id; if (item.IsFolder) { result.IsFolder = true; } var primaryImageTag = _imageProcessor.GetImageCacheTag(item, ImageType.Primary); if (primaryImageTag != null) { result.PrimaryImageTag = primaryImageTag; result.PrimaryImageAspectRatio = _dtoService.GetPrimaryImageAspectRatio(item); } SetThumbImageInfo(result, item); SetBackdropImageInfo(result, item); var program = item as LiveTvProgram; if (program != null) { result.StartDate = program.StartDate; } var hasSeries = item as IHasSeries; if (hasSeries != null) { result.Series = hasSeries.SeriesName; } var series = item as Series; if (series != null) { if (series.Status.HasValue) { result.Status = series.Status.Value.ToString(); } } var album = item as MusicAlbum; if (album != null) { result.Artists = album.Artists; result.AlbumArtist = album.AlbumArtist; } var song = item as Audio; if (song != null) { result.AlbumArtist = song.AlbumArtists.FirstOrDefault(); result.Artists = song.Artists; album = song.AlbumEntity; if (album != null) { result.Album = album.Name; result.AlbumId = album.Id; } else { result.Album = song.Album; } } if (!item.ChannelId.Equals(Guid.Empty)) { var channel = _libraryManager.GetItemById(item.ChannelId); result.ChannelName = channel == null ? null : channel.Name; } return(result); }
/// <summary> /// Gets the search hint result. /// </summary> /// <param name="hintInfo">The hint info.</param> /// <returns>SearchHintResult.</returns> private SearchHint GetSearchHintResult(SearchHintInfo hintInfo) { var item = hintInfo.Item; var result = new SearchHint { Name = item.Name, IndexNumber = item.IndexNumber, ParentIndexNumber = item.ParentIndexNumber, Id = item.Id, Type = item.GetClientTypeName(), MediaType = item.MediaType, MatchedTerm = hintInfo.MatchedTerm, RunTimeTicks = item.RunTimeTicks, ProductionYear = item.ProductionYear, ChannelId = item.ChannelId, EndDate = item.EndDate }; // legacy result.ItemId = result.Id; if (item.IsFolder) { result.IsFolder = true; } var primaryImageTag = _imageProcessor.GetImageCacheTag(item, ImageType.Primary); if (primaryImageTag != null) { result.PrimaryImageTag = primaryImageTag; result.PrimaryImageAspectRatio = _dtoService.GetPrimaryImageAspectRatio(item); } SetThumbImageInfo(result, item); SetBackdropImageInfo(result, item); switch (item) { case IHasSeries hasSeries: result.Series = hasSeries.SeriesName; break; case LiveTvProgram program: result.StartDate = program.StartDate; break; case Series series: if (series.Status.HasValue) { result.Status = series.Status.Value.ToString(); } break; case MusicAlbum album: result.Artists = album.Artists; result.AlbumArtist = album.AlbumArtist; break; case Audio song: result.AlbumArtist = song.AlbumArtists?[0]; result.Artists = song.Artists; MusicAlbum musicAlbum = song.AlbumEntity; if (musicAlbum != null) { result.Album = musicAlbum.Name; result.AlbumId = musicAlbum.Id; } else { result.Album = song.Album; } break; } if (!item.ChannelId.Equals(Guid.Empty)) { var channel = _libraryManager.GetItemById(item.ChannelId); result.ChannelName = channel?.Name; } return(result); }
/// <summary> /// Gets the search hint result. /// </summary> /// <param name="hintInfo">The hint info.</param> /// <returns>SearchHintResult.</returns> private SearchHint GetSearchHintResult(SearchHintInfo hintInfo) { var item = hintInfo.Item; var result = new SearchHint { Name = item.Name, IndexNumber = item.IndexNumber, ParentIndexNumber = item.ParentIndexNumber, ItemId = DtoBuilder.GetClientItemId(item), Type = item.GetType().Name, MediaType = item.MediaType, MatchedTerm = hintInfo.MatchedTerm, DisplayMediaType = item.DisplayMediaType, RunTimeTicks = item.RunTimeTicks }; if (item.HasImage(ImageType.Primary)) { result.PrimaryImageTag = Kernel.Instance.ImageManager.GetImageCacheTag(item, ImageType.Primary, item.GetImage(ImageType.Primary)); } var episode = item as Episode; if (episode != null) { result.Series = episode.Series.Name; } var season = item as Season; if (season != null) { result.Series = season.Series.Name; result.EpisodeCount = season.RecursiveChildren.OfType <Episode>().Count(); } var series = item as Series; if (series != null) { result.EpisodeCount = series.RecursiveChildren.OfType <Episode>().Count(); } var album = item as MusicAlbum; if (album != null) { var songs = album.RecursiveChildren.OfType <Audio>().ToList(); result.SongCount = songs.Count; result.Artists = songs .Select(i => i.Artist) .Where(i => !string.IsNullOrEmpty(i)) .Distinct(StringComparer.OrdinalIgnoreCase) .ToArray(); result.AlbumArtist = songs.Select(i => i.AlbumArtist).FirstOrDefault(i => !string.IsNullOrEmpty(i)); } var song = item as Audio; if (song != null) { result.Album = song.Album; result.AlbumArtist = song.AlbumArtist; result.Artists = !string.IsNullOrEmpty(song.Artist) ? new[] { song.Artist } : new string[] { }; } return(result); }