Exemplo n.º 1
0
        private void startRecording(string lvid, bool isPlayOnlyMode)
        {
            util.setProxy(cfg, form);
            isRecording = true;
            form.formAction(() => {
                form.urlText.Text = "https://live2.nicovideo.jp/watch/" + lvid;
                setRecModeForm(true);

                form.resetDisplay();
                recordingUrl = form.urlText.Text;
            }, false);

            rfu = new RecordFromUrl(this, isPlayOnlyMode);
            Task.Run(() => {
                try {
                    var _rfu = rfu;
                    util.debugWriteLine("rm rec 録画開始" + rfu);
                    util.debugWriteLine(form.urlText.Text);

                    var rfuCode = rfu.GetHashCode();
                    recordRunningList.Add(rfuCode);
                    //endcode 0-その他の理由 1-stop 2-最初に終了 3-始まった後に番組終了
                    var endCode = rfu.rec(form.urlText.Text, lvid);
                    util.debugWriteLine("endcode " + endCode);
                    recordRunningList.Remove(rfuCode);

                    endProcess(endCode, rfu == _rfu);
                } catch (Exception e) {
                    util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite);
                    rfu = null;
                    setRecModeForm(false);
                }
            });
        }
Exemplo n.º 2
0
        public TimeShiftCommentGetter_xml(
            string userId, RecordingManager rm,
            RecordFromUrl rfu, MainForm form,
            long openTime, string[] recFolderFile,
            string lvid, CookieContainer container,
            string programType, long _openTime,
            WebSocketRecorder rp, int startSecond,
            bool isVposStartTime, bool isRtmp)
        {
//			this.uri = util.getRegGroup(message, "messageServerUri\"\\:\"(ws.+?)\"");
//			this.thread = util.getRegGroup(message, "threadId\":\"(.+?)\"");
            this.rm            = rm;
            this.rfu           = rfu;
            this.userId        = userId;
            this.form          = form;
            this.openTime      = openTime;
            this.recFolderFile = recFolderFile[1];
            this.lvid          = lvid;
            this.container     = container;
            this.isGetXml      = bool.Parse(rm.cfg.get("IsgetcommentXml"));
//			this.programType = programType;
            this._openTime   = _openTime;
            this.rp          = rp;
            this.startSecond = startSecond;
            //this.tsConfig = tsConfig;
            this.isVposStartTime = isVposStartTime;
            this.isRtmp          = isRtmp;
        }
Exemplo n.º 3
0
        public void stopRecording()
        {
            if (util.isShowWindow)
            {
                try {
                    form.Invoke((MethodInvoker) delegate() {
                        try {
                            form.recBtn.Text            = "録画開始";
                            form.urlText.Enabled        = true;
                            form.optionMenuItem.Enabled = true;
                            var _m = (isPlayOnlyMode) ? "視聴" : "録画";
                            form.addLogText(_m + "を中断しました");
                        } catch (Exception e) {
                            util.debugWriteLine(e.Message + " " + e.StackTrace + " " + e.Source + " " + e.TargetSite);
                        }
                    });
                } catch (Exception e) {
                    util.debugWriteLine(e.Message + " " + e.StackTrace + " " + e.Source + " " + e.TargetSite);
                }
            }
            isRecording = false;
            rfu         = null;
            hlsUrl      = null;

            recordingUrl = null;
        }
Exemplo n.º 4
0
 public JikkenRecordProcess(
     CookieContainer container, string[] recFolderFile,
     RecordingManager rm, RecordFromUrl rfu,
     JikkenRecorder jr, long openTime,
     bool isTimeShift, string lvid,
     TimeShiftConfig tsConfig, string userId,
     bool isPremium, TimeSpan programTime,
     WatchingInfo wi, long releaseTime, bool isSub, bool isRtmp)
 {
     this.container     = container;
     this.recFolderFile = recFolderFile;
     this.rm            = rm;
     this.rfu           = rfu;
     this.jr            = jr;
     this.openTime      = openTime;
     this.isTimeShift   = isTimeShift;
     this.lvid          = lvid;
     this.tsConfig      = tsConfig;
     this.userId        = userId;
     this.isPremium     = isPremium;
     this.programTime   = programTime;
     this.wi            = wi;
     this.msUri         = wi.msUri;
     isGetCommentXml    = bool.Parse(rm.cfg.get("IsgetcommentXml"));
     isJikken           = true;
     this.releaseTime   = releaseTime;
     this.isSub         = isSub;
     this.isRtmp        = isRtmp;
 }
