コード例 #1
0
 public GetItemRetryApr(string lvid, McsProto.DataMessageStanza lresp, AppPushReceiver pr)
 {
     this.lvid  = lvid;
     this.lresp = lresp;
     this.pr    = pr;
 }
コード例 #2
0
        public List <RssItem> getNicoCasItem(string lvid, McsProto.DataMessageStanza msg)
        {
            try
            {
                string   title, thumbnail, comName, hostName, description;
                DateTime dt = util.getUnixToDatetime(msg.Sent / 1000);
                if (dt < startTime || dt < DateTime.Now - TimeSpan.FromMinutes(10))
                {
                    return(null);
                }
                hostName = "";

                var hg = new namaichi.rec.HosoInfoGetter();
                var r  = hg.get(lvid, check.container);

                var d = "";
                foreach (var a in msg.AppDatas)
                {
                    d += a.Value;
                }
                var  appData = d;
                bool isCom;
                if (!r)
                {
                    check.form.addLogText("スマホプッシュ通知から取得した放送のページが取得できませんでした " + lvid);
                    util.debugWriteLine("app push page error !r " + lvid);
                    return(null);

                    hg.description = hg.userId = hg.communityId = hg.thumbnail = "";
                    hg.tags        = new String[] { };


                    if (appData.IndexOf("\"user_id\\\":") > -1)
                    {
                        hostName = util.getRegGroup(appData, "user_name\\\\\":\\\\\"(.+?)\\\\\"");
                        isCom    = true;
                        comName  = "";
                    }
                    else
                    {
                        //reg = new Regex("\\[生放送開始\\](.+?)「(.+?)」を開始しました。");
                        //m = reg.Match(msg.AppData.ToString());
                        comName  = util.getRegGroup(appData, "channel_name\\\\\":\\\\\"(.+?)\\\\\"");
                        isCom    = false;
                        hostName = "";
                    }
                    title = util.getRegGroup(appData, "program_title\\\\\":\\\\\"(.+?)\\\\\"");
                }
                else
                {
                    if (hg.type == "community" || hg.type == "user")
                    {
                        //var reg = new Regex("\\[生放送開始\\](.+?)さんが「(.+?)」を開始しました。");
                        //var m = reg.Match(msg.AppData.ToString());
                        //hostName = util.getRegGroup(appData, "user_name\\\\\":\\\\\"(.+?)\\\\\"");
                        hostName = util.getRegGroup(appData, "user_name\":\"(.+?)\"");
                        comName  = (hg.group != null) ? hg.group : "";
                        isCom    = true;
                    }
                    else
                    {
                        //var reg = new Regex("\\[生放送開始\\](.+?)「(.+?)」を開始しました。");
                        //var m = reg.Match(msg.AppData.ToString());
                        //comName = util.getRegGroup(appData, "channel_name\\\\\":\\\\\"(.+?)\\\\\"");
                        comName = util.getRegGroup(appData, "channel_name\":\"(.+?)\"");
                        //comId = util.getRegGroup(appData, "channel_id\\\\\":\\\\\"(.+?)\\\\\"");
                        isCom = false;
                        if (!string.IsNullOrEmpty(hg.userName))
                        {
                            hostName = hg.userName;
                        }
                    }
                    //title = util.getRegGroup(appData, "program_title\\\\\":\\\\\"(.+?)\\\\\"");
                    title = util.getRegGroup(appData, "program_title\":\"(.+?)\"");
                }


                util.debugWriteLine("description " + hg.description);
                util.debugWriteLine("userId " + hg.userId);
                util.debugWriteLine("userName " + hostName);
                util.debugWriteLine("comName " + comName);
                //thumbnail = "";

                if (title == null || lvid == null || hg.thumbnail == null ||
                    dt == DateTime.MinValue || comName == null || hg.communityId == null ||
                    hg.tags == null || hg.description == null ||
                    (isCom && (hostName == null || hg.userId == null)))
                {
                    check.form.addLogText("app push error " + msg);
                    util.debugWriteLine("app push error nullinfo " + msg);
                    return(null);
                }

                var i = new RssItem(title, lvid, dt.ToString(), hg.description, comName, hg.communityId, hostName, hg.thumbnail, hg.isMemberOnly.ToString(), "");
                i.setUserId(hg.userId);
                i.setTag(hg.tags);
                i.category = hg.category;
                i.type     = hg.type;
                var ret = new List <RssItem>();
                ret.Add(i);
                return(ret);
            }
            catch (Exception e)
            {
                util.debugWriteLine("app push getitem error " + e.Message + e.Source + e.StackTrace + e.TargetSite);
                return(null);
            }
        }