internal void UpdateActiveRecordings() { // if (Interlocked.CompareExchange(ref CurrentFacade.Update, 1, 0) != 0) // return; if (Utils.LatestTVRecordings) { try { if (Utils.UsedArgus) { Largusrh.UpdateActiveRecordings(); } else { Ltvrh.UpdateActiveRecordings(); } } catch (FileNotFoundException) { //do nothing } catch (MissingMethodException) { //do nothing } catch (Exception ex) { logger.Error("UpdateActiveRecordings: " + ex.ToString()); } } // CurrentFacade.Update = 0; }
internal void MyContextMenu() { try { if (Utils.UsedArgus) { Largusrh.MyContextMenu(); } else { Ltvrh.MyContextMenu(); } } catch (Exception ex) { logger.Error("MyContextMenu: " + ex.ToString()); } }
internal bool PlayRecording(GUIWindow fWindow, ref MediaPortal.GUI.Library.Action action) { try { int idx = -1; int FocusControlID = fWindow.GetFocusControlId(); if (ControlIDPlays.Contains(FocusControlID)) { idx = ControlIDPlays.IndexOf(FocusControlID) + 1; } // // CurrentFacade.Facade = Utils.GetLatestsFacade(CurrentFacade.ControlID); if (CurrentFacade.Facade != null && CurrentFacade.Facade.Focus && CurrentFacade.Facade.SelectedListItem != null) { idx = CurrentFacade.Facade.SelectedListItem.ItemId; } // if (idx >= 0) { if (Utils.UsedArgus) { action.wID = MediaPortal.GUI.Library.Action.ActionType.ACTION_KEY_PRESSED; Largusrh.PlayRecording(idx); } else { Ltvrh.PlayRecording(idx); } return(true); } } catch (Exception ex) { logger.Error("Unable to play recording! " + ex.ToString()); return(true); } return(false); }
internal void UpdateImageTimer(GUIWindow fWindow, Object stateInfo, ElapsedEventArgs e) { if (Utils.LatestTVRecordings) { try { bool showRedDot = false; if (Utils.UsedArgus) { showRedDot = Largusrh.GetRecordingRedDot(); } else { showRedDot = Ltvrh.GetRecordingRedDot(); } if (showRedDot != TVRecordingShowRedDot) { TVRecordingShowRedDot = showRedDot; Utils.SetProperty("#latestMediaHandler.tvrecordings.reddot", TVRecordingShowRedDot ? "true" : "false"); logger.Debug("TV Recordings reddot changes detected: Refreshing Active/Schedulled."); UpdateActiveRecordingsThread(); } } catch (Exception ex) { logger.Error("UpdateImageTimer/RedDot: " + ex.ToString()); } try { if (fWindow.GetFocusControlId() == CurrentFacade.ControlID) { if (Utils.UsedArgus) { Largusrh.UpdateSelectedImageProperties(); } else { Ltvrh.UpdateSelectedImageProperties(); } NeedCleanup = true; } else { if (NeedCleanup && NeedCleanupCount >= 5) { Utils.SetProperty("#latestMediaHandler.tvrecordings.selected.fanart1", " "); Utils.SetProperty("#latestMediaHandler.tvrecordings.selected.fanart2", " "); if (Utils.UsedArgus) { Utils.UnLoadImages(ref Largusrh.images); } else { Utils.UnLoadImages(ref Ltvrh.images); } ShowFanart = 1; CurrentFacade.SelectedItem = -1; CurrentFacade.SelectedImage = -1; NeedCleanup = false; NeedCleanupCount = 0; } else if (NeedCleanup && NeedCleanupCount == 0) { Utils.SetProperty("#latestMediaHandler.tvrecordings.selected.showfanart1", "false"); Utils.SetProperty("#latestMediaHandler.tvrecordings.selected.showfanart2", "false"); NeedCleanupCount++; } else if (NeedCleanup) { NeedCleanupCount++; } } } catch (Exception ex) { logger.Error("UpdateImageTimer (recordings): " + ex.ToString()); } } }
internal void GetLatestMediaInfo() { int z = 1; if (Utils.LatestTVRecordings) { //TV Recordings LatestsCollection latestTVRecordings = null; try { MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")); string useArgus = xmlreader.GetValue("plugins", "ARGUS TV"); string dllFile = Config.GetFile(Config.Dir.Plugins, @"Windows\ArgusTV.UI.MediaPortal.dll"); if (useArgus != null && useArgus.Equals("yes", StringComparison.CurrentCulture) && File.Exists(dllFile)) { FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(dllFile); logger.Debug("Argus version = {0}", myFileVersionInfo.FileVersion); if (Largusrh == null) { Largusrh = new LatestArgusRecordingsHandler(this); } ResolveEventHandler assemblyResolve = Largusrh.OnAssemblyResolve; try { AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.AssemblyResolve += new ResolveEventHandler(Largusrh.OnAssemblyResolve); Largusrh.IsGetTypeRunningOnThisThread = true; latestTVRecordings = Largusrh.GetArgusRecordings(); Largusrh.UpdateActiveRecordings(); AppDomain.CurrentDomain.AssemblyResolve -= assemblyResolve; Utils.UsedArgus = true; } catch (FileNotFoundException) { //do nothing } catch (MissingMethodException) { //do nothing } catch (Exception ex) { logger.Error("GetLatestMediaInfo (TV Argus Recordings): " + ex.ToString()); AppDomain.CurrentDomain.AssemblyResolve -= assemblyResolve; } } else { if (Ltvrh == null) { Ltvrh = new LatestTVRecordingsHandler(this); } latestTVRecordings = Ltvrh.GetTVRecordings(); Ltvrh.UpdateActiveRecordings(); Utils.UsedArgus = false; } } catch (FileNotFoundException) { //do nothing } catch (MissingMethodException) { //do nothing } catch (Exception ex) { logger.Error("GetLatestMediaInfo (TV Recordings): " + ex.ToString()); } bool noNewRecordings = false; if ((latestTVRecordings != null && latestTVRecordings.Count > 0) && Utils.GetProperty("#latestMediaHandler.tvrecordings.latest" + z + ".title").Equals(latestTVRecordings[0].Title, StringComparison.CurrentCulture)) { noNewRecordings = true; logger.Info("Updating Latest Media Info: TV Recording: No new recordings since last check!"); } if (latestTVRecordings != null && latestTVRecordings.Count > 0) { if (!noNewRecordings) { EmptyLatestMediaProperties(); z = 1; for (int i = 0; i < latestTVRecordings.Count && i < Utils.LatestsMaxTVNum; i++) { logger.Info("Updating Latest Media Info: TV Recording: Recording " + z + ": " + latestTVRecordings[i].Title); string recsummary = (string.IsNullOrEmpty(latestTVRecordings[i].Summary) ? Translation.NoDescription : latestTVRecordings[i].Summary); string recsummaryoutline = Utils.GetSentences(recsummary, Utils.LatestPlotOutlineSentencesNum); Utils.SetProperty("#latestMediaHandler.tvrecordings.latest" + z + ".thumb", latestTVRecordings[i].Thumb); Utils.SetProperty("#latestMediaHandler.tvrecordings.latest" + z + ".title", latestTVRecordings[i].Title); Utils.SetProperty("#latestMediaHandler.tvrecordings.latest" + z + ".dateAdded", latestTVRecordings[i].DateAdded); Utils.SetProperty("#latestMediaHandler.tvrecordings.latest" + z + ".genre", latestTVRecordings[i].Genre); Utils.SetProperty("#latestMediaHandler.tvrecordings.latest" + z + ".summary", recsummary); Utils.SetProperty("#latestMediaHandler.tvrecordings.latest" + z + ".summaryoutline", recsummaryoutline); Utils.SetProperty("#latestMediaHandler.tvrecordings.latest" + z + ".series", latestTVRecordings[i].SeriesIndex); Utils.SetProperty("#latestMediaHandler.tvrecordings.latest" + z + ".episode", latestTVRecordings[i].EpisodeIndex); Utils.SetProperty("#latestMediaHandler.tvrecordings.latest" + z + ".episodename", latestTVRecordings[i].ThumbSeries); Utils.SetProperty("#latestMediaHandler.tvrecordings.latest" + z + ".directory", latestTVRecordings[i].Directory); Utils.SetProperty("#latestMediaHandler.tvrecordings.latest" + z + ".new", latestTVRecordings[i].New); z++; } //latestTVRecordings.Clear(); Utils.SetProperty("#latestMediaHandler.tvrecordings.latest.enabled", "true"); Utils.SetProperty("#latestMediaHandler.tvrecordings.hasnew", CurrentFacade.HasNew ? "true" : "false"); logger.Debug("Updating Latest Media Info: TV Recording: Has new: " + (CurrentFacade.HasNew ? "true" : "false")); } } else { EmptyLatestMediaProperties(); logger.Info("Updating Latest Media Info: TV Recording: No recordings found!"); } //latestTVRecordings = null; z = 1; } else { EmptyLatestMediaProperties(); } Utils.UpdateLatestsUpdate(Utils.LatestsCategory.TV, DateTime.Now); }