protected override string GetLyricById(string copyrightId)
        {
            LyricInfo lyric = null;

            try
            {
                lyric = _GetLyric(copyrightId);
            }
            catch (Exception Ex)
            {
                Log($"获取歌词失败了喵:{Ex.Message}");
            }
            return(lyric?.GetLyricText());
        }
Ejemplo n.º 2
0
        protected override string GetLyric(SongItem songItem)
        {
            LyricInfo lyric = null;

            try
            {
                lyric = _GetLyric(Convert.ToString(songItem.SongId));
            }
            catch (Exception Ex)
            {
                Log($"获取歌词失败了喵:{Ex.Message}");
            }
            return(lyric?.GetLyricText());
        }
        protected override string GetLyric(SongItem songItem)
        {
            LyricInfo lyric = null;

            try
            {
                lyric = _GetLyric(songItem.SongId);
            }
            catch (WebException e)
            {
                Log($"获取歌词失败了喵:{e.Message}\r\n这是由于网络原因导致获取失败, 如果多次出现, 请检查你的网络连接喵。");
            }
            catch (Exception e)
            {
                Log($"获取歌词失败了喵:{e.Message}");
            }
            return(lyric?.GetLyricText());
        }
        protected override string GetLyricById(string Id, string albumId = "")
        {
            long      id    = long.Parse(Id);
            LyricInfo lyric = null;

            try
            {
                lyric = _GetLyric(id);
            }
            catch (WebException e)
            {
                Log($"获取歌词失败了喵:{e.Message}\r\n这是由于网络原因导致获取失败, 如果多次出现, 请检查你的网络连接喵。");
            }
            catch (Exception e)
            {
                Log($"获取歌词失败了喵:{e.Message}");
            }
            return(lyric?.GetLyricText());
        }
 protected override SongInfo Search(string keyword)
 {
     try
     {
         MiguMusic.SongInfo song  = MiguMusicApi.SearchSong(keyword);
         LyricInfo          lyric = null;
         try
         {
             lyric = _GetLyric(song.CopyrightId);
         }
         catch (Exception Ex)
         {
             Log($"获取歌词失败了喵:{Ex.Message}");
         }
         return(new SongInfo(this, song.CopyrightId, song.Name, new string[] { song.Artist }, lyric?.GetLyricText()));
     }
     catch (Exception Ex)
     {
         Log($"搜索单曲失败了喵:{Ex.Message}");
     }
     return(null);
 }
 protected override SongInfo Search(string keyword)
 {
     try
     {
         NeteaseMusic.SongInfo[] songs = MainConfig.Instance.LoginSession.LoginStatus ?
                                         NeteaseMusicApi.SearchSongs(MainConfig.Instance.LoginSession, keyword, 1) :
                                         NeteaseMusicApi.SearchSongs(keyword, 1);
         NeteaseMusic.SongInfo song = songs.FirstOrDefault();
         if (song?.CanPlay == true)
         {
             LyricInfo lyric = null;
             try
             {
                 lyric = _GetLyric(song.Id);
             }
             catch (Exception e)
             {
                 Log($"获取歌词失败了喵:{e.Message}");
             }
             return(new SongInfo(this, PlatformType.NeteaseMusic, song.Id.ToString(), song.Name, song.Artists.Select(p => p.Name).ToArray(), Convert.ToString(song.Album.Id), lyric?.GetLyricText()));
         }
         else
         {
             Log($"{song.ArtistNames} - {song.Name} : 暂无版权喵");
         }
     }
     catch (WebException e)
     {
         Log($"搜索单曲失败了喵:{e.Message}\r\n这是由于网络原因导致搜索失败, 如果多次出现, 请检查你的网络连接喵。");
     }
     catch (Exception e)
     {
         Log($"搜索单曲失败了喵:{e.Message}");
     }
     return(null);
 }