Beispiel #1
0
 bool PlayBackOpWasOfConcern(MediaPortal.Player.g_Player.MediaType type, string filename)
 {
     BaseConfig.MyAnimeLog.Write("PlayBackOpWasOfConcern: {0} - {1} - {2}", filename, type, prevEpisode);
     return(prevEpisode != null &&
            type == g_Player.MediaType.Video &&
            prevFileName == filename);
 }
        private void OnPlayRecordingBackEnded(MediaPortal.Player.g_Player.MediaType type, string filename)
        {
            if (g_Player.currentFileName == _playingRecordingFileName)
            {
                g_Player.Stop();
                _playingRecordingFileName = null;
                _playingRecording         = null;

                Proxies.ControlService.SetRecordingLastWatchedPosition(filename, 0);
            }
        }
Beispiel #3
0
        bool PlayBackOpIsOfConcern(MediaPortal.Player.g_Player.MediaType type, string filename)
        {
            bool IsOfConcern = curEpisode != null && type == g_Player.MediaType.Video && currentUri == filename;

            if (IsOfConcern)
            {
                BaseConfig.MyAnimeLog.Write("PlayBackOpIsOfConcern: {0} - {1} - {2}", filename, type, curEpisode);
            }

            return(IsOfConcern);
        }
        private void OnPlayRecordingBackStopped(MediaPortal.Player.g_Player.MediaType type, int stoptime, string filename)
        {
            if (g_Player.currentFileName == _playingRecordingFileName)
            {
                _playingRecordingFileName = null;
                _playingRecording         = null;

                if (stoptime >= g_Player.Duration)
                {
                    // Temporary workaround before end of stream gets properly implemented.
                    stoptime = 0;
                }
                Proxies.ControlService.SetRecordingLastWatchedPosition(filename, stoptime);
            }
        }
Beispiel #5
0
        void OnPlayBackStarted(MediaPortal.Player.g_Player.MediaType type, string filename)
        {
            if (PlayBackOpIsOfConcern(type, filename))
            {
                MainWindow.keyCommandDelayTimer.Start();
                LogPlayBackOp("started", filename);

                w.RunWorkerAsync(false);

                // ffdshow preset auto loading
                FFDShowHelper ffdshowHelper = new FFDShowHelper();
                // ASync call to avoid mediaportal video treatment sleep
                ffdshowHelper.loadPlayingPresetASync(curEpisode, filename);
            }
        }
Beispiel #6
0
        void OnPlayBackStarted(MediaPortal.Player.g_Player.MediaType type, string filename)
        {
            if (PlayBackOpIsOfConcern(type, filename))
            {
                LogPlayBackOp("started", filename);

                // really stupid, you have to wait until the player itself sets the properties (a few seconds) and after that set them
                w.RunWorkerAsync(false);

                // ffdshow preset auto loading
                FFDShowHelper ffdshowHelper = new FFDShowHelper();
                // ASync call to avoid mediaportal video treatment sleep
                ffdshowHelper.loadPlayingPresetASync(curEpisode, filename);
            }
        }
Beispiel #7
0
        void OnPlayBackEnded(MediaPortal.Player.g_Player.MediaType type, string filename)
        {
            if (PlayBackOpIsOfConcern(type, filename))
            {
                LogPlayBackOp("ended", filename);

                try
                {
                    PlaybackOperationEnded(true, curEpisode);
                }
                catch (Exception e)
                {
                    BaseConfig.MyAnimeLog.Write("Error in VideoHandler.OnPlayBackEnded: {0}", e.ToString());
                }
            }
        }
Beispiel #8
0
        static void g_Player_PlayBackStarted(MediaPortal.Player.g_Player.MediaType type, string filename)
        {
            switch (type)
            {
            case MediaPortal.Player.g_Player.MediaType.Music:
                setTuneOnChange = true;
                if (Settings.publishActivityMusic)
                {
                    SetActivity(Enums.ActivityType.partying, "see Tune");
                }
                break;

            case MediaPortal.Player.g_Player.MediaType.Radio:
                setTuneOnChange = true;
                if (Settings.publishActivityRadio)
                {
                    SetActivity(Enums.ActivityType.relaxing, "see Tune");
                }
                break;

            case MediaPortal.Player.g_Player.MediaType.TV:
                if (Settings.publishActivityTV)
                {
                    SetActivity(Enums.ActivityType.watching_tv, String.Format("watching: {0} on {1}", GUIPropertyManager.GetProperty("#TV.View.title"), GUIPropertyManager.GetProperty("#TV.View.channel")));
                }
                break;

            case MediaPortal.Player.g_Player.MediaType.Video:
                if (Settings.publishActivityMovie)
                {
                    SetActivity(Enums.ActivityType.watching_a_movie, String.Format("watching: '{0}' (Director: {1}, Cast: {2}", GUIPropertyManager.GetProperty("#Play.Current.Title"), GUIPropertyManager.GetProperty("#Play.Current.Director"), GUIPropertyManager.GetProperty("#Play.Current.Cast")));
                }
                break;

            case MediaPortal.Player.g_Player.MediaType.Recording:
                if (Settings.publishActivityRecording)
                {
                    SetActivity(Enums.ActivityType.watching_tv, String.Format("recording: {0} on {1}" + GUIPropertyManager.GetProperty("#TV.View.title") + " on " + GUIPropertyManager.GetProperty("#TV.View.channel")));
                }
                break;

            case MediaPortal.Player.g_Player.MediaType.Unknown:
            default:
                break;
            }
        }
