public async Task <WebSong> GetMatch(Mp3Provider provider, string title, string artist, string album = null) { var webSongs = new List <WebSong>(); WebSong song = null; switch (provider) { case Mp3Provider.ProstoPleer: webSongs = await _service.SearchPleer(title, artist).ConfigureAwait(false); break; case Mp3Provider.Songily: webSongs = await _service.SearchSongily(title, artist).ConfigureAwait(false); break; case Mp3Provider.Mp3FreeXMatch: webSongs = await _service.SearchMp3Freex(title, artist).ConfigureAwait(false); break; case Mp3Provider.Mp3Lio: webSongs = await _service.SearchMp3lio(title, artist).ConfigureAwait(false); break; case Mp3Provider.Mp3Pm: webSongs = await _service.SearchMp3Pm(title, artist).ConfigureAwait(false); break; case Mp3Provider.YouTube: webSongs = await _service.SearchYoutube(title, artist).ConfigureAwait(false); break; case Mp3Provider.Mp3Miner: webSongs = await _service.SearchMp3Miner(title, artist).ConfigureAwait(false); break; case Mp3Provider.SoundCloud: webSongs = await _service.SearchSoundCloud(title, artist).ConfigureAwait(false); break; case Mp3Provider.AnyMaza: webSongs = await _service.SearchAnyMaza(title, artist).ConfigureAwait(false); break; case Mp3Provider.MiMp3: webSongs = await _service.SearchMiMp3(title, artist).ConfigureAwait(false); break; case Mp3Provider.Mp3Skull: webSongs = await _service.SearchMp3Skull(title, artist).ConfigureAwait(false); break; case Mp3Provider.Mp3Clan: webSongs = await _service.SearchMp3Clan(title, artist).ConfigureAwait(false); break; case Mp3Provider.Netease: webSongs = await _service.SearchNetease(title, artist).ConfigureAwait(false); break; case Mp3Provider.Mp3Truck: webSongs = await _service.SearchMp3Truck(title, artist).ConfigureAwait(false); break; case Mp3Provider.Mp3Glu: webSongs = await _service.SearchMp3Glu(title, artist).ConfigureAwait(false); break; case Mp3Provider.Meile: webSongs = await _service.SearchMeile(title, artist).ConfigureAwait(false); break; } if (webSongs != null) { song = webSongs.FirstOrDefault(p => p.IsBestMatch); if (song != null) { return(song); } song = webSongs.FirstOrDefault(p => p.IsMatch && !p.IsLinkDeath); if (song != null) { return(song); } } return(null); }
public async Task <string> GetMatch(Mp3Provider provider, string title, string artist, string album = null) { var webSongs = new List <WebSong>(); switch (provider) { case Mp3Provider.ProstoPleer: webSongs = await _service.SearchPleer(title, artist, album).ConfigureAwait(false); break; case Mp3Provider.Netease: webSongs = await _service.SearchNetease(title, artist, album).ConfigureAwait(false); break; case Mp3Provider.Mp3Clan: webSongs = await _service.SearchMp3Clan(title, artist, album).ConfigureAwait(false); break; case Mp3Provider.Meile: webSongs = await _service.SearchMeile(title, artist, album).ConfigureAwait(false); break; case Mp3Provider.Mp3Truck: webSongs = await _service.SearchMp3Truck(title, artist, album).ConfigureAwait(false); break; case Mp3Provider.Songily: webSongs = await _service.SearchSongily(title, artist, album).ConfigureAwait(false); break; case Mp3Provider.SoundCloud: webSongs = await _service.SearchSoundCloud(title, artist, album).ConfigureAwait(false); break; case Mp3Provider.Mp3Skull: webSongs = await _service.SearchMp3Skull(title, artist, album).ConfigureAwait(false); break; case Mp3Provider.YouTube: webSongs = await _service.SearchYoutube(title, artist, album).ConfigureAwait(false); break; } if (webSongs != null) { var song = webSongs.FirstOrDefault(p => p.IsBestMatch); if (song != null) { return(song.AudioUrl); } song = webSongs.FirstOrDefault(p => p.IsMatch && !p.IsLinkDeath); if (song != null) { return(song.AudioUrl); } } return(null); }
public async Task<string> GetMatch(Mp3Provider provider, string title, string artist, string album = null) { var webSongs = new List<WebSong>(); switch (provider) { case Mp3Provider.ProstoPleer: webSongs = await _service.SearchPleer(title, artist, album).ConfigureAwait(false); break; case Mp3Provider.Netease: webSongs = await _service.SearchNetease(title, artist, album).ConfigureAwait(false); break; case Mp3Provider.Mp3Clan: webSongs = await _service.SearchMp3Clan(title, artist, album).ConfigureAwait(false); break; case Mp3Provider.Meile: webSongs = await _service.SearchMeile(title, artist, album).ConfigureAwait(false); break; case Mp3Provider.Mp3Truck: webSongs = await _service.SearchMp3Truck(title, artist, album).ConfigureAwait(false); break; case Mp3Provider.Songily: webSongs = await _service.SearchSongily(title, artist, album).ConfigureAwait(false); break; case Mp3Provider.SoundCloud: webSongs = await _service.SearchSoundCloud(title, artist, album).ConfigureAwait(false); break; case Mp3Provider.Mp3Skull: webSongs = await _service.SearchMp3Skull(title, artist, album).ConfigureAwait(false); break; case Mp3Provider.YouTube: webSongs = await _service.SearchYoutube(title, artist, album).ConfigureAwait(false); break; } if (webSongs != null) { var song = webSongs.FirstOrDefault(p => p.IsBestMatch); if (song != null) return song.AudioUrl; song = webSongs.FirstOrDefault(p => p.IsMatch && !p.IsLinkDeath); if (song != null) return song.AudioUrl; } return null; }