public IEnumerable <TrackInfo> Tracks(string filter) { try { TrackInfo[] filteredTracks = _libraryStore.GetTracks(filter); return(filteredTracks); } catch (Exception) { return(null); } }
public TrackInfo[] Tracks(string ids) { var idList = ids.Split("|", StringSplitOptions.RemoveEmptyEntries).Select(id => long.Parse(id)); try { var songs = _libraryStore.GetTracks(idList); var podcastEpisodes = _podcastStore.GetTracks(idList.Except(songs.Select(song => song.Id))); var presentIds = idList.Where(id => songs.Any(song => song.Id == id) || podcastEpisodes.Any(episode => episode.Id == id)); var tracks = presentIds.Select(id => songs.FirstOrDefault(song => song.Id == id) ?? podcastEpisodes.First(episode => episode.Id == id)); return(tracks.ToArray()); } catch (Exception) { return(null); } }