Commits

Mathias Panzenböck committed 60ae40b

bugfix album.also

  • Participants
  • Parent commits ee7cf14

Comments (0)

Files changed (2)

 
 			for (var j = 0; j < cArtist.albums.length; ++ j) {
 				var aAlbum = cArtist.albums[j];
-				var album = slice(aAlbum, 'albumname', 'also', 'description', 'sku', 'launchdate', 'upc', 'itunes');
+				var album = slice(aAlbum, 'albumname', 'description', 'sku', 'launchdate', 'upc', 'itunes');
 				album.genres = collect(aAlbum.genres, 'genre');
+				album.also   = collect(aAlbum.also, 'sku');
 				album.songs  = collectSlices(aAlbum.songs, 'desc', 'number', 'duration', 'mp3');
 				artist.albums[j] = album;
 			}
 		var album;
 
 		if (cAlbum) {
-			album = slice(cAlbum, 'albumname', 'description', 'sku', 'launchdate', 'itunes', 'also');
+			album = slice(cAlbum, 'albumname', 'description', 'sku', 'launchdate', 'itunes');
 			album.artist = cAlbum.artist.artist;
+			album.also   = collect(cAlbum.also, 'albumname');
 			album.songs  = collectSlices(cAlbum.songs,'number','desc','duration','mp3');
 		}
 		else {
 			for (i = 0; i < C.SortedAlbums.length; ++ i) {
 				var album = C.SortedAlbums[i];
 				var artist = C.Artists[album.artist];
-				album.relatedAlbums = album.also.map(function (sku) {
+				album.also = album.also.map(function (sku) {
 					return C.AlbumsBySku[sku];
 				});
 				// awkward comparison so that it evaluates to true if latestdate is undefined:
 
 				addVector(album, [album.albumname, artist.artist]);
 				C.AlbumsBySku[album.sku] = C.Albums[album.albumname] = album;
+				C.SortedAlbums.push(album);
 
 				// awkward comparison so that it evaluates to true if latestdate is undefined:
 				if (!(artist.latestdate >= album.launchdate)) {
 		console.time("dereference related albums");
 		for (var i = 0; i < C.SortedAlbums.length; ++ i) {
 			var album = C.SortedAlbums[i];
-			album.relatedAlbums = album.also.map(function (sku) {
+			album.also = album.also.map(function (sku) {
 				return C.AlbumsBySku[sku];
 			});
 		}
 {
   "name": "GreattunePlayer",
   "subdomain": "greattuneplayer",
-  "version": "0.1.0-188",
+  "version": "0.1.0-190",
   "author": "Mathias Panzenböck",
   "description": "This is a HTML5 audio player based on the music from Magnatune.com",
   "bin": {