// 获取输出文件名
        public static string GetOutputName(SongVO songVO, SearchInfo searchInfo)
        {
            switch (searchInfo.OutputFileNameType)
            {
            case OUTPUT_FILENAME_TYPE_ENUM.NAME_SINGER:
                return(songVO.Name + " - " + songVO.Singer);

            case OUTPUT_FILENAME_TYPE_ENUM.SINGER_NAME:
                return(songVO.Singer + " - " + songVO.Name);

            case OUTPUT_FILENAME_TYPE_ENUM.NAME:
                return(songVO.Name);

            default:
                return("");
            }
        }
        // 获取歌曲基本信息
        public static SongVO GetSongVO(SongUrls songUrls, DetailResult detailResult, out string errorMsg)
        {
            SongVO vo = new SongVO();

            if (songUrls == null)
            {
                errorMsg = ErrorMsg.SONG_NOT_EXIST;
                return(vo);
            }
            if (detailResult == null)
            {
                errorMsg = ErrorMsg.LRC_NOT_EXIST;
                return(vo);
            }

            try
            {
                if (songUrls.Code == 200)
                {
                    vo.Links = songUrls.Data[0].Url;
                }
                if (detailResult.Code == 200)
                {
                    Song[] songArray = detailResult.Songs;
                    if (songArray == null || songArray.Length == 0)
                    {
                        errorMsg = ErrorMsg.SONG_NOT_EXIST;
                        return(vo);
                    }

                    Song song = songArray[0];
                    vo.Name   = song.Name;
                    vo.Singer = ContractSinger(song.Ar);
                    vo.Album  = song.Al.Name;
                }
                errorMsg = ErrorMsg.SUCCESS;
            }
            catch (Exception ew)
            {
                errorMsg = ew.Message;
                Console.WriteLine(ew);
            }

            return(vo);
        }
示例#3
0
 public SaveVO(string songId, SongVO songVO, LyricVO lyricVO)
 {
     this.songId  = songId;
     this.songVO  = songVO;
     this.lyricVO = lyricVO;
 }