private void DoShowProperties() { lvi = new List <object>(); foreach (string item in strItems) { VideoFileInfo vi = VideoFileInfo.FromPath(item) as VideoFileInfo; if (vi.IsValid) { lvi.Add(vi); } } FileAttributesBrowser.ProcessObjectAttributes(lvi); pgProperties.SelectedObjects = lvi.ToArray(); btnSearchSubtitles.Enabled = false; if (lvi.Count == 1) { VideoFileInfo vfi = lvi[0] as VideoFileInfo; if (vfi != null) { btnSearchSubtitles.Enabled = SubtitleDownloadProcessor.CanPerformSubtitleDownload(vfi.Path, (int)vfi.Duration.GetValueOrDefault().TotalSeconds); } } }
private void TryFindSubtitle(string strFile, int duration) { // If strFile indicates only a disk root, the movie is actually a DVD // We don't want to look up on Internet for DVD subtitles. Usually DVD's // come with their builtin subtitles. if (PathUtils.IsRootPath(strFile)) { return; } if (SubtitleDownloadProcessor.TestForExistingSubtitle(strFile)) { if (MessageDisplay.Query(Translator.Translate("TXT_OVERWRITE_SUBTITLE"), Translator.Translate("TXT_QUESTION"), MessageBoxIcon.Information) != DialogResult.Yes) { return; } } if (SubtitleDownloadProcessor.CanPerformSubtitleDownload(strFile, duration)) { // We should display a subtitle but we don't have one. // Try to grab one from internet. ThreadPool.QueueUserWorkItem( new WaitCallback(SubtitleDownloadProcessor.AttemptDownload), strFile); } }
private bool EnableSubtitleEntry(PlaylistItem plItem) { return (plItem != null && plItem.IsVideo && SubtitleDownloadProcessor.CanPerformSubtitleDownload(plItem.Path, (int)plItem.Duration.TotalSeconds)); }
void _delayedSubtitleLookupTimer_Tick(object sender, EventArgs e) { try { SubtitleDownloadProcessor.TryFindSubtitle(MediaRenderer.DefaultInstance.GetRenderFile(), (int)MediaRenderer.DefaultInstance.MediaLength, false); } catch { } finally { _delayedSubtitleLookupTimer.Stop(); } }
public void OnExecuteShortcut(OPMShortcutEventArgs args) { if (args.Handled) { return; } Logger.LogInfo("OnExecuteShortcut enter: " + args); if (_renderingFrame == null || !_renderingFrame.Visible) { pnlScreens.Focus(); } switch (args.cmd) { case OPMShortcut.CmdPlayPause: if (MediaRenderer.DefaultInstance.FilterState == FilterState.Paused || MediaRenderer.DefaultInstance.FilterState == FilterState.Running) { Pause(); args.Handled = true; } else { Play(); args.Handled = true; } break; case OPMShortcut.CmdStop: Stop(true); args.Handled = true; break; case OPMShortcut.CmdPrev: MovePrevious(); args.Handled = true; break; case OPMShortcut.CmdNext: MoveNext(); args.Handled = true; break; case OPMShortcut.CmdLoad: LoadFiles(); args.Handled = true; break; case OPMShortcut.CmdFwd: MoveToPosition(pnlRendering.ElapsedSeconds + 5); args.Handled = true; break; case OPMShortcut.CmdRew: MoveToPosition(pnlRendering.ElapsedSeconds - 5); args.Handled = true; break; case OPMShortcut.CmdVolUp: pnlRendering.ProjectedVolume += 500; SetVolume(pnlRendering.ProjectedVolume); args.Handled = true; break; case OPMShortcut.CmdVolDn: pnlRendering.ProjectedVolume -= 500; SetVolume(pnlRendering.ProjectedVolume); args.Handled = true; break; case OPMShortcut.CmdFullScreen: ToggleFullScreen(); args.Handled = true; break; case OPMShortcut.CmdOpenDisk: LoadDisc(); args.Handled = true; break; case OPMShortcut.CmdCfgAudio: FfdShowConfig.DoConfigureAudio(this.Handle); args.Handled = true; break; case OPMShortcut.CmdCfgVideo: FfdShowConfig.DoConfigureVideo(this.Handle); args.Handled = true; break; case OPMShortcut.CmdCfgSubtitles: ProTONESettingsForm.Show("TXT_S_SUBTITLESETTINGS", "TXT_S_SUBTITLESETTINGS"); args.Handled = true; break; case OPMShortcut.CmdCfgTimer: ProTONESettingsForm.Show("TXT_S_MISC_SETTINGS", "TXT_S_SCHEDULERSETTINGS"); args.Handled = true; break; case OPMShortcut.CmdCfgRemote: ProTONESettingsForm.Show("TXT_S_CONTROL", "TXT_REMOTECONTROLCFG"); args.Handled = true; break; case OPMShortcut.CmdOpenSettings: DialogResult dlgResult = ProTONESettingsForm.Show(); args.Handled = true; break; case OPMShortcut.CmdCfgKeyboard: ProTONESettingsForm.Show("TXT_S_CONTROL", "TXT_S_KEYMAP"); args.Handled = true; break; case OPMShortcut.CmdOpenURL: { args.Handled = true; //StreamingServerChooserDlg dlg2 = new StreamingServerChooserDlg(); //dlg2.Show(); if (_onlineContentBrowser == null) { _onlineContentBrowser = new OnlineContentBrowser(); _onlineContentBrowser.FormClosing += new FormClosingEventHandler(_onlineContentBrowser_FormClosing); _onlineContentBrowser.FormClosed += _onlineContentBrowser_FormClosed; _onlineContentBrowser.Shown += new EventHandler(_onlineContentBrowser_Shown); } _onlineContentBrowser.Show(); /* * if (dlg2.ShowDialog() == DialogResult.OK) * { * string textUrl = dlg2.Uri; * string radioStationUrl = dlg2.RadioStation != null ? dlg2.RadioStation.Url : string.Empty; * * if (string.Compare(textUrl, radioStationUrl, true) != 0) * { * // Load the specified url (manually entered by the user) * string[] urls = new string[] { textUrl }; * LoadFiles(urls); * } * else if (dlg2.RadioStation != null) * { * LoadRadioStation(dlg2.RadioStation); * } * }*/ } break; case OPMShortcut.CmdSearchSubtitles: { args.Handled = true; PlaylistItem plItem = pnlScreens.PlaylistScreen.GetPlaylistItemForEditing(); if (plItem != null && plItem.MediaFileInfo is VideoFileInfo) { SubtitleDownloadProcessor.TryFindSubtitle(plItem.Path, (int)plItem.Duration.TotalSeconds, true); } } break; default: pnlScreens.OnExecuteShortcut(args); break; } Logger.LogInfo("OnExecuteShortcut leave"); }
private bool UpdateMiscIcon(ListViewItem lvi) { PlaylistItem plItem = lvi.Tag as PlaylistItem; Image imgMisc = null; string txtMisc = string.Empty; bool retVal = false; if (plItem != null) { string renderFile = MediaRenderer.DefaultInstance.GetRenderFile(); bool isActiveItem = string.Compare(renderFile, plItem.Path, true) == 0; if (plItem.IsVideo) { if (SubtitleDownloadProcessor.IsFileOnDownloadList(plItem.Path)) { // Currently downloading a subtitle Bitmap bmp = OPMedia.UI.Properties.Resources.hourglass; bmp.MakeTransparent(ThemeManager.TransparentColor); imgMisc = ImageProvider.ScaleImage(bmp, new Size(16, 16), true); txtMisc = Translator.Translate("TXT_SUBTITLE_DOWNLOADING"); } else if (SubtitleDownloadProcessor.TestForExistingSubtitle(plItem.Path)) { // Already having a subtitle imgMisc = ImageProcessing.Subtitle16; txtMisc = Translator.Translate("TXT_SUBTITLE_AVAILABLE"); } } else if (isActiveItem) { Image img = null; switch (MediaRenderer.DefaultInstance.FilterState) { case FilterState.Running: img = Resources.btnPlay; break; case FilterState.Paused: img = Resources.btnPause; break; default: img = null; break; } imgMisc = img.Resize(false); } else { imgMisc = null; } if (isActiveItem) { _prevActiveItem = plItem.Path; retVal = string.Compare(_prevActiveItem, plItem.Path, true) == 0; } } lvi.SubItems[colMisc.Index].Tag = new ExtendedSubItemDetail(imgMisc, txtMisc); return(retVal); }