示例#1
0
 private void _programsDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 3 &&
         e.RowIndex >= 0 &&
         e.RowIndex < _programsDataGridView.Rows.Count)
     {
         UpcomingOrActiveProgramView programView = _programsDataGridView.Rows[e.RowIndex].DataBoundItem as UpcomingOrActiveProgramView;
         if (programView.UpcomingProgram.GuideProgramId.HasValue)
         {
             using (GuideServiceAgent tvGuideAgent = new GuideServiceAgent())
             {
                 GuideProgram guideProgram = tvGuideAgent.GetProgramById(programView.UpcomingProgram.GuideProgramId.Value);
                 using (ProgramDetailsPopup popup = new ProgramDetailsPopup())
                 {
                     popup.Channel      = programView.UpcomingProgram.Channel;
                     popup.GuideProgram = guideProgram;
                     Point location = Cursor.Position;
                     location.Offset(-250, -40);
                     popup.Location = location;
                     popup.ShowDialog(this);
                 }
             }
         }
     }
 }
        public void EpisodeIsEnricherReturnsFalseWhenNoEpisodeNumber()
        {
            var guideProgram = new GuideProgram();
            var program      = new GuideEnricherProgram(guideProgram);

            program.EpisodeIsEnriched().ShouldBeFalse();
        }
        /// <summary>
        /// Gets the title and year from a program title
        /// Title should be in the form 'title (year)' or 'title [year]'
        /// </summary>
        private void GetTitleAndYear(GuideProgram program, out string title, out string year)
        {
            Match regMatch = Regex.Match(program.Title, @"^(?<title>.+?)(?:\s*[\(\[](?<year>\d{4})[\]\)])?$");

            title = regMatch.Groups["title"].Value;
            year  = regMatch.Groups["year"].Value;
        }
        /// <summary>
        /// Gets the current program
        /// </summary>
        /// <returns></returns>
        private VideoInfo GetCurrentProgram()
        {
            VideoInfo videoInfo = new VideoInfo();

            // get current program details
            GuideProgram program = ForTheRecordMain.GetProgramAt(DateTime.Now);

            if (program == null || string.IsNullOrEmpty(program.Title))
            {
                TraktLogger.Info("Unable to get current program from database.");
                return(null);
            }
            else
            {
                string title = null;
                string year  = null;
                GetTitleAndYear(program, out title, out year);

                videoInfo = new VideoInfo
                {
                    Type       = program.EpisodeNumber != null || program.SeriesNumber != null ? VideoType.Series : VideoType.Movie,
                    Title      = title,
                    Year       = year,
                    SeasonIdx  = program.SeriesNumber == null ? null : program.SeriesNumber.ToString(),
                    EpisodeIdx = program.EpisodeNumber == null ? null : program.EpisodeNumber.ToString(),
                    StartTime  = program.StartTime,
                    Runtime    = GetRuntime(program)
                };
            }

            return(videoInfo);
        }
        /// <summary>
        /// Gets the current program
        /// </summary>
        private VideoInfo GetCurrentProgram()
        {
            VideoInfo videoInfo = new VideoInfo();

            // get current program details
            GuideProgram program = PluginMain.GetProgramAt(DateTime.Now);

            if (program == null || string.IsNullOrEmpty(program.Title))
            {
                TraktLogger.Info("Unable to get current program from database");
                return(null);
            }
            else
            {
                string title = null;
                string year  = null;
                BasicHandler.GetTitleAndYear(program.Title, out title, out year);

                videoInfo = new VideoInfo
                {
                    Type       = program.EpisodeNumber != null || program.SeriesNumber != null ? VideoType.Series : VideoType.Movie,
                    Title      = title,
                    Year       = year,
                    SeasonIdx  = program.SeriesNumber == null ? null : program.SeriesNumber.ToString(),
                    EpisodeIdx = program.EpisodeNumber == null ? null : program.EpisodeNumber.ToString(),
                    StartTime  = program.StartTime,
                    Runtime    = GetRuntime(program)
                };

                TraktLogger.Info("Current program details. Title='{0}', Year='{1}', Season='{2}', Episode='{3}', StartTime='{4}', Runtime='{5}'", videoInfo.Title, videoInfo.Year.ToLogString(), videoInfo.SeasonIdx.ToLogString(), videoInfo.EpisodeIdx.ToLogString(), videoInfo.StartTime == null ? "<empty>" : videoInfo.StartTime.ToString(), videoInfo.Runtime);
            }

            return(videoInfo);
        }
