예제 #1
0
 /// <summary>
 /// 获取歌曲对象(适合歌手兆赫或者专辑兆赫)
 /// </summary>
 /// <param name="searchedSong">搜索到的歌曲</param>
 /// <returns>歌曲对象</returns>
 public static SongEntity GetSongEntity(SearchedSongEntity searchedSong)
 {
     MoreInfoEntity moreInfo = GetMoreInfo(searchedSong.SongID.ToString());
     if (moreInfo == null || moreInfo.Albums.Count == 0)
         return null;
     SongEntity song = new SongEntity();
     string albumPath = searchedSong.Album.AlbumPath;
     song.AlbumID = albumPath.Substring(32, albumPath.Length - 33);
     song.AlbumName = searchedSong.Album.AlbumName;
     song.AlbumPath = albumPath;
     song.AlbumPicture = moreInfo.Albums[0].AlbumPicture.Replace("spic","lpic");
     song.Company = moreInfo.Albums[0].Publisher;
     song.IsLiked = "0";
     song.PublishTime = moreInfo.Albums[0].PublishDate.Substring(0,4);
     song.RatingScore = double.Parse(moreInfo.AlbumRating);
     song.SingerName = searchedSong.SingerName;
     song.SongID = searchedSong.SongID.ToString();
     song.Kbps = "64";
     song.SongName = searchedSong.SongName;
     song.SongUrl = searchedSong.SongUrl;
     song.Ssid = string.Empty;
     song.SubType = string.Empty;
     song.Lyrics = LyricTrans(moreInfo.Lyric);
     return song;
 }
예제 #2
0
 /// <summary>
 /// 自然结束
 /// </summary>
 /// <param name="channelID">兆赫ID号</param>
 /// <param name="songID">歌曲ID号</param>
 /// <param name="songPT">结束时歌曲进度,为歌曲总长度(单位:0.1秒)</param>
 public void NaturalEnd(int channelID, string songID, double songPT)
 {
     GetPlaylistResult result = GetNormalPlayList(channelID, "e", songID, songPT);
     currentSong = playList.Dequeue();
     LoadMore(channelID, songID, songPT);
     isPlayListChanged = true;
     isCurrentSongChanged = true;
 }
예제 #3
0
 /// <summary>
 /// 获取歌曲歌词(适合NormalFM来获取歌词)
 /// </summary>
 /// <param name="song">歌曲对象</param>
 public void GetLyric(ref SongEntity song)
 {
     MoreInfoEntity moreInfo = GetMoreInfo(song.SongID);
     if (moreInfo == null)
         return;
     string lyricString = moreInfo.Lyric;
     if (string.IsNullOrEmpty(lyricString))
         return;
     song.Lyrics = LyricTrans(lyricString);
 }
예제 #4
0
 /// <summary>
 /// 加载新的播放列表,适用于刚启动或者切换兆赫
 /// </summary>
 /// <param name="channelID">兆赫ID号</param>
 /// <param name="songID">歌曲ID号</param>
 /// <param name="SongPT">加红心时歌曲进度(单位:0.1秒)</param>
 public void GetNewPlayList(int channelID, string songID = "", double SongPT = 0.0)
 {
     GetPlaylistResult result = GetNormalPlayList(channelID, "n", songID, SongPT);
     if (result == null || result.R != 0 || result.Songs.Count == 0)
     {
         isPlayListLoadFailed = true;
         return;
     }
     playList.Clear();
     foreach (SongEntity song in result.Songs)
     {
         if(song.SubType != "T")
             playList.Enqueue(song);
     }
     currentSong = playList.Dequeue();
     LoadMore(channelID, string.Empty, 0.0);
     isPlayListChanged = true;
     isCurrentSongChanged = true;
 }
예제 #5
0
 /// <summary>
 /// 判断播放列表是否为空
 /// </summary>
 private void EmptyCheck()
 {
     if (playList.Count == 0)
     {
         isPlayListEmpty = true;
     }
     else
     {
         currentSong = playList.Dequeue();
         isPlayListChanged = true;
         isCurrentSongChanged = true;
     }
 }
예제 #6
0
 /// <summary>
 /// 获取歌曲歌词(适合NormalFM来获取歌词)
 /// </summary>
 /// <param name="song">歌曲对象</param>
 public void GetLyric(ref Entities.Song.SongEntity song)
 {
     moreInfoAPI.GetLyric(ref song);
 }
예제 #7
0
 /// <summary>
 /// 不再播放/跳过该曲操作
 /// </summary>
 /// <param name="channelID">兆赫ID号</param>
 /// <param name="songID">歌曲ID号</param>
 /// <param name="songPT">结束时歌曲进度,为歌曲总长度(单位:0.1秒)</param>
 /// <param name="ban">操作标志,true为不再播放操作,false为跳过该曲操作</param>
 private void BanOrSkip(int channelID, string songID, double songPT, bool ban)
 {
     GetPlaylistResult result = GetNormalPlayList(channelID, ban ? "b" : "s", songID, songPT);
     if (result == null || result.R != 0)
     {
         System.Diagnostics.Debug.WriteLine(ban ? "标记不再播放失败!" : "跳过该曲失败!");
         return;
     }
     else if (result.Songs.Count == 0)
     {
         currentSong = playList.Dequeue();
         LoadMore(channelID, songID, songPT);
     }
     else
     {
         playList.Clear();
         foreach (SongEntity song in result.Songs)
         {
             if (song.SubType != "T")
                 playList.Enqueue(song);
         }
         currentSong = playList.Dequeue();
         LoadMore(channelID, songID, songPT);
     }
     isPlayListChanged = true;
     isCurrentSongChanged = true;
 }