Пример #1
0
        private bool isReserveAiLive(TimelineItem o, string lvid, HosoInfoGetter hig, List <AlartInfo> aiList, out RssItem ri)
        {
            string desc = "", comName = "", comId = "", hostName = "",
                   isMemberOnly = "false";
            bool isPayment      = false;

            if (hig != null)
            {
                desc         = hig.description;
                comName      = hig.group;
                comId        = hig.communityId;
                hostName     = o.actor.name;
                isMemberOnly = hig.isMemberOnly.ToString();
                isPayment    = hig.isPayment;
            }
            ri = new RssItem([email protected], lvid, hig.openDt.ToString(), desc, comName, comId, hostName, "", isMemberOnly, "", isPayment);
            if (hig != null)
            {
                ri.setUserId(hig.userId);
                ri.setTag(hig.tags);
                ri.category = hig.category;
                ri.type     = hig.type;
            }
            foreach (var ai in aiList)
            {
                if (!ai.isAutoReserve)
                {
                    continue;
                }

                var isSuccessAccess = true;
                var isAlart         = check.isAlartItem(ri, ai, out isSuccessAccess);
                if (isAlart || !isSuccessAccess)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #2
0
        public List <RssItem> getItem(string dec)
        {
            //com "{\"title\":\"すのーまんさんが生放送を開始\",\"body\":\"名作探訪録 で、「【GB】ポケットキョロちゃん【初見プレイ】」を放送\",\"icon\":\"https://secure-dcdn.cdn.nimg.jp/nicoaccount/usericon/3122/31221850.jpg?1496114222\",\"data\":{\"on_click\":\"http://live.nicovideo.jp/watch/lv318353209?from=webpush&_topic=live_user_program_onairs\",\"created_at\":\"2019-02-06T09:00:05.738+09:00\",\"ttl\":600,\"log_params\":{\"content_type\":\"live.user.program.onairs\",\"content_ids\":\"lv318353209\"}}}";
            //ch "{\"title\":\"KawaiianTVが生放送を開始\",\"body\":\"~夢アド可鈴の深堀り情報番組!?~ YUMEステーション #62\",\"icon\":\"https://secure-dcdn.cdn.nimg.jp/comch/channel-icon/128x128/ch2601967.jpg?1548247262\",\"data\":{\"on_click\":\"http://live.nicovideo.jp/watch/lv318248031?from=webpush&_topic=live_channel_program_onairs\",\"created_at\":\"2019-02-06T19:30:10.941+09:00\",\"ttl\":600,\"log_params\":{\"content_type\":\"live.channel.program.onairs\",\"content_ids\":\"lv318248031\"}}}";

            try
            {
                var    isCom = dec.IndexOf("\"content_type\":\"live.user.program.onairs\"") > -1;
                var    isJikken = dec.IndexOf("\"content_type\":\"live.user.program.cas.onairs\"") > -1;
                string title, lvid, thumbnail, dt, comName, hostName, description;
                hostName = null;

                lvid      = util.getRegGroup(dec, "\"content_ids\":\"(lv\\d+)\"");
                thumbnail = util.getRegGroup(dec, "\"icon\":\"(.+?)\"");
                dt        = util.getRegGroup(dec, "\"created_at\":\"(.+?)\"");
                if (dt != null && DateTime.Parse(dt) < startTime)
                {
                    return(null);
                }
                if (isCom || isJikken)
                {
                    title    = util.getRegGroup(dec, "\"body\":\".+? で、*「(.+?)」を放送\"");
                    comName  = util.getRegGroup(dec, "\"body\":\"(.+?) で、*「");
                    hostName = util.getRegGroup(dec, "\"title\":\"(.+?)さんが生放送(\\(実験放送\\))*を開始\"");
                }
                else
                {
                    title   = util.getRegGroup(dec, "\"body\":\"(.+?)\",\"icon\"");
                    comName = util.getRegGroup(dec, "\"title\":\"(.+?)が生放送を開始\"");
                }

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

                if (!r)
                {
                    hg.description = hg.userId = hg.communityId = "";
                    hg.tags        = new string[] { };
                    check.form.addLogText("プッシュ通知から取得した放送のページが取得できませんでした " + lvid);
                    util.debugWriteLine("push page error !r " + lvid);
                    return(null);
                }
                util.debugWriteLine("description " + hg.description);
                util.debugWriteLine("userId " + hg.userId);
                util.debugWriteLine("userName " + hostName);

                if (title == null || lvid == null || thumbnail == null ||
                    dt == null || comName == null || hg.communityId == null ||
                    hg.tags == null || hg.description == null ||
                    (isCom && (hostName == null || hg.userId == null)))
                {
                    check.form.addLogText("push error " + dec);
                    util.debugWriteLine("push error null " + dec);
                    return(null);
                }
                //				util.debugWriteLine("communityId " + hg.communityId);
                //				util.debugWriteLine("tags " + string.Join(", ", hg.tags));
                //				util.debugWriteLine("userid " + hg.userId);
                //				util.debugWriteLine("description " + hg.description);

                var i = new RssItem(title, lvid, dt, 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 ee)
            {
                util.debugWriteLine(ee.Message + ee.Source + ee.StackTrace + ee.TargetSite);
            }
            return(null);
        }
Пример #3
0
        void GetInfoFromHosoIdBtnClick(object sender, EventArgs e)
        {
            util.debugWriteLine("getInfoFromHosoIdBtnClick " + hosoIdText.Text);
            if (hosoIdText.Text == "")
            {
                return;
            }

            var    t  = hosoIdText.Text;
            string id = null;
            var    lv = util.getRegGroup(t, "(lv\\d+)");

            if (lv != null)
            {
                id = lv;
            }
            else
            {
                var coch = util.getRegGroup(t, "(c[oh]\\d+)");
                if (coch != null)
                {
                    id = coch;
                }
                else
                {
                    var user = util.getRegGroup(t, "user/(\\d+)");
                    if (user != null)
                    {
                        id = user;
                    }
                }
            }
            hosoIdText.Text = id;
            if (id == null || (!id.StartsWith("l") && !id.StartsWith("c")))
            {
                MessageBox.Show("しっぱい");
            }

            communityId.Text              = communityNameText.Text =
                userIdText.Text           = userNameText.Text = "";
            communityFollowChkBox.Checked = userFollowChkBox.Checked = false;

            var url = "https://live2.nicovideo.jp/watch/" + id;
            var hig = new HosoInfoGetter();

            hig.get(url, form.check.container);

            communityId.Text = hig.communityId;
            userIdText.Text  = hig.userId;
            GetCommunityInfoBtnClick(null, null);
            GetUserInfoBtnClick(null, null);

            try {
                if (hig.communityId == null && hig.userId == null)
                {
                    MessageBox.Show(hig.type == "official" ? "公式放送でした" : "しっぱい");
                }

                inputLvidItem = new RssItem(hig.title, id, hig.openDt.ToString(), hig.description, hig.group, hig.communityId, hig.userName, hig.thumbnail, hig.isMemberOnly.ToString(), "", hig.isPayment);
                inputLvidItem.setUserId(hig.userId);
                inputLvidItem.setTag(hig.tags);
                inputLvidItem.category  = hig.category;
                inputLvidItem.type      = hig.type;
                inputLvidItem.pubDateDt = hig.openDt;
                isInputLvidItemClosed   = hig.isClosed;
            } catch (Exception ee) {
                util.debugWriteLine(ee.Message + ee.Source + ee.Source + ee.StackTrace + ee.TargetSite);
            }

            /*
             * if (id.StartsWith("c")) {
             *      if (hig.communityId != null) {
             *              var isFollow = false;
             *              var name = util.getCommunityName(hig.communityId, out isFollow, form.check.container);
             *              communityId.Text = hig.communityId;
             *              if (name != null)
             *                      communityNameText.Text = name;
             *      }
             *      if (hig.userId != null) {
             *              var isFollow = false;
             *              var name = util.getUserName(hig.userId, out isFollow, form.check.container);
             *              if (name != null)
             *                      userNameText.Text = name;
             *      }
             * } else {
             *      communityId.Text = hig.communityId;
             *      userIdText.Text = hig.userId;
             *      GetCommunityInfoBtnClick(null, null);
             *      GetUserInfoBtnClick(null, null);
             *
             *      if (hig.communityId == null && hig.userId == null)
             *              MessageBox.Show(hig.type == "official" ? "公式放送でした" : "しっぱい");
             * }
             */
        }
Пример #4
0
        private void process(List <string> lvList, TwitterInfo ti)
        {
            foreach (var lv in lvList)
            {
                try {
                    var     hig = new HosoInfoGetter();
                    RssItem item;
                    if (hig.get("https://live2.nicovideo.jp/watch/" + lv, form.check.container))
                    {
                        item = new RssItem(hig.title, lv, hig.openDt.ToString(), hig.description, hig.group, hig.communityId, hig.userName, null, hig.isMemberOnly ? "限定" : "", "", hig.isPayment);
                        item.setUserId(hig.userId);
                        item.setTag(hig.tags);
                        item.category = hig.category;
                        item.type     = hig.type;
                        if (hig.openDt < startTime || hig.openDt > DateTime.Now + TimeSpan.FromMinutes(3))
                        {
                            return;
                        }
                    }
                    else
                    {
                        item = new RssItem(lv, lv, DateTime.Now.ToString(), "", "", "",
                                           "", "", "", "", false);
                    }



                    form.check.checkedLvIdList.Add(item);
                    form.check.processedLvidList.Add(item.lvId);

                    if (ti.appliA && !form.notifyOffList[7])
                    {
                        var appliAPath = form.config.get("appliAPath");
                        var args       = form.config.get("appliAArgs");
                        TaskCheck.appliProcess(appliAPath, lv, args);
                    }
                    if (ti.appliB && !form.notifyOffList[8])
                    {
                        var appliBPath = form.config.get("appliBPath");
                        var args       = form.config.get("appliBArgs");
                        TaskCheck.appliProcess(appliBPath, lv, args);
                    }
                    if (ti.appliC && !form.notifyOffList[9])
                    {
                        var appliCPath = form.config.get("appliCPath");
                        var args       = form.config.get("appliCArgs");
                        TaskCheck.appliProcess(appliCPath, lv, args);
                    }
                    if (ti.appliD && !form.notifyOffList[10])
                    {
                        var appliDPath = form.config.get("appliDPath");
                        var args       = form.config.get("appliDArgs");
                        TaskCheck.appliProcess(appliDPath, lv, args);
                    }
                    if (ti.appliE && !form.notifyOffList[11])
                    {
                        var appliEPath = form.config.get("appliEPath");
                        var args       = form.config.get("appliEArgs");
                        TaskCheck.appliProcess(appliEPath, lv, args);
                    }
                    if (ti.appliF && !form.notifyOffList[12])
                    {
                        var appliFPath = form.config.get("appliFPath");
                        var args       = form.config.get("appliFArgs");
                        TaskCheck.appliProcess(appliFPath, lv, args);
                    }
                    if (ti.appliG && !form.notifyOffList[13])
                    {
                        var appliGPath = form.config.get("appliGPath");
                        var args       = form.config.get("appliGArgs");
                        TaskCheck.appliProcess(appliGPath, lv, args);
                    }
                    if (ti.appliH && !form.notifyOffList[14])
                    {
                        var appliHPath = form.config.get("appliHPath");
                        var args       = form.config.get("appliHArgs");
                        TaskCheck.appliProcess(appliHPath, lv, args);
                    }
                    if (ti.appliI && !form.notifyOffList[15])
                    {
                        var appliIPath = form.config.get("appliIPath");
                        var args       = form.config.get("appliIArgs");
                        TaskCheck.appliProcess(appliIPath, lv, args);
                    }
                    if (ti.appliJ && !form.notifyOffList[16])
                    {
                        var appliJPath = form.config.get("appliJPath");
                        var args       = form.config.get("appliJArgs");
                        TaskCheck.appliProcess(appliJPath, lv, args);
                    }
                    if (ti.popup && !form.notifyOffList[2])
                    {
                        TaskCheck.displayPopup(item, form);
                    }
                    if (ti.baloon && !form.notifyOffList[3])
                    {
                        TaskCheck.displayBaloon(item, form);
                    }
                    if (ti.browser && !form.notifyOffList[4])
                    {
                        TaskCheck.openBrowser(item, form);
                    }
                    if (ti.mail && !form.notifyOffList[5])
                    {
                        form.check.mail(item);
                    }
                    if (ti.sound && !form.notifyOffList[6])
                    {
                        TaskCheck.sound(form);
                    }
                    var hi = new HistoryInfo(item, null);
                    form.addHistoryList(hi);
                } catch (Exception e) {
                    util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite);
                }
            }
        }
Пример #5
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);
            }
        }
