示例#1
0
 public Reminder(ReminderType reminderType, ReminderTimeType reminderTimeType, RepeatingType repeatingType, int customReminderTime = 0)
 {
     RepeatingType = repeatingType;
     ReminderType = reminderType;
     CustomReminderTime = customReminderTime;
     ReminderTimeType = reminderTimeType;
 } 
示例#2
0
 public static Schedule CreateRecordRepeatingSchedule(RepeatingType repeatingType, ChannelType channelType, Guid channelId, Guid guideProgramId, string titleSuffix = null)
 {
     GuideProgram guideProgram = Proxies.GuideService.GetProgramById(guideProgramId).Result;
     if (guideProgram != null)
     {
         return CreateRecordRepeatingSchedule(repeatingType, channelType, channelId, guideProgram.Title, guideProgram.StartTime, titleSuffix);
     }
     return null;
 }
示例#3
0
 public static Schedule CreateRecordRepeatingSchedule(ISchedulerService tvSchedulerAgent, IGuideService tvGuideAgent,
     RepeatingType repeatingType, ChannelType channelType, Guid channelId, Guid guideProgramId, string titleSuffix = null)
 {
     GuideProgram guideProgram = tvGuideAgent.GetProgramById(guideProgramId);
     if (guideProgram != null)
     {
         return CreateRecordRepeatingSchedule(tvSchedulerAgent, repeatingType, channelType, channelId, guideProgram.Title, guideProgram.StartTime, titleSuffix);
     }
     return null;
 }
示例#4
0
        public Schedule CreateRecordRepeatingSchedule(RepeatingType repeatingType, Guid?channelId, Guid guideProgramId)
        {
            GuideProgram guideProgram = Proxies.GuideService.GetProgramById(guideProgramId).Result;

            if (guideProgram != null)
            {
                return(GuideController.CreateRecordRepeatingSchedule(repeatingType, _model.ChannelType, channelId, guideProgram.Title, guideProgram.StartTime, string.Empty));
            }
            return(null);
        }
示例#5
0
        public static Schedule CreateRecordRepeatingSchedule(RepeatingType repeatingType, ChannelType channelType, Guid channelId, Guid guideProgramId, string titleSuffix = null)
        {
            GuideProgram guideProgram = Proxies.GuideService.GetProgramById(guideProgramId).Result;

            if (guideProgram != null)
            {
                return(CreateRecordRepeatingSchedule(repeatingType, channelType, channelId, guideProgram.Title, guideProgram.StartTime, titleSuffix));
            }
            return(null);
        }
示例#6
0
        public static Schedule CreateRecordRepeatingSchedule(ISchedulerService tvSchedulerAgent, IGuideService tvGuideAgent,
                                                             RepeatingType repeatingType, ChannelType channelType, Guid channelId, Guid guideProgramId, string titleSuffix = null)
        {
            GuideProgram guideProgram = tvGuideAgent.GetProgramById(guideProgramId);

            if (guideProgram != null)
            {
                return(CreateRecordRepeatingSchedule(tvSchedulerAgent, repeatingType, channelType, channelId, guideProgram.Title, guideProgram.StartTime, titleSuffix));
            }
            return(null);
        }