Exemplo n.º 5
0
        public FFMpegConcat(RecordingManager rm, RecordFromUrl rfu)
        {
            this.rm = rm;
//			this.isFFmpeg = isFFmpeg;
            this.rfu         = rfu;
            afterConvertMode = int.Parse(rm.cfg.get("afterConvertMode"));
        }
Exemplo n.º 6
0
 public AnotherEngineRecorder(RecordingManager rm, RecordFromUrl rfu, Record rec)
 {
     this.rm  = rm;
     this.rfu = rfu;
     ext      = rfu.h5r.isFmp4 ? ".mp4" : ".ts";
     this.rec = rec;
 }
Exemplo n.º 7
0
 public NotHtmlCommentGetter(string[] messageInfo, RecordingManager rm, RecordFromUrl rfu, string[] recFolderFileInfo)
 {
     //0-url 1-port 2-thread
     this.messageInfo       = messageInfo;
     this.rm                = rm;
     this.rfu               = rfu;
     this.recFolderFileInfo = recFolderFileInfo;
 }
Exemplo n.º 8
0
 public NotHtml5Recorder(string url, CookieContainer container,
                         string lvid, RecordingManager rm, RecordFromUrl rfu)
 {
     this.url       = url;
     this.container = container;
     this.lvid      = lvid;
     this.rm        = rm;
     this.rfu       = rfu;
 }
Exemplo n.º 9
0
        public DropSegmentProcess(DateTime _lastWroteSegmentDt, int _lastSegmentNo, Record rec, string recFolderFileOrigin, RecordFromUrl rfu, RecordingManager rm, Html5Recorder h5r)
        {
//			this.nti = s;
            this.lastWroteSegmentDt = _lastWroteSegmentDt;
            this.lastSegmentNo      = _lastSegmentNo;
            this.rec = rec;
            this.recFolderFileOrigin = recFolderFileOrigin;
            this.rfu = rfu;
            this.rm  = rm;
            this.h5r = h5r;
        }
 public Html5Recorder(string url, CookieContainer container,
                      string lvid, RecordingManager rm, RecordFromUrl rfu,
                      bool isTimeShift)
 {
     this.url         = url;
     this.container   = container;
     this.lvid        = lvid;
     this.rm          = rm;
     this.rfu         = rfu;
     this.isTimeShift = isTimeShift;
     //this.isSub = isSub;
 }
Exemplo n.º 11
0
        public void stopRecording(bool isPlayOnlyMode)
        {
            setRecModeForm(false);
            var _m = (isPlayOnlyMode) ? "視聴" : "録画";

            form.addLogText(_m + "を中断しました");

            isRecording = false;
            rfu         = null;
            hlsUrl      = null;

            recordingUrl = null;
        }
Exemplo n.º 12
0
 public RecordStateSetter(MainForm form, RecordingManager rm, RecordFromUrl rfu, bool isTimeShift, bool isJikken, string[] recFolderFile, bool isPlayOnlyMode, bool isRtmpOnlyPage, bool isChase)
 {
     this.form             = form;
     this.rm               = rm;
     this.rfu              = rfu;
     this.isTimeShift      = isTimeShift;
     this.isJikken         = isJikken;
     this.recFolderFile    = recFolderFile;
     this.isPlayOnlyMode   = isPlayOnlyMode;
     this.isDescriptionTag = bool.Parse(rm.cfg.get("IsDescriptionTag"));
     this.isRtmpOnlyPage   = isRtmpOnlyPage;
     this.isChase          = isChase;
 }
 public ChaseLastRecord(string lvid,
                        CookieContainer container, RecordingManager rm,
                        string[] recFolderFileInfo, long openTime,
                        Html5Recorder h5r, TimeShiftConfig tsConfig, RecordFromUrl rfu)
 {
     this.lvid              = lvid;
     this.container         = container;
     this.rm                = rm;
     this.recFolderFileInfo = recFolderFileInfo;
     this.openTime          = openTime;
     this.h5r               = h5r;
     this.tsConfig          = tsConfig;
     this.rfu               = rfu;
 }
