2012-11-30, 11:42 AM
I'm getting the classic "Object reference not set to an instance of an object." when trying to update the epg.
I original get these two lines back and then the "Object reference not set to an instance of an object."
im using the following code to call the update
and this is my WebConsoleEpgUpdateCallback class
I believe the object not set is inside the manager.UpdateEPG somewhere, but i get no more information than that. theres nothing mentioned in any of the nextpvr logs.
is this not the correct way to update the EPG? (if its not is there a similar call, or a way I can call it and still get the status of the update as I would like to make this visible to the user, seeing as it can take a while for some setups).
I original get these two lines back and then the "Object reference not set to an instance of an object."
Code:
Checking for any XMLTV listings
Checking for any DVB/ATSC listings
im using the following code to call the update
Code:
static Mutex EpgUpdateMutex = new Mutex();
internal static void UpdateEpg(Action<string> CallBack = null)
{
Logger.ILog("Update EPG Started");
NShared.EPGManager manager = new NShared.EPGManager();
WebConsoleEpgUpdateCallback wcCallback = new WebConsoleEpgUpdateCallback(CallBack);
System.Threading.Tasks.Task.Factory.StartNew(delegate
{
if (!EpgUpdateMutex.WaitOne(100))
{
Logger.ELog("Failed to update EPG, already running.");
return;
}
try
{
Hubs.NextPvrEventHub.Clients_ShowInfoMessage("EPG Update Started");
manager.UpdateEPG(wcCallback);
Hubs.NextPvrEventHub.Clients_ShowInfoMessage("EPG Update Completed");
}
catch (Exception ex)
{
Hubs.NextPvrEventHub.Clients_ShowErrorMessage(ex.Message, "EPG Update Failed");
wcCallback.SetEPGUpdateStatus("ERROR: " + ex.Message);
}
finally
{
System.Threading.Thread.Sleep(10000);
EpgUpdateMutex.ReleaseMutex();
}
});
}
Code:
class WebConsoleEpgUpdateCallback : NShared.EPGManager.IEPGUpdateCallback
{
private Action<string> CallBack;
public WebConsoleEpgUpdateCallback(Action<string> CallBack = null)
{
this.CallBack = CallBack;
}
public bool SetEPGUpdateStatus(string status)
{
Logger.ILog("Updating EPG Status: " + status);
if (CallBack != null)
CallBack(status);
return true;
}
}
I believe the object not set is inside the manager.UpdateEPG somewhere, but i get no more information than that. theres nothing mentioned in any of the nextpvr logs.
is this not the correct way to update the EPG? (if its not is there a similar call, or a way I can call it and still get the status of the update as I would like to make this visible to the user, seeing as it can take a while for some setups).