public static Task <IList <WebTVSeasonBasic> > ProcessAsync(IOwinContext context, string id, string filter, WebSortField?sort, WebSortOrder?order) { // Get all seasons for this series IList <MediaItem> seasons = MediaLibraryAccess.GetMediaItemsByGroup(context, SeasonAspect.ROLE_SEASON, SeriesAspect.ROLE_SERIES, Guid.Parse(id), BasicNecessaryMIATypeIds, BasicOptionalMIATypeIds); if (seasons.Count == 0) { return(Task.FromResult <IList <WebTVSeasonBasic> >(new List <WebTVSeasonBasic>())); } var output = new List <WebTVSeasonBasic>(); foreach (var season in seasons) { output.Add(TVSeasonBasic(context, season, Guid.Parse(id))); } // sort if (sort != null && order != null) { output = output.SortWebTVSeasonBasic(sort, order).ToList(); } return(Task.FromResult <IList <WebTVSeasonBasic> >(output)); }
public static Task <IList <WebMusicTrackDetailed> > ProcessAsync(IOwinContext context, string id, string filter, WebSortField?sort, WebSortOrder?order) { if (id == null) { throw new BadRequestException("GetMusicTracksDetailedForAlbum: id is null"); } IList <MediaItem> tracks = MediaLibraryAccess.GetMediaItemsByGroup(context, AudioAspect.ROLE_TRACK, AudioAlbumAspect.ROLE_ALBUM, Guid.Parse(id), BasicNecessaryMIATypeIds, BasicOptionalMIATypeIds); if (tracks.Count == 0) { return(Task.FromResult <IList <WebMusicTrackDetailed> >(new List <WebMusicTrackDetailed>())); } var output = tracks.Select(t => MusicTrackDetailed(t)).ToList(); // sort if (sort != null && order != null) { output = output.SortWebMusicTrackBasic(sort, order).ToList(); } // assign artists AssignArtists(context, output); return(Task.FromResult <IList <WebMusicTrackDetailed> >(output)); }
public static Task <IList <WebActor> > ProcessAsync(IOwinContext context, string filter, WebSortField?sort, WebSortOrder?order) { ISet <Guid> necessaryMIATypes = new HashSet <Guid>(); necessaryMIATypes.Add(MediaAspect.ASPECT_ID); necessaryMIATypes.Add(PersonAspect.ASPECT_ID); var items = MediaLibraryAccess.GetMediaItemsByGroup(context, PersonAspect.ROLE_ACTOR, MovieAspect.ROLE_MOVIE, Guid.Empty, necessaryMIATypes, null); if (items.Count == 0) { throw new BadRequestException("No Movies found"); } var output = items.Select(mi => new WebActor(mi.GetAspect(PersonAspect.Metadata).GetAttributeValue <string>(PersonAspect.ATTR_PERSON_NAME))) .Filter(filter); // sort and filter if (sort != null && order != null) { output = output.SortWebActor(sort, order); } return(System.Threading.Tasks.Task.FromResult <IList <WebActor> >(output.ToList())); }
public static Task <IList <WebMusicArtistBasic> > ProcessAsync(IOwinContext context, string filter, WebSortField?sort, WebSortOrder?order) { var items = MediaLibraryAccess.GetMediaItemsByGroup(context, PersonAspect.ROLE_ARTIST, AudioAspect.ROLE_TRACK, Guid.Empty, BasicNecessaryMIATypeIds, BasicOptionalMIATypeIds); if (items.Count == 0) { return(System.Threading.Tasks.Task.FromResult <IList <WebMusicArtistBasic> >(new List <WebMusicArtistBasic>())); } var output = items.Select(mi => MusicArtistBasic(mi)).Filter(filter); // sort and filter if (sort != null && order != null) { output = output.SortWebMusicArtistBasic(sort, order); } return(System.Threading.Tasks.Task.FromResult <IList <WebMusicArtistBasic> >(output.ToList())); }
public static Task <IList <WebTVEpisodeBasic> > ProcessAsync(IOwinContext context, string id, WebSortField?sort, WebSortOrder?order) { // Get all episodes for this season IList <MediaItem> episodes = MediaLibraryAccess.GetMediaItemsByGroup(context, EpisodeAspect.ROLE_EPISODE, SeasonAspect.ROLE_SEASON, Guid.Parse(id), BasicNecessaryMIATypeIds, BasicOptionalMIATypeIds); if (episodes.Count == 0) { return(Task.FromResult <IList <WebTVEpisodeBasic> >(new List <WebTVEpisodeBasic>())); } var output = episodes.Select(episode => EpisodeBasic(episode, null, Guid.Parse(id))); // sort if (sort != null && order != null) { output = output.SortWebTVEpisodeBasic(sort, order); } return(Task.FromResult <IList <WebTVEpisodeBasic> >(output.ToList())); }
public static Task <IList <WebTVEpisodeDetailed> > ProcessAsync(IOwinContext context, string id, WebSortField?sort, WebSortOrder?order) { IList <MediaItem> episodes = MediaLibraryAccess.GetMediaItemsByGroup(context, EpisodeAspect.ROLE_EPISODE, SeriesAspect.ROLE_SERIES, Guid.Parse(id), DetailedNecessaryMIATypeIds, DetailedOptionalMIATypeIds); var output = new List <WebTVEpisodeDetailed>(); if (episodes.Count == 0) { return(Task.FromResult <IList <WebTVEpisodeDetailed> >(output)); } output.AddRange(episodes.Select(episode => EpisodeDetailed(episode, Guid.Parse(id)))); // sort if (sort != null && order != null) { output = output.SortWebTVEpisodeDetailed(sort, order).ToList(); } return(Task.FromResult <IList <WebTVEpisodeDetailed> >(output)); }
public static Task <IList <WebActor> > ProcessAsync(IOwinContext context, string filter, WebSortField?sort, WebSortOrder?order) { ISet <Guid> necessaryMIATypes = new HashSet <Guid>(); necessaryMIATypes.Add(MediaAspect.ASPECT_ID); necessaryMIATypes.Add(PersonAspect.ASPECT_ID); IList <MediaItem> items = MediaLibraryAccess.GetMediaItemsByGroup(context, PersonAspect.ROLE_ACTOR, SeriesAspect.ROLE_SERIES, Guid.Empty, necessaryMIATypes, null); if (items.Count == 0) { return(System.Threading.Tasks.Task.FromResult <IList <WebActor> >(new List <WebActor>())); } var output = items.Select(a => new WebActor(a.GetAspect(PersonAspect.Metadata).GetAttributeValue <string>(PersonAspect.ATTR_PERSON_NAME))) .Filter(filter); if (sort != null && order != null) { output.SortWebActor(sort, order); } return(System.Threading.Tasks.Task.FromResult <IList <WebActor> >(output.ToList())); }