private LyricInfo _GetLyric(string copyrightId, bool useCache = true)
 {
     if (!useCache || !LyricCache.ContainsKey(copyrightId))
     {
         LyricInfo lyric = MiguMusicApi.GetLyric(copyrightId);
         LyricCache[copyrightId] = lyric;
     }
     return(LyricCache[copyrightId]);
 }
 protected override List <SongInfo> GetPlaylist(string keyword)
 {
     MiguMusic.SongInfo[] songs;
     if (long.TryParse(keyword, out long id))
     {
         songs = MiguMusicApi.GetPlaylist(id);
         return(songs.Select(p => new SongInfo(this, p.CopyrightId, p.Name, new string[] { p.Artist }, null)).ToList());
     }
     else
     {
         Log("提供的Id必须为“http://music.migu.cn/v3/music/playlist/”后边的数字喵!");
         return(new List <SongInfo>());
     }
 }
 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 string GetDownloadUrl(SongItem songInfo)
 {
     return(MiguMusicApi.GetSongUrl(songInfo.SongId));
 }
示例#5
0
 protected override string GetDownloadUrl(SongItem songItem)
 {
     return(MiguMusicApi.GetSongUrl(Convert.ToString(songItem.SongId)));
 }