示例#6
0
        // For shows beginning with EP, the next 8 digits represent the series ID, with the last 4 digits representing the episode id.
        private bool ParseEpisodeAndSeriesIds(string programId, GuideProgram guideProgram)
        {
            guideProgram.SeriesNumber  = null;
            guideProgram.EpisodeNumber = null;

            bool hasEpisodeAndSeriesInfo = false;

            if (programId.StartsWith("EP") && programId.Length >= 12)
            {
                string seriesIdString  = programId.Substring(2, 8);
                string episodeIdString = programId.Substring(programId.Length - 4);

                int tmp;
                if (int.TryParse(seriesIdString, out tmp))
                {
                    guideProgram.SeriesNumber = tmp;
                }
                if (int.TryParse(episodeIdString, out tmp))
                {
                    guideProgram.EpisodeNumber = tmp;
                }
                hasEpisodeAndSeriesInfo = true;
            }
            return(hasEpisodeAndSeriesInfo);
        }
示例#7
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);
        }
示例#8
0
        public Schedule CreateRecordOnceSchedule(ISchedulerService tvSchedulerAgent, IGuideService tvGuideAgent, Guid channelId, Guid guideProgramId)
        {
            GuideProgram guideProgram = tvGuideAgent.GetProgramById(guideProgramId);

            if (guideProgram != null)
            {
                return(GuideController.CreateRecordOnceSchedule(tvSchedulerAgent, _model.ChannelType, channelId, guideProgram.Title, guideProgram.SubTitle, guideProgram.EpisodeNumberDisplay, guideProgram.StartTime));
            }
            return(null);
        }
示例#9
0
        public static Schedule CreateRecordOnceSchedule(ChannelType channelType, Guid channelId, Guid guideProgramId)
        {
            GuideProgram guideProgram = Proxies.GuideService.GetProgramById(guideProgramId).Result;

            if (guideProgram != null)
            {
                return(CreateRecordOnceSchedule(channelType, channelId, guideProgram.Title, guideProgram.SubTitle, guideProgram.EpisodeNumberDisplay, guideProgram.StartTime));
            }
            return(null);
        }
示例#10
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);
        }
示例#11
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);
        }
示例#12
0
        private void SetProperties(UpcomingProgram upcoming, ScheduleSummary schedule)
        {
            string guiPropertyPrefix = this._channelType == ChannelType.Television ? "#TV" : "#Radio";

            if (schedule != null)
            {
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Channel", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Title", schedule.Name);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Genre", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Time", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Description", " ");
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.thumb", "defaultFolderBig.png");
            }
            else if (upcoming != null)
            {
                GuideProgram guideProgram = upcoming.GuideProgramId.HasValue ?
                                            Proxies.GuideService.GetProgramById(upcoming.GuideProgramId.Value).Result : null;

                string strTime = string.Format("{0} {1} - {2}",
                                               Utility.GetShortDayDateString(upcoming.StartTime),
                                               upcoming.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                               upcoming.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Channel", upcoming.Channel.DisplayName);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Title", upcoming.Title);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Genre", upcoming.Category);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Time", strTime);

                string description = String.Empty;
                if (guideProgram != null)
                {
                    description = guideProgram.CreateCombinedDescription(true);
                }
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Description", description);

                string logo = Utility.GetLogoImage(upcoming.Channel.ChannelId, upcoming.Channel.DisplayName);
                if (!string.IsNullOrEmpty(logo))
                {
                    GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.thumb", logo);
                }
                else
                {
                    GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.thumb", "defaultVideoBig.png");
                }
            }
            else
            {
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Channel", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Title", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Genre", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Time", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Description", " ");
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.thumb", String.Empty);
            }
        }
示例#13
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);
        }
        public void EpisodeIsEnricherReturnsFalseWhenNoSeasonEpisode()
        {
            var guideProgram = new GuideProgram();

            guideProgram.SeriesNumber         = 3;
            guideProgram.EpisodeNumber        = 10;
            guideProgram.EpisodeNumberDisplay = "Test";
            var program = new GuideEnricherProgram(guideProgram);

            program.EpisodeIsEnriched().ShouldBeFalse();
        }
        public void EpisodeIsEnricherReturnsTrueWhenEpisodeNumberAndSeasonEpisode()
        {
            var guideProgram = new GuideProgram();

            guideProgram.SeriesNumber         = 3;
            guideProgram.EpisodeNumber        = 10;
            guideProgram.EpisodeNumberDisplay = "S03E10";
            var program = new GuideEnricherProgram(guideProgram);

            program.EpisodeIsEnriched().ShouldBeTrue();
        }
示例#16
0
        /// <summary>
        /// Import a new program into the guide.
        /// </summary>
        /// <param name="guideProgram">The program to import.</param>
        /// <param name="source">The source of the program.</param>
        /// <returns>The ID of the imported program.</returns>
        public async Task <Guid> ImportProgram(GuideProgram guideProgram, GuideSource source)
        {
            var request = NewRequest(HttpMethod.Post, "ImportNewProgram");

            request.AddBody(new
            {
                Program = guideProgram,
                Source  = source
            });
            var result = await ExecuteAsync <GuideProgramIdResult>(request).ConfigureAwait(false);

            return(result.GuideProgramId);
        }
        private double GetRuntime(GuideProgram program)
        {
            try
            {
                DateTime startTime = program.StartTime;
                DateTime endTime   = program.StopTime;

                return(endTime.Subtract(startTime).TotalMinutes);
            }
            catch
            {
                return(0.0);
            }
        }
示例#18
0
        internal static bool IsActiveRecording(Guid channelId, GuideProgram guideProgram, out ActiveRecording activeRecording)
        {
            Guid upcomingProgramId = guideProgram.GetUniqueUpcomingProgramId(channelId);

            foreach (ActiveRecording recording in ActiveRecordings)
            {
                if (recording.Program.UpcomingProgramId == upcomingProgramId)
                {
                    activeRecording = recording;
                    return(true);
                }
            }
            activeRecording = null;
            return(false);
        }
示例#19
0
 private void Get_TimeInfo()
 {
   string strTime = channelName;
   GuideProgram prog = PluginMain.GetCurrentForChannel(channel);
   if (prog != null)
   {
     strTime = String.Format("{0}-{1}",
                             prog.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                             prog.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
   }
   if (lblCurrentTime != null)
   {
     lblCurrentTime.Label = strTime;
   }
 }
示例#20
0
        public void CancelOrUncancelUpcomingProgram(Guid scheduleId, Guid channelId, Guid guideProgramId, bool cancel)
        {
            GuideProgram guideProgram = Proxies.GuideService.GetProgramById(guideProgramId).Result;

            if (guideProgram != null)
            {
                if (cancel)
                {
                    Proxies.SchedulerService.CancelUpcomingProgram(scheduleId, guideProgramId, channelId, guideProgram.StartTime).Wait();
                }
                else
                {
                    Proxies.SchedulerService.UncancelUpcomingProgram(scheduleId, guideProgramId, channelId, guideProgram.StartTime).Wait();
                }
                RefreshUpcomingPrograms();
            }
        }
示例#21
0
        public void CancelOrUncancelUpcomingProgram(ISchedulerService tvSchedulerAgent, IGuideService tvGuideAgent,
                                                    IControlService tvControlAgent, Guid scheduleId, Guid channelId, Guid guideProgramId, bool cancel)
        {
            GuideProgram guideProgram = tvGuideAgent.GetProgramById(guideProgramId);

            if (guideProgram != null)
            {
                if (cancel)
                {
                    tvSchedulerAgent.CancelUpcomingProgram(scheduleId, guideProgramId, channelId, guideProgram.StartTime);
                }
                else
                {
                    tvSchedulerAgent.UncancelUpcomingProgram(scheduleId, guideProgramId, channelId, guideProgram.StartTime);
                }
                RefreshUpcomingPrograms(tvSchedulerAgent, tvControlAgent);
            }
        }
示例#22
0
        public static Schedule CreateRecordOnceSchedule(ChannelType channelType, Guid channelId, string title, string subTitle, string episodeNumber, DateTime startTime)
        {
            Schedule schedule = Proxies.SchedulerService.CreateNewSchedule(channelType, ScheduleType.Recording).Result;

            schedule.Name = GuideProgram.CreateProgramTitle(title, subTitle, episodeNumber);
            schedule.Rules.Add(ScheduleRuleType.Channels, channelId);
            schedule.Rules.Add(ScheduleRuleType.OnDate, startTime.Date);
            schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(startTime.TimeOfDay));
            schedule.Rules.Add(ScheduleRuleType.TitleEquals, title);
            if (!String.IsNullOrEmpty(subTitle))
            {
                schedule.Rules.Add(ScheduleRuleType.SubTitleEquals, subTitle);
            }
            else if (!String.IsNullOrEmpty(episodeNumber))
            {
                schedule.Rules.Add(ScheduleRuleType.EpisodeNumberEquals, episodeNumber);
            }
            return(schedule);
        }
示例#23
0
        private static void RefreshCurrentAndNext(Channel channel, bool forceUpdate)
        {
            TimeSpan ts = DateTime.Now - _programUpdateTimer;

            if (ts.TotalMilliseconds < 1000 && !forceUpdate)
            {
                return;
            }
            _programUpdateTimer = DateTime.Now;

            lock (_refreshCurrAndNextLock)
            {
                using (GuideServiceAgent tvGuideAgent = new GuideServiceAgent())
                    using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
                    {
                        CurrentAndNextProgram currentAndNext = tvSchedulerAgent.GetCurrentAndNextForChannel(channel.ChannelId, false, null);
                        if (currentAndNext != null)
                        {
                            if (currentAndNext.Current != null)
                            {
                                _currentProgram = tvGuideAgent.GetProgramById(currentAndNext.Current.GuideProgramId);
                            }
                            else
                            {
                                _currentProgram = null;
                            }
                            if (currentAndNext.Next != null)
                            {
                                _nextProgram = tvGuideAgent.GetProgramById(currentAndNext.Next.GuideProgramId);
                            }
                            else
                            {
                                _nextProgram = null;
                            }
                        }
                        else
                        {
                            _nextProgram    = null;
                            _currentProgram = null;
                        }
                    }
            }
        }
示例#24
0
    private void UpdateProgressBar()
    {
      double fPercent = 0.0;
      GuideProgram prog = PluginMain.GetCurrentForChannel(channel);
      if (prog != null)
      {
          string strTime = String.Format("{0}-{1}",
                                         prog.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                         prog.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

          TimeSpan ts = prog.StopTime - prog.StartTime;
          double iTotalSecs = ts.TotalSeconds;
          ts = DateTime.Now - prog.StartTime;
          double iCurSecs = ts.TotalSeconds;
          fPercent = ((double)iCurSecs) / ((double)iTotalSecs);
          fPercent *= 100.0d;
      }
      GUIPropertyManager.SetProperty("#TV.View.Percentage", fPercent.ToString());
    }
 private void _programsDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 3 &&
         e.RowIndex >= 0 &&
         e.RowIndex < _programsDataGridView.Rows.Count)
     {
         ChannelProgramView programView  = _programsDataGridView.Rows[e.RowIndex].DataBoundItem as ChannelProgramView;
         GuideProgram       guideProgram = Proxies.GuideService.GetProgramById(programView.Program.GuideProgramId).Result;
         using (ProgramDetailsPopup popup = new ProgramDetailsPopup())
         {
             popup.Channel      = programView.Program.Channel;
             popup.GuideProgram = guideProgram;
             Point location = Cursor.Position;
             location.Offset(-250, -40);
             popup.Location = location;
             popup.ShowDialog(this);
         }
     }
 }
示例#26
0
 private void _epgControl_ProgramClicked(object sender, ArgusTV.WinForms.Controls.EpgControl.ProgramEventArgs e)
 {
     try
     {
         GuideProgram guideProgram = Proxies.GuideService.GetProgramById(e.GuideProgram.GuideProgramId).Result;
         using (ProgramDetailsPopup popup = new ProgramDetailsPopup())
         {
             popup.Channel      = e.Channel;
             popup.GuideProgram = guideProgram;
             Point location = _epgControl.PointToScreen(e.Location);
             location.Offset(-250, -40);
             popup.Location = location;
             popup.ShowDialog(this);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#27
0
        public static GuideProgram makeGuideProgram(
            SchedulesResponse sr,
            SchedulesResponse.Program srp,
            ProgramResponseInstance pri)
        {
            try {
                var gp = new GuideProgram();


                gp.Title       = makeTitle(pri);
                gp.SubTitle    = pri.episodeTitle150;
                gp.Description = makeDescription(pri);
                DateTime startTime = DateTime.Parse(srp.airDateTime);
                gp.StartTime            = startTime;
                gp.StopTime             = startTime.AddSeconds(srp.duration);
                gp.EpisodeNumber        = makeEpisodeNumber(pri);
                gp.SeriesNumber         = makeSeriesNumber(pri);
                gp.EpisodeNumberDisplay = makeEpisodeNumberDisplay(pri);
                gp.Rating = makeRatings(srp);
                // srp.Premiere is for miniseries or movies
                if (srp.premiere.HasValue)
                {
                    gp.IsPremiere = (true == srp.premiere.Value);
                }
                // so use srp.new to determine if it's a repeat... srp.repeat is only for sporting events
                gp.IsRepeat = true;                  // default to a repeat
                if ([email protected])
                {
                    gp.IsRepeat = [email protected];
                }
                gp.PreviouslyAiredTime = DateTime.Parse(srp.airDateTime);
                gp.Actors    = makeActors(pri);
                gp.Category  = makeCategory(pri);
                gp.Directors = makeDirectors(pri);

                return(gp);
            } catch (Exception ex) {
                Logger.Error("Error while creating guide program instances: {0}\n{1}", ex.Message, ex.StackTrace);
                throw;
            }
        }
示例#28
0
        private static void RefreshCurrentAndNext(Channel channel, bool forceUpdate)
        {
            TimeSpan ts = DateTime.Now - _programUpdateTimer;

            if (ts.TotalMilliseconds < 1000 && !forceUpdate)
            {
                return;
            }
            _programUpdateTimer = DateTime.Now;

            lock (_refreshCurrAndNextLock)
            {
                CurrentAndNextProgram currentAndNext = Proxies.SchedulerService.GetCurrentAndNextForChannel(channel.ChannelId, false, null).Result;
                if (currentAndNext != null)
                {
                    if (currentAndNext.Current != null)
                    {
                        _currentProgram = Proxies.GuideService.GetProgramById(currentAndNext.Current.GuideProgramId).Result;
                    }
                    else
                    {
                        _currentProgram = null;
                    }
                    if (currentAndNext.Next != null)
                    {
                        _nextProgram = Proxies.GuideService.GetProgramById(currentAndNext.Next.GuideProgramId).Result;
                    }
                    else
                    {
                        _nextProgram = null;
                    }
                }
                else
                {
                    _nextProgram    = null;
                    _currentProgram = null;
                }
            }
        }
示例#29
0
        private void SetProperties(UpcomingProgram program)
        {
            string guiPropertyPrefix = _channelType == ChannelType.Television ? "#TV" : "#Radio";

            if (program == null)
            {
                Utility.ClearProperty(guiPropertyPrefix + ".Search.Channel");
                Utility.ClearProperty(guiPropertyPrefix + ".Search.Title");
                Utility.ClearProperty(guiPropertyPrefix + ".Search.Genre");
                Utility.ClearProperty(guiPropertyPrefix + ".Search.Time");
                Utility.ClearProperty(guiPropertyPrefix + ".Search.Description");
                Utility.ClearProperty(guiPropertyPrefix + ".Search.thumb");
            }
            else
            {
                string strTime = string.Format("{0} {1} - {2}",
                                               Utility.GetShortDayDateString(program.StartTime),
                                               program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                               program.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.Channel", program.Channel.DisplayName);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.Title", program.Title);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.Genre", program.Category);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.Time", strTime);
                string logo = Utility.GetLogoImage(program.Channel.ChannelId, program.Channel.DisplayName, _tvSchedulerAgent);
                if (System.IO.File.Exists(logo))
                {
                    GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.thumb", logo);
                }
                else
                {
                    GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.thumb", "defaultVideoBig.png");
                }

                GuideProgram guideProgram = GuideAgent.GetProgramById(program.GuideProgramId.Value);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.Description", guideProgram.CreateCombinedDescription(true));
            }
        }
示例#30
0
 private void _channelsGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if ((e.ColumnIndex == ColumnIndex.CurrentTitle || e.ColumnIndex == ColumnIndex.NextTitle) &&
         e.RowIndex >= 0 &&
         e.RowIndex < _channelsGridView.Rows.Count)
     {
         CurrentAndNextProgramView programView    = _channelsGridView.Rows[e.RowIndex].DataBoundItem as CurrentAndNextProgramView;
         GuideProgramSummary       programSummary = (e.ColumnIndex == ColumnIndex.CurrentTitle)
             ? programView.CurrentAndNextProgram.Current : programView.CurrentAndNextProgram.Next;
         if (programSummary != null)
         {
             GuideProgram guideProgram = Proxies.GuideService.GetProgramById(programSummary.GuideProgramId).Result;
             using (ProgramDetailsPopup popup = new ProgramDetailsPopup())
             {
                 popup.Channel      = programView.CurrentAndNextProgram.Channel;
                 popup.GuideProgram = guideProgram;
                 Point location = Cursor.Position;
                 location.Offset(-250, -40);
                 popup.Location = location;
                 popup.ShowDialog(this);
             }
         }
     }
 }
 /// <summary>
 /// Gets the title and year from a program title
 /// Title should be in the form 'title (year)' or 'title [year]'
 /// </summary>
 private void GetTitleAndYear(GuideProgram program, out string title, out string year)
 {
     Match regMatch = Regex.Match(program.Title, @"^(?<title>.+?)(?:\s*[\(\[](?<year>\d{4})[\]\)])?$");
     title = regMatch.Groups["title"].Value;
     year = regMatch.Groups["year"].Value;
 }
        private double GetRuntime(GuideProgram program)
        {
            try
            {
                DateTime startTime = program.StartTime;
                DateTime endTime = program.StopTime;

                return endTime.Subtract(startTime).TotalMinutes;
            }
            catch
            {
                return 0.0;
            }
        }