本文整理汇总了C#中TvDatabase.Schedule类的典型用法代码示例。如果您正苦于以下问题:C# Schedule类的具体用法?C# Schedule怎么用?C# Schedule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Schedule类属于TvDatabase命名空间,在下文中一共展示了Schedule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckEpsiodesForRecording
private void CheckEpsiodesForRecording(Schedule schedule, TvDatabase.Program program)
{
if (!schedule.DoesUseEpisodeManagement)
return;
//check how many episodes we got
while (true)
{
IList<Recording> recordings = Recording.ListAll();
List<Recording> episodes = GetEpisodes(program.Title, recordings);
if (episodes.Count <= schedule.MaxAirings)
return;
Recording oldestEpisode = GetOldestEpisode(episodes);
if (oldestEpisode == null)
return;
Log.Write("diskmanagement: Delete episode {0} {1} {2} {3}",
oldestEpisode.ReferencedChannel(),
oldestEpisode.Title,
oldestEpisode.StartTime.ToLongDateString(),
oldestEpisode.StartTime.ToLongTimeString());
// Delete the file from disk and the recording entry from the database.
bool result = RecordingFileHandler.DeleteRecordingOnDisk(oldestEpisode.FileName);
if (result)
{
oldestEpisode.Delete();
}
}
}
示例2: OnScheduleEnded
public void OnScheduleEnded(string recordingFilename, Schedule recording, TvDatabase.Program program)
{
Log.Write("diskmanagement: recording {0} ended. type:{1} max episodes:{2}",
program.Title, (ScheduleRecordingType)recording.ScheduleType, recording.MaxAirings);
CheckEpsiodesForRecording(recording, program);
}
示例3: AddScheduleAdvanced
public bool AddScheduleAdvanced(int idChannel, string programName, DateTime startTime, DateTime endTime, int scheduleType, int preRecordInterval, int postRecordInterval, string directory, int keepMethod)
{
if (!ConnectToDatabase())
return false;
Schedule sched = new Schedule(idChannel, programName, startTime, endTime);
// using negative numbers instead of null because non-primitive types (which a Nullable<int> is) and SOAP don't mix easily
sched.PreRecordInterval = preRecordInterval < 0 ? Int32.Parse(GetSetting("preRecordInterval", "5").Value) : preRecordInterval;
sched.PostRecordInterval = postRecordInterval < 0 ? Int32.Parse(GetSetting("postRecordInterval", "5").Value) : postRecordInterval;
sched.ScheduleType = scheduleType;
sched.Directory = directory;
sched.KeepMethod = keepMethod;
sched.Persist();
RemoteControl.Instance.OnNewSchedule();
return true;
}
示例4: AddSchedule
public bool AddSchedule(int channelId, String programName, DateTime startTime, DateTime endTime, int scheduleType, Int32 priority, Int32 keepmethod, DateTime keepdate, Int32 preRecordInterval, Int32 postRecordInterval)
{
try
{
TvBusinessLayer layer = new TvBusinessLayer();
TvDatabase.Schedule s = new TvDatabase.Schedule(channelId, programName, startTime, endTime);
if (scheduleType < 0)
{
s.ScheduleType = (int)TvDatabase.ScheduleRecordingType.Once;
}
else
{
s.ScheduleType = scheduleType;
}
if (priority != -1)
{
s.Priority = priority;
}
if (keepmethod != -1)
{
s.KeepMethod = keepmethod;
s.KeepDate = keepdate;
}
if ((preRecordInterval < 0) && (postRecordInterval < 0))
{ //Use the settings from Mediaportal
s.PreRecordInterval = Int32.Parse(layer.GetSetting("preRecordInterval", "5").Value);
s.PostRecordInterval = Int32.Parse(layer.GetSetting("postRecordInterval", "5").Value);
}
else
{ // Use the settings from XBMC
s.PreRecordInterval = preRecordInterval;
s.PostRecordInterval = postRecordInterval;
}
s.Persist();
RemoteControl.Instance.OnNewSchedule();
return true;
}
catch
{
return false;
}
}
示例5: CopyTimeShiftFile
public void CopyTimeShiftFile(object itemlist, Recording rec, Schedule newSchedule)
{
try
{
ThreadStart ts = delegate()
{
TsCopier(itemlist, rec, newSchedule);
};
Thread _CopyTimeShiftFile;
_CopyTimeShiftFile = new Thread(ts);
_CopyTimeShiftFile.Priority = ThreadPriority.Lowest;
_CopyTimeShiftFile.IsBackground = true;
_CopyTimeShiftFile.Start();
}
catch (Exception ex)
{
Log.Error("TsCopier exception: {0}", ex);
return;
}
}
示例6: RecordingDetail
/// <summary>
/// constructor
/// </summary>
/// <param name="schedule">Schedule of this recording</param>
/// <param name="channel">Channel on which the recording is done</param>
/// <param name="endTime">Date/Time the recording should start without pre-record interval</param>
/// <param name="endTime">Date/Time the recording should stop with post record interval</param>
/// <param name="isSerie">Is serie recording</param>
///
///
public RecordingDetail(Schedule schedule, Channel channel, DateTime endTime, bool isSerie)
{
_user = UserFactory.CreateSchedulerUser(schedule.IdSchedule);
/*User.Name = string.Format("scheduler{0}", schedule.IdSchedule);
User.CardId = -1;
User.SubChannel = -1;
User.IsAdmin = true;
User.Priority = UserFactory.SCHEDULER_PRIORITY;*/
_schedule = schedule;
_channel = channel;
_endTime = endTime;
_program = null;
_isSerie = isSerie;
DateTime startTime = DateTime.MinValue;
if (isSerie)
{
DateTime now = DateTime.Now.AddMinutes(schedule.PreRecordInterval);
startTime = new DateTime(now.Year, now.Month, now.Day, schedule.StartTime.Hour, schedule.StartTime.Minute, 0);
}
else
{
startTime = schedule.StartTime;
}
_program = schedule.ReferencedChannel().GetProgramAt(startTime);
//no program? then treat this as a manual recording
if (_program == null)
{
_program = new TvDatabase.Program(0, DateTime.Now, endTime, "manual", "", "",
TvDatabase.Program.ProgramState.None,
System.Data.SqlTypes.SqlDateTime.MinValue.Value, string.Empty, string.Empty,
string.Empty, string.Empty, -1, string.Empty, 0);
}
}
示例7: OnPostRecordInterval
private void OnPostRecordInterval()
{
Schedule rec = currentSchedule;
if (currentSchedule == null && !IsRecordingProgram(CurrentProgram, out rec, false))
{
return;
}
GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
if (dlg != null)
{
dlg.Reset();
dlg.ShowQuickNumbers = false;
dlg.SetHeading(GUILocalizeStrings.Get(1445)); //pre-record
foreach (int interval in RecordingIntervalValues)
{
if (interval == 1)
{
if (interval == _postRec)
{
dlg.Add(String.Format("{0} {1}", interval,
GUILocalizeStrings.Get(3003) + " (" + GUILocalizeStrings.Get(886) + ")"));
// minute (default)
}
else
{
dlg.Add(String.Format("{0} {1}", interval, GUILocalizeStrings.Get(3003))); // minute
}
}
else
{
if (interval == _postRec)
{
dlg.Add(String.Format("{0} {1}", interval,
GUILocalizeStrings.Get(3004) + " (" + GUILocalizeStrings.Get(886) + ")"));
// minutes (default)
}
else
{
dlg.Add(String.Format("{0} {1}", interval, GUILocalizeStrings.Get(3004))); // minutes
}
}
}
if (rec.PostRecordInterval < 0)
{
dlg.SelectedLabel = 0;
}
else if (RecordingIntervalValues.IndexOf(rec.PostRecordInterval) == -1)
{
RecordingIntervalValues.IndexOf(_postRec); // select default if the value is not part of the list
}
else
{
dlg.SelectedLabel = RecordingIntervalValues.IndexOf(rec.PostRecordInterval);
}
dlg.DoModal(GetID);
if (dlg.SelectedLabel < 0)
{
return;
}
rec.PostRecordInterval = RecordingIntervalValues[dlg.SelectedLabel];
rec.Persist();
currentSchedule = rec;
Schedule assocSchedule = Schedule.RetrieveSpawnedSchedule(rec.IdSchedule, rec.StartTime);
if (assocSchedule != null)
{
assocSchedule.PostRecordInterval = rec.PostRecordInterval;
assocSchedule.Persist();
}
}
Update();
}
示例8: GetRecordingDateTime
private static string GetRecordingDateTime(Schedule rec)
{
return String.Format("{0} {1} - {2}",
Utils.GetShortDayString(rec.StartTime),
rec.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
rec.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
}
示例9: CreateProgram
public static void CreateProgram(Program program, int scheduleType, int dialogId)
{
Log.Debug("TVProgramInfo.CreateProgram: program = {0}", program.ToString());
Schedule schedule;
Schedule saveSchedule = null;
TvBusinessLayer layer = new TvBusinessLayer();
if (IsRecordingProgram(program, out schedule, false)) // check if schedule is already existing
{
Log.Debug("TVProgramInfo.CreateProgram - series schedule found ID={0}, Type={1}", schedule.IdSchedule,
schedule.ScheduleType);
Log.Debug(" - schedule= {0}", schedule.ToString());
//schedule = Schedule.Retrieve(schedule.IdSchedule); // get the correct informations
if (schedule.IsSerieIsCanceled(schedule.GetSchedStartTimeForProg(program), program.IdChannel))
{
//lets delete the cancelled schedule.
saveSchedule = schedule;
schedule = new Schedule(program.IdChannel, program.Title, program.StartTime, program.EndTime);
schedule.PreRecordInterval = saveSchedule.PreRecordInterval;
schedule.PostRecordInterval = saveSchedule.PostRecordInterval;
schedule.ScheduleType = (int)ScheduleRecordingType.Once; // needed for layer.GetConflictingSchedules(...)
}
}
else
{
Log.Debug("TVProgramInfo.CreateProgram - no series schedule");
// no series schedule => create it
schedule = new Schedule(program.IdChannel, program.Title, program.StartTime, program.EndTime);
schedule.PreRecordInterval = Int32.Parse(layer.GetSetting("preRecordInterval", "5").Value);
schedule.PostRecordInterval = Int32.Parse(layer.GetSetting("postRecordInterval", "5").Value);
schedule.ScheduleType = scheduleType;
}
// check if this program is conflicting with any other already scheduled recording
IList conflicts = layer.GetConflictingSchedules(schedule);
Log.Debug("TVProgramInfo.CreateProgram - conflicts.Count = {0}", conflicts.Count);
TvServer server = new TvServer();
bool skipConflictingEpisodes = false;
if (conflicts.Count > 0)
{
TVConflictDialog dlg =
(TVConflictDialog)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_TVCONFLICT);
if (dlg != null)
{
dlg.Reset();
dlg.SetHeading(GUILocalizeStrings.Get(879)); // "recording conflict"
foreach (Schedule conflict in conflicts)
{
Log.Debug("TVProgramInfo.CreateProgram: Conflicts = " + conflict);
GUIListItem item = new GUIListItem(conflict.ProgramName);
item.Label2 = GetRecordingDateTime(conflict);
Channel channel = Channel.Retrieve(conflict.IdChannel);
if (channel != null && !string.IsNullOrEmpty(channel.DisplayName))
{
item.Label3 = channel.DisplayName;
}
else
{
item.Label3 = conflict.IdChannel.ToString();
}
item.TVTag = conflict;
dlg.AddConflictRecording(item);
}
dlg.ConflictingEpisodes = (scheduleType != (int)ScheduleRecordingType.Once);
dlg.DoModal(dialogId);
switch (dlg.SelectedLabel)
{
case 0: // Skip new Recording
{
Log.Debug("TVProgramInfo.CreateProgram: Skip new recording");
return;
}
case 1: // Don't record the already scheduled one(s)
{
Log.Debug("TVProgramInfo.CreateProgram: Skip old recording(s)");
foreach (Schedule conflict in conflicts)
{
Program prog =
new Program(conflict.IdChannel, conflict.StartTime, conflict.EndTime, conflict.ProgramName, "-", "-",
Program.ProgramState.None,
DateTime.MinValue, string.Empty, string.Empty, string.Empty, string.Empty, -1,
string.Empty, -1);
CancelProgram(prog, Schedule.Retrieve(conflict.IdSchedule), dialogId);
}
break;
}
case 2: // keep conflict
{
Log.Debug("TVProgramInfo.CreateProgram: Keep Conflict");
break;
}
case 3: // Skip for conflicting episodes
{
Log.Debug("TVProgramInfo.CreateProgram: Skip conflicting episode(s)");
skipConflictingEpisodes = true;
break;
}
default: // Skipping new Recording
//.........这里部分代码省略.........
示例10: ResetCurrentScheduleAndProgram
private static void ResetCurrentScheduleAndProgram()
{
currentProgram = initialProgram;
currentSchedule = null;
}
示例11: AddSchedule
// Add schedules for importing from xml
public Schedule AddSchedule(int idChannel, string programName, DateTime startTime, DateTime endTime,
int scheduleType)
{
Schedule schedule = GetSchedule(idChannel, programName, startTime, endTime, scheduleType);
if (schedule != null)
{
return schedule;
}
Schedule newSchedule = new Schedule(idChannel, programName, startTime, endTime);
return newSchedule;
}
示例12: GetRecordingTimes
public List<Schedule> GetRecordingTimes(Schedule rec)
{
return GetRecordingTimes(rec, 10);
}
示例13: CancelEpisode
private static bool CancelEpisode(DateTime cancelStartTime, Schedule scheduleToCancel, int idChannel)
{
bool episodeCanceled = false;
if (scheduleToCancel != null)
{
//create the canceled schedule to prevent the schedule from restarting again.
// we only create cancelled recordings on series type schedules
Schedule sched2cancel = Schedule.Retrieve(scheduleToCancel.IdSchedule);
bool isOnce = IsScheduleTypeOnce(scheduleToCancel.IdSchedule);
if (!isOnce)
{
DateTime cancel = cancelStartTime;
int IdForScheduleToCancel = scheduleToCancel.IdSchedule;
CanceledSchedule canceledSchedule = new CanceledSchedule(IdForScheduleToCancel, idChannel, cancel);
canceledSchedule.Persist();
episodeCanceled = true;
}
}
return episodeCanceled;
}
示例14: DeleteEntireOrOnceSchedule
private static bool DeleteEntireOrOnceSchedule(Schedule schedule, Schedule parentSchedule)
{
//is the schedule recording, then stop it now.
bool wasDeleted = false;
try
{
bool isRec = TvDatabase.Schedule.IsScheduleRecording(schedule.IdSchedule);
bool isOnce = IsScheduleTypeOnce(parentSchedule.IdSchedule);
if (parentSchedule != null)
{
wasDeleted = DeleteSchedule(parentSchedule.IdSchedule);
}
if (schedule != null)
{
wasDeleted = DeleteSchedule(schedule.IdSchedule);
}
}
catch (Exception)
{
//consume ex
}
return wasDeleted;
}
示例15: StopRecAndDeleteEntireSchedule
private static bool StopRecAndDeleteEntireSchedule(Schedule schedule, Schedule parentSchedule, DateTime canceledStartTime)
{
int idChannel = schedule.IdChannel;
CancelEpisode(canceledStartTime, parentSchedule, idChannel);
TvServer server = new TvServer();
bool wasRecStopped = StopRecording(schedule);
bool wasDeleted = DeleteEntireOrOnceSchedule(schedule, parentSchedule);
server.OnNewSchedule();
return wasRecStopped || wasDeleted;
}