示例#7
0
        public static Schedule CreateRecordRepeatingSchedule(RepeatingType repeatingType, ChannelType channelType,
                                                             Guid channelId, string title, DateTime startTime, string titleSuffix = null)
        {
            Schedule schedule = Proxies.SchedulerService.CreateNewSchedule(channelType, ScheduleType.Recording).Result;

            if (repeatingType == RepeatingType.AnyTime)
            {
                schedule.Name = title + (titleSuffix ?? " (Any Time)");
                schedule.Rules.Add(ScheduleRuleType.NewEpisodesOnly, true);
            }
            else if (repeatingType == RepeatingType.Weekly)
            {
                schedule.Name = title + (titleSuffix ?? " (Weekly)");
                schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, GetDaysOfWeek(startTime));
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(startTime.TimeOfDay));
            }
            else if (repeatingType == RepeatingType.MonFri)
            {
                schedule.Name = title + (titleSuffix ?? " (Mon-Fri)");
                schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, ScheduleDaysOfWeek.WorkingDays);
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(startTime.TimeOfDay));
            }
            else if (repeatingType == RepeatingType.SatSun)
            {
                schedule.Name = title + (titleSuffix ?? " (Sat-Sun)");
                schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, ScheduleDaysOfWeek.Weekends);
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(startTime.TimeOfDay));
            }
            else
            {
                schedule.Name = title + (titleSuffix ?? " (Daily)");
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(startTime.TimeOfDay));
            }

            schedule.Rules.Add(ScheduleRuleType.Channels, channelId);
            schedule.Rules.Add(ScheduleRuleType.TitleEquals, title);
            return(schedule);
        }
示例#8
0
        public static Schedule CreateRecordRepeatingSchedule(RepeatingType repeatingType, ChannelType channelType,
            Guid channelId, string title, DateTime startTime, string titleSuffix = null)
        {
            Schedule schedule = Proxies.SchedulerService.CreateNewSchedule(channelType, ScheduleType.Recording).Result;

            if (repeatingType == RepeatingType.AnyTime)
            {
                schedule.Name = title + (titleSuffix ?? " (Any Time)");
                schedule.Rules.Add(ScheduleRuleType.NewEpisodesOnly, true);
            }
            else if (repeatingType == RepeatingType.Weekly)
            {
                schedule.Name = title + (titleSuffix ?? " (Weekly)");
                schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, GetDaysOfWeek(startTime));
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(startTime.TimeOfDay));
            }
            else if (repeatingType == RepeatingType.MonFri)
            {
                schedule.Name = title + (titleSuffix ?? " (Mon-Fri)");
                schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, ScheduleDaysOfWeek.WorkingDays);
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(startTime.TimeOfDay));
            }
            else if (repeatingType == RepeatingType.SatSun)
            {
                schedule.Name = title + (titleSuffix ?? " (Sat-Sun)");
                schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, ScheduleDaysOfWeek.Weekends);
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(startTime.TimeOfDay));
            }
            else
            {
                schedule.Name = title + (titleSuffix ?? " (Daily)");
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(startTime.TimeOfDay));
            }

            schedule.Rules.Add(ScheduleRuleType.Channels, channelId);
            schedule.Rules.Add(ScheduleRuleType.TitleEquals, title);
            return schedule;
        }
示例#9
0
 public Schedule CreateRecordRepeatingSchedule(ISchedulerService tvSchedulerAgent, IGuideService tvGuideAgent, RepeatingType repeatingType, Guid? channelId, Guid guideProgramId)
 {
     GuideProgram guideProgram = tvGuideAgent.GetProgramById(guideProgramId);
     if (guideProgram != null)
     {
         return GuideController.CreateRecordRepeatingSchedule(tvSchedulerAgent, repeatingType, _model.ChannelType, channelId, guideProgram.Title, guideProgram.StartTime,string.Empty);
     }
     return null;
 }
示例#10
0
        public Schedule CreateRecordRepeatingSchedule(ISchedulerService tvSchedulerAgent, IGuideService tvGuideAgent, RepeatingType repeatingType, Guid?channelId, Guid guideProgramId)
        {
            GuideProgram guideProgram = tvGuideAgent.GetProgramById(guideProgramId);

            if (guideProgram != null)
            {
                return(GuideController.CreateRecordRepeatingSchedule(tvSchedulerAgent, repeatingType, _model.ChannelType, channelId, guideProgram.Title, guideProgram.StartTime, string.Empty));
            }
            return(null);
        }
示例#11
0
 public static Schedule CreateRecordRepeatingSchedule(RepeatingType repeatingType, ChannelType channelType,
     Guid? channelId, string title, DateTime startTime)
 {
     return CreateRecordRepeatingSchedule(repeatingType, channelType, channelId, title, startTime, string.Empty);
 }
