.../TVLibrary/SetupTv/Sections/Epg.Designer.cs | 19 ++++++++++++++-- TvEngine3/TVLibrary/SetupTv/Sections/Epg.cs | 15 +++++++++++++ TvEngine3/TVLibrary/TvService/Epg/EpgCard.cs | 6 +++-- TvEngine3/TVLibrary/TvService/Epg/EpgGrabber.cs | 5 +++-- .../TVLibrary/TvService/Scheduler/Scheduler.cs | 3 +++ TvEngine3/TVLibrary/TvService/TVController.cs | 26 +++++++++++++++++++--- 6 files changed, 65 insertions(+), 9 deletions(-) diff --git a/TvEngine3/TVLibrary/SetupTv/Sections/Epg.Designer.cs b/TvEngine3/TVLibrary/SetupTv/Sections/Epg.Designer.cs index 4c47280..ae5ccc8 100644 --- a/TvEngine3/TVLibrary/SetupTv/Sections/Epg.Designer.cs +++ b/TvEngine3/TVLibrary/SetupTv/Sections/Epg.Designer.cs @@ -44,6 +44,7 @@ this.numericUpDownEpgRefresh = new System.Windows.Forms.NumericUpDown(); this.numericUpDownEpgTimeOut = new System.Windows.Forms.NumericUpDown(); this.checkBoxEnableEPGWhileIdle = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.checkBoxEnableEPGWhileIdleOnFreeTuner = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.label15 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); @@ -209,6 +210,7 @@ this.groupBox2.Controls.Add(this.numericUpDownEpgRefresh); this.groupBox2.Controls.Add(this.numericUpDownEpgTimeOut); this.groupBox2.Controls.Add(this.checkBoxEnableEPGWhileIdle); + this.groupBox2.Controls.Add(this.checkBoxEnableEPGWhileIdleOnFreeTuner); this.groupBox2.Controls.Add(this.label15); this.groupBox2.Controls.Add(this.label14); this.groupBox2.Controls.Add(this.label8); @@ -267,6 +269,17 @@ this.checkBoxEnableEPGWhileIdle.Text = "Enabled"; this.checkBoxEnableEPGWhileIdle.UseVisualStyleBackColor = true; // + // checkBoxEnableEPGWhileIdleOnFreeTuner + // + this.checkBoxEnableEPGWhileIdleOnFreeTuner.AutoSize = true; + this.checkBoxEnableEPGWhileIdleOnFreeTuner.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.checkBoxEnableEPGWhileIdleOnFreeTuner.Location = new System.Drawing.Point(86, 12); + this.checkBoxEnableEPGWhileIdleOnFreeTuner.Name = "checkBoxEnableEPGWhileIdleOnFreeTuner"; + this.checkBoxEnableEPGWhileIdleOnFreeTuner.Size = new System.Drawing.Size(163, 17); + this.checkBoxEnableEPGWhileIdleOnFreeTuner.TabIndex = 12; + this.checkBoxEnableEPGWhileIdleOnFreeTuner.Text = "Grab on free tuner while\ntimeshifting / recording"; + this.checkBoxEnableEPGWhileIdleOnFreeTuner.UseVisualStyleBackColor = true; + // // label15 // this.label15.AutoSize = true; @@ -283,7 +296,7 @@ this.label14.Name = "label14"; this.label14.Size = new System.Drawing.Size(73, 13); this.label14.TabIndex = 5; - this.label14.Text = "Refresh every"; + this.label14.Text = "Refresh every:"; // // label8 // @@ -344,8 +357,9 @@ this.checkBoxEnableEpgWhileTimeshifting.Name = "checkBoxEnableEpgWhileTimeshifting"; this.checkBoxEnableEpgWhileTimeshifting.Size = new System.Drawing.Size(63, 17); this.checkBoxEnableEpgWhileTimeshifting.TabIndex = 9; - this.checkBoxEnableEpgWhileTimeshifting.Text = "Enabled"; + this.checkBoxEnableEpgWhileTimeshifting.Text = "Enabled (disable option in idle grabber)"; this.checkBoxEnableEpgWhileTimeshifting.UseVisualStyleBackColor = true; + this.checkBoxEnableEpgWhileTimeshifting.CheckedChanged += new System.EventHandler(this.checkBoxEnableEpgWhileTimeshifting_CheckedChanged); // // label22 // @@ -501,6 +515,7 @@ private System.Windows.Forms.NumericUpDown numericUpDownEpgRefresh; private System.Windows.Forms.NumericUpDown numericUpDownEpgTimeOut; private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxEnableEPGWhileIdle; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxEnableEPGWhileIdleOnFreeTuner; private System.Windows.Forms.Label label15; private System.Windows.Forms.Label label14; private System.Windows.Forms.Label label8; diff --git a/TvEngine3/TVLibrary/SetupTv/Sections/Epg.cs b/TvEngine3/TVLibrary/SetupTv/Sections/Epg.cs index a7090c0..716b94e 100644 --- a/TvEngine3/TVLibrary/SetupTv/Sections/Epg.cs +++ b/TvEngine3/TVLibrary/SetupTv/Sections/Epg.cs @@ -49,11 +49,16 @@ namespace SetupTv.Sections checkboxSameTransponder.Checked = (layer.GetSetting("generalGrapOnlyForSameTransponder", "no").Value == "yes"); checkBoxEnableEPGWhileIdle.Checked = (layer.GetSetting("idleEPGGrabberEnabled", "yes").Value == "yes"); + checkBoxEnableEPGWhileIdleOnFreeTuner.Checked = (layer.GetSetting("idleEPGGrabberEnabledOnFreeTuner", "no").Value == "yes"); checkBoxEnableCRCCheck.Checked = !DebugSettings.DisableCRCCheck; numericUpDownEpgTimeOut.Value = Convert.ToDecimal(layer.GetSetting("timeoutEPG", "10").Value); numericUpDownEpgRefresh.Value = Convert.ToDecimal(layer.GetSetting("timeoutEPGRefresh", "240").Value); checkBoxEnableEpgWhileTimeshifting.Checked = (layer.GetSetting("timeshiftingEpgGrabberEnabled", "no").Value == "yes"); + if (checkBoxEnableEpgWhileTimeshifting.Checked == true) + { + checkBoxEnableEPGWhileIdleOnFreeTuner.Enabled = false; + } numericUpDownTSEpgTimeout.Value = Convert.ToDecimal(layer.GetSetting("timeshiftingEpgGrabberTimeout", "2").Value); edTitleTemplate.Text = layer.GetSetting("epgTitleTemplate", "%TITLE%").Value; @@ -83,6 +88,10 @@ namespace SetupTv.Sections s.Value = checkBoxEnableEPGWhileIdle.Checked ? "yes" : "no"; s.Persist(); + s = layer.GetSetting("idleEPGGrabberEnabledOnFreeTuner", "no"); + s.Value = checkBoxEnableEPGWhileIdleOnFreeTuner.Checked ? "yes" : "no"; + s.Persist(); + s = layer.GetSetting("timeoutEPG", "10"); s.Value = numericUpDownEpgTimeOut.Value.ToString(); s.Persist(); @@ -130,5 +139,11 @@ namespace SetupTv.Sections edTitleTest.Text = EvalTemplate(edTitleTemplate.Text, defaults); edDescriptionTest.Text = EvalTemplate(edDescriptionTemplate.Text, defaults); } + private void checkBoxEnableEpgWhileTimeshifting_CheckedChanged(object sender, EventArgs e) + { + if (checkBoxEnableEpgWhileTimeshifting.Checked == true) + checkBoxEnableEPGWhileIdleOnFreeTuner.Checked = false; + checkBoxEnableEPGWhileIdleOnFreeTuner.Enabled = (checkBoxEnableEpgWhileTimeshifting.Checked == false); + } } } \ No newline at end of file diff --git a/TvEngine3/TVLibrary/TvService/Epg/EpgCard.cs b/TvEngine3/TVLibrary/TvService/Epg/EpgCard.cs index b20125d..5692fad 100644 --- a/TvEngine3/TVLibrary/TvService/Epg/EpgCard.cs +++ b/TvEngine3/TVLibrary/TvService/Epg/EpgCard.cs @@ -379,9 +379,11 @@ namespace TvService return false; } //remove following check to enable multi-card epg grabbing (still beta) - if (_tvController.AllCardsIdle == false) + TvBusinessLayer layer = new TvBusinessLayer(); + if ((_tvController.AllCardsIdle == false && layer.GetSetting("idleEPGGrabberEnabledOnFreeTuner", "no").Value != "yes") + || (layer.GetSetting("idleEPGGrabberEnabledOnFreeTuner", "no").Value == "yes" && _tvController.AnyCardOnEpgGrabbing)) { - Log.Epg("Epg: card:{0} cards are not idle", Card.IdCard); + Log.Epg("Epg: card:{0} cards are not idle or minimum one card is already grabbing", Card.IdCard); return false; } diff --git a/TvEngine3/TVLibrary/TvService/Epg/EpgGrabber.cs b/TvEngine3/TVLibrary/TvService/Epg/EpgGrabber.cs index 9a5f393..2c1a0fe 100644 --- a/TvEngine3/TVLibrary/TvService/Epg/EpgGrabber.cs +++ b/TvEngine3/TVLibrary/TvService/Epg/EpgGrabber.cs @@ -227,7 +227,8 @@ namespace TvService } catch (InvalidOperationException) {} - if (_tvController.AllCardsIdle == false) + TvBusinessLayer layer = new TvBusinessLayer(); + if (_tvController.AllCardsIdle == false && layer.GetSetting("idleEPGGrabberEnabledOnFreeTuner", "no").Value != "yes") return; foreach (EpgCard card in _epgCards) { @@ -236,7 +237,7 @@ namespace TvService return; if (card.IsGrabbing) continue; - if (_tvController.AllCardsIdle == false) + if (_tvController.AllCardsIdle == false && layer.GetSetting("idleEPGGrabberEnabledOnFreeTuner", "no").Value != "yes") return; GrabEpgOnCard(card); } diff --git a/TvEngine3/TVLibrary/TvService/Scheduler/Scheduler.cs b/TvEngine3/TVLibrary/TvService/Scheduler/Scheduler.cs index 8be3d77..c2beb92 100644 --- a/TvEngine3/TVLibrary/TvService/Scheduler/Scheduler.cs +++ b/TvEngine3/TVLibrary/TvService/Scheduler/Scheduler.cs @@ -1051,6 +1051,9 @@ namespace TvService private void StartRecordOnFreeCard(RecordingDetail recDetail, ref IUser user) { + //Stop EPG Grabber becourse prevent stop Timeshiftig in Dualtuner EPG Grabbing Patch + _tvController.StopEPGgrabber(); + var cardAllocationStatic = new AdvancedCardAllocationStatic(_layer, _tvController); List freeCardsForReservation = cardAllocationStatic.GetFreeCardsForChannel(_tvController.CardCollection, recDetail.Channel, ref user); StartRecordOnCard(recDetail, ref user, freeCardsForReservation); diff --git a/TvEngine3/TVLibrary/TvService/TVController.cs b/TvEngine3/TVLibrary/TvService/TVController.cs index f6e779b..2da8ff8 100644 --- a/TvEngine3/TVLibrary/TvService/TVController.cs +++ b/TvEngine3/TVLibrary/TvService/TVController.cs @@ -2471,7 +2471,7 @@ namespace TvService finally { CardReservationHelper.CancelAllCardReservations(tickets, CardCollection); - if (!HasTvSucceeded(result)) + if (!HasTvSucceeded(result) || _layer.GetSetting("idleEPGGrabberEnabledOnFreeTuner", "no").Value == "yes") { StartEPGgrabber(); } @@ -2907,7 +2907,7 @@ namespace TvService return intialTimeshiftingFilename; } - private void StopEPGgrabber() + public void StopEPGgrabber() { if (_epgGrabber != null) { @@ -2918,7 +2918,8 @@ namespace TvService private void StartEPGgrabber() { - if (_epgGrabber != null && AllCardsIdle) + //if (_epgGrabber != null && AllCardsIdle) + if (_epgGrabber != null && (AllCardsIdle || _layer.GetSetting("idleEPGGrabberEnabledOnFreeTuner", "no").Value == "yes")) { Log.Write("Controller: epg start"); _epgGrabber.Start(); @@ -3255,6 +3256,25 @@ namespace TvService } } + /// + /// Check if there is a card that grab epg. + /// + /// true if [minimum one card is grab epg]; otherwise, false. + public bool AnyCardOnEpgGrabbing + { + get + { + Dictionary.Enumerator enumer = _cards.GetEnumerator(); + while (enumer.MoveNext()) + { + int cardId = enumer.Current.Key; + if (_cards[cardId].Card.IsEpgGrabbing == true) + return true; + } + return false; + } + } + #region DiSEqC public void DiSEqCGetPosition(int cardId, out int satellitePosition, out int stepsAzimuth, out int stepsElevation)