internal bool PlayRecording(int index) { TvDatabase.Recording rec = (TvDatabase.Recording)latestTVRecordings[index]; _rec = rec; _filename = rec.FileName; bool _bIsLiveRecording = false; IList <TvDatabase.Recording> itemlist = TvDatabase.Recording.ListAll(); TvServer server = new TvServer(); foreach (TvDatabase.Recording recItem in itemlist) { if (rec.IdRecording == recItem.IdRecording && IsRecordingActual(recItem)) { _bIsLiveRecording = true; break; } } int stoptime = rec.StopTime; if (_bIsLiveRecording) { stoptime = -1; } if (TVHome.Card != null) { TVHome.Card.StopTimeShifting(); } return(TVUtil.PlayRecording(rec, stoptime)); }
internal LatestsCollection GetTVRecordings() { UpdateSheduledTVRecordings(); if (TVHome.Connected) { LatestMediaHandler.LatestsCollection resultTmp = new LatestMediaHandler.LatestsCollection(); LatestsCollection latests = new LatestsCollection(); try { IList <TvDatabase.Recording> recordings = TvDatabase.Recording.ListAll(); int x = 0; int i0 = 1; foreach (TvDatabase.Recording rec in recordings) { if (!Utils.LatestTVRecordingsUnfinished && IsRecordingActual(rec)) { continue; } if (Utils.LatestTVRecordingsWatched && (rec.TimesWatched > 0)) { continue; } latests.Add(new Latest(rec.StartTime.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.CurrentCulture), "defaultTVBig.png", null, rec.Title, rec.EndTime.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.CurrentCulture), null, null, rec.Genre, null, null, null, null, null, null, rec.EpisodeNum, rec.EpisodeName, rec, null, rec.Description, rec.SeriesNum)); Utils.ThreadToSleep(); } // parent.CurrentFacade.Facade = Utils.GetLatestsFacade(parent.CurrentFacade.ControlID); if (parent.CurrentFacade.Facade != null) { Utils.ClearFacade(ref parent.CurrentFacade.Facade); } if (facadeCollection != null) { facadeCollection.Clear(); } // latests.Sort(new LatestAddedComparerDesc()); Utils.SortLatests(ref latests, parent.CurrentFacade.Type, parent.CurrentFacade.LeftToRight); latestTVRecordings = new Hashtable(); for (int x0 = 0; x0 < latests.Count; x0++) { //latests[x0].DateAdded = latests[x0].DateAdded.Substring(0, 10); try { DateTime dTmp = DateTime.Parse(latests[x0].DateAdded); latests[x0].DateAdded = String.Format("{0:" + Utils.DateFormat + "}", dTmp); } catch { } string _filename = ((Recording)latests[x0].Playable).FileName; string thumbNail = string.Empty; if (LatestMediaHandlerSetup.MpVersion.CompareTo("1.03") > 0) { // MP 1.4 logger.Debug("GetTVRecordings [" + LatestMediaHandlerSetup.MpVersion + "] Thumbs method: 1.4 and above ..."); thumbNail = TVRecordingsThumbnailHandler.GetThumb(_filename); } else { // MP 1.3 or older logger.Debug("GetTVRecordings [" + LatestMediaHandlerSetup.MpVersion + "] Thumbs method: 1.3 or older ..."); thumbNail = string.Format(CultureInfo.CurrentCulture, "{0}\\{1}{2}", Thumbs.TVRecorded, Path.ChangeExtension(MediaPortal.Util.Utils.SplitFilename(_filename), null), MediaPortal.Util.Utils.GetThumbExtension()); if (File.Exists(thumbNail)) { string tmpThumbNail = MediaPortal.Util.Utils.ConvertToLargeCoverArt(thumbNail); if (File.Exists(tmpThumbNail)) { thumbNail = tmpThumbNail; } } if (!File.Exists(thumbNail)) { thumbNail = string.Format(CultureInfo.CurrentCulture, "{0}{1}", Path.ChangeExtension(_filename, null), MediaPortal.Util.Utils.GetThumbExtension()); } if (!File.Exists(thumbNail)) { thumbNail = "defaultTVBig.png"; } } latests[x0].Fanart = (Utils.FanartHandler ? UtilsFanartHandler.GetFanartForLatest(latests[x0].Title) : string.Empty); latests[x0].Directory = Utils.GetGetDirectoryName(TVUtil.GetFileNameForRecording(((Recording)latests[x0].Playable))); latests[x0].Thumb = thumbNail; resultTmp.Add(latests[x0]); if (result == null || result.Count == 0) { result = resultTmp; } latestTVRecordings.Add(i0, latests[x].Playable); AddToFilmstrip(parent.CurrentFacade.Facade, latests[x], i0); x++; i0++; if (x == Utils.FacadeMaxNum) { break; } } Utils.UpdateFacade(ref parent.CurrentFacade.Facade, parent.CurrentFacade); if (latests != null) { latests.Clear(); } latests = null; } catch (FileNotFoundException) { //do nothing } catch (MissingMethodException) { //do nothing } catch (Exception ex) { if (latests != null) { latests.Clear(); } latests = null; logger.Error("GetTVRecordings: " + ex.ToString()); } result = resultTmp; } return(result); }