示例#12
0
 public Schedule CreateRecordRepeatingSchedule(RepeatingType repeatingType, Guid? channelId, Guid guideProgramId)
 {
     GuideProgram guideProgram = Proxies.GuideService.GetProgramById(guideProgramId).Result;
     if (guideProgram != null)
     {
         return GuideController.CreateRecordRepeatingSchedule(repeatingType, _model.ChannelType, channelId, guideProgram.Title, guideProgram.StartTime,string.Empty);
     }
     return null;
 }
示例#13
0
 public static Schedule CreateRecordRepeatingSchedule(ISchedulerService tvSchedulerAgent, RepeatingType repeatingType, ChannelType channelType,
                                                      Guid?channelId, string title, DateTime startTime)
 {
     return(CreateRecordRepeatingSchedule(tvSchedulerAgent, repeatingType, channelType, channelId, title, startTime, string.Empty));
 }
示例#14
0
 public static Schedule CreateRecordRepeatingSchedule(RepeatingType repeatingType, ChannelType channelType,
                                                      Guid?channelId, string title, DateTime startTime)
 {
     return(CreateRecordRepeatingSchedule(repeatingType, channelType, channelId, title, startTime, string.Empty));
 }
示例#15
0
        public static Schedule CreateRecordRepeatingSchedule(ISchedulerService tvSchedulerAgent, RepeatingType repeatingType, ChannelType channelType,
                                                             Guid?channelId, string title, DateTime startTime, string repeatingTime)
        {
            Schedule schedule = tvSchedulerAgent.CreateNewSchedule(channelType, ScheduleType.Recording);

            if (repeatingType == RepeatingType.AnyTime ||
                repeatingType == RepeatingType.AnyTimeThisChannel)
            {
                if (String.IsNullOrEmpty(repeatingTime))
                {
                    repeatingTime = "(Any Time)";
                }
                schedule.Name = title + " " + repeatingTime;
                schedule.Rules.Add(ScheduleRuleType.NewEpisodesOnly, true);
            }
            else if (repeatingType == RepeatingType.Weekly)
            {
                if (String.IsNullOrEmpty(repeatingTime))
                {
                    repeatingTime = "(Weekly)";
                }
                schedule.Name = title + " " + repeatingTime;
                schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, GetDaysOfWeek(startTime));
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(startTime.TimeOfDay));
            }
            else if (repeatingType == RepeatingType.MonFri)
            {
                if (String.IsNullOrEmpty(repeatingTime))
                {
                    repeatingTime = "(Mon-Fri)";
                }
                schedule.Name = title + " " + repeatingTime;
                schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, ScheduleDaysOfWeek.WorkingDays);
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(startTime.TimeOfDay));
            }
            else if (repeatingType == RepeatingType.SatSun)
            {
                if (String.IsNullOrEmpty(repeatingTime))
                {
                    repeatingTime = "(Sat-Sun)";
                }
                schedule.Name = title + " " + repeatingTime;
                schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, ScheduleDaysOfWeek.Weekends);
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(startTime.TimeOfDay));
            }
            else
            {
                if (String.IsNullOrEmpty(repeatingTime))
                {
                    repeatingTime = "(Daily)";
                }
                schedule.Name = title + " " + repeatingTime;
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(startTime.TimeOfDay));
            }

            if (channelId != null)
            {
                schedule.Rules.Add(ScheduleRuleType.Channels, channelId);
            }
            schedule.Rules.Add(ScheduleRuleType.TitleEquals, title);
            return(schedule);
        }
