public DbAlbum GetAlbum(int index) { AlbumMetadata albumMetadata = _zuneLibrary.GetAlbumMetadata(index); var albumMediaId = GetFieldValue(index, EListType.eAlbumList, ZuneQueryList.AtomNameToAtom("ZuneMediaID"), Guid.Empty); var dateAdded = GetFieldValue(index, EListType.eAlbumList, ZuneQueryList.AtomNameToAtom("DateAdded"), new DateTime()); var album = new DbAlbum { AlbumMediaId = albumMediaId, DateAdded = dateAdded, Title = albumMetadata.AlbumTitle, Artist = albumMetadata.AlbumArtist, ArtworkUrl = albumMetadata.CoverUrl, MediaId = albumMetadata.MediaId, ReleaseYear = albumMetadata.ReleaseYear.ToString(), TrackCount = (int)albumMetadata.TrackCount, Tracks = GetTracksForAlbum(albumMetadata.MediaId).ToList() }; albumMetadata.Dispose(); return(album); }
private static T GetTrackValue <T>(ZuneQueryItem item, string fieldName) { var result = item.GetFieldValue(typeof(T), (uint)ZuneQueryList.AtomNameToAtom(fieldName)); if (result != null) { return((T)result); } return(default(T)); }
public DbAlbum GetAlbumMin(int index) { AlbumMetadata albumMetadata = _zuneLibrary.GetAlbumMetadata(index); var albumMediaId = GetFieldValue(index, EListType.eAlbumList, ZuneQueryList.AtomNameToAtom("ZuneMediaID"), Guid.Empty); var dateAdded = GetFieldValue(index, EListType.eAlbumList, ZuneQueryList.AtomNameToAtom("DateAdded"), new DateTime()); var album = new DbAlbum { AlbumMediaId = albumMediaId, DateAdded = dateAdded, Title = albumMetadata.AlbumTitle, Artist = albumMetadata.AlbumArtist, ArtworkUrl = albumMetadata.CoverUrl, MediaId = albumMetadata.MediaId, }; albumMetadata.Dispose(); return(album); }