private bool IsWithinTime(AccessSchedule schedule, DateTime localTime) { var hour = localTime.TimeOfDay.TotalHours; return hour >= schedule.StartHour && hour <= schedule.EndHour; }
public UserPolicy() { EnableSync = true; EnableSyncTranscoding = true; EnableMediaPlayback = true; EnableAudioPlaybackTranscoding = true; EnableVideoPlaybackTranscoding = true; EnableLiveTvManagement = true; EnableLiveTvAccess = true; EnableSharedDeviceControl = true; BlockedTags = new string[] { }; BlockUnratedItems = new UnratedItem[] { }; EnableUserPreferenceAccess = true; AccessSchedules = new AccessSchedule[] { }; EnableAllChannels = true; EnabledChannels = new string[] { }; EnableAllFolders = true; EnabledFolders = new string[] { }; EnabledDevices = new string[] { }; EnableAllDevices = true; EnableContentDownloading = true; EnablePublicSharing = true; }
private bool IsParentalScheduleAllowed(AccessSchedule schedule, DateTime date) { if (date.Kind != DateTimeKind.Utc) { throw new ArgumentException("Utc date expected"); } var localTime = date.ToLocalTime(); return DayOfWeekHelper.GetDaysOfWeek(schedule.DayOfWeek).Contains(localTime.DayOfWeek) && IsWithinTime(schedule, localTime); }
public UserPolicy() { EnableSync = true; EnableSyncTranscoding = true; EnableMediaPlayback = true; EnableAudioPlaybackTranscoding = true; EnableVideoPlaybackTranscoding = true; EnableLiveTvManagement = true; EnableLiveTvAccess = true; // Without this on by default, admins won't be able to do this // Improve in the future EnableLiveTvManagement = true; EnableSharedDeviceControl = true; BlockedTags = new string[] { }; BlockUnratedItems = new UnratedItem[] { }; EnableUserPreferenceAccess = true; AccessSchedules = new AccessSchedule[] { }; EnableAllChannels = true; EnabledChannels = new string[] { }; EnableAllFolders = true; EnabledFolders = new string[] { }; EnabledDevices = new string[] { }; EnableAllDevices = true; EnableContentDownloading = true; EnablePublicSharing = true; }