Permalink
Browse files

Extra debug info added to TVController.cs

  • Loading branch information...
owlsroost committed Oct 4, 2018
1 parent c6d0b39 commit 4cc926d93fb082121785ed7e752e0a4692ab4bd7
Showing with 19 additions and 19 deletions.
  1. +19 −19 TvEngine3/TVLibrary/TvService/TVController.cs
@@ -591,7 +591,7 @@ private bool InitController()
{
_epgGrabber = new EpgGrabber(this);
//Initial EPG timer interval is 30s to allow other things to initialise
StartEPGgrabber(30000);
StartEPGgrabber(30000, 0);
_scheduler = new Scheduler(this);
_scheduler.Start();
}
@@ -705,7 +705,7 @@ public void DeInit()
Log.Info("Controller: scheduler stopped...");
}
//stop the epg grabber
StopEPGgrabber();
StopEPGgrabber(0);
_epgGrabber = null;

//clean up the tv cards
@@ -1663,7 +1663,7 @@ public TvResult StartTimeShifting(ref IUser user, ref string fileName)
}

Fire(this, new TvServerEventArgs(TvServerEventType.StartTimeShifting, GetVirtualCard(user), (User)user));
StopEPGgrabber();
StopEPGgrabber(1);

bool isTimeShifting;
try
@@ -1784,7 +1784,7 @@ public bool StopTimeShifting(ref IUser user)
{
if (IsGrabbingEpg(cardId))
{
StopEPGgrabber();
StopEPGgrabber(2);
// we need this, otherwise tvservice will hang in the event stoptimeshifting is called by heartbeat timeout function
}
RemoteControl.HostName = tvcard.DataBaseCard.ReferencedServer().HostName;
@@ -1829,7 +1829,7 @@ private bool DoStopTimeShifting(ref IUser user, int cardId)
{
if (IsGrabbingEpg(cardId))
{
StopEPGgrabber();
StopEPGgrabber(3);
// we need this, otherwise tvservice will hang in the event stoptimeshifting is called by heartbeat timeout function
}
ITvCardHandler tvcard = _cards[cardId];
@@ -1848,7 +1848,7 @@ private bool DoStopTimeShifting(ref IUser user, int cardId)
int subChannel = user.SubChannel;
_streamer.Remove(String.Format("stream{0}.{1}", cardId, subChannel));
}
StartEPGgrabber();
StartEPGgrabber(3);
UpdateChannelStatesForUsers();
}
}
@@ -1867,7 +1867,7 @@ public TvResult StartRecording(ref IUser user, ref string fileName)
{
return TvResult.UnknownError;
}
StopEPGgrabber();
StopEPGgrabber(4);
TvResult result = _cards[user.CardId].Recorder.Start(ref user, ref fileName);

if (result == TvResult.Succeeded)
@@ -1876,7 +1876,7 @@ public TvResult StartRecording(ref IUser user, ref string fileName)
}
else
{
StartEPGgrabber();
StartEPGgrabber(4);
}

return result;
@@ -1899,7 +1899,7 @@ public bool StopRecording(ref IUser user)
{
UpdateChannelStatesForUsers();
}
StartEPGgrabber();
StartEPGgrabber(2);
return result;
}

@@ -2442,7 +2442,7 @@ public TvResult StartTimeShifting(ref IUser user, int idChannel, out VirtualCard
user.Priority = UserFactory.GetDefaultPriority(user.Name, user.Priority);
Channel channel = Channel.Retrieve(idChannel);
Log.Write("Controller: StartTimeShifting {0} {1}", channel.DisplayName, channel.IdChannel);
StopEPGgrabber();
StopEPGgrabber(5);

IDictionary<CardDetail, ICardTuneReservationTicket> tickets = null;
try
@@ -2474,7 +2474,7 @@ public TvResult StartTimeShifting(ref IUser user, int idChannel, out VirtualCard
CardReservationHelper.CancelAllCardReservations(tickets, CardCollection);
if (!HasTvSucceeded(result))
{
StartEPGgrabber();
StartEPGgrabber(5);
}
if (card != null)
{
@@ -2908,29 +2908,29 @@ private string GetIntialTimeshiftingFilename(VirtualCard initialCard)
return intialTimeshiftingFilename;
}

private void StopEPGgrabber()
private void StopEPGgrabber(int caller)
{
if (_epgGrabber != null)
{
Log.Write("Controller: epg stop");
Log.Write("Controller: epg stop, caller {0}", caller);
_epgGrabber.Stop();
}
}

private void StartEPGgrabber()
private void StartEPGgrabber(int caller)
{
if (_epgGrabber != null && AllCardsIdle)
{
Log.Write("Controller: epg start");
Log.Write("Controller: epg start, caller {0}", caller);
_epgGrabber.Start();
}
}

private void StartEPGgrabber(double timerInterval)
private void StartEPGgrabber(double timerInterval, int caller)
{
if (_epgGrabber != null && AllCardsIdle)
{
Log.Write("Controller: epg start, timerInterval {0}s", timerInterval/1000);
Log.Write("Controller: epg start, timerInterval {0}s, caller {1}", timerInterval/1000, caller);
_epgGrabber.Start(timerInterval);
}
}
@@ -3158,7 +3158,7 @@ public bool EpgGrabberEnabled
{
if (_layer.GetSetting("idleEPGGrabberEnabled", "yes").Value == "yes")
{
StartEPGgrabber();
StartEPGgrabber(6);
}
}
}
@@ -3168,7 +3168,7 @@ public bool EpgGrabberEnabled
{
if (_layer.GetSetting("idleEPGGrabberEnabled", "yes").Value == "yes")
{
StopEPGgrabber();
StopEPGgrabber(6);
}
}
}

0 comments on commit 4cc926d

Please sign in to comment.