CreateQianQianCode() public static méthode

public static CreateQianQianCode ( string singer, string title, int lrcId ) : string
singer string
title string
lrcId int
Résultat string
Exemple #1
0
        public static string DownloadLRCLite(int sLrcId, string xSinger, string xTitle)
        {
            string temp = string.Format(DownloadPath, sLrcId,
                                        EncodeHelper.CreateQianQianCode(xSinger, xTitle, sLrcId));

            return(RequestALink(temp));
        }
        public string DownloadLrc(string singer, string title)
        {
            this.currentSong = null;
            XmlDocument xml    = SearchLrc(singer, title);
            string      retStr = "没有找到该歌词";

            if (xml == null)
            {
                return(retStr);
            }

            XmlNodeList list = xml.SelectNodes("/result/lrc");

            if (list.Count > 0)
            {
                this.OnSelectSong(list);
                if (this.currentSong == null)
                {
                    this.currentSong = list[0];
                }
            }
            else if (list.Count == 1)
            {
                this.currentSong = list[0];
            }
            else
            {
                return(retStr);
            }
            if (this.currentSong == null)
            {
                return(retStr);
            }

            XmlNode node  = this.currentSong;
            int     lrcId = -1;

            if (node != null && node.Attributes != null && node.Attributes["id"] != null)
            {
                string sLrcId = node.Attributes["id"].Value;
                if (int.TryParse(sLrcId, out lrcId))
                {
                    string xSinger = node.Attributes["artist"].Value;
                    string xTitle  = node.Attributes["title"].Value;
                    retStr = RequestALink(string.Format(DownloadPath, lrcId,
                                                        EncodeHelper.CreateQianQianCode(xSinger, xTitle, lrcId)));
                }
            }
            return(retStr);
        }
Exemple #3
0
        public static string DownloadLrc(string singer, string title)
        {
            XmlDocument xml    = SearchLrc(singer, title);
            string      retStr = null;

            if (xml == null)
            {
                return(retStr);
            }

            XmlNodeList list = xml.SelectNodes("/result/lrc");

            if (list.Count > 0)
            {
                int    sLrcId = -1;
                string xSinger = null, xTitle = null;
                foreach (XmlNode node in list)
                {
                    if (node != null && node.Attributes != null && node.Attributes["id"] != null)
                    {
                        int lrcId = -1;
                        if (int.TryParse(node.Attributes["id"].Value, out lrcId))
                        {
                            //优先选择双语对照、中文与其他语言对照的版本
                            //这里可以写更多的artificial intelligence
                            if (sLrcId == -1 ||
                                node.Attributes["artist"].Value.IndexOf("中") > 0 ||
                                node.Attributes["artist"].Value.IndexOf("双") > 0)
                            {
                                sLrcId  = lrcId;
                                xSinger = node.Attributes["artist"].Value;
                                xTitle  = node.Attributes["title"].Value;
                            }
                        }
                    }
                }

                if (sLrcId > -1)
                {
                    string temp = string.Format(DownloadPath, sLrcId,
                                                EncodeHelper.CreateQianQianCode(xSinger, xTitle, sLrcId));
                    retStr = RequestALink(temp);
                }
            }
            return(retStr);
        }