本文整理汇总了C#中TvDatabase.Schedule.Persist方法的典型用法代码示例。如果您正苦于以下问题:C# Schedule.Persist方法的具体用法?C# Schedule.Persist怎么用?C# Schedule.Persist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TvDatabase.Schedule
的用法示例。
在下文中一共展示了Schedule.Persist方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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;
}
}
示例3: StartRecordingSchedule
public static void StartRecordingSchedule(Channel channel, bool manual)
{
TvBusinessLayer layer = new TvBusinessLayer();
TvServer server = new TvServer();
if (manual) // until manual stop
{
Schedule newSchedule = new Schedule(channel.IdChannel,
GUILocalizeStrings.Get(413) + " (" + channel.DisplayName + ")",
DateTime.Now, DateTime.Now.AddDays(1));
newSchedule.PreRecordInterval = Int32.Parse(layer.GetSetting("preRecordInterval", "5").Value);
newSchedule.PostRecordInterval = Int32.Parse(layer.GetSetting("postRecordInterval", "5").Value);
newSchedule.Persist();
server.OnNewSchedule();
}
else // current program
{
// lets find any canceled episodes that match this one we want to create, if found uncancel it.
Schedule existingParentSchedule = Schedule.RetrieveSeries(channel.IdChannel, channel.CurrentProgram.Title,
channel.CurrentProgram.StartTime,
channel.CurrentProgram.EndTime);
if (existingParentSchedule != null)
{
foreach (CanceledSchedule cancelSched in existingParentSchedule.ReferringCanceledSchedule())
{
if (cancelSched.CancelDateTime == channel.CurrentProgram.StartTime)
{
existingParentSchedule.UnCancelSerie(channel.CurrentProgram.StartTime, channel.CurrentProgram.IdChannel);
server.OnNewSchedule();
return;
}
}
}
// ok, no existing schedule found with matching canceled schedules found. proceeding to add the schedule normally
Schedule newSchedule = new Schedule(channel.IdChannel, channel.CurrentProgram.Title,
channel.CurrentProgram.StartTime, channel.CurrentProgram.EndTime);
newSchedule.PreRecordInterval = Int32.Parse(layer.GetSetting("preRecordInterval", "5").Value);
newSchedule.PostRecordInterval = Int32.Parse(layer.GetSetting("postRecordInterval", "5").Value);
newSchedule.Persist();
server.OnNewSchedule();
}
GUIMessage msgManualRecord = new GUIMessage(GUIMessage.MessageType.GUI_MSG_MANUAL_RECORDING_STARTED, 0, 0, 0, 0, 0, null);
GUIWindowManager.SendMessage(msgManualRecord);
}
示例4: OnQuickRecord
//.........这里部分代码省略.........
Channel selectedChannel = (channels[dlg.SelectedLabel]).ReferencedChannel();
dlg.Reset();
dlg.SetHeading(616); //select recording type
for (int i = 611; i <= 615; ++i)
{
dlg.Add(GUILocalizeStrings.Get(i));
}
dlg.Add(GUILocalizeStrings.Get(WeekEndTool.GetText(DayType.Record_WorkingDays)));
dlg.Add(GUILocalizeStrings.Get(WeekEndTool.GetText(DayType.Record_WeekendDays)));
Schedule rec = new Schedule(selectedChannel.IdChannel, "", Schedule.MinSchedule, Schedule.MinSchedule);
TvBusinessLayer layer = new TvBusinessLayer();
rec.PreRecordInterval = Int32.Parse(layer.GetSetting("preRecordInterval", "5").Value);
rec.PostRecordInterval = Int32.Parse(layer.GetSetting("postRecordInterval", "5").Value);
rec.ScheduleType = (int)ScheduleRecordingType.Once;
DateTime dtNow = DateTime.Now;
int day;
day = 0;
dlg.Reset();
dlg.SetHeading(142); //select time
dlg.ShowQuickNumbers = false;
//time
//int no = 0;
int hour, minute, steps;
steps = 15;
dlg.Add("00:00");
for (hour = 0; hour <= 23; hour++)
{
for (minute = 0; minute < 60; minute += steps)
{
if (hour == 0 && minute == 0)
{
continue;
}
string time;
if (hour < 10)
{
time = "0" + hour;
}
else
{
time = hour.ToString();
}
time += ":";
if (minute < 10)
{
time = time + "0" + minute;
}
else
{
time += minute.ToString();
}
//if (hour < 1) time = String.Format("{0} {1}", minute, GUILocalizeStrings.Get(3004));
dlg.Add(time);
}
}
// pre-select the current time
dlg.SelectedLabel = (DateTime.Now.Hour * (60 / steps)) + (Convert.ToInt16(DateTime.Now.Minute / steps));
dlg.DoModal(GetID);
if (dlg.SelectedLabel == -1)
{
return;
}
int mins = (dlg.SelectedLabel) * steps;
hour = (mins) / 60;
minute = ((mins) % 60);
dlg.Reset();
dlg.SetHeading(180); //select time
dlg.ShowQuickNumbers = false;
//duration
for (float hours = 0.5f; hours <= 24f; hours += 0.5f)
{
dlg.Add(String.Format("{0} {1}", hours.ToString("f2"), GUILocalizeStrings.Get(3002)));
}
dlg.DoModal(GetID);
if (dlg.SelectedLabel == -1)
{
return;
}
int duration = (dlg.SelectedLabel + 1) * 30;
dtNow = DateTime.Now.AddDays(day);
rec.StartTime = new DateTime(dtNow.Year, dtNow.Month, dtNow.Day, hour, minute, 0, 0);
rec.EndTime = rec.StartTime.AddMinutes(duration);
rec.ProgramName = GUILocalizeStrings.Get(413) + " (" + rec.ReferencedChannel().DisplayName + ")";
rec.Persist();
TvServer server = new TvServer();
server.OnNewSchedule();
GUIWindowManager.ShowPreviousWindow();
}
示例5: AddSchedule
public bool AddSchedule(int idChannel,string programName,DateTime startTime,DateTime endTime,int scheduleType)
{
if (!ConnectToDatabase())
return false;
Schedule sched = new Schedule(idChannel, programName, startTime, endTime);
sched.PreRecordInterval = Int32.Parse(GetSetting("preRecordInterval", "5").Value);
sched.PostRecordInterval = Int32.Parse(GetSetting("postRecordInterval", "5").Value);
sched.ScheduleType = scheduleType;
sched.Persist();
RemoteControl.Instance.OnNewSchedule();
return true;
}
示例6: OnSetQuality
public static void OnSetQuality(Schedule rec)
{
GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
if (dlg != null)
{
dlg.Reset();
dlg.SetHeading(882);
dlg.ShowQuickNumbers = true;
dlg.AddLocalizedString(968);
dlg.AddLocalizedString(965);
dlg.AddLocalizedString(966);
dlg.AddLocalizedString(967);
VIDEOENCODER_BITRATE_MODE _newBitRate = rec.BitRateMode;
switch (_newBitRate)
{
case VIDEOENCODER_BITRATE_MODE.NotSet:
dlg.SelectedLabel = 0;
break;
case VIDEOENCODER_BITRATE_MODE.ConstantBitRate:
dlg.SelectedLabel = 1;
break;
case VIDEOENCODER_BITRATE_MODE.VariableBitRateAverage:
dlg.SelectedLabel = 2;
break;
case VIDEOENCODER_BITRATE_MODE.VariableBitRatePeak:
dlg.SelectedLabel = 3;
break;
}
dlg.DoModal(GUIWindowManager.ActiveWindow);
if (dlg.SelectedLabel == -1)
{
return;
}
switch (dlg.SelectedLabel)
{
case 0: // Not Set
_newBitRate = VIDEOENCODER_BITRATE_MODE.NotSet;
break;
case 1: // CBR
_newBitRate = VIDEOENCODER_BITRATE_MODE.ConstantBitRate;
break;
case 2: // VBR
_newBitRate = VIDEOENCODER_BITRATE_MODE.VariableBitRateAverage;
break;
case 3: // VBR Peak
_newBitRate = VIDEOENCODER_BITRATE_MODE.VariableBitRatePeak;
break;
}
rec.BitRateMode = _newBitRate;
rec.Persist();
dlg.Reset();
dlg.SetHeading(882);
dlg.ShowQuickNumbers = true;
dlg.AddLocalizedString(968);
dlg.AddLocalizedString(886); //Default
dlg.AddLocalizedString(993); // Custom
dlg.AddLocalizedString(893); //Portable
dlg.AddLocalizedString(883); //Low
dlg.AddLocalizedString(884); //Medium
dlg.AddLocalizedString(885); //High
QualityType _newQuality = rec.QualityType;
switch (_newQuality)
{
case QualityType.NotSet:
dlg.SelectedLabel = 0;
break;
case QualityType.Default:
dlg.SelectedLabel = 1;
break;
case QualityType.Custom:
dlg.SelectedLabel = 2;
break;
case QualityType.Portable:
dlg.SelectedLabel = 3;
break;
case QualityType.Low:
dlg.SelectedLabel = 4;
break;
case QualityType.Medium:
dlg.SelectedLabel = 5;
break;
case QualityType.High:
dlg.SelectedLabel = 6;
break;
}
dlg.DoModal(GUIWindowManager.ActiveWindow);
if (dlg.SelectedLabel == -1)
{
return;
//.........这里部分代码省略.........
示例7: ChangeType
private void ChangeType(Schedule rec)
{
GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
if (dlg != null)
{
dlg.Reset();
dlg.SetHeading(GUILocalizeStrings.Get(616)); //616=Select Recording type
//611=Record once
//612=Record everytime on this channel
//613=Record everytime on every channel
//614=Record every week at this time
//615=Record every day at this time
for (int i = 611; i <= 615; ++i)
{
dlg.Add(GUILocalizeStrings.Get(i));
}
dlg.Add(GUILocalizeStrings.Get(WeekEndTool.GetText(DayType.Record_WorkingDays)));
dlg.Add(GUILocalizeStrings.Get(WeekEndTool.GetText(DayType.Record_WeekendDays)));
dlg.Add(GUILocalizeStrings.Get(990000));// 990000=Weekly everytime on this channel
switch ((ScheduleRecordingType)rec.ScheduleType)
{
case ScheduleRecordingType.Once:
dlg.SelectedLabel = 0;
break;
case ScheduleRecordingType.EveryTimeOnThisChannel:
dlg.SelectedLabel = 1;
break;
case ScheduleRecordingType.EveryTimeOnEveryChannel:
dlg.SelectedLabel = 2;
break;
case ScheduleRecordingType.Weekly:
dlg.SelectedLabel = 3;
break;
case ScheduleRecordingType.Daily:
dlg.SelectedLabel = 4;
break;
case ScheduleRecordingType.WorkingDays:
dlg.SelectedLabel = 5;
break;
case ScheduleRecordingType.Weekends:
dlg.SelectedLabel = 6;
break;
case ScheduleRecordingType.WeeklyEveryTimeOnThisChannel:
dlg.SelectedLabel = 7;
break;
}
dlg.DoModal(GetID);
if (dlg.SelectedLabel == -1)
{
return;
}
switch (dlg.SelectedLabel)
{
case 0: //once
rec.ScheduleType = (int)ScheduleRecordingType.Once;
rec.Canceled = Schedule.MinSchedule;
break;
case 1: //everytime, this channel
rec.ScheduleType = (int)ScheduleRecordingType.EveryTimeOnThisChannel;
rec.Canceled = Schedule.MinSchedule;
break;
case 2: //everytime, all channels
rec.ScheduleType = (int)ScheduleRecordingType.EveryTimeOnEveryChannel;
rec.Canceled = Schedule.MinSchedule;
break;
case 3: //weekly
rec.ScheduleType = (int)ScheduleRecordingType.Weekly;
rec.Canceled = Schedule.MinSchedule;
break;
case 4: //daily
rec.ScheduleType = (int)ScheduleRecordingType.Daily;
rec.Canceled = Schedule.MinSchedule;
break;
case 5: //WorkingDays
rec.ScheduleType = (int)ScheduleRecordingType.WorkingDays;
rec.Canceled = Schedule.MinSchedule;
break;
case 6: //Weekends
rec.ScheduleType = (int)ScheduleRecordingType.Weekends;
rec.Canceled = Schedule.MinSchedule;
break;
case 7://weekly everytime, this channel
rec.ScheduleType = (int)ScheduleRecordingType.WeeklyEveryTimeOnThisChannel;
rec.Canceled = Schedule.MinSchedule;
break;
}
rec.Persist();
TvServer server = new TvServer();
server.OnNewSchedule();
LoadDirectory();
}
}
示例8: CreateSpawnedOnceSchedule
private bool CreateSpawnedOnceSchedule(Schedule schedule, TvDatabase.Program current)
{
bool isSpawnedOnceScheduleCreated = false;
Schedule dbSchedule = Schedule.RetrieveOnce(current.IdChannel, current.Title, current.StartTime,
current.EndTime);
if (dbSchedule == null) // not created yet
{
Schedule once = Schedule.RetrieveOnce(current.IdChannel, current.Title, current.StartTime, current.EndTime);
if (once == null) // make sure that we DO NOT create multiple once recordings.
{
Schedule newSchedule = new Schedule(schedule);
newSchedule.IdChannel = current.IdChannel;
newSchedule.StartTime = current.StartTime;
newSchedule.EndTime = current.EndTime;
newSchedule.ScheduleType = 0; // type Once
newSchedule.Series = true;
newSchedule.IdParentSchedule = schedule.IdSchedule;
newSchedule.Persist();
isSpawnedOnceScheduleCreated = true;
// 'once typed' created schedule will be used instead at next call of IsTimeToRecord()
}
}
return isSpawnedOnceScheduleCreated;
}
示例9: InitiateBufferFilesCopyProcess
private void InitiateBufferFilesCopyProcess(Recording rec)
{
if (_tsBufferExtractorSetup == "A" && _snapshotBufferPosition == -2)
{
Log.Info("TsBufferExtractor: there is no program information, skip the ts buffer copy.");
return;
}
string recordingFilename = rec.FileName;
IUser u = _tvEvent.Card.User;
long bufferId = 0;
Int64 currentPosition = -1;
var layer = new TvBusinessLayer();
Int64 maximumFileSize = Int64.Parse(layer.GetSetting("timeshiftMaxFileSize", "30").Value) * 1000 * 1000;
int maxFiles = Convert.ToInt16(layer.GetSetting("timeshiftMaxFiles", "30").Value);
List<string[]> itemlist = new List<string[]>();
if (RemoteControl.Instance.TimeShiftGetCurrentFilePosition(ref u, ref currentPosition, ref bufferId))
{
string currentFile = RemoteControl.Instance.TimeShiftFileName(ref u) + bufferId.ToString() + ".ts";
if (_snapshotBufferPosition == -2)
{
_snapshotBufferId = bufferId + 1;
Log.Debug("TsBufferExtractor: snapshotBufferPosition was overwritten, the new _snapshotBufferId {0}", _snapshotBufferId);
}
Log.Info("TsBufferExtractor: current TS Position {0}, TS bufferId {1}, snapshotBufferId {2}, recording file {3}",
currentPosition, bufferId, _snapshotBufferId, recordingFilename);
if (_snapshotBufferId < bufferId)
{
Log.Debug("TsBufferExtractor: snapshotBufferId {0}, bufferId {1}", _snapshotBufferId, bufferId);
string nextFile;
for (long i = _snapshotBufferId; i < bufferId; i++)
{
nextFile = RemoteControl.Instance.TimeShiftFileName(ref u) + i + ".ts";
Log.Debug("TsBufferExtractor: nextFile {0}", nextFile);
itemlist.Add(new[] { nextFile, string.Format("{0}", maximumFileSize), recordingFilename });
}
}
else if (_snapshotBufferId > bufferId)
{
{
string nextFile;
for (long i = _snapshotBufferId; i <= maxFiles; i++)
{
nextFile = RemoteControl.Instance.TimeShiftFileName(ref u) + i + ".ts";
Log.Debug("TsBufferExtractor: nextFile {0}", nextFile);
itemlist.Add(new[] { nextFile, string.Format("{0}", maximumFileSize), recordingFilename });
}
if (1 < _bufferId)
{
for (long i = 1; i < _bufferId; i++)
{
nextFile = RemoteControl.Instance.TimeShiftFileName(ref u) + i + ".ts";
Log.Debug("TsBufferExtractor: nextFile {0}", nextFile);
itemlist.Add(new[] { nextFile, string.Format("{0}", maximumFileSize), recordingFilename });
}
}
}
}
itemlist.Add(new[] { currentFile, string.Format("{0}", currentPosition), recordingFilename });
Log.Debug("TsBufferExtractor: currentFile {0}", currentFile);
try
{
Schedule newSchedule = new Schedule(rec.IdChannel, rec.Title, rec.StartTime, DateTime.Now);
newSchedule.PreRecordInterval = 0;
newSchedule.PostRecordInterval = 0;
newSchedule.Persist();
Copyer Copy = new Copyer();
Copy.CopyTimeShiftFile(itemlist, rec, newSchedule);
}
catch (Exception ex)
{
Log.Error("TsBufferExtractor.CopyTimeShiftFile exception : {0}", ex);
}
}
_snapshotBufferPosition = -1;
_snapshotBufferFile = string.Empty;
_snapshotBufferId = 0;
}
示例10: AssignSchedulesToCard
private static bool AssignSchedulesToCard(Schedule schedule, List<Schedule>[] cardSchedules,
out List<Schedule> overlappingSchedules)
{
overlappingSchedules = new List<Schedule>();
Log.Info("AssignSchedulesToCard: schedule = " + schedule);
IList<Card> cards = Card.ListAll();
bool assigned = false;
int count = 0;
foreach (Card card in cards)
{
if (card.Enabled && card.canViewTvChannel(schedule.IdChannel))
{
// checks if any schedule assigned to this cards overlaps current parsed schedule
bool free = true;
foreach (Schedule assignedSchedule in cardSchedules[count])
{
Log.Info("AssignSchedulesToCard: card {0}, ID = {1} has schedule = " + assignedSchedule, count, card.IdCard);
if (schedule.IsOverlapping(assignedSchedule))
{
if (!(schedule.isSameTransponder(assignedSchedule) && card.supportSubChannels))
{
overlappingSchedules.Add(assignedSchedule);
Log.Info("AssignSchedulesToCard: overlapping with " + assignedSchedule + " on card {0}, ID = {1}", count,
card.IdCard);
free = false;
break;
}
}
}
if (free)
{
Log.Info("AssignSchedulesToCard: free on card {0}, ID = {1}", count, card.IdCard);
cardSchedules[count].Add(schedule);
int recommendedCard = schedule.RecommendedCard;
if (recommendedCard != card.IdCard)
{
schedule.RecommendedCard = card.IdCard;
//Only update, do not insert
if (schedule.IsPersisted)
{
schedule.Persist();
}
}
assigned = true;
break;
}
}
count++;
}
if (!assigned)
{
return false;
}
return true;
}
示例11: RecordProgram
public void RecordProgram(int id, int scheduleType)
{
UpdateTvServer();
Program program = Program.Retrieve(id);
bool isSeries;
Schedule schedule;
if (IsRecording(program, out schedule, out isSeries) == false)
{
TvBusinessLayer layer = new TvBusinessLayer();
int preInterval = Int32.Parse(layer.GetSetting("preRecordInterval", "5").Value);
int postInterval = Int32.Parse(layer.GetSetting("postRecordInterval", "5").Value);
Schedule rec = new Schedule(program.IdChannel, program.Title, program.StartTime, program.EndTime);
rec.ScheduleType = (int)scheduleType;
rec.PreRecordInterval = preInterval;
rec.PostRecordInterval = postInterval;
rec.Persist();
RemoteControl.Instance.OnNewSchedule();
}
}