Stay Awake Whilst Loading EPG (1 Viewer)

jameson_uk

Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,257
    2,533
    Birmingham
    Home Country
    United Kingdom United Kingdom
    XMLTV imports a tvguide if its "modified" time is later than the end of the last import. So if you run the grabber while xmltv was still importing the previous tvguide, this is probably normal.
    Grabber is set to run at 5am everyday and takes a couple of minutes. When I have rerun it, it has been at least a few hours in between runs

    Why is your tv.log full of entries saying that you have tried to import an existing program into the EPG? All programs should have been removed prior to the import.
    No idea.... the option it ticked to delete before import but there are still lots of entries. Don't get this normally with the XMLTV import though so does the force input button not do a delete first ???
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,257
    2,533
    Birmingham
    Home Country
    United Kingdom United Kingdom
    OK something very odd going on here.

    Just loaded up MP and went into guide but several cannels were showing as no-data available.
    Have clean MP logs too so went through and it says everything is fine.

    FIVER and QUEST both had no data at all in the EPG (in single channel view there was not a single entry)

    yet in TV.log you have
    Code:
    2009-11-23 05:02:16.765625 [XmlTvImporter]: XMLTVImport: Inserting 395 programs for FIVER
    2009-11-23 05:02:16.781250 [XmlTvImporter]: XMLTVImport: Inserting 288 programs for QUEST

    Seems as logs seem ok I went to database and by the time I had located idChannel for FIVER and done a count in programs table there was data there...

    Seems like a commit or something is not being triggered at the right time?? You mentioned a background process being spawned to do the insert, is this on a channel by channel basis (there was data for other channels). When the log says
    Code:
    2009-11-23 05:02:16.812500 [XmlTvImporter]: Xmltv: imported 89 channels, 43769 programs status:tvguide.xml:File imported successfully; 
    2009-11-23 05:02:16.812500 [XmlTvImporter]: plugin:xmltv import done
    Does this mean that all processing has finished or just that any worked processes have been spawned?

    Stuggling to tell whether this is an issue with the EPG through MP client not getting the right data, an issue with xmltv plugin not writing data to database for a while or a problem with mysql ?

    Any ideas?? Logs attached but as above these just show clean processing of the file
     

    arion_p

    Retired Team Member
  • Premium Supporter
  • February 7, 2007
    3,367
    1,642
    Athens
    Home Country
    Greece Greece
    When the log says
    Code:
    2009-11-23 05:02:16.812500 [XmlTvImporter]: Xmltv: imported 89 channels, 43769 programs status:tvguide.xml:File imported successfully; 
    2009-11-23 05:02:16.812500 [XmlTvImporter]: plugin:xmltv import done
    Does this mean that all processing has finished or just that any worked processes have been spawned?

    Stuggling to tell whether this is an issue with the EPG through MP client not getting the right data, an issue with xmltv plugin not writing data to database for a while or a problem with mysql ?

    Any ideas?? Logs attached but as above these just show clean processing of the file

    The background thread is spawned after xmltv has finished. So the problem is, since you are importing a large number of programs, that the background thread has not finished by the time the system suspends. This is a problem also with WebEPG and DVB EPG, although not so much as the thread is spawned after each channel, so normally only the last few channels may suffer this issue.

    Mantis issue updated.
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,070
    7,459
    Home Country
    Germany Germany
    arion_p, I modified the xmltv plugin.

    if I got your bugreport right, this patch should fix it. can you take a look on it before I commit?
     

    Attachments

    • mantis_2550.patch
      30.6 KB

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,257
    2,533
    Birmingham
    Home Country
    United Kingdom United Kingdom
    if I got your bugreport right, this patch should fix it. can you take a look on it before I commit?
    Had a rush job of trying to understand the code but I am doing this on a machine without Visual Studio...

    I think your code probably fixes the original problem Arion_p raised however not the additional bit he added today...

    I think (well quessing really) that a new thread gets raised in StartImport (where you have removed the call to SetStandbyAllowed(false); ) but this thread creates an instance of XMLTVImport and kicks off the import but somewhere in here a new thread gets called which physically does the insert however it does not wait for this to return so the main plugin code gets to finish and SetStandbyAllows(true); gets called

    Not sure if the problem is line 782 of xmltvimport.cs where is makes a call to
    layer.InsertPrograms(progChan.programs, ThreadPriority.BelowNormal);
    and then returns back to the main plugin code

    As I said I have only had a very sort time to look at this on a machine without VS but if I can help with any testing let me know...

    Thanks
     

    arion_p

    Retired Team Member
  • Premium Supporter
  • February 7, 2007
    3,367
    1,642
    Athens
    Home Country
    Greece Greece
    My only worry about your patch is that ForceImport() and/or StartImport() might fail after SetStandbyAllowed(false) but before the thread is started (e.g. when executing the SQL), in which case SetStandbyAllowed(true) will never be called and tvserver will stay awake (at least for one hour, then xmltv handler will be ignored). I would suggest these two blocks are put in a try / catch and SetStandbyAllowed(true) be called in case of an exception.

    Other than that I think it will do the trick.;)
     

    arion_p

    Retired Team Member
  • Premium Supporter
  • February 7, 2007
    3,367
    1,642
    Athens
    Home Country
    Greece Greece
    Not sure if the problem is line 782 of xmltvimport.cs where is makes a call to
    layer.InsertPrograms(progChan.programs, ThreadPriority.BelowNormal);
    and then returns back to the main plugin code

    This is what starts the DB insert thread, and yes the patch won't fix this. But don't worry about this, it needs to be fixed separately as it also affects WebEPG and things get even more complex if you consider the newly committed tv guide speedup by gibman. I will take a look at it as soon as I get some time from debugging TSReader.
     

    arion_p

    Retired Team Member
  • Premium Supporter
  • February 7, 2007
    3,367
    1,642
    Athens
    Home Country
    Greece Greece
    jameson_uk: Can you please try this patch to see if it works for you?

    To install stop TVService, extract the zip in you TV Server installation folder (backup existing files first) and restart TVService.
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,257
    2,533
    Birmingham
    Home Country
    United Kingdom United Kingdom
    @jameson_uk: Can you please try this patch to see if it works for you?
    Will do once I get home tonight.

    I am thinking that if I update the xml file that should trigger an import. If I set powerscheduler for a 1 minute timeout this should show the problem? If it does and I can replicate I will try your patch and hopefully all should be good :D

    :D

    might be tomorrow.... kicked off comskip via a script to analyse some older H264 recordings and looking like it wont finish until the morning...
     

    Users who are viewing this thread

    Top Bottom