private LyricVO RequestLyricVO(long songId, SearchInfo searchInfo, out string errorMsg) { LyricResult lyricResult = api.GetLyric(songId); return(NeteaseMusicUtils.GetLyricVO(lyricResult, searchInfo, out errorMsg)); }
private async void AlbumSongList_CurrentItemChanged(MediaPlaybackList sender, CurrentMediaPlaybackItemChangedEventArgs args) { if (MediaPlayList.AlbumSongList.CurrentItemIndex == 4294967295) { return; } await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { BackBlurBrush.Amount = 0; BackBlurTicker.Start(); LrcControl.c_lrc_items.Children.Clear(); if (MusicPage.ThisPage.MediaControl.MediaPlayer.Source == MediaPlayList.AlbumSongList) { try { RollTicker.Start(); } catch (Exception) { } SearchSingleMusic PL = MediaPlayList.AlbumSongBackup[Convert.ToInt32(MediaPlayList.AlbumSongList.CurrentItemIndex)]; Title.Text = PL.MusicName; var SongSearchResult = await NetEaseMusic.SearchAsync <SingleMusicSearchResult>(PL.MusicName, 5, 0, NeteaseMusicAPI.SearchType.Song); foreach (var Song in SongSearchResult.Result.Songs.Where(Song => Song.Name == PL.MusicName && Song.Ar[0].Name == PL.Artist && Song.Al.Name == PL.Album).Select(Song => Song)) { var bitmap = new BitmapImage(); Image1.ImageSource = bitmap; bitmap.UriSource = new Uri(Song.Al.PicUrl); break; } GridBack.Background = new ImageBrush { ImageSource = Image1.ImageSource, Stretch = Stretch.UniformToFill }; LyricResult LrcTemp = await NetEaseMusic.GetLyricAsync(PL.SongID[0]); if (LrcTemp.Lrc == null) { TextBlock TB = new TextBlock() { Text = "纯音乐,无歌词", FontSize = 18 }; LrcControl.c_lrc_items.Children.Add(TB); RollTicker.Stop(); } else { LrcControl.LoadLrc(LrcTemp.Lrc.Lyric, LrcTemp.Tlyric.Lyric); } } else { try { RollTicker.Start(); } catch (Exception) { } var bitmap = new BitmapImage(); Image1.ImageSource = bitmap; bitmap.UriSource = new Uri(MusicSearch.ForDetail_ImageURL); GridBack.Background = new ImageBrush { ImageSource = Image1.ImageSource, Stretch = Stretch.UniformToFill }; Title.Text = MusicSearch.ForDetail_Name; LyricResult LrcTemp = await NetEaseMusic.GetLyricAsync(MusicSearch.ForDetail_ID); if (LrcTemp.Lrc == null) { TextBlock TB = new TextBlock() { Text = "纯音乐,无歌词", FontSize = 18 }; LrcControl.c_lrc_items.Children.Add(TB); RollTicker.Stop(); } else { LrcControl.LoadLrc(LrcTemp.Lrc.Lyric, LrcTemp.Tlyric.Lyric); } } }); }
private async void MediaList_CurrentItemChanged(MediaPlaybackList sender, CurrentMediaPlaybackItemChangedEventArgs args) { if (MediaPlayList.FavouriteSongList.CurrentItemIndex == 4294967295) { return; } await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { BackBlurBrush.Amount = 0; BackBlurTicker.Start(); LrcControl.c_lrc_items.Children.Clear(); if (MusicPage.ThisPage.MediaControl.MediaPlayer.Source == MediaPlayList.FavouriteSongList) { try { RollTicker.Start(); } catch (Exception) { } PlayList PL = MusicList.ThisPage.FavouriteMusicCollection[Convert.ToInt32(MediaPlayList.FavouriteSongList.CurrentItemIndex)]; Title.Text = PL.Music; var bitmap = new BitmapImage(); Image1.ImageSource = bitmap; bitmap.UriSource = new Uri(PL.ImageUrl); GridBack.Background = new ImageBrush { ImageSource = Image1.ImageSource, Stretch = Stretch.UniformToFill }; LyricResult LrcTemp = await NetEaseMusic.GetLyricAsync(PL.SongID); if (LrcTemp.Lrc == null) { TextBlock TB = new TextBlock() { Text = "纯音乐,无歌词", FontSize = 18 }; LrcControl.c_lrc_items.Children.Add(TB); RollTicker.Stop(); } else { LrcControl.LoadLrc(LrcTemp.Lrc.Lyric, LrcTemp.Tlyric.Lyric); } } else { try { RollTicker.Start(); } catch (Exception) { } var bitmap = new BitmapImage(); Image1.ImageSource = bitmap; bitmap.UriSource = new Uri(MusicSearch.ForDetail_ImageURL); GridBack.Background = new ImageBrush { ImageSource = Image1.ImageSource, Stretch = Stretch.UniformToFill }; Title.Text = MusicSearch.ForDetail_Name; LyricResult LrcTemp = await NetEaseMusic.GetLyricAsync(MusicSearch.ForDetail_ID); if (LrcTemp.Lrc == null) { TextBlock TB = new TextBlock() { Text = "纯音乐,无歌词", FontSize = 18 }; LrcControl.c_lrc_items.Children.Add(TB); RollTicker.Stop(); } else { LrcControl.LoadLrc(LrcTemp.Lrc.Lyric, LrcTemp.Tlyric.Lyric); } } }); }
private async void MusicDetail_Loaded(object sender, RoutedEventArgs e) { if (MusicPage.ThisPage.MediaControl.MediaPlayer.Source == MediaPlayList.FavouriteSongList) { PlayList PL = MusicList.ThisPage.FavouriteMusicCollection[Convert.ToInt32(MediaPlayList.FavouriteSongList.CurrentItemIndex)]; if (PL.SongID == LastSongID) { return; } else { LastSongID = PL.SongID; } LrcControl.c_lrc_items.Children.Clear(); Title.Text = PL.Music; var bitmap = new BitmapImage(); Image1.ImageSource = bitmap; bitmap.UriSource = new Uri(PL.ImageUrl); GridBack.Background = new ImageBrush { ImageSource = Image1.ImageSource, Stretch = Stretch.UniformToFill }; LyricResult LrcTemp = await NetEaseMusic.GetLyricAsync(PL.SongID); if (LrcTemp.Lrc == null) { TextBlock TB = new TextBlock() { Text = "纯音乐,无歌词", FontSize = 18 }; LrcControl.c_lrc_items.Children.Add(TB); RollTicker.Stop(); } else { LrcControl.LoadLrc(LrcTemp.Lrc.Lyric, LrcTemp.Tlyric?.Lyric); } } else if (MusicPage.ThisPage.MediaControl.MediaPlayer.Source == MediaPlayList.SingerHotSongList) { SearchSingleMusic PL = MediaPlayList.HotSongBackup[Convert.ToInt32(MediaPlayList.SingerHotSongList.CurrentItemIndex)]; if (PL.SongID[0] == LastSongID) { return; } else { LastSongID = PL.SongID[0]; } LrcControl.c_lrc_items.Children.Clear(); Title.Text = PL.MusicName; var SongSearchResult = await NetEaseMusic.SearchAsync <SingleMusicSearchResult>(PL.MusicName, 5, 0, NeteaseMusicAPI.SearchType.Song); foreach (var Song in SongSearchResult.Result.Songs.Where(Song => Song.Name == PL.MusicName && Song.Ar[0].Name == PL.Artist && Song.Al.Name == PL.Album).Select(Song => Song)) { var bitmap = new BitmapImage(); Image1.ImageSource = bitmap; bitmap.UriSource = new Uri(Song.Al.PicUrl); break; } GridBack.Background = new ImageBrush { ImageSource = Image1.ImageSource, Stretch = Stretch.UniformToFill }; LyricResult LrcTemp = await NetEaseMusic.GetLyricAsync(PL.SongID[0]); if (LrcTemp.Lrc == null) { TextBlock TB = new TextBlock() { Text = "纯音乐,无歌词", FontSize = 18 }; LrcControl.c_lrc_items.Children.Add(TB); RollTicker.Stop(); } else { LrcControl.LoadLrc(LrcTemp.Lrc.Lyric, LrcTemp.Tlyric?.Lyric); } } else if (MusicPage.ThisPage.MediaControl.MediaPlayer.Source == MediaPlayList.AlbumSongList) { SearchSingleMusic PL = MediaPlayList.AlbumSongBackup[Convert.ToInt32(MediaPlayList.AlbumSongList.CurrentItemIndex)]; if (PL.SongID[0] == LastSongID) { return; } else { LastSongID = PL.SongID[0]; } LrcControl.c_lrc_items.Children.Clear(); Title.Text = PL.MusicName; var SongSearchResult = await NetEaseMusic.SearchAsync <SingleMusicSearchResult>(PL.MusicName, 5, 0, NeteaseMusicAPI.SearchType.Song); foreach (var Song in SongSearchResult.Result.Songs.Where(Song => Song.Name == PL.MusicName && Song.Ar[0].Name == PL.Artist && Song.Al.Name == PL.Album).Select(Song => Song)) { var bitmap = new BitmapImage(); Image1.ImageSource = bitmap; bitmap.UriSource = new Uri(Song.Al.PicUrl); break; } GridBack.Background = new ImageBrush { ImageSource = Image1.ImageSource, Stretch = Stretch.UniformToFill }; LyricResult LrcTemp = await NetEaseMusic.GetLyricAsync(PL.SongID[0]); if (LrcTemp.Lrc == null) { TextBlock TB = new TextBlock() { Text = "纯音乐,无歌词", FontSize = 18 }; LrcControl.c_lrc_items.Children.Add(TB); RollTicker.Stop(); } else { LrcControl.LoadLrc(LrcTemp.Lrc.Lyric, LrcTemp.Tlyric?.Lyric); } } else { var bitmap = new BitmapImage(); Image1.ImageSource = bitmap; bitmap.UriSource = new Uri(MusicSearch.ForDetail_ImageURL); GridBack.Background = new ImageBrush { ImageSource = Image1.ImageSource, Stretch = Stretch.UniformToFill }; if (MusicSearch.ForDetail_ID == LastSongID) { return; } else { LastSongID = MusicSearch.ForDetail_ID; } LrcControl.c_lrc_items.Children.Clear(); Title.Text = MusicSearch.ForDetail_Name; LyricResult LrcTemp = await NetEaseMusic.GetLyricAsync(MusicSearch.ForDetail_ID); if (LrcTemp.Lrc == null) { TextBlock TB = new TextBlock() { Text = "纯音乐,无歌词", FontSize = 18 }; LrcControl.c_lrc_items.Children.Add(TB); RollTicker.Stop(); } else { LrcControl.LoadLrc(LrcTemp.Lrc.Lyric, LrcTemp.Tlyric?.Lyric); } }; }