本文整理汇总了C#中MediaBrowser.Controller.LiveTv.SeriesTimerInfo类的典型用法代码示例。如果您正苦于以下问题:C# SeriesTimerInfo类的具体用法?C# SeriesTimerInfo怎么用?C# SeriesTimerInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SeriesTimerInfo类属于MediaBrowser.Controller.LiveTv命名空间,在下文中一共展示了SeriesTimerInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTimersForSeries
public static List<TimerInfo> GetTimersForSeries(SeriesTimerInfo seriesTimer, IEnumerable<ProgramInfo> epgData, IReadOnlyList<RecordingInfo> currentRecordings, ILogger logger)
{
List<TimerInfo> timers = new List<TimerInfo>();
// Filtered Per Show
var filteredEpg = epgData.Where(epg => epg.Id.Substring(0, 10) == seriesTimer.Id);
if (!seriesTimer.RecordAnyTime)
{
filteredEpg = filteredEpg.Where(epg => (seriesTimer.StartDate.TimeOfDay == epg.StartDate.TimeOfDay));
}
if (seriesTimer.RecordNewOnly)
{
filteredEpg = filteredEpg.Where(epg => !epg.IsRepeat); //Filtered by New only
}
if (!seriesTimer.RecordAnyChannel)
{
filteredEpg = filteredEpg.Where(epg => string.Equals(epg.ChannelId, seriesTimer.ChannelId, StringComparison.OrdinalIgnoreCase));
}
filteredEpg = filteredEpg.Where(epg => seriesTimer.Days.Contains(epg.StartDate.DayOfWeek));
filteredEpg = filteredEpg.Where(epg => currentRecordings.All(r => r.Id.Substring(0, 14) != epg.Id.Substring(0, 14))); //filtered recordings already running
filteredEpg = filteredEpg.GroupBy(epg => epg.Id.Substring(0, 14)).Select(g => g.First()).ToList();
foreach (var epg in filteredEpg)
{
timers.Add(CreateTimer(epg, seriesTimer));
}
return timers;
}
示例2: GetSeriesTimers
public static List<SeriesTimerInfo> GetSeriesTimers(Stream stream, IJsonSerializer json, ILogger logger)
{
List<SeriesTimerInfo> ret = new List<SeriesTimerInfo>();
var root = ParseRecRules(stream, json);
foreach (var item in root.RecRuleList.RecRules)
{
if (!item.Inactive && string.Compare(item.Type, "Single Record", true) != 0 && string.Compare(item.Type, "Not Recording", true) != 0)
{
SeriesTimerInfo val = new SeriesTimerInfo()
{
Name = item.Title,
//Overview = item.Description,
ChannelId = item.ChanId.ToString(),
EndDate = (DateTime)item.EndTime,
StartDate = (DateTime)item.StartTime,
//Overview = item.Description,
Id = item.Id,
PrePaddingSeconds = item.StartOffset * 60,
PostPaddingSeconds = item.EndOffset * 60,
RecordAnyChannel = !((item.Filter & RecFilter.ThisChannel) == RecFilter.ThisChannel),
RecordAnyTime = !((item.Filter & RecFilter.ThisDayTime) == RecFilter.ThisDayTime),
RecordNewOnly = ((item.Filter & RecFilter.NewEpisode) == RecFilter.NewEpisode),
//IsPostPaddingRequired = item.EndOffset != 0,
//IsPrePaddingRequired = item.StartOffset != 0,
ProgramId = item.ProgramId
};
ret.Add(val);
}
}
return ret;
}
示例3: SingleTimer
public SingleTimer(ProgramInfo parent, SeriesTimerInfo series)
{
ChannelId = parent.ChannelId;
Id = parent.Id;
StartDate = parent.StartDate;
EndDate = parent.EndDate;
ProgramId = parent.Id;
PrePaddingSeconds = series.PrePaddingSeconds;
PostPaddingSeconds = series.PostPaddingSeconds;
IsPostPaddingRequired = series.IsPostPaddingRequired;
IsPrePaddingRequired = series.IsPrePaddingRequired;
Priority = series.Priority;
Name = parent.Name;
Overview = parent.Overview;
SeriesTimerId = series.Id;
}
示例4: CreateTimer
public static TimerInfo CreateTimer(ProgramInfo parent, SeriesTimerInfo series)
{
var timer = new TimerInfo();
timer.ChannelId = parent.ChannelId;
timer.Id = (series.Id + parent.Id).GetMD5().ToString("N");
timer.StartDate = parent.StartDate;
timer.EndDate = parent.EndDate;
timer.ProgramId = parent.Id;
timer.PrePaddingSeconds = series.PrePaddingSeconds;
timer.PostPaddingSeconds = series.PostPaddingSeconds;
timer.IsPostPaddingRequired = series.IsPostPaddingRequired;
timer.IsPrePaddingRequired = series.IsPrePaddingRequired;
timer.Priority = series.Priority;
timer.Name = parent.Name;
timer.Overview = parent.Overview;
timer.SeriesTimerId = series.Id;
return timer;
}
示例5: GetSeriesTimerInfoDto
public SeriesTimerInfoDto GetSeriesTimerInfoDto(SeriesTimerInfo info, ILiveTvService service, string channelName)
{
var dto = new SeriesTimerInfoDto
{
Id = GetInternalSeriesTimerId(service.Name, info.Id).ToString("N"),
Overview = info.Overview,
EndDate = info.EndDate,
Name = info.Name,
StartDate = info.StartDate,
ExternalId = info.Id,
PrePaddingSeconds = info.PrePaddingSeconds,
PostPaddingSeconds = info.PostPaddingSeconds,
IsPostPaddingRequired = info.IsPostPaddingRequired,
IsPrePaddingRequired = info.IsPrePaddingRequired,
Days = info.Days,
Priority = info.Priority,
RecordAnyChannel = info.RecordAnyChannel,
RecordAnyTime = info.RecordAnyTime,
RecordNewOnly = info.RecordNewOnly,
ExternalChannelId = info.ChannelId,
ExternalProgramId = info.ProgramId,
ServiceName = service.Name,
ChannelName = channelName,
ServerId = _appHost.SystemId
};
if (!string.IsNullOrEmpty(info.ChannelId))
{
dto.ChannelId = GetInternalChannelId(service.Name, info.ChannelId).ToString("N");
}
if (!string.IsNullOrEmpty(info.ProgramId))
{
dto.ProgramId = GetInternalProgramId(service.Name, info.ProgramId).ToString("N");
}
dto.DayPattern = info.Days == null ? null : GetDayPattern(info.Days);
return dto;
}
示例6: ChangeSeriesSchedule
public void ChangeSeriesSchedule(CancellationToken cancellationToken, SeriesTimerInfo schedule)
{
var timerData = GetSchedule(cancellationToken, schedule.Id);
if (timerData == null)
{
throw ExceptionHelper.CreateArgumentException("schedule.Id", "The schedule id {0} could not be found", schedule.Id);
}
var builder = new StringBuilder("AddScheduleDetailed?");
builder.AppendFormat("channelid={0}&", timerData.ChannelId);
builder.AppendFormat("title={0}&", timerData.Title);
builder.AppendFormat("starttime={0}&", timerData.StartTime.ToLocalTime().ToUrlDate());
builder.AppendFormat("endtime={0}&", timerData.EndTime.ToLocalTime().ToUrlDate());
builder.AppendFormat("scheduletype={0}&", (Int32)schedule.ToScheduleType());
if (schedule.IsPrePaddingRequired & schedule.PrePaddingSeconds > 0)
{
builder.AppendFormat("preRecordInterval={0}&", TimeSpan.FromSeconds(schedule.PrePaddingSeconds).RoundUpMinutes());
}
if (schedule.IsPostPaddingRequired & schedule.PostPaddingSeconds > 0)
{
builder.AppendFormat("postRecordInterval={0}&", TimeSpan.FromSeconds(schedule.PostPaddingSeconds).RoundUpMinutes());
}
builder.Remove(builder.Length - 1, 1);
Plugin.Logger.Info("Creating series schedule with StartTime: {0}, EndTime: {1}, ProgramData from MP: {2}",
schedule.StartDate, schedule.EndDate, builder.ToString());
Plugin.TvProxy.DeleteSchedule(cancellationToken, schedule.Id);
var response = GetFromService<WebBoolResult>(cancellationToken, builder.ToString());
if (!response.Result)
{
throw new LiveTvConflictException();
}
}
示例7: GetNewTimerDefaultsAsync
public Task<SeriesTimerInfo> GetNewTimerDefaultsAsync(CancellationToken cancellationToken, ProgramInfo program = null)
{
var config = GetConfiguration();
var defaults = new SeriesTimerInfo()
{
PostPaddingSeconds = Math.Max(config.PostPaddingSeconds, 0),
PrePaddingSeconds = Math.Max(config.PrePaddingSeconds, 0),
RecordAnyChannel = true,
RecordAnyTime = true,
RecordNewOnly = false,
Days = new List<DayOfWeek>
{
DayOfWeek.Sunday,
DayOfWeek.Monday,
DayOfWeek.Tuesday,
DayOfWeek.Wednesday,
DayOfWeek.Thursday,
DayOfWeek.Friday,
DayOfWeek.Saturday
}
};
if (program != null)
{
defaults.SeriesId = program.SeriesId;
defaults.ProgramId = program.Id;
}
return Task.FromResult(defaults);
}
示例8: UpdateSeriesTimerAsync
public async Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
{
var instance = _seriesTimerProvider.GetAll().FirstOrDefault(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase));
if (instance != null)
{
instance.ChannelId = info.ChannelId;
instance.Days = info.Days;
instance.EndDate = info.EndDate;
instance.IsPostPaddingRequired = info.IsPostPaddingRequired;
instance.IsPrePaddingRequired = info.IsPrePaddingRequired;
instance.PostPaddingSeconds = info.PostPaddingSeconds;
instance.PrePaddingSeconds = info.PrePaddingSeconds;
instance.Priority = info.Priority;
instance.RecordAnyChannel = info.RecordAnyChannel;
instance.RecordAnyTime = info.RecordAnyTime;
instance.RecordNewOnly = info.RecordNewOnly;
instance.StartDate = info.StartDate;
_seriesTimerProvider.Update(instance);
List<ProgramInfo> epgData;
if (instance.RecordAnyChannel)
{
var channels = await GetChannelsAsync(true, CancellationToken.None).ConfigureAwait(false);
var channelIds = channels.Select(i => i.Id).ToList();
epgData = GetEpgDataForChannels(channelIds);
}
else
{
epgData = GetEpgDataForChannel(instance.ChannelId);
}
await UpdateTimersForSeriesTimer(epgData, instance, true).ConfigureAwait(false);
}
}
示例9: buildAutorecInfos
public Task<IEnumerable<SeriesTimerInfo>> buildAutorecInfos(CancellationToken cancellationToken)
{
return Task.Factory.StartNew<IEnumerable<SeriesTimerInfo>>(() =>
{
lock (_data)
{
List<SeriesTimerInfo> result = new List<SeriesTimerInfo>();
foreach (KeyValuePair<string, Message> entry in _data)
{
if (cancellationToken.IsCancellationRequested)
{
_logger.Info("[TVHclient] DvrDataHelper.buildDvrInfos, call canceled - returning part list.");
return result;
}
Message m = entry.Value;
SeriesTimerInfo sti = new SeriesTimerInfo();
try
{
if (m.containsField("id"))
{
sti.Id = m.getString("id");
}
}
catch (InvalidCastException)
{
}
try
{
if (m.containsField("daysOfWeek"))
{
int daysOfWeek = m.getInt("daysOfWeek");
sti.Days = getDayOfWeekListFromInt(daysOfWeek);
}
}
catch (InvalidCastException)
{
}
sti.StartDate = DateTime.Now.ToUniversalTime();
try
{
if (m.containsField("retention"))
{
int retentionInDays = m.getInt("retention");
sti.EndDate = DateTime.Now.AddDays(retentionInDays).ToUniversalTime();
}
}
catch (InvalidCastException)
{
}
try
{
if (m.containsField("channel"))
{
sti.ChannelId = "" + m.getInt("channel");
}
}
catch (InvalidCastException)
{
}
try
{
if (m.containsField("startExtra"))
{
sti.PrePaddingSeconds = (int)m.getLong("startExtra") * 60;
sti.IsPrePaddingRequired = true;
}
}
catch (InvalidCastException)
{
}
try
{
if (m.containsField("stopExtra"))
{
sti.PostPaddingSeconds = (int)m.getLong("stopExtra") * 60;
sti.IsPostPaddingRequired = true;
}
}
catch (InvalidCastException)
{
}
try
{
if (m.containsField("title"))
{
sti.Name = m.getString("title");
}
}
catch (InvalidCastException)
{
//.........这里部分代码省略.........
示例10: UpdateSeriesTimerAsync
public Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
{
UpdateTimersForSeriesTimer(info);
_seriesTimerProvider.Update(info);
return Task.FromResult(true);
}
示例11: CreateSeriesTimerAsync
public Task CreateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
{
info.Id = info.ProgramId.Substring(0, 10);
UpdateTimersForSeriesTimer(info);
_seriesTimerProvider.Add(info);
return Task.FromResult(true);
}
示例12: GetSeriesTimerInfo
private SeriesTimerInfo GetSeriesTimerInfo(EpgEventJSONObject i)
{
var info = new SeriesTimerInfo();
var recurr = i.recurr;
if (recurr != null)
{
info.ChannelId = GetChannelId(recurr);
info.Id = recurr.OID.ToString(_usCulture);
info.StartDate = DateTime.Parse(recurr.StartTime).ToUniversalTime();
info.EndDate = DateTime.Parse(recurr.EndTime).ToUniversalTime();
info.PrePaddingSeconds = int.Parse(recurr.PrePadding, _usCulture) * 60;
info.PostPaddingSeconds = int.Parse(recurr.PostPadding, _usCulture) * 60;
info.Name = recurr.RecurringName ?? recurr.EPGTitle;
info.RecordNewOnly = recurr.OnlyNew;
info.RecordAnyChannel = recurr.allChannels;
info.Days = (recurr.Day ?? string.Empty).Split(',')
.Select(d => (DayOfWeek)Enum.Parse(typeof(DayOfWeek), d.Trim(), true))
.ToList();
info.Priority = recurr.Priority;
}
var epg = i.epgEvent;
if (epg != null)
{
info.ProgramId = epg.OID.ToString(_usCulture);
info.Overview = epg.Desc;
}
return info;
}
示例13: UpdateScheduling
private void UpdateScheduling(SeriesTimerInfo seriesTimerInfo, Schedule schedule)
{
var schedulingType = (WebScheduleType)schedule.ScheduleType;
// Initialise
seriesTimerInfo.Days = new List<DayOfWeek>();
seriesTimerInfo.RecordAnyChannel = false;
seriesTimerInfo.RecordAnyTime = false;
seriesTimerInfo.RecordNewOnly = false;
switch (schedulingType)
{
case WebScheduleType.EveryTimeOnThisChannel:
seriesTimerInfo.RecordAnyTime = true;
break;
case WebScheduleType.EveryTimeOnEveryChannel:
seriesTimerInfo.RecordAnyTime = true;
seriesTimerInfo.RecordAnyChannel = true;
break;
case WebScheduleType.WeeklyEveryTimeOnThisChannel:
seriesTimerInfo.Days.Add(schedule.StartTime.DayOfWeek);
seriesTimerInfo.RecordAnyTime = true;
break;
case WebScheduleType.Daily:
seriesTimerInfo.Days.AddRange(new[]
{
DayOfWeek.Monday,
DayOfWeek.Tuesday,
DayOfWeek.Wednesday,
DayOfWeek.Thursday,
DayOfWeek.Friday,
DayOfWeek.Saturday,
DayOfWeek.Sunday,
});
break;
case WebScheduleType.WorkingDays:
seriesTimerInfo.Days.AddRange(new[]
{
DayOfWeek.Monday,
DayOfWeek.Tuesday,
DayOfWeek.Wednesday,
DayOfWeek.Thursday,
DayOfWeek.Friday,
});
break;
case WebScheduleType.Weekends:
seriesTimerInfo.Days.AddRange(new[]
{
DayOfWeek.Saturday,
DayOfWeek.Sunday,
});
break;
case WebScheduleType.Weekly:
seriesTimerInfo.Days.Add(schedule.StartTime.DayOfWeek);
break;
default:
throw new InvalidOperationException(String.Format("Should not be processing scheduling for ScheduleType={0}", schedulingType));
}
}
示例14: GetSeriesSchedules
public IEnumerable<SeriesTimerInfo> GetSeriesSchedules(CancellationToken cancellationToken)
{
var response = GetFromService<List<Schedule>>(cancellationToken, "GetSchedules");
var recordings = response.Where(r => r.ScheduleType > 0).Select(r =>
{
var seriesTimerInfo = new SeriesTimerInfo()
{
ChannelId = r.ChannelId.ToString(CultureInfo.InvariantCulture),
EndDate = r.EndTime,
Id = r.Id.ToString(CultureInfo.InvariantCulture),
SeriesId = r.Id.ToString(CultureInfo.InvariantCulture),
ProgramId = r.Id.ToString(CultureInfo.InvariantCulture),
Name = r.Title,
IsPostPaddingRequired = (r.PostRecordInterval > 0),
IsPrePaddingRequired = (r.PreRecordInterval > 0),
PostPaddingSeconds = r.PostRecordInterval * 60,
PrePaddingSeconds = r.PreRecordInterval * 60,
StartDate = r.StartTime,
};
UpdateScheduling(seriesTimerInfo, r);
return seriesTimerInfo;
});
return recordings;
}
示例15: GetTimersForSeries
private IEnumerable<TimerInfo> GetTimersForSeries(SeriesTimerInfo seriesTimer, IEnumerable<ProgramInfo> allPrograms, IReadOnlyList<RecordingInfo> currentRecordings)
{
// Exclude programs that have already ended
allPrograms = allPrograms.Where(i => i.EndDate > DateTime.UtcNow);
allPrograms = GetProgramsForSeries(seriesTimer, allPrograms);
var recordingShowIds = currentRecordings.Select(i => i.ProgramId).Where(i => !string.IsNullOrWhiteSpace(i)).ToList();
allPrograms = allPrograms.Where(i => !recordingShowIds.Contains(i.Id, StringComparer.OrdinalIgnoreCase));
return allPrograms.Select(i => RecordingHelper.CreateTimer(i, seriesTimer));
}