Пример #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));
        }
Пример #2
0
        public static XmlDocument SearchLrc(string singer, string title)
        {
            singer = singer.ToLower().Replace(" ", "").Replace("'", "");
            title  = title.ToLower().Replace(" ", "").Replace("'", "");


            string[] CharToDelete =
            { "`", "~",  "!", "@", "#", "$", "%",
              "^", "&",  "*", "(", ")", "-", "_", "=",
              "+", ",",  "<", ".", ">", "/", "?", ";",
              ":", "\"", "[", "{", "]", "}", "\\","|", "€",
              " ", "。",  ",", "、", ";", ":", "?", "!", "…", "—",  "·",
              "ˉ", "¨",  "‘", "’", "“", "”", "々", "~", "‖", "∶",  ""","'",
              "`", "|",  "〃", "〔", "〕", "〈", "〉", "《", "》", "「",  "」",
              "『", "』",  ".", "〖", "〗", "【", "】", "(", ")", "[",  "]",
              "{", "}",  "≈", "≡", "≠", "=", "≤", "≥", "<", ">",  "≮","≯", "∷",  "±",
              "+", "-",  "×", "÷", "/", "∫", "∮", "∝", "∞", "∧",  "∨","∑", "∏",  "∪",
              "∩", "∈",  "∵", "∴", "⊥", "∥", "∠", "⌒", "⊙", "≌",  "∽","√", "§",  "№",
              "☆", "★",  "○", "●", "◎", "◇", "◆", "□", "℃", "‰",  "■","△", "▲",  "※","→",
              "←", "↑",  "↓", "〓", "¤", "°", "#", "&", "@", "\",  "︿","_", " ̄",  "―",
              "♂", "♀",  "Ⅰ", "Ⅱ", "Ⅲ", "Ⅳ", "Ⅴ", "Ⅵ", "Ⅶ", "Ⅷ",  "Ⅸ","Ⅹ", "Ⅺ",
              "Ⅻ", "⒈",  "⒉", "⒊", "⒋", "⒌", "⒍", "⒎", "⒏", "⒐",  "⒑","⒒", "⒓",
              "⒔", "⒕",  "⒖", "⒗", "⒘", "⒙", "⒚", "⒛", "㈠", "㈡",  "㈢","㈣", "㈤",
              "㈥", "㈦",  "㈧", "㈨", "㈩", "①", "②", "③", "④", "⑤",  "⑥","⑦", "⑧",  "⑨","⑩",
              "⑴", "⑵",  "⑶", "⑷", "⑸", "⑹", "⑺", "⑻", "⑼", "⑽",  "⑾","⑿", "⒀",
              "⒁", "⒂",  "⒃", "⒄", "⒅", "⒆", "⒇", "┌", "┍", "┎",  "┏","┐", "┑",  "┒",
              "┓", "─",  "┄", "┈", "└", "┕", "┖", "┗", "┘", "┙",  "┚","┛", "━",  "┅","┉",
              "├", "┝",  "┞", "┟", "┠", "┡", "┢", "┣", "│", "┆",  "┊","┤", "┥",  "┦","┧", "┨",
              "┩", "┪",  "┫", "┃", "┇", "┋", "┬", "┭", "┮", "┯",  "┰","┱", "┲",  "┳","┴", "┵",
              "┶", "┷",  "┸", "┹", "┺", "┻", "┼", "┽", "┾", "┿",  "╀","╁", "╂",  "╃","╄", "╅",
              "╆", "╇",  "╈", "╉", "╊", "╋", "\"","-" };

            for (int i = 0; i < CharToDelete.Length; i++)
            {
                singer = singer.Replace(CharToDelete[i], "");
                title  = title.Replace(CharToDelete[i], "");
            }
            string x = RequestALink(string.Format(SearchPath,
                                                  EncodeHelper.ToQianQianHexString(singer, Encoding.Unicode),
                                                  EncodeHelper.ToQianQianHexString(title, Encoding.Unicode)));
            XmlDocument xml = new XmlDocument();

            try
            {
                xml.LoadXml(x);
            }
            catch (Exception)
            {
            }
            return(xml);
        }
Пример #3
0
        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);
        }
Пример #4
0
        public XmlDocument SearchLrc(string singer, string title)
        {
            singer = singer.ToLower().Replace(" ", "").Replace("'", "");
            title  = title.ToLower().Replace(" ", "").Replace("'", "");
            string x = RequestALink(string.Format(SearchPath,
                                                  EncodeHelper.ToQianQianHexString(singer, Encoding.Unicode),
                                                  EncodeHelper.ToQianQianHexString(title, Encoding.Unicode)));
            XmlDocument xml = new XmlDocument();

            try {
                xml.LoadXml(x);
            } catch (Exception) {
            }
            return(xml);
        }
Пример #5
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);
        }