private static mediaMetadata BuildMediaMetadata(Track track) { return new mediaMetadata() { Item = BuildTrackMetadata(track), itemType = itemType.track, id = String.Format("Trk/{0}", track.Key), title = track.Name, mimeType = String.Format("audio/{0}", track.Container.ToLower()) }; }
private static trackMetadata BuildTrackMetadata(Track track) { return new trackMetadata() { album = track.Parent.Name, albumId = String.Format("Alb/{0}", track.Parent.Key), artist = track.Parent.Parent.Name, albumArtist = track.Parent.Parent.Name, albumArtistId = track.Parent.Parent.Key, albumArtURI = (!String.IsNullOrEmpty(track.Parent.ThumbLocation) ? new albumArtUrl() { Value = String.Format("http://192.168.1.227:8888/ImageService/GetImage?image={0}", track.Parent.ThumbLocation) } : null), canPlay = true, canPlaySpecified = true, duration = track.Duration / 1000, durationSpecified = true, trackNumber = track.Index, trackNumberSpecified = true, canAddToFavorites = true, canAddToFavoritesSpecified = true, canSkip = true, canSkipSpecified = true }; }
private async Task<List<Track>> BuildTracks(Album album) { var list = new List<Track>(); using (dynamic client = this.CreateDynamicClient(album.Key)) { dynamic result = await client.get(); var tracks = result._children as IEnumerable<dynamic>; foreach (dynamic track in tracks) { var t = new Track(album, track); if (t.Duration > 0) list.Add(t); } } return list; }