public void DialogInfo(string title, string msg) { AnimePluginSettings settings = new AnimePluginSettings(); if (!settings.FfdshowNotificationsShow) { return; } GUIDialogNotify dlgInfo = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (null == dlgInfo) { return; } dlgInfo.Reset(); //dlgInfo.Focusable = false; if (settings.FfdshowNotificationsAutoClose) { dlgInfo.TimeOut = (settings.FfdshowNotificationsAutoCloseTime / 1000); } dlgInfo.SetHeading(title); dlgInfo.SetText(msg); dlgInfo.DoModal(GUIWindowManager.ActiveWindow); }
private void OnEditName() { string name = _name; GetStringFromKeyboard(ref name, -1); foreach (GUIListItem item in lcRefreshRatesList.ListItems) { if (item.Label.Equals(name, StringComparison.InvariantCultureIgnoreCase) || string.IsNullOrEmpty(name)) { GUIDialogNotify dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (null != dlgNotify) { dlgNotify.SetHeading(GUILocalizeStrings.Get(257)); dlgNotify.SetText(GUILocalizeStrings.Get(300013)); dlgNotify.DoModal(GetID); OnEditItem(); return; } } } _name = name; OnEditItem(); }
public void RSSDownload(RSSItem item) { GUIDialogYesNo dlg = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); dlg.SetHeading("Download this torrent?"); dlg.SetLine(1, item.Title); dlg.DoModal(GUIWindowManager.ActiveWindow); if (!dlg.IsConfirmed) { return; } TorrentLabel label = DialogAskLabel.Ask(); if (label != null) { bool ok = TorrentEngine.Instance().StartDownloading(item.Link, label.Name, true, "", "0", "", ""); if (!ok) { GUIDialogNotify notify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); notify.Reset(); notify.SetHeading("Failed!"); notify.SetText("Unable to start download."); notify.DoModal(GUIWindowManager.ActiveWindow); } } }
public void DisplayError(string ErrorHeading, string ErrorMessage) { GUIDialogNotify notify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); notify.Reset(); notify.SetHeading(ErrorHeading); notify.SetText(ErrorMessage); notify.DoModal(GUIWindowManager.ActiveWindow); }
private void ShowNotify(string strHeading, string description, string imgFileName) { GUIDialogNotify dlgYesNo = (GUIDialogNotify)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_NOTIFY); dlgYesNo.SetHeading(strHeading); dlgYesNo.SetText(description); dlgYesNo.SetImage(imgFileName); dlgYesNo.DoModal(GUIWindowManager.ActiveWindow); }
void _torrentSession_TorrentAdded(Torrent torrent) { Log.Instance().Print(String.Format("Torrent [{0}] added.", torrent.Name)); GUIDialogNotify notify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); notify.Reset(); notify.SetHeading("New torrent added!"); notify.SetText(torrent.Name); notify.DoModal(GUIWindowManager.ActiveWindow); }
/// <summary> /// Thread, which runs the reorg in background /// </summary> public void ReorgAsync() { m_dbs.MusicDatabaseReorg(null); GUIDialogNotify dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (null != dlgNotify) { dlgNotify.SetHeading(GUILocalizeStrings.Get(313)); dlgNotify.SetText(GUILocalizeStrings.Get(317)); dlgNotify.DoModal(_parentWindowID); } }
void showDialog(string message) { GUIDialogNotify dlg = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (dlg != null) { dlg.Reset(); dlg.SetImage(pluginIconPath); dlg.SetHeading("Airplay Error"); dlg.SetText(message); dlg.DoModal(GUIWindowManager.ActiveWindow); } }
public void ShowNotifyDialog(int timeOut, string header, string icon, string text, Helper.PLUGIN_NOTIFY_WINDOWS notifyType) { try { GUIWindow guiWindow = GUIWindowManager.GetWindow((int)notifyType); switch (notifyType) { default: case Helper.PLUGIN_NOTIFY_WINDOWS.WINDOW_DIALOG_AUTO: if (text.Length <= 60) { ShowNotifyDialog(timeOut, header, icon, text, Helper.PLUGIN_NOTIFY_WINDOWS.WINDOW_DIALOG_NOTIFY); } else { ShowNotifyDialog(timeOut, header, icon, text, Helper.PLUGIN_NOTIFY_WINDOWS.WINDOW_DIALOG_TEXT); } break; case Helper.PLUGIN_NOTIFY_WINDOWS.WINDOW_DIALOG_NOTIFY: GUIDialogNotify notifyDialog = (GUIDialogNotify)guiWindow; notifyDialog.Reset(); notifyDialog.TimeOut = timeOut; notifyDialog.SetImage(icon); notifyDialog.SetHeading(header); notifyDialog.SetText(text); notifyDialog.DoModal(GUIWindowManager.ActiveWindow); break; case Helper.PLUGIN_NOTIFY_WINDOWS.WINDOW_DIALOG_OK: GUIDialogOK okDialog = (GUIDialogOK)guiWindow; okDialog.Reset(); okDialog.SetHeading(header); okDialog.SetLine(1, (text.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries))[0]); okDialog.DoModal(GUIWindowManager.ActiveWindow); break; case Helper.PLUGIN_NOTIFY_WINDOWS.WINDOW_DIALOG_TEXT: GUIDialogText textDialog = (GUIDialogText)guiWindow; textDialog.Reset(); try { textDialog.SetImage(icon); } catch (Exception e) { Debug.WriteLine(e.ToString()); } textDialog.SetHeading(header); textDialog.SetText(text); textDialog.DoModal(GUIWindowManager.ActiveWindow); break; } } catch (Exception ex) { Log.Error(ex); } }
public void FolderClickMenu(GUIListItem fldr, GUIListItem _selectedtorrent, TorrentLabel label) { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading("Folder Options"); dlg.Add("Set as download location"); //dlg.Add("Add to favourite places"); dlg.DoModal(GUIWindowManager.ActiveWindow); switch (dlg.SelectedLabelText) { case "Set as download location": { MyTorrents.Instance().HideFolderBrowser(); if (MyTorrents.ListType == "SeriesInfo") { SeriesItem item = _selectedtorrent.AlbumInfoTag as SeriesItem; MyTorrents.Instance()._torrentWatchlist.GetSeriesList().Where(e => e.show.ID == item.show.ID).First().folder = fldr.Path + @"\" + fldr.Label; GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.Folder", fldr.Path + @"\" + fldr.Label); } else { DefaultDir = TorrentEngine.Instance().TorrentSession.GetSettings("dir_active_download"); string response = TorrentEngine.Instance().TorrentSession.GetResponse(string.Format("?action=setsetting&s=dir_active_download&v={0}", fldr.Path + @"\" + fldr.Label)); string response2 = TorrentEngine.Instance().TorrentSession.GetResponse("?action=setsetting&s=dir_active_download_flag&v=1"); TorrentSearch.TorrentMatch match = _selectedtorrent.AlbumInfoTag as TorrentSearch.TorrentMatch; bool ok = TorrentEngine.Instance().StartDownloading(match.Url, label.Name, true, match.cookie, match.Id, _downloadoption, ""); if (!ok) { GUIDialogNotify notify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); notify.Reset(); notify.SetHeading("Failed!"); notify.SetText("Unable to start download."); notify.DoModal(GUIWindowManager.ActiveWindow); } string revert = TorrentEngine.Instance().TorrentSession.GetResponse(string.Format("?action=setsetting&s=dir_active_download&v={0}", DefaultDir)); } break; } } }
/// <summary> /// Displays a notification dialog. /// </summary> public static void ShowNotifyDialog(string heading, string text, string image, string buttonText, int timeout) { if (GUIGraphicsContext.form.InvokeRequired) { ShowNotifyDialogDelegate d = ShowNotifyDialog; GUIGraphicsContext.form.Invoke(d, heading, text, image, buttonText, timeout); return; } GUIDialogNotify pDlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (pDlgNotify == null) { return; } try { pDlgNotify.Reset(); pDlgNotify.SetHeading(heading); pDlgNotify.SetImage(image); pDlgNotify.SetText(text); if (timeout >= 0) { pDlgNotify.TimeOut = timeout; } foreach (GUIControl item in pDlgNotify.Children) { if (item is GUIButtonControl) { GUIButtonControl btn = (GUIButtonControl)item; if (btn.GetID == 4 && !string.IsNullOrEmpty(buttonText) && !string.IsNullOrEmpty(btn.Label)) { // Only if ID is 4 and we have our custom text and if button already has label (in case the skin "hides" the button by emptying the label) btn.Label = buttonText; } } } pDlgNotify.DoModal(GUIWindowManager.ActiveWindow); } finally { if (pDlgNotify != null) { pDlgNotify.ClearAll(); } } }
/// <summary> /// Changes the aspect ratio of MediaPortal /// </summary> /// <param name="MessageString">Message text of the switch message</param> /// <param name="AR">the aspect ratio to switch to</param> private void SetAspectRatio(string MessageString, Geometry.Type AR) { Log.Info("ViewModeSwitcher: Switching to viewmode: " + AR); GUIGraphicsContext.ARType = AR; if (currentSettings.ShowSwitchMsg) { GUIDialogNotify SwitchMsg = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); SwitchMsg.SetHeading("ViewModeSwitcher"); SwitchMsg.SetText(MessageString + " > " + AR); SwitchMsg.TimeOut = 2; SwitchMsg.DoModal(GUIWindowManager.ActiveWindow); } }
public override bool OnMessage(GUIMessage message) { switch (message.Message) { case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT: { GUIWindowManager.OnResize(); GUIWindowManager.PreInit(); GUIGraphicsContext.Save(); if (m_orgZoomVertical != GUIGraphicsContext.ZoomVertical) // only vertical zoom affects font sizes { GUIDialogNotify dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (dlgNotify != null) { dlgNotify.Reset(); dlgNotify.ClearAll(); dlgNotify.SetHeading(213); // UI Calibration dlgNotify.SetText(GUILocalizeStrings.Get(2650)); // Reloading fonts, please wait... dlgNotify.TimeOut = 1; dlgNotify.DoModal(GUIWindowManager.ActiveWindow); } GUIFontManager.LoadFonts(Config.GetFile(Config.Dir.Skin, GUIGraphicsContext.Skin, "fonts.xml")); GUIFontManager.InitializeDeviceObjects(); } } break; case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT: { base.OnMessage(message); m_iSpeed = 1; m_iCountU = 0; m_iCountD = 0; m_iCountL = 0; m_iCountR = 0; m_iMode = 0; m_bModeLocked = true; m_orgZoomVertical = GUIGraphicsContext.ZoomVertical; m_iLogWidth = (int)Math.Round((float)GUIGraphicsContext.Width * (float)GUIGraphicsContext.ZoomHorizontal); m_iLogHeight = (int)Math.Round((float)GUIGraphicsContext.Height * (float)GUIGraphicsContext.ZoomVertical); ClampLogicalScreenSize(); UpdateControlLabel(); return(true); } } return(base.OnMessage(message)); }
/// <summary> /// Pop up a dialog in MediaPortal. /// </summary> /// <param name="heading">Dialog heading text.</param> /// <param name="text">Dialog body text.</param> /// <param name="timeout">Dialog timeout in seconds, zero for no timeout.</param> public static void ShowNotifyDialog(string heading, string text, int timeout) { GUIDialogNotify dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (dlgNotify == null) { throw new ApplicationException("Failed to create GUIDialogNotify"); } dlgNotify.Reset(); dlgNotify.ClearAll(); dlgNotify.SetHeading(heading); dlgNotify.SetText(text); dlgNotify.TimeOut = timeout; dlgNotify.DoModal(GUIWindowManager.ActiveWindow); }
/// <summary> /// Pop up a dialog in MediaPortal. /// </summary> /// <param name="heading">Dialog heading text.</param> /// <param name="text">Dialog body text.</param> /// <param name="timeout">Dialog timeout in seconds, zero for no timeout.</param> public static void ShowNotifyDialog(string heading, string text, int timeout) { GUIDialogNotify dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (dlgNotify == null) { throw new InvalidOperationException("Failed to create GUIDialogNotify"); } dlgNotify.Reset(); dlgNotify.ClearAll(); dlgNotify.SetHeading(heading); dlgNotify.SetText(text); dlgNotify.TimeOut = timeout; dlgNotify.DoModal(GUIWindowManager.ActiveWindow); // TODO: Put this on a separate thread to allow caller to continue? }
/// <summary> /// Execute this command. /// </summary> /// <param name="variables">The variable list of the calling code.</param> public override void Execute(VariableList variables) { GUIDialogNotify dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (dlgNotify == null) { throw new CommandExecutionException("Failed to create GUIDialogNotify"); } string[] processed = ProcessParameters(variables, Parameters); int timeout = int.Parse(processed[2]); dlgNotify.Reset(); dlgNotify.ClearAll(); dlgNotify.SetHeading(processed[0]); dlgNotify.SetText(processed[1]); dlgNotify.TimeOut = timeout; dlgNotify.DoModal(GUIWindowManager.ActiveWindow); }
private void ShowErrorDialog(string message, bool waitForOK) { if (waitForOK) { GUIDialogOK dlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); if (dlgOK != null) { dlgOK.SetHeading("Error" /* or Message */); dlgOK.SetLine(1, message); dlgOK.SetLine(2, ""); dlgOK.DoModal(PLUGIN_ID); } } else { GUIDialogNotify dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (dlgNotify != null) { dlgNotify.SetHeading("Error"); dlgNotify.SetText(message); dlgNotify.DoModal(PLUGIN_ID); } } }
void VideoDownloader_DownloadComplete(object sender, EventArgs e) { GUIDialogNotify dlg1 = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (dlg1 != null) { dlg1.Reset(); dlg1.SetHeading("Download done"); dlg1.SetText(VideoDownloader.DownloadingTo); dlg1.Reset(); dlg1.TimeOut = 5; dlg1.DoModal(GetID); } Youtube2MP._settings.LocalFile.Items.Add(new LocalFileStruct(VideoDownloader.DownloadingTo, VideoDownloader.Entry.VideoId, VideoDownloader.Entry.Title.Text)); Youtube2MP._settings.LocalFile.Save(); string imageFile = GetLocalImageFileName(GetBestUrl(VideoDownloader.Entry.Media.Thumbnails)); try { if (File.Exists(imageFile)) { File.Copy(imageFile, Path.GetDirectoryName(VideoDownloader.DownloadingTo) + "\\" + Path.GetFileNameWithoutExtension(VideoDownloader.DownloadingTo) + ".png"); } } catch { } if (dlgProgress != null) { dlgProgress.SetPercentage(100); dlgProgress.Progress(); dlgProgress.ShowProgressBar(true); dlgProgress.Close(); dlgProgress = null; } }
private void FolderScanThread() { _scanRunning = true; ArrayList shares = new ArrayList(); ArrayList scanShares = new ArrayList(); foreach (GUIListItem item in lcFolders.ListItems) { if (item.IsPlayed) { scanShares.Add(item); } } for (int index = 0; index < _scanShare; index++) { GUIListItem item = (GUIListItem)scanShares[index]; string path = item.Path; if (Directory.Exists(path)) { try { string driveName = path.Substring(0, 1); if (path.StartsWith(@"\\")) { // we have the path in unc notation driveName = path; } ulong freeBytesAvailable = Util.Utils.GetFreeDiskSpace(driveName); if (freeBytesAvailable > 0) { ulong diskSpace = freeBytesAvailable / 1048576; if (diskSpace > 100) // > 100MB left for creation of thumbs, etc { Log.Info("MusicDatabase: adding share {0} for scanning - available disk space: {1} MB", path, diskSpace.ToString()); shares.Add(path); } else { Log.Warn("MusicDatabase: NOT scanning share {0} because of low disk space: {1} MB", path, diskSpace.ToString()); } } } catch (Exception) { // Drive not ready, etc } } } MusicDatabase.DatabaseReorgChanged += new MusicDBReorgEventHandler(SetStatus); EnableControls(false); // Now create a Settings Object with the Settings checked to pass to the Import MusicDatabaseSettings setting = new MusicDatabaseSettings(); setting.CreateMissingFolderThumb = btnCreateMissingFolderThumbs.Selected; setting.ExtractEmbeddedCoverArt = btnExtractthumbs.Selected; setting.StripArtistPrefixes = btnStripartistprefixes.Selected; setting.TreatFolderAsAlbum = btnTreatFolderAsAlbum.Selected; setting.UseFolderThumbs = btnUseFolderThumbs.Selected; setting.UseAllImages = btnUseAllImages.Selected; setting.CreateArtistPreviews = btnCreateartistthumbs.Selected; setting.CreateGenrePreviews = btnCreategenrethumbs.Selected; setting.UseLastImportDate = btnUpdateSinceLastImport.Selected; setting.ExcludeHiddenFiles = false; setting.DateAddedValue = _dateAddedSelectedIndex; try { m_dbs.MusicDatabaseReorg(shares, setting); } catch (Exception ex) { Log.Error("Folder Scan: Exception during processing: ", ex.Message); _scanRunning = false; } using (Profile.Settings xmlreader = new Profile.MPSettings()) { _updateSinceLastImport = String.Format("Only update files after {0}", xmlreader.GetValueAsString("musicfiles", "lastImport", "1900-01-01 00:00:00")); } _scanRunning = false; EnableControls(true); SetProperties(); GUIDialogNotify dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (null != dlgNotify) { dlgNotify.SetHeading(GUILocalizeStrings.Get(1020)); // Information dlgNotify.SetText(GUILocalizeStrings.Get(300024)); // Scan finished dlgNotify.DoModal(GetID); } }
public bool Scrobble(string filename) { StopScrobble(); istStoppingScrobble = false; if (!g_Player.IsTV) { return(false); } EbasicHandler.setCurrentProgram(GetCurrentProgram()); if (EbasicHandler.getCurrentProgram() == null) { return(false); } EbasicHandler.SetCurrentProgramIsScrobbling(true); TVJustTurnedOn = true; if (EbasicHandler.getCurrentProgramType() == VideoType.Series) { TraktLogger.Info("Detected tv show playing on Live TV. Title = '{0}'", EbasicHandler.getCurrentProgram().Title.ToString()); } else { TraktLogger.Info("Detected movie playing on Live TV. Title = '{0}'", EbasicHandler.getCurrentProgram().Title.ToString()); } #region Scrobble Timer TraktTimer = new Timer(new TimerCallback((stateInfo) => { Thread.CurrentThread.Name = "Scrobble"; // get the current program airing on tv now // this may have changed since last status update on trakt EVideoInfo videoInfo = GetCurrentProgram(); //Reinit all variables item = new TraktEPGCacheRecord(); response = new TraktScrobbleResponse(); // I have problems with GUI rendering most of the times. If i set the thread to sleep it really helps with GUI rendering. // This might also work well to handle zapping correctly. Thread.Sleep((TraktSettings.ETVScrobbleDelay) * 1000); try { if (videoInfo != null) { // if we are watching something different, // check if we should mark previous as watched //if (!videoInfo.Equals(CurrentProgram)) if (!videoInfo.Equals(EbasicHandler.getCurrentProgram())) { TraktLogger.Info("Detected new tv program has started. Previous Program = '{0}', New Program = '{1}'", EbasicHandler.getCurrentProgram().ToString(), videoInfo.ToString()); //The new program has changed. I should check if the active window is GUIShowSelect and eventually close it. if (GUIWindowManager.ActiveWindow.Equals((int)TraktGUIWindows.EPGShowSelect)) { GUIShowSelectGUI.exitGUI(); } if (IsProgramWatched(EbasicHandler.getCurrentProgram()) && EbasicHandler.IsCurrentProgramScrobbling()) { TraktLogger.Info("Playback of program on Live TV is considered watched. Title = '{0}'", EbasicHandler.getCurrentProgram().ToString()); BasicHandler.StopScrobble(EbasicHandler.getCurrentProgram(), true); } //The programs are different so we should start the whole scrobbling process. //For that we set the new videoInfo scrobbling status to true //later we're checking if videoInfo is scrobbling, and it should be false if we don't set it true here. videoInfo.IsScrobbling = true; //EbasicHandler.SetCurrentProgramIsScrobbling(true); } // continue watching new program // dont try to scrobble if previous attempt failed // If the current program is scrobbling, according to the APIARY there's no need to resend every 15 minutes, // it will expire after runtime has elapsed. if ((videoInfo.IsScrobbling) | (TVJustTurnedOn)) { TVJustTurnedOn = false; //Starts the scrobble of the new program because it changed //cache should search here because some shows have no name and could be in cache. #region CACHE CHECK and SCROBBLE from CACHE if (EPGCache.searchOnCache(videoInfo.Title, out item)) { if (item.Type.Equals("nullRecord")) { response.Code = 901; response.Description = "Manually set don't scrobble"; } else if ((item.Type.Equals("movie")) & (videoInfo.Type == VideoType.Movie)) { EbasicHandler.overrideVideoInfoProgram(ref videoInfo, item.Movie); response = EbasicHandler.StartScrobbleMovie(videoInfo); } else if ((item.Type.Equals("show")) & (videoInfo.Type == VideoType.Series)) { EbasicHandler.overrideVideoInfoProgram(ref videoInfo, item.Show); response = EbasicHandler.StartScrobbleEpisode(videoInfo); } else //The item type is different from the videoinfo type. Cache is authoritative here so overriding videoInfo with the cache. //It's most likely that a show is detected wrong as a movie, because a movie with episode and season number is totally nonsense, but handles both. { response.Code = 904; //This code will be used later. if (item.Type.Equals("show")) { EbasicHandler.overrideVideoInfoProgram(ref videoInfo, item.Show); response.Description = item.Show.Ids.Slug; } else { EbasicHandler.overrideVideoInfoProgram(ref videoInfo, item.Movie); } } }// end cache thingy if it was successful it should be scrobbled. #endregion #region CACHE MATCH UNSUCCESSFUL: TRY RETRIEVE ORIGINAL LANGUAGE AND SCROBBLE else { #region FOUND ORIGINAL LANGUAGE TITLE WITH A SINGLE MATCH // Try first to scrobble without changing anything. This is to avoid problems with shows that uses // real non translated shows. In this case the name of the show usually is enough to succesfully scrobble. if (videoInfo.Type == VideoType.Series) { response = EbasicHandler.StartScrobbleEpisode(videoInfo); } else { response = EbasicHandler.StartScrobbleMovie(videoInfo); } if (!(response.Code == 0) && EbasicHandler.setOriginalTitle(ref videoInfo)) { if ((videoInfo.Type == VideoType.Series)) { response = EbasicHandler.StartScrobbleEpisode(videoInfo); } else { response = EbasicHandler.StartScrobbleMovie(videoInfo); } } #endregion #region NO CACHE, NO ORIGINAL LANGUAGE SINGLE MATCH FOUND everything is very likely to fail. else if (!response.Code.Equals(0)) { response.Code = 404; response.Description = "Not Found"; } #endregion } #endregion EbasicHandler.setCurrentProgram(videoInfo); if (response.Code.Equals(901)) { TraktLogger.Info("Program {0} skipped because manually marked to skip on cache", videoInfo.Title); } else if (response.Code.Equals(0)) { if (TraktSettings.AllowPopUPOnSuccessfulScrobbling) { GUIDialogNotify notification = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); notification.Reset(); notification.SetHeading(string.Format("{0} scrobbled!", EbasicHandler.getCurrentProgram().Type.ToString())); notification.SetText(string.Format("Scrobbling '{0}' as '{1}'", EbasicHandler.getCurrentProgram().getOriginalTitle(), EbasicHandler.getCurrentProgram().Title)); notification.SetImage(Path.Combine(Config.GetFolder(Config.Dir.Skin), string.Format(@"{0}\Media\Logos\trakt.png", Config.SkinName))); notification.DoModal(GUIWindowManager.ActiveWindow); } } else // the response was bad! Everything gone worse than ever, again open the GUI { GUIDialogYesNo askManualSelection = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); if (askManualSelection != null) { askManualSelection.Reset(); askManualSelection.SetHeading("Start manual matching?"); askManualSelection.SetLine(1, string.Format("Cannot find a match for '{0}'", videoInfo.Title)); askManualSelection.SetDefaultToYes(true); askManualSelection.DoModal(GUIWindowManager.ActiveWindow); if (askManualSelection.IsConfirmed) { if (!istStoppingScrobble) //maybe we can handle this better. If the user stops the program right before this the plugin crashes. { EbasicHandler.StartGui(response.Code, item, TraktSettings.GUIAsDialog); } } else { // Need to handle cancel button with a null on cache to avoid future scrobbling. EPGCache.addOnCache(videoInfo.Title); } } } } } } catch (NullReferenceException exception) { //handle the worst. This usually happens when the user stops the player during a dialog. //We should at least log this in the mediaportal error. } }), null, 1000, 300000); #endregion return(true); }
private void OnScanDatabaseThread() { try { ArrayList paths = new ArrayList(); SetStatus(GUILocalizeStrings.Get(300061)); // Starting scan... ArrayList scanShares = new ArrayList(); foreach (GUIListItem item in lcFolders.ListItems) { if (item.IsPlayed) { scanShares.Add(item); } } for (int index = 0; index < _scanShare; index++) { GUIListItem item = (GUIListItem)scanShares[index]; string fullPath = item.Path; if (Directory.Exists(fullPath)) { paths.Add(fullPath); } } // get all pictures from the path ArrayList availableFiles = new ArrayList(); foreach (string path in paths) { CountFiles(path, ref availableFiles); } int count = 1; int totalFiles = availableFiles.Count; Log.Info("PictureDatabase: Beginning picture database reorganization and thumbnail generation..."); // treat each picture file one by one EnableControls(false); foreach (string file in availableFiles) { Log.Info("Scanning file: {0}", file); // create thumb if not created and add file to db if not already there CreateThumbsAndAddPictureToDB(file); SetStatus(String.Format("{0}/{1} thumbnails generated", count, totalFiles)); count++; } Log.Info("PictureDatabase: Database reorganization and thumbnail generation finished"); SetStatus(String.Format("Finished. {0} files processsed", totalFiles)); EnableControls(true); GUIDialogNotify dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (null != dlgNotify) { dlgNotify.SetHeading(GUILocalizeStrings.Get(1020)); // Information dlgNotify.SetText(GUILocalizeStrings.Get(300062)); // Scan finsihed dlgNotify.DoModal(GetID); } } catch (Exception) {} }
void ShowOptionsForSite(OnlineVideosWebservice.Site site) { SiteSettings localSite = null; int localSiteIndex = OnlineVideoSettings.Instance.GetSiteByName(site.Name, out localSite); GUIDialogMenu dlgSel = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); dlgSel.ShowQuickNumbers = false; if (dlgSel != null) { dlgSel.Reset(); dlgSel.SetHeading(Translation.Instance.Actions); if (localSiteIndex == -1) { if (site.State != OnlineVideosWebservice.SiteState.Broken) { dlgSel.Add(Translation.Instance.AddToMySites); } } else { if ((site.LastUpdated - localSite.LastUpdated).TotalMinutes > 2 && site.State != OnlineVideosWebservice.SiteState.Broken) { dlgSel.Add(Translation.Instance.UpdateMySite); dlgSel.Add(Translation.Instance.UpdateMySiteSkipCategories); } dlgSel.Add(Translation.Instance.RemoveFromMySites); } if (GUI_infoList.Count > 1) { dlgSel.Add(Translation.Instance.RemoveAllFromMySites); dlgSel.Add(Translation.Instance.UpdateAll); dlgSel.Add(Translation.Instance.UpdateAllSkipCategories); } if (!string.IsNullOrEmpty(site.Owner_FK) && localSiteIndex >= 0) // !only local && ! only global { dlgSel.Add(Translation.Instance.ShowReports); if (site.State != OnlineVideosWebservice.SiteState.Broken) { dlgSel.Add(Translation.Instance.ReportBroken); } } } dlgSel.DoModal(GUIWindowManager.ActiveWindow); if (dlgSel.SelectedId == -1) { return; // ESC used, nothing selected } if (dlgSel.SelectedLabelText == Translation.Instance.AddToMySites || dlgSel.SelectedLabelText == Translation.Instance.UpdateMySite || dlgSel.SelectedLabelText == Translation.Instance.UpdateMySiteSkipCategories) { if (CheckOnlineVideosVersion()) { Gui2UtilConnector.Instance.ExecuteInBackgroundAndCallback( () => { bool?updateResult = OnlineVideos.Sites.Updater.UpdateSites(null, new List <OnlineVideosWebservice.Site> { site }, false, dlgSel.SelectedLabelText == Translation.Instance.UpdateMySiteSkipCategories); if (updateResult == true) { newDllsDownloaded = true; } else if (updateResult == null) { newDataSaved = true; } return(updateResult != false); }, (success, result) => { if (success && (bool)result) { SiteImageExistenceCache.UnCacheImageForSite(site.Name); RefreshDisplayedOnlineSites(); } }, Translation.Instance.GettingSiteXml, true); } } else if (dlgSel.SelectedLabelText == Translation.Instance.UpdateAll || dlgSel.SelectedLabelText == Translation.Instance.UpdateAllSkipCategories) { if (CheckOnlineVideosVersion()) { GUIDialogProgress dlgPrgrs = PrepareProgressDialog(Translation.Instance.FullUpdate); new System.Threading.Thread(delegate() { bool?updateResult = OnlineVideos.Sites.Updater.UpdateSites((m, p) => { if (dlgPrgrs != null) { if (!string.IsNullOrEmpty(m)) { dlgPrgrs.SetLine(1, m); } if (p != null) { dlgPrgrs.SetPercentage(p.Value); } return(dlgPrgrs.ShouldRenderLayer()); } else { return(true); } }, GUI_infoList.ListItems.Select(g => g.TVTag as OnlineVideosWebservice.Site).ToList(), dlgSel.SelectedLabelText == Translation.Instance.UpdateAllSkipCategories); if (updateResult == true) { newDllsDownloaded = true; } else if (updateResult == null) { newDataSaved = true; } if (updateResult != false) { SiteImageExistenceCache.ClearCache(); } if (dlgPrgrs != null) { dlgPrgrs.Close(); } GUIWindowManager.SendThreadCallbackAndWait((p1, p2, data) => { RefreshDisplayedOnlineSites(); return(0); }, 0, 0, null); }) { Name = "OVSelectUpdate", IsBackground = true }.Start(); } } else if (dlgSel.SelectedLabelText == Translation.Instance.RemoveFromMySites) { OnlineVideoSettings.Instance.RemoveSiteAt(localSiteIndex); OnlineVideoSettings.Instance.SaveSites(); newDataSaved = true; RefreshDisplayedOnlineSites(GUI_infoList.SelectedListItemIndex); } else if (dlgSel.SelectedLabelText == Translation.Instance.RemoveAllFromMySites) { bool needRefresh = false; foreach (var siteToRemove in GUI_infoList.ListItems.Where(g => g.IsPlayed).Select(g => g.TVTag as OnlineVideosWebservice.Site).ToList()) { localSiteIndex = OnlineVideoSettings.Instance.GetSiteByName(siteToRemove.Name, out localSite); if (localSiteIndex >= 0) { OnlineVideoSettings.Instance.RemoveSiteAt(localSiteIndex); needRefresh = true; } } if (needRefresh) { OnlineVideoSettings.Instance.SaveSites(); newDataSaved = true; RefreshDisplayedOnlineSites(); } } else if (dlgSel.SelectedLabelText == Translation.Instance.ShowReports) { Gui2UtilConnector.Instance.ExecuteInBackgroundAndCallback( () => { OnlineVideosWebservice.OnlineVideosService ws = new OnlineVideosWebservice.OnlineVideosService(); return(ws.GetReports(site.Name)); }, (success, result) => { if (success) { OnlineVideosWebservice.Report[] reports = result as OnlineVideosWebservice.Report[]; if (reports == null || reports.Length == 0) { GUIDialogNotify dlg = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (dlg != null) { dlg.Reset(); dlg.SetImage(SiteImageExistenceCache.GetImageForSite("OnlineVideos", type: "Icon")); dlg.SetHeading(PluginConfiguration.Instance.BasicHomeScreenName); dlg.SetText(Translation.Instance.NoReportsForSite); dlg.DoModal(GUIWindowManager.ActiveWindow); } } else { selectedSite = site.Name; GUIControl.ClearControl(GetID, GUI_infoList.GetID); Array.Sort(reports, new Comparison <OnlineVideosWebservice.Report>(delegate(OnlineVideosWebservice.Report a, OnlineVideosWebservice.Report b) { return(b.Date.CompareTo(a.Date)); })); foreach (OnlineVideosWebservice.Report report in reports) { string shortMsg = report.Message.Replace(Environment.NewLine, " ").Replace("\n", " ").Replace("\r", " "); GUIListItem loListItem = new GUIListItem(shortMsg.Length > 44 ? shortMsg.Substring(0, 40) + " ..." : shortMsg); loListItem.TVTag = report; loListItem.Label2 = report.Type.ToString(); loListItem.Label3 = report.Date.ToString("g", OnlineVideoSettings.Instance.Locale); loListItem.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnReportSelected); GUI_infoList.Add(loListItem); } GUIControl.SelectItemControl(GetID, GUI_infoList.GetID, 0); GUIPropertyManager.SetProperty("#itemcount", GUI_infoList.Count.ToString()); GUIPropertyManager.SetProperty("#itemtype", Translation.Instance.Reports); } } }, Translation.Instance.GettingReports, true); } else if (dlgSel.SelectedLabelText == Translation.Instance.ReportBroken) { if (CheckOnlineVideosVersion()) { if ((site.LastUpdated - localSite.LastUpdated).TotalMinutes > 1) { GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); if (dlg != null) { dlg.Reset(); dlg.SetHeading(site.Name); dlg.SetLine(1, Translation.Instance.PleaseUpdateLocalSite); dlg.DoModal(GUIWindowManager.ActiveWindow); } } else { string userReason = ""; if (GUIOnlineVideos.GetUserInputString(ref userReason, false)) { if (userReason.Length < 15) { GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); if (dlg != null) { dlg.Reset(); dlg.SetHeading(PluginConfiguration.Instance.BasicHomeScreenName); dlg.SetLine(1, Translation.Instance.PleaseEnterDescription); dlg.DoModal(GUIWindowManager.ActiveWindow); } } else { OnlineVideosWebservice.OnlineVideosService ws = new OnlineVideosWebservice.OnlineVideosService(); string message = ""; bool success = ws.SubmitReport(site.Name, userReason, OnlineVideosWebservice.ReportType.Broken, out message); GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); if (dlg != null) { dlg.Reset(); dlg.SetHeading(PluginConfiguration.Instance.BasicHomeScreenName); dlg.SetLine(1, success ? Translation.Instance.Done : Translation.Instance.Error); dlg.SetLine(2, message); dlg.DoModal(GUIWindowManager.ActiveWindow); } if (success) { // reload online sites OnlineVideos.Sites.Updater.GetRemoteOverviews(true); RefreshDisplayedOnlineSites(); } } } } } } }
private void OnScanDatabaseThread() { try { ArrayList paths = new ArrayList(); SetStatus(GUILocalizeStrings.Get(300061)); // Starting scan... ArrayList scanShares = new ArrayList(); foreach (GUIListItem item in lcFolders.ListItems) { if (item.IsPlayed) { scanShares.Add(item); } } for (int index = 0; index < _scanShare; index++) { GUIListItem item = (GUIListItem)scanShares[index]; string fullPath = item.Path; if (Directory.Exists(fullPath)) { paths.Add(fullPath); } } Stopwatch benchclockfile = new Stopwatch(); benchclockfile.Start(); // get all pictures from the path ArrayList availableFiles = new ArrayList(); foreach (string path in paths) { CountFiles(path, ref availableFiles); } if (!_noLargeThumbnails) { // Display double count (for generate small and large thumbnail) totalFiles = availableFiles.Count * 2; } else { totalFiles = availableFiles.Count; } Log.Info("GUIPictures Setting : Beginning picture database reorganization and thumbnail generation..."); // treat each picture file one by one EnableControls(false); foreach (string file in availableFiles) { Log.Info("Scanning file: {0}", file); // create thumb if not created and add file to db if not already there CreateThumbsAndAddPictureToDB(file); SetStatus(String.Format("{0}/{1} thumbnails generated", count, totalFiles)); } benchclockfile.Stop(); TimeSpan t = TimeSpan.FromSeconds(benchclockfile.Elapsed.TotalSeconds); string totalTime = string.Format("{0:D2}h {1:D2}m {2:D2}s {3:D3}ms", t.Hours, t.Minutes, t.Seconds, t.Milliseconds); Log.Debug("GUIPictures Setting : Creation of selected thumb for '{0}' files, took {1}. Generated {2} thumbnails.", totalFiles, totalTime, totalFiles); Log.Info("GUIPictures Setting : Database reorganization and thumbnail generation finished"); SetStatus(String.Format("Finished. {0} files processsed", totalFiles)); EnableControls(true); GUIDialogNotify dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (null != dlgNotify) { dlgNotify.SetHeading(GUILocalizeStrings.Get(1020)); // Information dlgNotify.SetText(GUILocalizeStrings.Get(300062)); // Scan finsihed dlgNotify.DoModal(GetID); } } catch (Exception ex) { Log.Error("GUISettingsPictures: OnScanDatabaseThread {0}", ex.Message); } }
private void ChannelTuneFailedNotifyUser(LiveStreamResult result, Channel channel) { string TuningResult = string.Empty; switch (result) { case LiveStreamResult.ChannelTuneFailed: TuningResult = (Utility.GetLocalizedText(TextId.ChannelTuneFailed)); break; case LiveStreamResult.NoFreeCardFound: TuningResult = (Utility.GetLocalizedText(TextId.NoFreeCardFound)); break; case LiveStreamResult.NotSupported: TuningResult = (Utility.GetLocalizedText(TextId.NotSupported)); break; case LiveStreamResult.NoRetunePossible: TuningResult = (Utility.GetLocalizedText(TextId.NoRetunePossible)); break; case LiveStreamResult.IsScrambled: TuningResult = (Utility.GetLocalizedText(TextId.IsScrambled)); break; case LiveStreamResult.UnknownError: TuningResult = (Utility.GetLocalizedText(TextId.UnknownError)); break; } if (GUIWindowManager.ActiveWindow == (int)(int)GUIWindow.Window.WINDOW_TVFULLSCREEN) { // If failed and wasPlaying TV, left screen as it is and show zaposd with error message GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_TV_ERROR_NOTIFY, GUIWindowManager.ActiveWindow, 0, 0, 0, 0, null); msg.SendToTargetWindow = true; msg.Object = TuningResult; // forward error info object msg.TargetWindowId = (int)(int)GUIWindow.Window.WINDOW_TVFULLSCREEN; GUIGraphicsContext.SendMessage(msg); } else { // if not fulscreen, show notify dialog with the error message string caption = string.Empty; string tvlogo = string.Empty; if (channel != null) { _navigatorChannels[_currentChannel.ChannelType].PreviousChannel = channel; _currentChannel = null; using (SchedulerServiceAgent SchedulerAgent = new SchedulerServiceAgent()) { tvlogo = Utility.GetLogoImage(channel, SchedulerAgent); } if (channel.ChannelType == ChannelType.Television) { caption = GUILocalizeStrings.Get(605) + " - " + channel.DisplayName; } else { caption = GUILocalizeStrings.Get(665) + " - " + channel.DisplayName; } } GUIDialogNotify pDlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (pDlgNotify != null) { pDlgNotify.Reset(); pDlgNotify.ClearAll(); pDlgNotify.SetHeading(caption); if (!string.IsNullOrEmpty(TuningResult)) { pDlgNotify.SetText(TuningResult); } pDlgNotify.SetImage(tvlogo); pDlgNotify.TimeOut = 5; pDlgNotify.DoModal(GUIWindowManager.ActiveWindow); } } }
public static void OnGlobalMessage(GUIMessage message) { switch (message.Message) { /// <summary> /// We need to stop the player if our livestream ends unexpectedly. /// If the stream stopped for a recording, we show it in a message. /// Without this mediaportal can hang,crash (c++ error in tsreader). /// </summary> case GUIMessage.MessageType.GUI_MSG_STOP_SERVER_TIMESHIFTING: { Log.Debug("TvHome: GUI_MSG_STOP_SERVER_TIMESHIFTING, param1 = {0}", message.Param1); if (PluginMain.Navigator.IsLiveStreamOn) { if (message.Param1 == 4321) //fired by eventlistener { LiveStream liveStream = message.Object as LiveStream; LiveStream navigatorLiveStream = PluginMain.Navigator.LiveStream; Channel channel = PluginMain.Navigator.CurrentChannel; if (liveStream != null && channel != null && navigatorLiveStream.TimeshiftFile == liveStream.TimeshiftFile && liveStream.StreamStartedTime == navigatorLiveStream.StreamStartedTime) { if (g_Player.Playing && (g_Player.IsTV || g_Player.IsRadio)) { g_Player.Stop(); Log.Info("TvHome: our live stream seems to be aborted, stop the playback now"); } string text = GUILocalizeStrings.Get(1516); if (message.Label == LiveStreamAbortReason.RecordingStartedOnCard.ToString()) { text = GUILocalizeStrings.Get(1513); } text = text.Replace("\\r", " "); string heading = string.Empty; string tvlogo = string.Empty; using (SchedulerServiceAgent SchedulerAgent = new SchedulerServiceAgent()) { if (channel.ChannelType == ChannelType.Television) { heading = GUILocalizeStrings.Get(605) + " - " + channel.DisplayName; //my tv } else { heading = GUILocalizeStrings.Get(665) + " - " + channel.DisplayName; //my radio } tvlogo = Utility.GetLogoImage(channel, SchedulerAgent); } GUIDialogNotify pDlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (pDlgNotify != null) { pDlgNotify.Reset(); pDlgNotify.ClearAll(); pDlgNotify.SetHeading(heading); if (!string.IsNullOrEmpty(text)) { pDlgNotify.SetText(text); } pDlgNotify.SetImage(tvlogo); pDlgNotify.TimeOut = 5; Utils.PlaySound("notify.wav", false, true); pDlgNotify.DoModal(GUIWindowManager.ActiveWindow); } } } else //fired by mp player { PluginMain.Navigator.AsyncStopLiveStream(); } } } break; case GUIMessage.MessageType.GUI_MSG_NOTIFY_REC: { if (_enableRecNotification) { Log.Debug("TvHome: GUI_MSG_NOTIFY_REC"); string head = string.Empty; string logo = string.Empty; Recording recording = message.Object as Recording; if (message.Param1 == 1) { head = GUILocalizeStrings.Get(1446); } else { head = GUILocalizeStrings.Get(1447); } using (SchedulerServiceAgent SchedulerAgent = new SchedulerServiceAgent()) { Channel chan = SchedulerAgent.GetChannelById(recording.ChannelId); logo = Utility.GetLogoImage(chan, SchedulerAgent); } string _text = String.Format("{0} {1}-{2}", recording.Title, recording.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), recording.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); GUIDialogNotify DlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (DlgNotify != null) { DlgNotify.Reset(); DlgNotify.ClearAll(); DlgNotify.SetHeading(head); if (!string.IsNullOrEmpty(_text)) { DlgNotify.SetText(_text); } DlgNotify.SetImage(logo); DlgNotify.TimeOut = 5; if (_playNotifyBeep) { Utils.PlaySound("notify.wav", false, true); } DlgNotify.DoModal(GUIWindowManager.ActiveWindow); } } } break; case GUIMessage.MessageType.GUI_MSG_NOTIFY_TV_PROGRAM: { Log.Debug("TvHome: GUI_MSG_NOTIFY_TV_PROGRAM"); TVNotifyYesNoDialog tvNotifyDlg = (TVNotifyYesNoDialog)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_TVNOTIFYYESNO); UpcomingProgram prog = message.Object as UpcomingProgram; if (tvNotifyDlg == null || prog == null) { return; } tvNotifyDlg.Reset(); if (prog.StartTime > DateTime.Now) { int minUntilStart = (prog.StartTime - DateTime.Now).Minutes; if (minUntilStart > 1) { tvNotifyDlg.SetHeading(String.Format(GUILocalizeStrings.Get(1018), minUntilStart)); } else { tvNotifyDlg.SetHeading(1019); // Program is about to begin } } else { tvNotifyDlg.SetHeading(String.Format(GUILocalizeStrings.Get(1206), (DateTime.Now - prog.StartTime).Minutes.ToString())); } string description = GUILocalizeStrings.Get(736); using (GuideServiceAgent tvGuideAgent = new GuideServiceAgent()) { try { if (prog.GuideProgramId.HasValue) { GuideProgram Program = tvGuideAgent.GetProgramById(prog.GuideProgramId.Value); description = Program.CreateCombinedDescription(false); } } catch { } } tvNotifyDlg.SetLine(1, prog.Title); tvNotifyDlg.SetLine(2, description); tvNotifyDlg.SetLine(4, String.Format(GUILocalizeStrings.Get(1207), prog.Channel.DisplayName)); string strLogo = string.Empty; using (SchedulerServiceAgent SchedulerAgent = new SchedulerServiceAgent()) { strLogo = Utility.GetLogoImage(prog.Channel, SchedulerAgent); } tvNotifyDlg.SetImage(strLogo); tvNotifyDlg.TimeOut = _notifyTVTimeout; if (_playNotifyBeep) { Utils.PlaySound("notify.wav", false, true); } tvNotifyDlg.SetDefaultToYes(false); tvNotifyDlg.DoModal(GUIWindowManager.ActiveWindow); if (tvNotifyDlg.IsConfirmed) { try { if (prog.Channel.ChannelType == ChannelType.Television) { if (g_Player.Playing && g_Player.IsTV && PluginMain.Navigator.IsLiveStreamOn) { GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_TVFULLSCREEN); } else { GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_TV); } PluginMain.Navigator.ZapToChannel(prog.Channel, false); if (PluginMain.Navigator.CheckChannelChange()) { TvHome.UpdateProgressPercentageBar(true); if (!PluginMain.Navigator.LastChannelChangeFailed) { g_Player.ShowFullScreenWindow(); } } } else { PluginMain.Navigator.ZapToChannel(prog.Channel, false); GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_RADIO); } } catch (Exception e) { Log.Error("TVHome: TVNotification: Error on starting channel {0} after notification: {1} {2} {3}", prog.Channel.DisplayName, e.Message, e.Source, e.StackTrace); } } } break; //this (GUI_MSG_RECORDER_VIEW_CHANNEL) event is used to let other plugins play a recording, //lastMediaHandler does this (with param1 = 5577 for indentification). case GUIMessage.MessageType.GUI_MSG_RECORDER_VIEW_CHANNEL: { if (message.Param1 == 5577) { try { Recording rec = message.Object as Recording; RecordedBase.PlayRecording(rec, message.Param2); } catch { Log.Error("TVHome: GUI_MSG_RECORDER_VIEW_CHANNEL error"); } } } break; } }