[EPG] Will EPG data be updated while watching TV? (1 Viewer)

Snoopy87

Portal Pro
August 12, 2012
468
167
Germany Germany
Hi,

I always wondered why EPG data is very often not updated and why I very often have no epg info on many channels.

Today I looked in the code and saw this code (EpgCard.cs):

Code:
public override int OnEpgReceived()
	{
	  try
	  {
		//is epg grabbing in progress?
		/*if (_state == EpgState.Idle)
		{
		  Log.Epg("Epg: card:{0} OnEpgReceived while idle", _user.CardId);
		  return 0;
		}*/
		//is epg grabber already updating the database?
 
		if (_state == EpgState.Updating)
		{
		  Log.Epg("Epg: card:{0} OnEpgReceived while updating", _user.CardId);
		  return 0;
		}
 
		//is the card still idle?
		if (IsCardIdle(_user) == false)
		{
		  Log.Epg("Epg: card:{0} OnEpgReceived but card is not idle", _user.CardId);
		  _state = EpgState.Idle;
		  _tvController.StopGrabbingEpg(_user);
		  _user.CardId = -1;
		  _currentTransponder.InUse = false;
		  return 0;
		}
 
		List<EpgChannel> epg = _tvController.Epg(_user.CardId) ?? new List<EpgChannel>();
		//did we receive epg info?
		if (epg.Count == 0)
		{
		  //no epg found for this transponder
		  Log.Epg("Epg: card:{0} no epg found", _user.CardId);
		  _currentTransponder.InUse = false;
		  _currentTransponder.OnTimeOut();
 
		  _state = EpgState.Idle;
		  _tvController.StopGrabbingEpg(_user);
		  _tvController.PauseCard(_user);
		  _user.CardId = -1;
		  _currentTransponder.InUse = false;
		  return 0;
		}
 
		//create worker thread to update the database
		Log.Epg("Epg: card:{0} received epg for {1} channels", _user.CardId, epg.Count);
		_state = EpgState.Updating;
		_epg = epg;
		Thread workerThread = new Thread(UpdateDatabaseThread);
		workerThread.IsBackground = true;
		workerThread.Name = "EPG Update thread";
		workerThread.Start();
	  }
	  catch (Exception ex)
	  {
		Log.Write(ex);
	  }
	  return 0;
	}
So, if EPG Grabber is already updating some data, the new received EPG data will not be stored.
Also, if the TV Card is NOT in idle state, the method returns.

So is it true, that the EPG data will only be stored, if my tv card is in idle state? That will mean, the EPG is not stored while watching a channel? Is there any reason for this behaviour? In my opinion it makes more sense to store the EPG which will be received on the channel I'm watching, because this is the normal and expected behaviour of any set top box / tv / dvb software. If I always watch TV with my HTPC, so that my TV card is never in idle mode, EPG data will never be stored?

