Beispiel #1
0
        private static bool GetAllRecordingSchedule(double daysBack, bool merge)
        {
            bool debug = (Settings.Default.DebugAdvanced);

            Functions.WriteLineToLogFileIfSetting(debug, "" + ReloadingRecordings + "," + daysBack + "ReloadingRecordings, daysBack");

            lock (oneEntryAtATime) //-	Live TV: Handled race condition where scheduling live TV always comes up with all recordings busy.
            {
                if (ReloadingRecordings)
                {
                    Functions.WriteLineToLogFileIfSetting(debug, "ReloadingRecordings=True");
                    return(true); // Don't bother, already doing it
                }

                // Set flag
                ReloadingRecordings = true;


                if (!isWMCOnline)
                {
                    Functions.WriteLineToLogFileIfSetting(debug, "isWMCOnline=False");
                    return(false);
                }
                //if (!merge)
                {
                    Functions.WriteLineToLogFileIfSetting(debug, "WMC is online now clearing requests and recordings");
                    Functions.WriteLineToLogFileIfSetting(debug, "recording count=" + AllRecordings.Count());
                    Functions.WriteLineToLogFileIfSetting(debug, "AllRequests count=" + AllRequests.Count());
                    AllRecordings.Clear();
                    AllRequests.Clear();
                }

                DateRange theRange = new DateRange(DateTime.Now.ToUniversalTime().AddDays(-daysBack), DateTime.Now.ToUniversalTime().AddDays(100));

                MergeInRequests(mcData.GetAllRequests(theRange));
                MergeInRecordings(mcData.GetAllRecordingsForRequests(AllRequests.Values.ToList(), theRange));

                Functions.WriteLineToLogFileIfSetting(debug, "recording count=" + AllRecordings.Count());
                Functions.WriteLineToLogFileIfSetting(debug, "AllRequests count=" + AllRequests.Count());

                // SortAllRecordingsByDate();
                //  SortAllRequestsByTitle();

                // Unset flag
                ReloadingRecordings = false;
                Functions.WriteLineToLogFileIfSetting(debug, "ReloadingRecordings set to False");
            }

            return(true);
        }
Beispiel #2
0
        private static bool GetAllRecordingSchedule(double daysBack, bool merge)
        {
            if (ReloadingRecordings)
            {
                return(true); // Don't bother, already doing it
            }
            // Set flag
            ReloadingRecordings = true;

            if (!isWMCOnline)
            {
                return(false);
            }
            //if (!merge)
            {
                AllRecordings.Clear();
                AllRequests.Clear();
            }

            DateRange theRange = new DateRange(DateTime.Now.ToUniversalTime().AddDays(-daysBack), DateTime.Now.ToUniversalTime().AddDays(100));

            MergeInRequests(mcData.GetAllRequests(theRange));
            MergeInRecordings(mcData.GetAllRecordingsForRequests(AllRequests.Values.ToList(), theRange));


            // SortAllRecordingsByDate();
            //  SortAllRequestsByTitle();

            // Unset flag
            ReloadingRecordings = false;

            return(true);
        }