Exemplo n.º 14
0
        public RtmpRecorder(string lvid, CookieContainer container,
                            RecordingManager rm, RecordFromUrl rfu, bool isSub,
                            string[] recFolderFile, IRecorderProcess wr, long openTime)
        {
//			this.getPlayerStatusRes = getPlayerStatusRes;
            this.lvid      = lvid;
            this.container = container;
//			this.cfg = cfg;
            this.rm            = rm;
            this.rfu           = rfu;
            this.isSub         = isSub;
            this.wr            = wr;
            this.openTime      = openTime;
            this.recFolderFile = recFolderFile[1];
            rm.isTitleBarInfo  = bool.Parse(rm.cfg.get("IstitlebarInfo"));
            afterConvertMode   = int.Parse(rm.cfg.get("afterConvertMode"));
        }
        private void endProcess(int endCode, bool isSameRfu)
        {
            if (endCode == 3 && bool.Parse(cfg.get("IsSoundEnd")))
            {
                util.soundEnd(cfg, form);
            }

            if (isSameRfu)
            {
                isRecording = false;
                rfu         = null;
                setRecModeForm(false);

                if (form.recEndProcess != null && endCode == 3)
                {
                    form.formAction(() =>
                                    util.shutdown(form.recEndProcess));
                }

                util.debugWriteLine("end rec " + rfu);
                if (!isClickedRecBtn && endCode == 3)
                {
                    Environment.ExitCode = 5;

                    if (util.isShowWindow && bool.Parse(cfg.get("IscloseExit")))
                    {
                        form.close();
                    }
                }
                hlsUrl       = null;
                recordingUrl = null;
            }
            if (bool.Parse(cfg.get("IscloseExit")) && endCode == 3)
            {
                rfu = null;
                Environment.ExitCode = 5;
                form.close();
            }
            if (util.isStdIO && (endCode == 0 || endCode == 2 || endCode == 3))
            {
                form.close();
            }
        }
Exemplo n.º 16
0
 public XmlCommentGetter_ontime(string lvid,
                                CookieContainer container, RecordingManager rm,
                                RecordFromUrl rfu, string recFolderFile,
                                IRecorderProcess rp, bool isTimeShift, bool isRtmp,
                                long openTime, long _openTime, long serverTime)
 {
     this.lvid            = lvid;
     this.container       = container;
     this.rm              = rm;
     this.rfu             = rfu;
     this.recFolderFile   = recFolderFile;
     this.rp              = rp;
     this.isTimeShift     = isTimeShift;
     this.isRtmp          = isRtmp;
     this.isGetComment    = rm.cfg.get("IsgetComment");
     this.isGetCommentXml = rm.cfg.get("IsgetcommentXml");
     this.openTime        = openTime;
     this._openTime       = _openTime;
     this.serverTime      = serverTime;
 }
