NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 71 72 73 74 75 … 93 Next »
LoadRecordingSchedule()

 
  • 0 Vote(s) - 0 Average
LoadRecordingSchedule()
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#1
2005-05-06, 06:43 AM
i have a problem in my videos where at load LoadRecordingSchedule() causes me problems and forces my videos to stop loading, and gbpvr to restart loading every plugin, trapping it in a forever loop and maxing out the cpu and ram. this problem has been in my videos for a while, and only know have i found out why. im using this code
Code:
foreach (ScheduledRecording scheduledRecording in GetScheduledRecordings())
                    {    
                        if(scheduledRecording != null)
                        {
                            if(scheduledRecording.getFileName().ToLower().EndsWith(fullName.ToLower()) && scheduledRecording.getProgramme() != null)
                            {
                                Description = scheduledRecording.getProgramme().getDescription();
                                Title = scheduledRecording.getProgramme().getTitle();
                                Subtitle = scheduledRecording.getProgramme().getSubTitle();                            
                                TimeSpan runtime = (TimeSpan)(scheduledRecording.getProgramme().getEndTime() - scheduledRecording.getProgramme().getStartTime());
                                Runtime = ""+ (runtime.Hours*60 + runtime.Minutes);
                                if(Subtitle.Length > 0)
                                {
                                    displayName = Subtitle;
                                }        
                                MyVideosTask.database.AddToDatabase(new VideoInfo(fullName,description,Title,Subtitle,Runtime,"","",Seen,null),false);
                                break;
                            }
                        }
                    }
                }
and this is GetScheduledRecordings()
Code:
private IList GetScheduledRecordings()
        {
            Logger.Verbose("entered recording schedule");
            if(ScheduledRecordings == null)
            {
                Logger.Verbose("debug 1");
                ScheduledRecordings = ScheduleHelper.getInstance().LoadRecordingSchedule();
                Logger.Verbose("debug 2");
                ScheduleLoadedAt = DateTime.Now;
                Logger.Verbose("debug 3");
            }
            else if(DateTime.Now > ScheduleLoadedAt.AddMinutes(30))
            {
                Logger.Verbose("debug 4");
                ScheduledRecordings = ScheduleHelper.getInstance().LoadRecordingSchedule();
                Logger.Verbose("debug 5");
                ScheduleLoadedAt = DateTime.Now;
                Logger.Verbose("debug 6");
            }
            Logger.Verbose("debug 7");
            return ScheduledRecordings;
        }
ignore the debug lines Smile.

anyway when i run this the GetScheduledRecordings doesnt even get called it crashes somewhere before then (the same line of code, just before the method is called, found this out by useful debug lines Smile). im just wondering if anyone knows why this is happening and how i can fix this.

i put a temp fix on it by using a boolean LOADING, which i set to true when my vids is created and false once all the loading is done, and when LOADING=true i just skip this method.

i can use this fix without much problems, but if a entry in the myvids database doesnt exist for a file, it will check the recordingschedule to see if a description exists in there (and when loading it checks the virtual root + paused files... which is how i discovered the problem). paused files isnt a problem since that is refreshed whenever a videostopping event happens. but the root never gets refreshed (well hardly ever, it might do i have to check the code).

i think this is the same problem jeff was having with vidarch awhile ago.

anyway, long boring post has finished

TIA
reven.
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,787
Threads: 769
Joined: Nov 2003
#2
2005-05-06, 07:06 AM
Are you doing this in the constructor for the plugin? If so, you should really being doing this the first time Activate() method is called in your plugin.

Loading the recording schedule can trigger the plugins to be loaded if they havn't already (primarily for the recording source plugins), which in turn will find your plugin again, which will load the recording schedule, which will load the plugins and so on and so on.
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,787
Threads: 769
Joined: Nov 2003
#3
2005-05-06, 07:09 AM
I've added a small piece of logic to stop this happening in the next release, but I still recommend you do any initialization in the first call to Activate().
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#4
2005-05-06, 07:22 AM
i dont like putting it in the activate method, it just slows down the program (well the first time you enter it). i prefer for gbpvr take a few seconds longer to load, than a few seconds longer to open a plugin. the only reason the recording schedule is being loaded is when trying to find a description/title/subtitle for a unknown file, and it doesnt really happen that often (most of the videos should be in the my vids db). and its just one of the methods used to get the description
1. my vids db
2. recording schedule
3. .details file
4. use the parent

thanks for the fix thou. after thinking about it for a little longer, the bool i set should work, since if you just define the "recordings" directory for the virtual root, there shouldnt be any loose files in that folder anyway, so nothing to check for description from recordingschedule (only movies are checked with this method aswell), so i might just keep the boolean around.

well at least that bug is now fixed Smile
Jeff
Offline

Posting Freak

Posts: 1,933
Threads: 69
Joined: Oct 2004
#5
2005-05-06, 01:46 PM
Yes, I had a similiar problem in that like you I was also doing lots of initialization earlier on to make the plug-in more responsive. I chnaged it so now I call my init routine the first time the GetName() method is callled, which GBPVR calls to get the button name to build the menu. This happens late enough in the process that GBPVR is settled down but still happens earlier enough fr me to start loading things in a background so that the first time Activate() is called the plug-in is usually pretty well along iun setting itself up.

Jeff
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#6
2005-05-06, 01:55 PM
getname, thanks for the tip, i can easily add a check in there to see if its the config getting the name or actually gbpvr. Smile
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  1.0.8: LoadRecordingSchedule doesn't work anymore? Remco 4 2,083 2007-07-28, 08:27 AM
Last Post: Remco
  ScheduleHelper.LoadRecordingSchedule() and SQLite database locks alibert 0 1,278 2006-05-23, 05:36 PM
Last Post: alibert
  LoadRecordingSchedule endless loop crash (v0.97.7) Mister Slimm 2 1,510 2006-05-15, 05:36 PM
Last Post: Mister Slimm
  Error from ScheduleHelper.LoadRecordingSchedule() Jeff 1 1,427 2005-02-07, 05:11 AM
Last Post: KingArgyle

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

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

Linear Mode
Threaded Mode