本文整理汇总了C#中TvControl.TvServer类的典型用法代码示例。如果您正苦于以下问题:C# TvServer类的具体用法?C# TvServer怎么用?C# TvServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TvServer类属于TvControl命名空间,在下文中一共展示了TvServer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowDialog
public new DialogResult ShowDialog(IWin32Window owner)
{
Text = "Preview " + _channel.DisplayName;
TvServer server = new TvServer();
IUser user = new User("setuptv", false);
TvResult result = server.StartTimeShifting(ref user, _channel.IdChannel, out _card);
if (result != TvResult.Succeeded)
{
MessageBox.Show("Preview failed:" + result);
Close();
return DialogResult.None;
}
Log.Info("preview {0} user:{1} {2} {3} {4}", _channel.DisplayName, user.CardId, user.SubChannel, user.Name,
_card.TimeShiftFileName);
_player = new Player();
_player.Play(_card.TimeShiftFileName, this);
return base.ShowDialog(owner);
}
示例2: OnSetEpisodesToKeep
public static void OnSetEpisodesToKeep(Schedule rec)
{
Schedule schedule = Schedule.Retrieve(rec.IdSchedule);
GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
if (dlg == null)
{
return;
}
dlg.Reset();
dlg.SetHeading(887); //quality settings
dlg.ShowQuickNumbers = false;
dlg.AddLocalizedString(889); //All episodes
for (int i = 1; i < 40; ++i)
{
dlg.Add(i.ToString() + " " + GUILocalizeStrings.Get(874));
}
if (schedule.MaxAirings == Int32.MaxValue)
{
dlg.SelectedLabel = 0;
}
else
{
dlg.SelectedLabel = schedule.MaxAirings;
}
dlg.DoModal(GUIWindowManager.ActiveWindow);
if (dlg.SelectedLabel == -1)
{
return;
}
if (dlg.SelectedLabel == 0)
{
schedule.MaxAirings = Int32.MaxValue;
}
else
{
schedule.MaxAirings = dlg.SelectedLabel;
}
schedule.Persist();
TvServer server = new TvServer();
server.OnNewSchedule();
}
示例3: OnKeep
private void OnKeep()
{
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)
{
return;
}
dlg.Reset();
dlg.SetHeading(1042);
dlg.AddLocalizedString(1043); //Until watched
dlg.AddLocalizedString(1044); //Until space needed
dlg.AddLocalizedString(1045); //Until date
dlg.AddLocalizedString(1046); //Always
switch (rec.KeepMethod)
{
case (int)KeepMethodType.UntilWatched:
dlg.SelectedLabel = 0;
break;
case (int)KeepMethodType.UntilSpaceNeeded:
dlg.SelectedLabel = 1;
break;
case (int)KeepMethodType.TillDate:
dlg.SelectedLabel = 2;
break;
case (int)KeepMethodType.Always:
dlg.SelectedLabel = 3;
break;
}
dlg.DoModal(GetID);
if (dlg.SelectedLabel == -1)
{
return;
}
switch (dlg.SelectedId)
{
case 1043:
rec.KeepMethod = (int)KeepMethodType.UntilWatched;
break;
case 1044:
rec.KeepMethod = (int)KeepMethodType.UntilSpaceNeeded;
break;
case 1045:
rec.KeepMethod = (int)KeepMethodType.TillDate;
dlg.Reset();
dlg.ShowQuickNumbers = false;
dlg.SetHeading(1045);
for (int iDay = 1; iDay <= 100; iDay++)
{
DateTime dt = CurrentProgram.StartTime.AddDays(iDay);
dlg.Add(dt.ToLongDateString());
}
TimeSpan ts = (rec.KeepDate - CurrentProgram.StartTime);
int days = (int)ts.TotalDays;
if (days >= 100)
{
days = 30;
}
dlg.SelectedLabel = days - 1;
dlg.DoModal(GetID);
if (dlg.SelectedLabel < 0)
{
return;
}
rec.KeepDate = CurrentProgram.StartTime.AddDays(dlg.SelectedLabel + 1);
break;
case 1046:
rec.KeepMethod = (int)KeepMethodType.Always;
break;
}
rec.Persist();
currentSchedule = rec;
TvServer server = new TvServer();
server.OnNewSchedule();
}
示例4: OnRecordProgram
private void OnRecordProgram(Program program)
{
if (program == null)
{
return;
}
Log.Debug("TVProgammInfo.OnRecordProgram - programm = {0}", program.ToString());
Schedule recordingSchedule;
if (!anyUpcomingEpisodesRecording && currentSchedule != null)
{
CancelProgram(program, currentSchedule, GetID);
}
else if (IsRecordingProgram(program, out recordingSchedule, true)) // check if schedule is already existing
{
CancelProgram(program, recordingSchedule, GetID);
}
else
{
TvServer server = new TvServer();
VirtualCard card;
if (TVHome.Navigator.Channel.IdChannel == program.IdChannel &&
server.IsRecording(TVHome.Navigator.Channel.IdChannel, out card))
{
Schedule schedFromDB = Schedule.Retrieve(card.RecordingScheduleId);
if (schedFromDB.IsManual)
{
Schedule sched = Schedule.Retrieve(card.RecordingScheduleId);
TVUtil.DeleteRecAndSchedWithPrompt(sched, program.IdChannel);
}
else
{
CreateProgram(program, (int)ScheduleRecordingType.Once, GetID);
}
}
else
{
CreateProgram(program, (int)ScheduleRecordingType.Once, GetID);
}
}
Update();
}
示例5: ViewChannelAndCheck
/// <summary>
/// Tunes to a new channel
/// </summary>
/// <param name="channel"></param>
/// <returns></returns>
public static bool ViewChannelAndCheck(Channel channel)
{
bool checkResult;
bool doContinue;
if (!Connected)
{
return false;
}
_status.Clear();
_doingChannelChange = false;
try
{
checkResult = PreTuneChecks(channel, out doContinue);
if (doContinue == false)
return checkResult;
_doingChannelChange = true;
TvResult succeeded;
IUser user = new User();
if (Card != null)
{
user.CardId = Card.Id;
}
if ((g_Player.Playing && g_Player.IsTimeShifting && !g_Player.Stopped) && (g_Player.IsTV || g_Player.IsRadio))
{
_status.Set(LiveTvStatus.WasPlaying);
}
//Start timeshifting the new tv channel
TvServer server = new TvServer();
VirtualCard card;
int newCardId = -1;
// check which card will be used
newCardId = server.TimeShiftingWouldUseCard(ref user, channel.IdChannel);
//Added by joboehl - If any major related to the timeshifting changed during the start, restart the player.
if (newCardId != -1 && Card.Id != newCardId)
{
_status.Set(LiveTvStatus.CardChange);
RegisterCiMenu(newCardId);
}
// we need to stop player HERE if card has changed.
if (_status.AllSet(LiveTvStatus.WasPlaying | LiveTvStatus.CardChange))
{
Log.Debug("TVHome.ViewChannelAndCheck(): Stopping player. CardId:{0}/{1}, RTSP:{2}", Card.Id, newCardId,
Card.RTSPUrl);
Log.Debug("TVHome.ViewChannelAndCheck(): Stopping player. Timeshifting:{0}", Card.TimeShiftFileName);
Log.Debug("TVHome.ViewChannelAndCheck(): rebuilding graph (card changed) - timeshifting continueing.");
}
if (_status.IsSet(LiveTvStatus.WasPlaying))
{
RenderBlackImage();
g_Player.PauseGraph();
}
else
{
// if CI menu is not attached due to card change, do it if graph was not playing
// (some handlers use polling threads that get stopped on graph stop)
if (_status.IsNotSet(LiveTvStatus.CardChange))
RegisterCiMenu(newCardId);
}
// if card was not changed
if (_status.IsNotSet(LiveTvStatus.CardChange))
{
g_Player.OnZapping(0x80); // Setup Zapping for TsReader, requesting new PAT from stream
}
bool cardChanged = false;
succeeded = server.StartTimeShifting(ref user, channel.IdChannel, out card, out cardChanged);
if (_status.IsSet(LiveTvStatus.WasPlaying))
{
if (card != null)
g_Player.OnZapping((int)card.Type);
else
g_Player.OnZapping(-1);
}
if (succeeded != TvResult.Succeeded)
{
//timeshifting new channel failed.
g_Player.Stop();
// ensure right channel name, even if not watchable:Navigator.Channel = channel;
ChannelTuneFailedNotifyUser(succeeded, _status.IsSet(LiveTvStatus.WasPlaying), channel);
//.........这里部分代码省略.........
示例6: OnActiveStreams
private void OnActiveStreams()
{
GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
if (dlg == null)
{
return;
}
dlg.Reset();
dlg.SetHeading(692); // Active Tv Streams
int selected = 0;
IList<Card> cards = TvDatabase.Card.ListAll();
List<Channel> channels = new List<Channel>();
int count = 0;
TvServer server = new TvServer();
List<IUser> _users = new List<IUser>();
foreach (Card card in cards)
{
if (card.Enabled == false)
{
continue;
}
if (!RemoteControl.Instance.CardPresent(card.IdCard))
{
continue;
}
IUser[] users = RemoteControl.Instance.GetUsersForCard(card.IdCard);
if (users == null)
{
return;
}
for (int i = 0; i < users.Length; ++i)
{
IUser user = users[i];
if (card.IdCard != user.CardId)
{
continue;
}
bool isRecording;
bool isTimeShifting;
VirtualCard tvcard = new VirtualCard(user, RemoteControl.HostName);
isRecording = tvcard.IsRecording;
isTimeShifting = tvcard.IsTimeShifting;
if (isTimeShifting || (isRecording && !isTimeShifting))
{
int idChannel = tvcard.IdChannel;
user = tvcard.User;
Channel ch = Channel.Retrieve(idChannel);
channels.Add(ch);
GUIListItem item = new GUIListItem();
item.Label = ch.DisplayName;
item.Label2 = user.Name;
string strLogo = Utils.GetCoverArt(Thumbs.TVChannel, ch.DisplayName);
if (string.IsNullOrEmpty(strLogo))
{
strLogo = "defaultVideoBig.png";
}
item.IconImage = strLogo;
if (isRecording)
{
item.PinImage = Thumbs.TvRecordingIcon;
}
else
{
item.PinImage = "";
}
dlg.Add(item);
_users.Add(user);
if (Card != null && Card.IdChannel == idChannel)
{
selected = count;
}
count++;
}
}
}
if (channels.Count == 0)
{
GUIDialogOK pDlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
if (pDlgOK != null)
{
pDlgOK.SetHeading(692); //my tv
pDlgOK.SetLine(1, GUILocalizeStrings.Get(1511)); // No Active streams
pDlgOK.SetLine(2, "");
pDlgOK.DoModal(this.GetID);
}
return;
}
dlg.SelectedLabel = selected;
dlg.DoModal(this.GetID);
if (dlg.SelectedLabel < 0)
{
return;
}
VirtualCard vCard = new VirtualCard(_users[dlg.SelectedLabel], RemoteControl.HostName);
Channel channel = Navigator.GetChannel(vCard.IdChannel);
ViewChannel(channel);
}
示例7: mpButtonTimeShift_Click
private void mpButtonTimeShift_Click(object sender, EventArgs e)
{
if (ServiceHelper.IsStopped) return;
if (mpComboBoxChannels.SelectedItem == null) return;
int id = ((ComboBoxExItem)mpComboBoxChannels.SelectedItem).Id;
TvServer server = new TvServer();
VirtualCard card = GetCardTimeShiftingChannel(id);
if (card != null)
{
card.StopTimeShifting();
mpButtonRec.Enabled = false;
}
else
{
string timeShiftingFilename = string.Empty;
int cardId = -1;
foreach (ListViewItem listViewItem in mpListView1.SelectedItems)
{
if (listViewItem.SubItems[2].Text != "disabled")
{
cardId = Convert.ToInt32(listViewItem.SubItems[0].Tag);
break; // Keep the first card enabled selected only
}
}
IUser user = new User();
user.Name = "setuptv-" + id + "-" + cardId;
user.IsAdmin = true;
user.CardId = cardId;
TvResult result = server.StartTimeShifting(ref user, id, out card, cardId != -1);
if (result != TvResult.Succeeded)
{
switch (result)
{
case TvResult.NoPmtFound:
MessageBox.Show(this, "No PMT found");
break;
case TvResult.NoSignalDetected:
MessageBox.Show(this, "No signal");
break;
case TvResult.CardIsDisabled:
MessageBox.Show(this, "Card is not enabled");
break;
case TvResult.AllCardsBusy:
MessageBox.Show(this, "All cards are busy");
break;
case TvResult.ChannelIsScrambled:
MessageBox.Show(this, "Channel is scrambled");
break;
case TvResult.NoVideoAudioDetected:
MessageBox.Show(this, "No Video/Audio detected");
break;
case TvResult.UnableToStartGraph:
MessageBox.Show(this, "Unable to create/start graph");
break;
case TvResult.ChannelNotMappedToAnyCard:
MessageBox.Show(this, "Channel is not mapped to any card");
break;
case TvResult.NoTuningDetails:
MessageBox.Show(this, "No tuning information available for this channel");
break;
case TvResult.UnknownChannel:
MessageBox.Show(this, "Unknown channel");
break;
case TvResult.UnknownError:
MessageBox.Show(this, "Unknown error occured");
break;
case TvResult.ConnectionToSlaveFailed:
MessageBox.Show(this, "Cannot connect to slave server");
break;
case TvResult.NotTheOwner:
MessageBox.Show(this, "Failed since card is in use and we are not the owner");
break;
case TvResult.GraphBuildingFailed:
MessageBox.Show(this, "Unable to create graph");
break;
case TvResult.SWEncoderMissing:
MessageBox.Show(this, "No suppported software encoder installed");
break;
case TvResult.NoFreeDiskSpace:
MessageBox.Show(this, "No free disk space");
break;
}
}
else
{
mpButtonRec.Enabled = true;
}
}
}
示例8: UpdateCurrentChannel
/// <summary>
/// Ensures that the navigator has the correct current channel (retrieved from the Recorder).
/// </summary>
public void UpdateCurrentChannel()
{
Channel newChannel = null;
//if current card is watching tv then use that channel
int id;
if (TVHome.Connected)
{
if (TVHome.Card.IsTimeShifting || TVHome.Card.IsRecording)
{
id = TVHome.Card.IdChannel;
if (id >= 0)
{
newChannel = Channel.Retrieve(id);
}
}
else
{
// else if any card is recording
// then get & use that channel
if (TVHome.IsAnyCardRecording)
{
TvServer server = new TvServer();
for (int i = 0; i < server.Count; ++i)
{
User user = new User();
VirtualCard card = server.CardByIndex(user, i);
if (card.IsRecording)
{
id = card.IdChannel;
if (id >= 0)
{
newChannel = Channel.Retrieve(id);
break;
}
}
}
}
}
if (newChannel == null)
{
newChannel = m_currentChannel;
}
int currentChannelId = 0;
int newChannelId = 0;
if (m_currentChannel != null)
{
currentChannelId = m_currentChannel.IdChannel;
}
if (newChannel != null)
{
newChannelId = newChannel.IdChannel;
}
if (currentChannelId != newChannelId)
{
m_currentChannel = newChannel;
m_currentChannel.CurrentGroup = CurrentGroup;
}
}
}
示例9: GetRecordingURL
public string GetRecordingURL(int idRecording)
{
if (!ConnectToDatabase())
return "";
TvControl.TvServer server = new TvControl.TvServer();
return server.GetStreamUrlForFileName(idRecording);
}
示例10: GetActiveStreams
public List<WebActiveStream> GetActiveStreams()
{
IList<Card> cards = Card.ListAll();
List<Channel> channels = new List<Channel>();
TvControl.TvServer server = new TvControl.TvServer();
List<User> _users = new List<User>();
List<WebActiveStream> activestream = new List<WebActiveStream>();
if(!ConnectToDatabase())
return activestream;
foreach (Card card in cards)
{
if (card.Enabled == false)
continue;
if (!RemoteControl.Instance.CardPresent(card.IdCard))
continue;
User[] users = RemoteControl.Instance.GetUsersForCard(card.IdCard);
if (users == null)
return activestream;
for (int i = 0; i < users.Length; ++i)
{
User user = users[i];
if (card.IdCard != user.CardId)
continue;
bool isRecording;
bool isTimeShifting;
VirtualCard tvcard = new VirtualCard(user, RemoteControl.HostName);
isRecording = tvcard.IsRecording;
isTimeShifting = tvcard.IsTimeShifting;
if (isTimeShifting || (isRecording && !isTimeShifting))
{
int idChannel = tvcard.IdChannel;
try
{
WebChannel channel = new WebChannel(Channel.Retrieve(idChannel));
WebTvServerUser tvServerUser = new WebTvServerUser(tvcard.User);
WebActiveStream stream = new WebActiveStream(tvServerUser, channel);
activestream.Add(stream);
}
catch (Exception ex)
{
// FIXME: handle it
}
}
}
}
return activestream;
}
示例11: ShowPrograms
private void ShowPrograms()
{
if (lblOnTvNow != null)
{
lblOnTvNow.EnableUpDown = false;
lblOnTvNow.Clear();
}
if (lblOnTvNext != null)
{
lblOnTvNext.EnableUpDown = false;
lblOnTvNext.Clear();
}
// Set recorder status
if (imgRecIcon != null)
{
VirtualCard card;
TvServer server = new TvServer();
imgRecIcon.IsVisible = server.IsRecording(idChannel, out card);
}
if (lblZapToCannelNo != null)
{
lblZapToCannelNo.Label = channelNr;
lblZapToCannelNo.Visible = !string.IsNullOrEmpty(channelNr);
}
if (LastError != null)
{
lblStartTime.Label = "";
lblEndTime.Label = "";
if (LastError.FailingChannel != null)
{
lblCurrentChannel.Label = LastError.FailingChannel.DisplayName;
}
if (LastError.Messages.Count > 0)
{
lblOnTvNow.Label = LastError.Messages[0]; // first line in "NOW"
if (LastError.Messages.Count > 1)
{
lblOnTvNext.Label = String.Join(", ", LastError.Messages.ToArray(), 1, LastError.Messages.Count - 1);
// 2nd and later in "NEXT"
}
}
m_lastError = null; // reset member only, not the failing channel info in Navigator
}
else
{
if (lblCurrentChannel != null)
{
lblCurrentChannel.Label = channelName;
}
Channel chan = TVHome.Navigator.GetChannel(idChannel, true);
Program prog = chan.GetProgramAt(m_dateTime);
if (prog != null)
{
string strTime = String.Format("{0}-{1}",
prog.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
prog.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
if (lblCurrentTime != null)
{
lblCurrentTime.Label = strTime;
}
if (lblOnTvNow != null)
{
lblOnTvNow.Label = prog.Title;
}
if (lblStartTime != null)
{
strTime = String.Format("{0}", prog.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
lblStartTime.Label = strTime;
}
if (lblEndTime != null)
{
strTime = String.Format("{0} ", prog.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
lblEndTime.Label = strTime;
}
// next program
prog = chan.GetProgramAt(prog.EndTime.AddMinutes(1));
//prog = TVHome.Navigator.GetChannel(channelName).GetProgramAt(prog.EndTime.AddMinutes(1));
if (prog != null)
{
if (lblOnTvNext != null)
{
lblOnTvNext.Label = prog.Title;
}
}
}
else
{
lblOnTvNow.Label = GUILocalizeStrings.Get(736); // no epg for this channel
if (lblStartTime != null)
{
lblStartTime.Label = String.Empty;
}
if (lblEndTime != null)
{
//.........这里部分代码省略.........
示例12: 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();
}
示例13: OnActiveStreams
private void OnActiveStreams()
{
GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
if (dlg == null)
{
return;
}
dlg.Reset();
dlg.SetHeading(692); // Active Tv Streams
int selected = 0;
string remoteHostName = string.Empty;
IList<Card> cards = TvDatabase.Card.ListAll();
List<Channel> channels = new List<Channel>();
int count = 0;
TvServer server = new TvServer();
List<IUser> _users = new List<IUser>();
foreach (Card card in cards)
{
if (card.Enabled == false)
{
continue;
}
if (!RemoteControl.Instance.CardPresent(card.IdCard))
{
continue;
}
IUser[] users = RemoteControl.Instance.GetUsersForCard(card.IdCard);
if (users == null)
{
return;
}
for (int i = 0; i < users.Length; ++i)
{
IUser user = users[i];
Log.Debug("rtsp url: {0}, {1}", user, RemoteControl.Instance.GetStreamingUrl(user));
if (card.IdCard != user.CardId)
{
continue;
}
bool isRecording;
bool isTimeShifting;
VirtualCard tvcard = new VirtualCard(user, RemoteControl.HostName);
isRecording = tvcard.IsRecording;
isTimeShifting = tvcard.IsTimeShifting;
if (isTimeShifting || (isRecording && !isTimeShifting))
{
int idChannel = tvcard.IdChannel;
user = tvcard.User;
Channel ch = Channel.Retrieve(idChannel);
channels.Add(ch);
GUIListItem item = new GUIListItem();
item.Label = ch.DisplayName;
item.Label2 = user.Name;
string strLogo = Utils.GetCoverArt(Thumbs.TVChannel, ch.DisplayName);
if (string.IsNullOrEmpty(strLogo))
{
strLogo = "defaultVideoBig.png";
}
item.IconImage = strLogo;
if (isRecording)
{
item.PinImage = Thumbs.TvRecordingIcon;
}
else
{
item.PinImage = "";
}
dlg.Add(item);
_users.Add(user);
if (Card != null && Card.IdChannel == idChannel)
{
selected = count;
}
count++;
}
}
}
if (channels.Count == 0)
{
GUIDialogOK pDlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
if (pDlgOK != null)
{
pDlgOK.SetHeading(692); //my tv
pDlgOK.SetLine(1, GUILocalizeStrings.Get(1511)); // No Active streams
pDlgOK.SetLine(2, "");
pDlgOK.DoModal(this.GetID);
}
return;
}
dlg.SelectedLabel = selected;
dlg.DoModal(this.GetID);
if (dlg.SelectedLabel < 0)
{
return;
}
string selectedUrl = RemoteControl.Instance.GetStreamingUrl(_users[dlg.SelectedLabel]);
//.........这里部分代码省略.........
示例14: OnClick
private void OnClick(int iItem)
{
m_iSelectedItem = GetSelectedItemNo();
GUIListItem item = GetItem(iItem);
if (item == null)
{
return;
}
if (item.IsFolder)
{
if (item.Label == "..")
{
if (selectedItem != null)
{
selectedItem = null;
}
LoadDirectory();
return;
}
if (selectedItem == null)
{
selectedItem = item;
}
LoadDirectory();
return;
}
Schedule schedule = item.TVTag as Schedule;
if (schedule == null)
{
return;
}
if (schedule.ScheduleType == (int)ScheduleRecordingType.Once)
{
GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO);
if (null != dlgYesNo)
{
dlgYesNo.SetHeading(GUILocalizeStrings.Get(653)); //Delete this recording?
dlgYesNo.SetLine(1, schedule.ReferencedChannel().DisplayName);
dlgYesNo.SetLine(2, schedule.ProgramName);
dlgYesNo.SetLine(3, GUILocalizeStrings.Get(732)); //are you sure
dlgYesNo.DoModal(GUIWindowManager.ActiveWindow);
if (dlgYesNo.IsConfirmed)
{
if (schedule.ScheduleType == (int)ScheduleRecordingType.Once)
{
schedule.Delete();
selectedItem = null;
}
}
}
}
else // advanced recording
{
GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
if (dlg != null)
{
dlg.Reset();
dlg.SetHeading(schedule.ProgramName);
dlg.AddLocalizedString(981); //Delete this recording
dlg.AddLocalizedString(982); //Delete series recording
dlg.DoModal(GetID);
if (dlg.SelectedLabel == -1)
{
return;
}
switch (dlg.SelectedId)
{
case 981: //delete specific series
CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, schedule.IdChannel, schedule.StartTime);
canceledSchedule.Persist();
selectedItem = null;
TvServer server = new TvServer();
server.OnNewSchedule();
break;
case 982: //Delete entire recording
schedule.Delete();
selectedItem = null;
break;
}
}
}
LoadDirectory();
}
示例15: OnSetQuality
//.........这里部分代码省略.........
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;
}
switch (dlg.SelectedLabel)
{
case 0: // Not Set
_newQuality = QualityType.NotSet;
break;
case 1: // Default
_newQuality = QualityType.Default;
break;
case 2: // Custom
_newQuality = QualityType.Custom;
break;
case 3: // Protable
_newQuality = QualityType.Portable;
break;
case 4: // Low
_newQuality = QualityType.Low;
break;
case 5: // Medium
_newQuality = QualityType.Medium;
break;
case 6: // High
_newQuality = QualityType.High;
break;
}
rec.QualityType = _newQuality;
rec.Persist();
}
TvServer server = new TvServer();
server.OnNewSchedule();
}