示例#16
0
        public static Schedule CreateRecordRepeatingSchedule(ISchedulerService tvSchedulerAgent, RepeatingType repeatingType, ChannelType channelType,
            Guid? channelId, string title, DateTime startTime, string repeatingTime)
        {
            Schedule schedule = tvSchedulerAgent.CreateNewSchedule(channelType, ScheduleType.Recording);

            if (repeatingType == RepeatingType.AnyTime ||
                repeatingType == RepeatingType.AnyTimeThisChannel)
            {
                if (String.IsNullOrEmpty(repeatingTime))
                    repeatingTime = "(Any Time)";
                schedule.Name = title + " " + repeatingTime;
                schedule.Rules.Add(ScheduleRuleType.NewEpisodesOnly, true);
            }
            else if (repeatingType == RepeatingType.Weekly)
            {
                if (String.IsNullOrEmpty(repeatingTime))
                    repeatingTime = "(Weekly)";
                schedule.Name = title + " " + repeatingTime;
                schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, GetDaysOfWeek(startTime));
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(startTime.TimeOfDay));
            }
            else if (repeatingType == RepeatingType.MonFri)
            {
                if (String.IsNullOrEmpty(repeatingTime))
                    repeatingTime = "(Mon-Fri)";
                schedule.Name = title + " " + repeatingTime;
                schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, ScheduleDaysOfWeek.WorkingDays);
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(startTime.TimeOfDay));
            }
            else if (repeatingType == RepeatingType.SatSun)
            {
                if (String.IsNullOrEmpty(repeatingTime))
                    repeatingTime = "(Sat-Sun)";
                schedule.Name = title + " " + repeatingTime;
                schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, ScheduleDaysOfWeek.Weekends);
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(startTime.TimeOfDay));
            }
            else
            {
                if (String.IsNullOrEmpty(repeatingTime))
                    repeatingTime = "(Daily)";
                schedule.Name = title + " " + repeatingTime;
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(startTime.TimeOfDay));
            }

            if (channelId != null)
            {
                schedule.Rules.Add(ScheduleRuleType.Channels, channelId);
            }
            schedule.Rules.Add(ScheduleRuleType.TitleEquals, title);
            return schedule;
        }
示例#17
0
 public static Schedule CreateRecordRepeatingSchedule(ISchedulerService tvSchedulerAgent, RepeatingType repeatingType, ChannelType channelType,
     Guid? channelId, string title, DateTime startTime)
 {
     return CreateRecordRepeatingSchedule(tvSchedulerAgent, repeatingType, channelType, channelId, title, startTime, string.Empty);
 }
示例#18
0
 public virtual void AddReminder(ReminderType reminderType, ReminderTimeType reminderTimeType,
     RepeatingType repeatingType, int customReminderTime)
 {
     Reminder = new Reminder(reminderType, reminderTimeType, repeatingType, customReminderTime);
 }