Exemplo n.º 17
0
        public TimeShiftCommentGetter(string uri, string thread,
                                      string uriStore, string threadStore,
                                      string userId, RecordingManager rm,
                                      RecordFromUrl rfu, MainForm form,
                                      long openTime, string recFolderFile,
                                      string lvid, CookieContainer container,
                                      string programType, long _openTime,
                                      WebSocketRecorder rp, int startSecond,
                                      bool isVposStartTime, bool isRtmp,
                                      RtmpRecorder rr, RecordStateSetter rss,
                                      string roomName, TimeShiftConfig tsConfig)
        {
            this.uri    = uri;
            this.thread = thread;

            this.rm                  = rm;
            this.rfu                 = rfu;
            this.userId              = userId;
            this.form                = form;
            this.openTime            = openTime;
            this.recFolderFile       = recFolderFile;
            this.lvid                = lvid;
            this.container           = container;
            this.isGetXml            = bool.Parse(rm.cfg.get("IsgetcommentXml"));
            this.isGetCommentXmlInfo = bool.Parse(rm.cfg.get("IsgetcommentXmlInfo"));
            this.programType         = programType;
            this._openTime           = _openTime;
            this.rp                  = rp;
            this.startSecond         = startSecond;
            //this.tsConfig = tsConfig;
            this.isVposStartTime = isVposStartTime;
            this.isRtmp          = isRtmp;
            this.rr            = rr;
            isConvertSpace     = bool.Parse(rm.cfg.get("IsCommentConvertSpace"));
            isNormalizeComment = bool.Parse(rm.cfg.get("IsNormalizeComment"));
            this.roomName      = roomName;
            this.tsConfig      = tsConfig;

            this.uriStore    = uriStore;
            this.threadStore = threadStore;
        }
Exemplo n.º 18
0
        public WebSocketRecorder(string[] webSocketInfo,
                                 CookieContainer container, string[] recFolderFile,
                                 RecordingManager rm, RecordFromUrl rfu,
                                 Html5Recorder h5r, long openTime,
                                 int lastSegmentNo, bool isTimeShift, string lvid,
                                 TimeShiftConfig tsConfig, string userId,
                                 bool isPremium, TimeSpan programTime,
                                 string programType, long _openTime, bool isSub, bool isRtmp,
                                 string latency
                                 )
        {
            this.webSocketInfo = webSocketInfo;
            this.container     = container;
            this.recFolderFile = recFolderFile;
            this.rm            = rm;
            this.rfu           = rfu;
            this.h5r           = h5r;
            this.openTime      = openTime;
            this.lastSegmentNo = lastSegmentNo;
            this.isTimeShift   = isTimeShift;
            this.lvid          = lvid;
            this.tsConfig      = tsConfig;
            this.userId        = userId;
            this.isPremium     = isPremium;
            this.programTime   = programTime;
            isJikken           = false;
            this.programType   = programType;
            this._openTime     = _openTime;
            this.isSub         = isSub;
            this.isRtmp        = isRtmp;

            this.qualityRank     = rm.cfg.get("qualityRank");
            this.isGetComment    = rm.cfg.get("IsgetComment");
            this.isGetCommentXml = rm.cfg.get("IsgetcommentXml");
            this.engineMode      = rm.cfg.get("EngineMode");
            selectLatency        = latency;
        }
Exemplo n.º 19
0
        public JikkenRecorder(string res, string lvid, CookieContainer container, config.config config, RecordingManager rm, RecordFromUrl rfu, bool isSub)
        {
            this.lvid      = lvid;
            this.container = container;
            this.config    = config;
            this.rm        = rm;
            this.rfu       = rfu;
            var data = util.getRegGroup(res, "<script id=\"embedded-data\" data-props=\"([\\d\\D]+?)</script>");

            status = (data == null) ? null : util.getRegGroup(data, "&quot;status&quot;:&quot;(.+?)&quot;");
            //if (status != "ON_AIR" && status != "ENDED") return 5;
            isLive             = status == "ON_AIR";
            isTimeshiftEnabled = res.IndexOf("isTimeshiftEnabled&quot;:true") > -1;
//			userId = util.getRegGroup(res, "\"user_id\"\\:(\\d+),");
            var _isBroadcaster = util.getRegGroup(data, "&quot;isBroadcaster&quot;\\:(.+?),");

            if (_isBroadcaster != null)
            {
                isBroadcaster = bool.Parse(_isBroadcaster);
            }
            isBroadcaster = false;
            actionTrackId = getActionTrackId();
            //maxQuality = util.getRegGroup(data, "&quot;maxQuality&quot;\\:&quot;(.+?)&quot;");

            watchingUrl = "https://api.cas.nicovideo.jp/v1/services/live/programs/" + lvid + "/watching" +
                          ((isLive) ? "" : "-archive");
            this.streamCapacity = util.getRegGroup(data, "&quot;maxQuality&quot;\\:&quot;(.+?)&quot;");
            util.debugWriteLine("maxQuality " + streamCapacity + util.getMainSubStr(isSub, true));
            //var wc = new WebHeaderCollection();
            //var watchingRes = util.getPageSource
//				public static int getPageTypeJikken(string res) {

//			if (res.IndexOf("<!doctype html>") > -1 && data != null && status == "ON_AIR") return 0;
//			else if (res.IndexOf("<!doctype html>") > -1 && data != null && status == "ENDED") return 7;
            this.isSub = isSub;
        }