Пример #6
0
        private List <LiveInfo> getOfficialLiveItems()
        {
            try {
                var r = util.getPageSource("https://live.nicovideo.jp/focus");
                if (r == null)
                {
                    foreach (var li in form.liveListDataSource)
                    {
                        if (li.type == "official")
                        {
                            li.lastExistTime = DateTime.Now;
                        }
                    }
                    foreach (var li in form.liveListDataReserve)
                    {
                        if (li.type == "official")
                        {
                            li.lastExistTime = DateTime.Now;
                        }
                    }
                    return(new List <LiveInfo>());
                }
                var m   = new Regex("id&quot;:&quot;(lv\\d+)").Matches(r);
                var ret = new List <LiveInfo>();
                foreach (Match _m in m)
                {
                    var lvid    = _m.Groups[1].Value;
                    var isAdded = false;
                    foreach (var li in form.liveListDataSource)
                    {
                        if (li.type != "official" && li.lvId == lvid)
                        {
                            li.lastExistTime = DateTime.Now;
                            isAdded          = true;
                        }
                    }
                    foreach (var li in form.liveListDataReserve)
                    {
                        if (li.type == "official" && li.lvId == lvid)
                        {
                            li.lastExistTime = DateTime.Now;
                            isAdded          = true;
                        }
                    }
                    if (isAdded)
                    {
                        continue;
                    }

                    var hig = new HosoInfoGetter();
                    var _r  = hig.get(lvid, null);
                    if (!_r)
                    {
                        continue;
                    }
                    if (hig.type != "official" || hig.openDt > DateTime.Now || hig.isClosed)
                    {
                        continue;
                    }

                    var ri = new RssItem(hig.title, lvid, hig.openDt.ToString(), hig.description, hig.group, hig.communityId, hig.userName, hig.thumbnail, hig.isMemberOnly.ToString(), "", hig.isPayment);
                    ri.type = "official";
                    ri.setUserId(hig.userId);
                    ri.tags      = new string[] { "" };
                    ri.pubDateDt = DateTime.Parse(ri.pubDate);
                    var _li = new LiveInfo(ri, form.alartListDataSource.ToArray(), form.config, form.userAlartListDataSource.ToArray());
                    ret.Add(_li);
                }
                return(ret);
            } catch (Exception e) {
                util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite);
                return(new List <LiveInfo>());
            }
        }