2 * Copyright (c) 2012, Intel Corporation.
4 * This program is licensed under the terms and conditions of the
5 * Apache License, version 2.0. The full text of the Apache License is at
6 * http://www.apache.org/licenses/LICENSE-2.0
13 var Store = function() {}
18 "firstName": "Regina",
19 "lastName": "Spektor",
20 "picture": "regina-spektor.jpg"
24 "lastName": "diFranco",
25 "picture": "ani-difranco.jpg"
31 "picture": "emily-haines.jpg"
36 "picture": "casey-dienel.jpg"
45 "picture": "regina-spektor/11-11.jpg"
51 "picture": "regina-spektor/songs.jpg"
55 "name": "Soviet Kitsch",
57 "picture": "regina-spektor/soviet-kitsch.jpg"
61 "name": "Begin to Hope",
63 "picture": "regina-spektor/begin-to-hope.jpg"
69 "picture": "regina-spektor/far.jpg"
73 "name": "What We Saw from the Cheap Seats",
75 "picture": "regina-spektor/what-we-saw-from-the-cheap-seats.jpg"
82 "title": "Love Affair",
92 "title": "Back of a Truck",
97 getArtist: function(id) {
98 var artist = app.Artist.create(
99 _.find(this.artists, function(artist_data) {
100 return artist_data.id === id;
106 getArtists: function() {
109 _.each(this.artists, function(artist_data) {
110 artists.push(app.Artist.create(artist_data));
116 getAlbum: function(id) {
117 var album_data = _.find(this.albums, function(album_data) {
118 return album_data.id === id;
121 var album = app.Album.create(album_data);
122 var artist = this.getArtist(album_data.artist_id);
124 album.set('artist', artist);
128 getAlbums: function(artist) {
132 _.each(this.albums, function(album_data) {
133 var album = app.Album.create(album_data);
134 var album_artist = self.getArtist(album_data.artist_id);
136 if (artist === undefined || artist.get('id') === album_artist.get('id')) {
137 album.set('artist', album_artist);
145 getSongs: function(album) {
149 _.each(this.songs, function(song_data) {
150 var song = app.Album.create(song_data);
151 var song_album = self.getAlbum(song_data.album_id);
153 if (album === undefined || album.get('id') === song_album.get('id')) {
154 song.set('album', song_album);
163 app.Store = new Store();
164 })(window.Calf, window._);