Beispiel #9
0
        /*
         *      public bool PlayPreview(string fileName)
         *      {
         *              bool result = false;
         *              try
         *              {
         *                      GUIGraphicsContext.IsFullScreenVideo = false;
         *                      result = g_Player.Play(fileName, g_Player.MediaType.Video);
         *
         *              }
         *              catch (Exception e)
         *              {
         *                      BaseConfig.MyAnimeLog.Write("Error in VideoHandler.Play: {0}", e);
         *                      result = false;
         *              }
         *              return result;
         *      }
         */
        #region Playback Event Handlers
        void OnPlayBackStopped(MediaPortal.Player.g_Player.MediaType type, int timeMovieStopped, string filename)
        {
            if (PlayBackOpIsOfConcern(type, filename))
            {
                MainWindow.keyCommandDelayTimer.Restart();
                LogPlayBackOp("stopped", filename);
                try
                {
                    VM_ShokoServer.Instance.ShokoServices.SetResumePosition(current.VideoLocalID, timeMovieStopped * 1000, VM_ShokoServer.Instance.CurrentUser.JMMUserID);
                    BaseConfig.MyAnimeLog.Write("Checking for set watched");
                    #region Set Watched
                    double watchedAfter = BaseConfig.Settings.WatchedPercentage;

                    if (!g_Player.IsExternalPlayer)
                    {
                        if ((timeMovieStopped / g_Player.Duration) > watchedAfter / 100)
                        {
                            PlaybackOperationEnded(true, curEpisode);
                        }
                        else
                        {
                            PlaybackOperationEnded(false, curEpisode);
                        }
                    }
                    else
                    {
                        // if this is an external player always set watched to true
                        PlaybackOperationEnded(true, curEpisode);
                    }

                    #endregion
                }
                catch (Exception e)
                {
                    traktScrobbleEnabled = false;
                    BaseConfig.MyAnimeLog.Write("AnimePlugin.VideoHandler.OnPlayBackStopped()\r\n" + e.ToString());
                }
            }
        }
Beispiel #10
0
        void OnPlayBackStopped(MediaPortal.Player.g_Player.MediaType type, int timeMovieStopped, string filename)
        {
            BaseConfig.MyAnimeLog.Write("OnPlayBackStopped: {0} - {1} - {2}", filename, timeMovieStopped, type);
            if (PlayBackOpIsOfConcern(type, filename))
            {
                LogPlayBackOp("stopped", filename);
                try
                {
                    BaseConfig.MyAnimeLog.Write("Checking for set watched");
                    #region Set Watched
                    double watchedAfter = BaseConfig.Settings.WatchedPercentage;

                    if (!g_Player.IsExternalPlayer)
                    {
                        if ((timeMovieStopped / g_Player.Duration) > watchedAfter / 100)
                        {
                            PlaybackOperationEnded(true, curEpisode);
                        }
                        else
                        {
                            PlaybackOperationEnded(false, curEpisode);
                        }
                    }
                    else
                    {
                        // if this is an external player always set watched to true
                        PlaybackOperationEnded(true, curEpisode);
                    }

                    #endregion
                }
                catch (Exception e)
                {
                    BaseConfig.MyAnimeLog.Write("AnimePlugin.VideoHandler.OnPlayBackStopped()\r\n" + e.ToString());
                }
            }
        }
 bool IPlayer.Play(string strFile, MediaPortal.Player.g_Player.MediaType type, int title, bool forcePlay)
 {
     return(Player.g_Player.Play(strFile, type, title, forcePlay));
 }
 bool IPlayer.Play(string strFile, MediaPortal.Player.g_Player.MediaType type)
 {
     return(Player.g_Player.Play(strFile, type));
 }
Beispiel #13
0
 public bool Play(string strFile, MediaPortal.Player.g_Player.MediaType type, int title, bool forcePlay)
 {
     return(true);
 }
Beispiel #14
0
 static void g_Player_PlayBackChanged(MediaPortal.Player.g_Player.MediaType type, int stoptime, string filename)
 {
     g_Player_PlayBackStarted(type, filename);
 }
Beispiel #15
0
 static void g_Player_PlayBackEnded(MediaPortal.Player.g_Player.MediaType type, string filename)
 {
     SetActivity(Settings.defaultActivityType, Settings.defaultActivityMessage);
 }