NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 8 9 10 11 12 … 93 Next »
updating EPG

 
  • 0 Vote(s) - 0 Average
updating EPG
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#1
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."
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();
                }
            });
        }
and this is my WebConsoleEpgUpdateCallback class
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).
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#2
2012-11-30, 01:31 PM
Here's how I do it in the System plugin. These methods are part of a class that implements EPGManager.IEPGUpdateCallback. It's run in its own thread.

Code:
private void EPGRunner()
{
    isUpdatingEPG = true;

    ClearLabels();
    args["@status1"] = "Requesting EPG update event...";
    NSystem.statusUpdated = true;

    Log.Debug("Requesting EPG update");
    new EPGManager().UpdateEPG(this);

    Log.Debug("Exporting recordings");
    ExportImport.ExportRecordings(false);

    Log.Debug("Requesting RELOAD_SETTINGS");
    EventBus.GetInstance().Notify("RELOAD_SETTINGS");

    isUpdatingEPG = false;
}

public bool SetEPGUpdateStatus(string status)
{
    // The messages received back from nPVR are either 1 or 2 lines
    string[] str = status.Split('\n');

    args["@status1"] = str[0];
    args["@status2"] = str.Length == 2 ? str[1] : "";
    NSystem.statusUpdated = true;

    return true;
}

Iain
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 53,202
Threads: 958
Joined: May 2006
#3
2012-11-30, 04:25 PM
There might be a difference running connecting to the recording server outside of a plugin. I needed a couple of lines I added here

http://forums.nextpvr.com/showthread.php...post439454

and then you also need the line sub wrote after that.

Martin
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#4
2012-11-30, 09:05 PM (This post was last modified: 2012-12-01, 02:47 AM by reven.)
ok im closer,

Code:
NUtility.PluginRegistry.GetInstance().LoadPlugins();
            NShared.RecordingServiceProxy.ForceRemote();
            ScheduleHelperFactory.SetScheduleHelper(GetRecordingServiceInstance());
            NShared.EPGManager manager = new NShared.EPGManager();
            WebConsoleEpgUpdateCallback wcCallback = new WebConsoleEpgUpdateCallback(CallBack);

now doesnt throw the error, i have log messages like this in my npvr.log
Code:
2012-12-01 10:01:43.807    [DEBUG][23]     - mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
2012-12-01 10:01:43.807    [DEBUG][23]     - mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
2012-12-01 10:01:43.807    [DEBUG][23]     - mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
2012-12-01 10:01:43.807    [DEBUG][23]     - mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
2012-12-01 10:01:43.807    [DEBUG][23]     - mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
2012-12-01 10:01:43.807    [DEBUG][23]     - mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
2012-12-01 10:01:43.807    [DEBUG][23]     - mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
2012-12-01 10:01:43.807    [DEBUG][23]     - mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
2012-12-01 10:01:43.807    [DEBUG][23]     - mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
2012-12-01 10:01:43.807    [DEBUG][23]    Looking for assembly in (2) C:\Users\Public\NPVR\Plugins\common\Unmanaged.dll
2012-12-01 10:01:43.807    [DEBUG][23]    Looking for assembly in (3) C:\Program Files (x86)\NPVR\Plugins\common\Unmanaged.dll
2012-12-01 10:01:43.811    [INFO][23]    UpdateAllRecurringRecordings()
2012-12-01 10:01:43.811    [INFO][23]    Deleting existing pending season recordings
2012-12-01 10:01:43.821    [INFO][23]    UpdateRecurringRecording(66, 'Harry's Law'):

however the update finishes within seconds, and only seems to grab my xmltv listings and doesnt do a scan of my DVB-S listings.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Updating images scb147 11 4,616 2010-07-30, 06:11 PM
Last Post: scb147
  GBPVRUIElement - updating frequently psycik 6 2,401 2008-01-04, 10:16 AM
Last Post: psycik
  @time and @date not updating Digital712 3 2,148 2006-08-23, 02:06 AM
Last Post: Fatman_do
  updating a database reven 2 1,658 2005-02-08, 08:19 AM
Last Post: reven

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode