Exemplo n.º 1
0
        /// <summary>
        /// Creates a new <see cref="TimeshiftContext"/> and fills the <see cref="LiveTvMediaItem.TimeshiftContexes"/> with it.
        /// A new context is created for each channel change or for changed programs on same channel.
        /// </summary>
        /// <param name="timeshiftMediaItem">MediaItem</param>
        /// <param name="channel">Current channel.</param>
        private void AddOrUpdateTimeshiftContext(LiveTvMediaItem timeshiftMediaItem, IChannel channel)
        {
            TimeshiftContext tsContext = new TimeshiftContext {
                Channel = channel
            };

            // Remove the newly tuned channel from history if present
            timeshiftMediaItem.TimeshiftContexes.Where(tc => tc.Channel.ChannelId == channel.ChannelId).ToList().
            ForEach(context => timeshiftMediaItem.TimeshiftContexes.Remove(context));
            // Then add the new context to the end
            timeshiftMediaItem.TimeshiftContexes.Add(tsContext);
            timeshiftMediaItem.AdditionalProperties[LiveTvMediaItem.CHANNEL] = channel;
        }
Exemplo n.º 2
0
        private void AddTimeshiftContext(LiveTvMediaItem timeshiftMediaItem, IChannel channel)
        {
            IProgram         program   = GetCurrentProgram(channel);
            TimeshiftContext tsContext = new TimeshiftContext
            {
                Channel    = channel,
                Program    = program,
                TuneInTime = DateTime.Now
            };

            int tc = timeshiftMediaItem.TimeshiftContexes.Count;

            if (tc > 0)
            {
                ITimeshiftContext lastContext = timeshiftMediaItem.TimeshiftContexes[tc - 1];
                lastContext.TimeshiftDuration = DateTime.Now - lastContext.TuneInTime;
            }
            timeshiftMediaItem.TimeshiftContexes.Add(tsContext);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a new <see cref="TimeshiftContext"/> and fills the <see cref="LiveTvMediaItem.TimeshiftContexes"/> with it.
 /// A new context is created for each channel change or for changed programs on same channel.
 /// </summary>
 /// <param name="timeshiftMediaItem">MediaItem</param>
 /// <param name="channel">Current channel.</param>
 private bool AddOrUpdateTimeshiftContext(LiveTvMediaItem timeshiftMediaItem, IChannel channel)
 {
   TimeshiftContext tsContext = new TimeshiftContext { Channel = channel };
   // Remove the newly tuned channel from history if present
   timeshiftMediaItem.TimeshiftContexes.Where(tc=>tc.Channel.ChannelId == channel.ChannelId).ToList().
     ForEach(context => timeshiftMediaItem.TimeshiftContexes.Remove(context));
   // Then add the new context to the end
   timeshiftMediaItem.TimeshiftContexes.Add(tsContext);
   timeshiftMediaItem.AdditionalProperties[LiveTvMediaItem.CHANNEL] = channel;
   return true;
 }
Exemplo n.º 4
0
    private void AddTimeshiftContext(LiveTvMediaItem timeshiftMediaItem, IChannel channel)
    {
      IProgram program = GetCurrentProgram(channel);
      TimeshiftContext tsContext = new TimeshiftContext
                                     {
                                       Channel = channel,
                                       Program = program,
                                       TuneInTime = DateTime.Now
                                     };

      int tc = timeshiftMediaItem.TimeshiftContexes.Count;
      if (tc > 0)
      {
        ITimeshiftContext lastContext = timeshiftMediaItem.TimeshiftContexes[tc - 1];
        lastContext.TimeshiftDuration = DateTime.Now - lastContext.TuneInTime;
      }
      timeshiftMediaItem.TimeshiftContexes.Add(tsContext);
    }