Exemplo n.º 20
0
        /*
         * async Task<int> test(int a) {
         *      //util.debugWriteLine(a);
         *      //c += a;
         *      return a;
         * }
         */
        async public void rec()
        {
            util.debugWriteLine("rm");


            var lv     = util.getRegGroup(form.urlText.Text, "(lv\\d+(,\\d+)*)");
            var wssUrl = util.getRegGroup(form.urlText.Text, "^(wss://[^,\\s]+)");

            util.setLog(cfg, lv);
            util.debugWriteLine(util.versionStr + " " + util.versionDayStr);

            if (rfu == null)
            {
                var arr = form.urlText.Text.Split('|');
//              var arr = "C:\\Users\\zack\\Desktop\\c#project\\nicoNewStreamRecorderKakkoKariRepo2 9.26 tuujou a\\nicoNewStreamRecorderKakkoKari\\namaichi\\bin\\Debug\\rec\\株式会社ジャパンミュージックエージェンシー\\株式会社ジャパンミュージックエージェンシー_0.ts".Split('|');



                var lvid = lv;                //util.getRegGroup(form.urlText.Text, "(lv\\d+(,\\d+)*)", 1);
                if (lvid != null || wssUrl != null)
                {
                    var url = lvid != null ? ("http://live2.nicovideo.jp/watch/" + lvid) : wssUrl;
                    if (isPlayOnlyMode)
                    {
                        form.Invoke((MethodInvoker) delegate() {
                            form.urlText.Text = url;
                        });
                    }
                    else
                    {
                        form.urlText.Text = url;
                    }

//				if (lvid != null) form.urlText.Text = "https://cas.nicovideo.jp/user/77252622/lv313508832";
                }
                else
                {
                    if (isPlayOnlyMode)
                    {
                        form.Invoke((MethodInvoker) delegate() {
                            MessageBox.Show("not found lvid");
                        });
                    }
                    else
                    {
                        MessageBox.Show("not found lvid");
                    }
                    return;
                }

                form.setQualityList(new string[] {}, "");
                var q = form.qualityBox.Items;

                isRecording = true;
                if (isPlayOnlyMode)
                {
                    form.Invoke((MethodInvoker) delegate() {
                        form.recBtn.Text            = "中断";
                        form.urlText.Enabled        = false;
                        form.optionMenuItem.Enabled = false;

                        //form.resetDisplay();
                        recordingUrl = form.urlText.Text;
                    });
                }
                else
                {
                    form.recBtn.Text            = "中断";
                    form.urlText.Enabled        = false;
                    form.optionMenuItem.Enabled = false;

                    //form.resetDisplay();
                    recordingUrl = form.urlText.Text;
                }

                rfu = new RecordFromUrl(this);
                Task.Run(() => {
                    try {
                        var _rfu = rfu;
                        util.debugWriteLine("rm rec 録画開始" + rfu);

                        util.debugWriteLine(form);
                        util.debugWriteLine(form.urlText);
                        util.debugWriteLine(form.urlText.Text);

                        var rfuCode = rfu.GetHashCode();
                        recordRunningList.Add(rfuCode);
                        //endcode 0-その他の理由 1-stop 2-最初に終了 3-始まった後に番組終了
                        var endCode = rfu.rec(form.urlText.Text, lvid, wssUrl);
                        util.debugWriteLine("endcode " + endCode);
                        recordRunningList.Remove(rfuCode);

                        if (rfu == _rfu)
                        {
                            isRecording = false;
                            rfu         = null;
                            if (!form.IsDisposed && util.isShowWindow)
                            {
                                try {
                                    form.Invoke((MethodInvoker) delegate() {
                                        try {
                                            form.recBtn.Text            = "録画開始";
                                            form.urlText.Enabled        = true;
                                            form.optionMenuItem.Enabled = true;
                                        } catch (Exception e) {
                                            util.debugWriteLine(e.Message + " " + e.StackTrace + " " + e.Source + " " + e.TargetSite);
                                        }
                                    });
                                } catch (Exception e) {
                                    util.debugWriteLine(e.Message + " " + e.StackTrace + " " + e.Source + " " + e.TargetSite);
                                }
                            }

                            util.debugWriteLine("end rec " + rfu);
                            if (!isClickedRecBtn && endCode == 3)
                            {
                                Environment.ExitCode = 5;
                                if (util.isShowWindow)
                                {
                                    try {
                                        form.Invoke((MethodInvoker) delegate() {
                                            try {
                                                form.Close();
                                            } catch (Exception e) {
                                                util.debugWriteLine(e.Message + " " + e.StackTrace + " " + e.Source + " " + e.TargetSite);
                                            }
                                        });
                                    } catch (Exception e) {
                                        util.debugWriteLine(e.Message + " " + e.StackTrace + " " + e.Source + " " + e.TargetSite);
                                    }
                                }
                            }
                            hlsUrl = null;

                            recordingUrl = null;
                        }
                        if (bool.Parse(cfg.get("IscloseExit")) && endCode == 3)
                        {
                            rfu = null;
                            Environment.ExitCode = 5;
                            if (util.isShowWindow)
                            {
                                try {
                                    form.Invoke((MethodInvoker) delegate() {
                                        try {
                                            form.Close();
                                            form.addLogText("終了しました。");
                                        } catch (Exception e) {
                                            util.debugWriteLine(e.Message + " " + e.StackTrace + " " + e.Source + " " + e.TargetSite);
                                        }
                                    });
                                } catch (Exception e) {
                                    util.debugWriteLine(e.Message + " " + e.StackTrace + " " + e.Source + " " + e.TargetSite);
                                }
                            }
                        }
                        if (util.isStdIO && (endCode == 0 || endCode == 2 || endCode == 3))
                        {
                            form.Invoke((MethodInvoker) delegate() {
                                try {
                                    form.Close();
                                } catch (Exception e) {
                                    util.debugWriteLine(e.Message + " " + e.StackTrace + " " + e.Source + " " + e.TargetSite);
                                }
                            });
                        }
                    } catch (Exception e) {
                        util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite);
                        rfu = null;
                        form.Invoke((MethodInvoker) delegate() {
                            try {
                                form.recBtn.Text            = "録画開始";
                                form.urlText.Enabled        = true;
                                form.optionMenuItem.Enabled = true;
                            } catch (Exception ee) {
                                util.debugWriteLine(ee.Message + " " + ee.StackTrace + " " + ee.Source + " " + ee.TargetSite);
                            }
                        });
                    }
                });
            }
            else
            {
                stopRecording();
            }
        }
Exemplo n.º 21
0
 public FFMpegRecord(RecordingManager rm, bool isFFmpeg, RecordFromUrl rfu)
 {
     this.rm       = rm;
     this.isFFmpeg = isFFmpeg;
     this.rfu      = rfu;
 }
Exemplo n.º 22
0
 public AnotherEngineRecorder(RecordingManager rm, RecordFromUrl rfu)
 {
     this.rm  = rm;
     this.rfu = rfu;
 }