示例#1
0
        /// <summary>
        /// 插入专辑-歌曲表
        /// </summary>
        /// <param name="albumSongInfo"></param>
        /// <param name="songNameList"></param>
        /// <returns></returns>
        public int InsertAlbumSong(AlbumSongInfo albumSongInfo)
        {
            int result = 0;

            try
            {
                for (int i = 0; i < albumSongInfo.SongNameList.Count; i++)
                {
                    SqlParameter[] parms = new SqlParameter[] {
                        new  SqlParameter("spiderTimeId", SpiderTimeInfo.SpiderTimeId),
                        new  SqlParameter("songName", albumSongInfo.SongNameList[i]),
                        new SqlParameter("xm_songid", albumSongInfo.XM_SongIdList[i]),
                        new  SqlParameter("songLanguage", albumSongInfo.SongLanguage),
                        new  SqlParameter("oriRightsHolder", albumSongInfo.OriRightsHolder),
                        new  SqlParameter("publishDate", albumSongInfo.PublishDate),
                        new  SqlParameter("fromPage", ModelArgs.FromPage),
                        new  SqlParameter("lyricTxt", albumSongInfo.LyricTxt),
                        new  SqlParameter("albumId", albumSongInfo.AlbumInfo.AlbumId),
                        new  SqlParameter("singerId", albumSongInfo.SingerInfo.SingerId)
                    };
                    result += HelperSQL.ExecNonQuery("usp_XM_Insert_XM_AlbumSong", parms, CommandType.StoredProcedure);
                }

                return(result);
            }
            catch (Exception ex)
            {
                LogNet.LogBLL.Error("InsertAlbumSong", ex);
                return(0);
            }
        }
