}//desde DB file echo nest
        private void SaveSimilarCanciones()
        {
            ModeloSimilitudEntities db = new ModeloSimilitudEntities();

            List<similares> ListaSimilares = db.similares.ToList();
            string id_song, json, jsonResult;
            for (int i = 11547; i < ListaSimilares.Count; i++)
            {
                ModeloSimilitudEntities database = new ModeloSimilitudEntities();
                similares similar = ListaSimilares[i];
                int milliseconds = 3000;
                Thread.Sleep(milliseconds);
                String artist_similar = similar.Artist_Similar;
                String song_similar = similar.Song_Similar;

                json = "http://developer.echonest.com/api/v4/song/search?api_key=ERYL0FA7VZ24XQMOO&format=json&results=1&artist=" + artist_similar + "&title=" + song_similar + "&bucket=id:spotify&bucket=tracks&limit=true&bucket=audio_summary";
                jsonResult = SONGGET(json);
                if (!jsonResult.Equals(""))
                {
                    string cancionesNoEncontradas = "";
                    canciones cancion = new canciones();
                    try
                    {
                        JObject jObject = JObject.Parse(jsonResult);
                        Array arraySongs = ((jObject["response"])["songs"]).ToArray();
                        JToken tokenSongs = (JToken)(arraySongs.GetValue(0));
                        JToken tokenSummary = tokenSongs["audio_summary"];

                        cancion.energy = Double.Parse(tokenSummary["energy"].ToString());
                        cancion.liveness = Double.Parse(tokenSummary["liveness"].ToString());
                        cancion.tempo = Double.Parse(tokenSummary["tempo"].ToString());
                        cancion.speechiness = Double.Parse(tokenSummary["speechiness"].ToString());
                        cancion.acousticness = Double.Parse(tokenSummary["acousticness"].ToString());
                        cancion.loudness = Double.Parse(tokenSummary["loudness"].ToString());
                        cancion.valence = Double.Parse(tokenSummary["valence"].ToString());
                        cancion.danceability = Double.Parse(tokenSummary["danceability"].ToString());
                        cancion.instrumentalness = Double.Parse(tokenSummary["instrumentalness"].ToString());
                        cancion.key = int.Parse(tokenSummary["key"].ToString());

                        Array arrayTracks = tokenSongs["tracks"].ToArray();
                        JToken tokenTracks = (JToken)arrayTracks.GetValue(0);
                        cancion.id_spotify = tokenTracks["foreign_id"].ToString();

                        cancion.track_id = tokenTracks["id"].ToString();
                        cancion.title = tokenSongs["title"].ToString();
                        cancion.song_id = tokenSongs["id"].ToString();
                        cancion.artist_id = tokenSongs["artist_id"].ToString();
                        cancion.artist_mbid = "";//falta
                        cancion.artist_name = tokenSongs["artist_name"].ToString();
                        cancion.duration = Double.Parse(tokenSummary["duration"].ToString());
                        cancion.artist_familiarity = 0;//falta
                        cancion.artist_hotttnesss = 0;//falta
                        cancion.year = 0;//falta
                        database.canciones.Add(cancion);
                        int numberOfObjects = database.SaveChanges();
                    }
                    catch (Exception e)
                    {

                        System.IO.File.AppendAllText(@"C:\Users\FastSolution\Documents\Visual Studio 2013\Projects\BusquedaSimilitud\Similitud.Web\App_Data\log\noencontradosEchoNest.txt", similar.Song_Similar + "-" + similar.Artist_Similar + i + Environment.NewLine);
                    }
                }

            }
        }
        private void CargadoCanciones()
        {
            ModeloSimilitudEntities db = new ModeloSimilitudEntities();
            subset_track_metadataEntities sm = new subset_track_metadataEntities();

            List<songs> musicas = sm.songs.ToList();
            string id_song, json, jsonResult;
            for (int i = 7212; i <= musicas.Count; i++)
            {
                songs song = musicas[i];
                int milliseconds = 3000;
                Thread.Sleep(milliseconds);
                id_song = song.song_id;
                json = "http://developer.echonest.com/api/v4/song/profile?api_key=ERYL0FA7VZ24XQMOO&format=json&results=1&id=" + id_song + "&bucket=id:spotify&bucket=tracks&limit=true&bucket=audio_summary";
                jsonResult = SONGGET(json);
                if (!jsonResult.Equals(""))
                {
                    string cancionesNoEncontradas = "";
                    canciones cancion = new canciones();
                    try
                    {
                        JObject jObject = JObject.Parse(jsonResult);
                        Array arraySongs = ((jObject["response"])["songs"]).ToArray();
                        JToken tokenSongs = (JToken)(arraySongs.GetValue(0));
                        JToken tokenSummary = tokenSongs["audio_summary"];

                        cancion.energy = Double.Parse(tokenSummary["energy"].ToString());
                        cancion.liveness = Double.Parse(tokenSummary["liveness"].ToString());
                        cancion.tempo = Double.Parse(tokenSummary["tempo"].ToString());
                        cancion.speechiness = Double.Parse(tokenSummary["speechiness"].ToString());
                        cancion.acousticness = Double.Parse(tokenSummary["acousticness"].ToString());
                        cancion.loudness = Double.Parse(tokenSummary["loudness"].ToString());
                        cancion.valence = Double.Parse(tokenSummary["valence"].ToString());
                        cancion.danceability = Double.Parse(tokenSummary["danceability"].ToString());
                        cancion.instrumentalness = Double.Parse(tokenSummary["instrumentalness"].ToString());
                        cancion.key = int.Parse(tokenSummary["key"].ToString());

                        Array arrayTracks = tokenSongs["tracks"].ToArray();
                        JToken tokenTracks = (JToken)arrayTracks.GetValue(0);
                        cancion.id_spotify = tokenTracks["foreign_id"].ToString();

                        cancion.track_id = song.track_id;
                        cancion.title = song.title;
                        cancion.song_id = song.song_id;
                        cancion.artist_id = song.artist_id;
                        cancion.artist_mbid = song.artist_mbid;
                        cancion.artist_name = song.artist_name;
                        cancion.duration = Double.Parse(song.duration.ToString());
                        cancion.artist_familiarity = song.artist_familiarity;
                        cancion.artist_hotttnesss = song.artist_hotttnesss;
                        cancion.year = int.Parse(song.year.ToString());
                        db.canciones.Add(cancion);
                        int numberOfObjects = db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        System.IO.File.AppendAllText(@"C:\Users\FastSolution\Documents\Visual Studio 2013\Projects\BusquedaSimilitud\Similitud.Web\App_Data\log\registros.txt", song.song_id + "\n");
                    }
                }

            }
        }//desde DB file echo nest