Or do I understand something completly wrong? :-(

Best regards,
Sascha
 
Last edited:

Django.edwards

Portal Pro
October 22, 2009
457
54
Eupen
Belgium Belgium
Country flag
If you have the Option "grab epg while timeshifting" ticked, then the epg will be grabbed in the first minutes you Switch to the channel. You can observe this if you take a look at the "Manual" section in the tvserver config.
 

Snoopy87

Portal Pro
August 12, 2012
468
167
Germany Germany
Ok, thanks.

Where do I find this code for? Is there another method which will be called in the case of "grab epg while timeshifting", because in the above code I can't see where the method does not return in this case.
 

tourettes

Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    No clue where the code resides but that pasted code is probably missing synchronisation for the state object. At least I would assume the state is used by multiple threads.

    @gibman
     

    Snoopy87

    Portal Pro
    August 12, 2012
    468
    167
    Germany Germany
    @Sebastiii: Could some developer look at this? I tooked a deeper look in this, and it seems to me, that EPG is not stored while watching TV, because it is only stored if the TV card is in idle state (which it is not, if you watch tv). Also the setting that EPG should be stored while timeshifting has no effect on this in my opinion.

    This could be found in TimeShifter.cs:

    Code:
    _timeshiftingEpgGrabberEnabled = (layer.GetSetting("timeshiftingEpgGrabberEnabled", "no").Value == "yes");
    _timeshiftingEpgGrabberEnabled will only be used here (TimeShifterBase.cs):

    Code:
    protected void StartTimeShiftingEPGgrabber(IUser user)
    	{
    	  if (_timeshiftingEpgGrabberEnabled)
    	  {
    		Channel channel = Channel.Retrieve(user.IdChannel);
    		if (channel.GrabEpg)
    		{
    		  _cardHandler.Card.GrabEpg();
    		}
    		else
    		{
    		  Log.Info("TimeshiftingEPG: channel {0} is not configured for grabbing epg",
    				  channel.DisplayName);
    		}
    	  }
    	}
    Because of Interfaces, etc. I was unable to follow the code more deeper, but I think at the end GrabEpg() will run OnEpgReceived() (posted in the first post) and as said then EPG data will not be stored, because TV card is not idling.
     
    Last edited:

    mm1352000

    Development Group
  • Team MediaPortal
  • September 1, 2008
    21,571
    8,218
    New Zealand New Zealand
    Country flag
    Could some developer look at this?
    Sure... but honestly, this problem would have been reported long ago if it were not working. ;)

    Where do I find this code for? Is there another method which will be called in the case of "grab epg while timeshifting", because in the above code I can't see where the method does not return in this case.
    OnEpgReceived() in TimeShiftingEPGGraber.cs (in the TV library).
    https://github.com/MediaPortal/Medi...TVLibrary/TVLibrary/TimeShiftingEPGGrabber.cs

    You're looking at the code for the idle EPG grabber only.
     

    Snoopy87

    Portal Pro
    August 12, 2012
    468
    167
    Germany Germany
    Thanks! I didn't know that, I only looked in the TV Service. Thanks! :)

    It's not easy to understand the whole code, if you are just starting with developing for MediaPortal, because it's a very huge project with a lot of code :)
     
    Last edited:

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    OP Similar threads Forum Replies Date
    D EPG No Data General Support 2
    D [solved] EPG Data off by -20 hours? General 10
    T Freeview EPG-Anyone know what channel sends the guide data? Electronic Program Guide 10
    G Newb trying MP2, trouble with guide data General 5
    J EPG data recheck? Feature Requests 0
    T Media Portal 2 EPG data missing General 16
    M EPG color by length of TV-show MediaPortal 1 Talk 1
    D Downloading EPG XML file: Installation, configuration support 0
    G Q about scheduling weekly series when epg lists duplicate back to back episodes each week General Support 2
    F Mini EPG more information? WMC Skin 4
    N No TV or EPG on fresh install General 0
    framug No color in TVGuide when XMLTV without DVB EPG MediaPortal 1 Talk 59
    T Freesat EPG in UK anyone? Electronic Program Guide 78
    Dark Eyes TVService locks up or fails to restart on resuming from sleep, and crashes when grabbing EPG Installation, configuration support 7
    G Movie release date in guide Electronic Program Guide 2
    Rob Hexenmeister Navigation problems adding menu buttons to EPG General Support 1
    404 [solved] EPG problem after Win10 'upgrade' General Support 1
    CyberSimian [fixed] MP1-4990 : Improve horizontal scrolling in the EPG MediaPortal 1 10
    framug [EPG] Some problems with DVB EPG Improvement Suggestions 49
    D [solved] EPG Buddy for MP2 - Does it work? General 5
    J Understanding what EPG shows about schedules General 8
    geotwticher TV Guide EPG Grabber for Australia 2020 RIP freepg.tv General 4
    B [solved] MP2.2.3 TV Guide not scrolling with mouse wheel General 2
    HTPCSourcer Special (foreign) characters don't display correctly in EPG MediaPortal 2 4
    B How to Search MP2 for Movies only in 7 day EPG that comes from the Antenna General 3
    Similar threads

























    Top Bottom