示例#2
0
        /// <summary>
        /// 得到一个专辑下面的所有的个歌曲
        /// </summary>
        /// <param name="albunNameUrl"> /album/519075 专辑相对Url路径</param>
        /// <returns></returns>
        public bool GetOneAlbumAllSong(string strUrl)
        {
            Thread.Sleep(AlbumStartArgsInfo.DelayTime);

            string strHtmlContent = HttpHelper.Open(strUrl, Encoding.GetEncoding("UTF-8"));

            strHtmlContent = strHtmlContent.Replace("\r\n", "").Replace("\r", "").Replace("\n", "");
            if (strHtmlContent.Equals(string.Empty))
            {
                return(true);
            }
            try
            {
                List <string> XM_SongIdList = new List <string>();

                List <string> SongNameList = GetAlbum_SongName(strHtmlContent, ref XM_SongIdList);

                AlbumSongInfo albumSongInfo = GetAlbumSongInfo(strHtmlContent);


                //http://www.xiami.com/album/70909
                albumSongInfo.AlbumInfo.AlbumXmId = CommonHelper.GetMatchRegex(strUrl, "http://www.xiami.com/album/(\\d+)").Replace("http://www.xiami.com/album/", "");

                foreach (string songname in SongNameList)
                {
                    if (songname.Contains("套广播体操"))
                    {
                        return(false);
                    }
                }
                //得到AlbumId
                albumSongInfo.AlbumInfo.AlbumId = sqlExecute.GetAlbumId(albumSongInfo.AlbumInfo);
                //得到歌手ID
                albumSongInfo.SingerInfo.SingerId = sqlExecute.GetSingerId(albumSongInfo.SingerInfo);

                if (albumSongInfo.AlbumInfo.AlbumId > 0 && albumSongInfo.SingerInfo.SingerId > 0)
                {
                    if (SongNameList.Count > 0)
                    {
                        albumSongInfo.SongNameList  = SongNameList;
                        albumSongInfo.XM_SongIdList = XM_SongIdList;
                        sqlExecute.InsertAlbumSong(albumSongInfo);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                LogNet.LogBLL.Info("GetOneAlbumAllSong", ex);
                return(true);
            }
        }
示例#3
0
        /// <summary>
        /// 得到专辑歌曲 的基本信息,包括 艺人,语种,唱片公司,发行时间
        /// </summary>
        /// <param name="strHtmlContent"></param>
        /// <returns></returns>
        public AlbumSongInfo GetAlbumSongInfo(string strHtmlContent)
        {
            AlbumSongInfo albumSongInfo = new AlbumSongInfo();

            try
            {
                AlbumInfo  albumInfo  = new AlbumInfo();
                SingerInfo singerInfo = new SingerInfo();
                string     pattern    = "";
                pattern = "<h1 property=\"v:item(.+?)</h1>";
                string matchResult = CommonHelper.GetMatchRegex(pattern, strHtmlContent);
                albumInfo.AlbumName = CommonHelper.NoHTML(matchResult);

                albumInfo.AlbumSinger = CommonHelper.GetMatchRegex("艺人:</td>(.+?)</tr>", strHtmlContent, "<a(.+?)</a>");
                albumInfo.AlbumSinger = CommonHelper.NoHTML(albumInfo.AlbumSinger);//href="/artist/111382">洪佳琦

                /*----------虾米 艺人介绍----------------------------------------------------------------------*/
                singerInfo.SingerXmId = CommonHelper.GetMatchRegex("艺人:</td>(.+?)</tr>", strHtmlContent, "<a href=\"/artist/(\\d+)");
                singerInfo.SingerXmId = singerInfo.SingerXmId.Replace("<a href=\"/artist/", "");
                // 进入歌手 信息 得到 歌手的 档案,和地区
                singerInfo = GetSingerInfoBySingerXmId(singerInfo.SingerXmId);

                albumInfo.AlbumDesc = CommonHelper.GetMatchRegex("专辑介绍(.+?)album_intro_toggle\">", strHtmlContent);
                albumInfo.AlbumDesc = CommonHelper.NoHTML(albumInfo.AlbumDesc).Replace("专辑介绍:", "").Replace("\"", "");

                /*----------专辑类别,专辑风格----------------------------------------------------------------------*/

                albumInfo.AlbumStyle = CommonHelper.NoHTML(CommonHelper.GetMatchRegex("专辑风格:</td>(.+?)</tr>", strHtmlContent));
                albumInfo.AlbumStyle = Regex.Replace(albumInfo.AlbumStyle, "\\t", "").Replace("专辑风格:", "");;


                albumInfo.AlbumType = CommonHelper.NoHTML(CommonHelper.GetMatchRegex("专辑类别:</td>(.+?)</tr>", strHtmlContent));
                albumInfo.AlbumType = Regex.Replace(albumInfo.AlbumType, "\\t", "").Replace("专辑类别:", "");

                albumSongInfo.AlbumInfo = albumInfo;

                //得到歌手
                singerInfo.SingerName    = albumInfo.AlbumSinger;
                albumSongInfo.SingerInfo = singerInfo;

                albumSongInfo.SongLanguage = CommonHelper.GetMatchRegex(">语种:</td>(.+?)</td>", strHtmlContent, "<td(.+?)</td>");
                albumSongInfo.SongLanguage = CommonHelper.NoHTML(albumSongInfo.SongLanguage);

                albumSongInfo.OriRightsHolder = CommonHelper.GetMatchRegex(">唱片公司:</td>(.+?)</td>", strHtmlContent, "<td(.+?)</td>");
                albumSongInfo.OriRightsHolder = CommonHelper.NoHTML(albumSongInfo.OriRightsHolder);

                string pubsishDate = CommonHelper.GetMatchRegex(">发行时间:</td>(.+?)</td>", strHtmlContent, "<td(.+?)</td>");

                pubsishDate = CommonHelper.NoHTML(pubsishDate);
                DateTime dtime = new DateTime(2010, 1, 1);
                DateTime.TryParse(pubsishDate, out dtime);
                albumSongInfo.PublishDate = dtime;


                return(albumSongInfo);
            }
            catch (Exception ex)
            {
                LogNet.LogBLL.Info("GetAlbumSongInfo", ex);
                return(null);
            }
        }