示例#19
0
        private IMBotMessage DoRecordCommand(IMBotConversation conversation, IList <string> arguments)
        {
            if (arguments.Count == 0)
            {
                return(new IMBotMessage("Program number missing.", IMBotMessage.ErrorColor));
            }

            RepeatingType repeatingType = RepeatingType.None;

            if (arguments.Count > 1)
            {
                switch (arguments[1].ToLowerInvariant())
                {
                case "once":
                case "o": repeatingType = RepeatingType.Once; break;

                case "daily":
                case "d": repeatingType = RepeatingType.Daily; break;

                case "weekly":
                case "w": repeatingType = RepeatingType.Weekly; break;

                case "workingdays":
                case "wd": repeatingType = RepeatingType.WorkingDays; break;

                case "weekends":
                case "we": repeatingType = RepeatingType.Weekends; break;

                case "anytime":
                case "a": repeatingType = RepeatingType.AnyTime; break;
                }
            }

            int programNumber;

            if (repeatingType == RepeatingType.None ||
                !int.TryParse(arguments[0], out programNumber))
            {
                return(new IMBotMessage("Please specify program number and once, daily, weekly, workingdays, weekends or anytime.", IMBotMessage.ErrorColor));
            }

            Session.Programs sessionPrograms = null;
            if (conversation.Session.ContainsKey(SessionKey.Programs))
            {
                sessionPrograms = conversation.Session[SessionKey.Programs] as Session.Programs;
            }

            IProgramSummary program = null;
            Channel         channel = null;

            if (sessionPrograms != null)
            {
                program = sessionPrograms.GetProgramAt(programNumber, out channel);
                if (program == null)
                {
                    return(new IMBotMessage("Bad program number.", IMBotMessage.ErrorColor));
                }
            }
            else
            {
                return(new IMBotMessage("No programs.", IMBotMessage.ErrorColor));
            }

            Schedule schedule = Proxies.SchedulerService.CreateNewSchedule(GetChannelType(conversation), ScheduleType.Recording).Result;

            bool   newEpisodesOnly = arguments.Count > 2 && arguments[2].Equals("new", StringComparison.CurrentCultureIgnoreCase);
            string repeatingText   = String.Empty;

            if (repeatingType == RepeatingType.Once)
            {
                schedule.Name = GuideProgram.CreateProgramTitle(program.Title, program.SubTitle, program.EpisodeNumberDisplay);
                schedule.Rules.Add(ScheduleRuleType.OnDate, program.StartTime.Date);
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(program.StartTime.TimeOfDay));
                if (!String.IsNullOrEmpty(program.SubTitle))
                {
                    schedule.Rules.Add(ScheduleRuleType.SubTitleEquals, program.SubTitle);
                }
                else if (!String.IsNullOrEmpty(program.EpisodeNumberDisplay))
                {
                    schedule.Rules.Add(ScheduleRuleType.EpisodeNumberEquals, program.EpisodeNumberDisplay);
                }
                newEpisodesOnly = false;
            }
            else if (repeatingType == RepeatingType.AnyTime)
            {
                schedule.Name = program.Title + " (Any Time)";
                repeatingText = " any time";
            }
            else if (repeatingType == RepeatingType.Weekly)
            {
                schedule.Name = program.Title + " (Weekly)";
                schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, GetDaysOfWeek(program.StartTime));
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(program.StartTime.TimeOfDay));
                repeatingText = " weekly";
            }
            else if (repeatingType == RepeatingType.WorkingDays)
            {
                schedule.Name = program.Title + " (Mon-Fri)";
                schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, ScheduleDaysOfWeek.WorkingDays);
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(program.StartTime.TimeOfDay));
                repeatingText = " Mon-Fri";
            }
            else if (repeatingType == RepeatingType.Weekends)
            {
                schedule.Name = program.Title + " (Sat-Sun)";
                schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, ScheduleDaysOfWeek.Weekends);
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(program.StartTime.TimeOfDay));
                repeatingText = " Sat-Sun";
            }
            else if (repeatingType == RepeatingType.Weekly)
            {
                schedule.Name = program.Title + " (Weekly)";
                schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, GetDaysOfWeek(program.StartTime));
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(program.StartTime.TimeOfDay));
                repeatingText = " weekly";
            }
            else
            {
                schedule.Name = program.Title + " (Daily)";
                schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(program.StartTime.TimeOfDay));
                repeatingText = " daily";
            }
            if (newEpisodesOnly)
            {
                schedule.Rules.Add(ScheduleRuleType.NewEpisodesOnly, true);
            }
            schedule.Rules.Add(ScheduleRuleType.Channels, channel.ChannelId);
            schedule.Rules.Add(ScheduleRuleType.TitleEquals, program.Title);
            Proxies.SchedulerService.SaveSchedule(schedule).Wait();

            StringBuilder replyText = new StringBuilder();

            replyText.Append("Created schedule to record ");
            Utility.AppendProgramDetails(replyText, channel, program);
            replyText.Append(repeatingText);
            if (newEpisodesOnly)
            {
                replyText.Append(" (record episodes once)");
            }
            replyText.Append(".");

            return(new IMBotMessage(replyText.ToString()));
        }