/// <summary> /// Play episode async /// </summary> /// <param name="episode">Episode to play</param> /// <param name="startPosition">Postion from where playback should be started (only valid if resum=false)</param> /// <param name="resume">Resume from last stop?</param> private static void DoPlayEpisode(DBEpisode episode, bool resume, int startPosition) { if (GUIGraphicsContext.form.InvokeRequired) { PlayEpisodeAsyncDelegate d = new PlayEpisodeAsyncDelegate(DoPlayEpisode); GUIGraphicsContext.form.Invoke(d, new object[] { episode, resume, startPosition }); return; } WifiRemote.LogMessage("Play episode (resume: " + resume + ", pos: " + startPosition, WifiRemote.LogType.Debug); if (player == null) player = new VideoHandler(); // Reset stopTime if resume is false if (!resume) { episode[DBEpisode.cStopTime] = 0; } player.ResumeOrPlay((DBEpisode)episode); if (!resume && startPosition > 0) { g_Player.SeekAbsolute(startPosition); } }
public static bool PlayEpisode(DBEpisode episode) { if (player == null) player = new VideoHandler(); return player.ResumeOrPlay(episode); }
public override bool Init() { m_localControlForInvoke = new Control(); m_localControlForInvoke.CreateControl(); MPTVSeriesLog.Write("**** Plugin started in MediaPortal ****"); DBOption.LogOptions(); #region Translations Translation.Init(); // Push Translated Strings to skin MPTVSeriesLog.Write("Setting translated strings: ", MPTVSeriesLog.LogLevel.Debug); string propertyName = string.Empty; string propertyValue = string.Empty; foreach (string name in Translation.Strings.Keys) { propertyName = "#TVSeries.Translation." + name + ".Label"; propertyValue = Translation.Strings[name]; MPTVSeriesLog.Write(propertyName + " = " + propertyValue, MPTVSeriesLog.LogLevel.Debug); GUIPropertyManager.SetProperty(propertyName, propertyValue); } #endregion #region Misc m_VideoHandler = new VideoHandler(); m_VideoHandler.RateRequestOccured += new VideoHandler.rateRequest(m_VideoHandler_RateRequestOccured); // Setup Random Fanart Timer m_FanartTimer = new System.Threading.Timer(new TimerCallback(FanartTimerEvent), null, Timeout.Infinite, Timeout.Infinite); m_bFanartTimerDisabled = true; // Lock for Parental Control logicalView.IsLocked = true; // Timer to reset Locked Status if (!string.IsNullOrEmpty(DBOption.GetOptions(DBOption.cParentalControlPinCode))) { long interval = DBOption.GetOptions(DBOption.cParentalControlResetInterval) * 60 * 1000; m_ParentalControlTimer = new System.Threading.Timer(new TimerCallback(ParentalControlTimerEvent), null, 0, interval); } // Check if MediaPortal will Show TVSeries Plugin when restarting // We need to do this because we may need to show a modal dialog e.g. PinCode and we can't do this if MediaPortal window is not yet ready using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { m_bShowLastActiveModule = xmlreader.GetValueAsBool("general", "showlastactivemodule", false); m_iLastActiveModule = xmlreader.GetValueAsInt("general", "lastactivemodule", -1); } #endregion #region Initialize Importer m_parserUpdater = new OnlineParsing(this); OnlineParsing.OnlineParsingProgress += new OnlineParsing.OnlineParsingProgressHandler(parserUpdater_OnlineParsingProgress); OnlineParsing.OnlineParsingCompleted += new OnlineParsing.OnlineParsingCompletedHandler(parserUpdater_OnlineParsingCompleted); System.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged += NetworkAvailabilityChanged; Microsoft.Win32.SystemEvents.PowerModeChanged += new Microsoft.Win32.PowerModeChangedEventHandler(SystemEvents_PowerModeChanged); // Setup Importer InitImporter(); #endregion #region Skin Settings / Load SkinSettings.Init(); // listen to this event to detect skin/language changes in GUI GUIWindowManager.OnDeActivateWindow += new GUIWindowManager.WindowActivationHandler(GUIWindowManager_OnDeActivateWindow); GUIWindowManager.OnActivateWindow += new GUIWindowManager.WindowActivationHandler(GUIWindowManager_OnActivateWindow); String xmlSkin = GUIGraphicsContext.Skin + @"\TVSeries.xml"; MPTVSeriesLog.Write("Loading main skin window: " + xmlSkin); return Load(xmlSkin); #endregion }