public override void searchArtist(SearchItems search) { if (String.IsNullOrEmpty(search.genre)) { search.genre = "*"; } if (search.genre.Contains(' ')) { search.genre.Trim(); string[] genreParts = search.genre.Split(' '); string tmp = "%22"; for (int n = 0; n < genreParts.Count(); n++) { tmp += genreParts[n]; if (n + 1 != genreParts.Count()) { tmp += "%20"; } } tmp += "%22"; Console.WriteLine("HAR MELLANRUM"); search.genre = tmp; Console.WriteLine(search.genre); //Console.ReadKey(); } string str = string.Format("q={0}%20genre:{1}&type=artist", search.artist, search.genre); string url = string.Format("https://api.spotify.com/v1/search?{0}", str); var jsonData = connector.getJsonData(url); //System.IO.File.WriteAllText(@"../MusicCollector/raw_data/test_result.json", jsonData); try { var parse = new CollectArtists(jsonData); Console.WriteLine("Laddar på med Artists"); parse.collect(holder); } catch (Exception e) { error.addError(e); } }
public override void searchTrack(SearchItems search) { int offset = 0; //string url = string.Format("https://api.spotify.com/v1/search?q={0} {1}&type=track&market=US&limit=10&offset={2}",search.track,search.artist,offset.ToString()); string url = string.Format("https://api.spotify.com/v1/search?q={0} {1}&type=track&limit=10&offset={2}", search.track, search.artist, offset.ToString()); var jsonData = connector.getJsonData(url); //Console.WriteLine(jsonData); //System.IO.File.WriteAllText(@"../MusicCollector/raw_data/search_result.json", jsonData); try { var parse = new CollectTracks(jsonData); Console.WriteLine("Laddar på med Tracks"); parse.collect(holder); } catch (Exception e) { error.addError(e); } }
public abstract void searchTrack(SearchItems search);
public abstract void searchArtist(SearchItems search);