public LatestTVAllRecordingsHandler(int id = ControlID) { ControlIDFacades = new List <LatestsFacade>(); ControlIDPlays = new List <int>(); // ControlIDFacades.Add(new LatestsFacade(id, "TVRecordings")); if (id == ControlID) { ControlIDPlays.Add(Play1ControlID); ControlIDPlays.Add(Play2ControlID); ControlIDPlays.Add(Play3ControlID); ControlIDPlays.Add(Play4ControlID); } ControlIDFacades[ControlIDFacades.Count - 1].UnWatched = Utils.LatestTVRecordingsWatched; // EmptyLatestMediaProperties(); EmptyRecordingProps(); // Ltvrh = new LatestTVRecordingsHandler(this); Largusrh = new LatestArgusRecordingsHandler(this); }
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); }