Permalink
Browse files

Merge remote-tracking branch 'remotes/origin/BUG-2817-Canceling_a_pla…

…yback_resume_dialog_adds_video_and_DVD_to_playlist'
  • Loading branch information...
2 parents 03238a9 + b84716f commit be91f6535340abf96d1ca0d6d49eaf3d1ccc7b33 @Sebastiii Sebastiii committed Mar 30, 2013
Showing with 58 additions and 20 deletions.
  1. +58 −20 mediaportal/WindowPlugins/GUIVideoFiles/GUIVideoFiles.cs
@@ -110,6 +110,8 @@ public bool SortAscending
private static VirtualDirectory _virtualDirectory;
private static string _currentFolder = string.Empty;
private static PlayListPlayer _playlistPlayer;
+ private static PlayListType _currentPlaylistType;
+ private static int _currentPlaylistIndex = -1;
private MapSettings _mapSettings = new MapSettings();
private DirectoryHistory _history = new DirectoryHistory();
@@ -772,7 +774,10 @@ protected override void OnClick(int iItem)
GUIResumeDialog.MediaType.Video);
if (result == GUIResumeDialog.Result.Abort)
- {
+ {
+ _playlistPlayer.Reset();
+ _playlistPlayer.CurrentPlaylistType = _currentPlaylistType;
+ _playlistPlayer.CurrentSong = _currentPlaylistIndex;
return;
}
@@ -843,7 +848,12 @@ protected override void OnClick(int iItem)
else
{
MovieDuration(movies, false);
- }
+ }
+
+ // Get current playlist
+ _currentPlaylistType = new PlayListType();
+ _currentPlaylistType = _playlistPlayer.CurrentPlaylistType;
+ _currentPlaylistIndex = _playlistPlayer.CurrentSong;
_playlistPlayer.Reset();
_playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_VIDEO_TEMP;
@@ -869,7 +879,13 @@ protected override void OnClick(int iItem)
#region StackDisabled or file not stackable
// play movie...(only 1 file)
- AddFileToDatabase(movieFileName);
+ AddFileToDatabase(movieFileName);
+
+ // Get current playlist
+ _currentPlaylistType = new PlayListType();
+ _currentPlaylistType = _playlistPlayer.CurrentPlaylistType;
+ _currentPlaylistIndex = _playlistPlayer.CurrentSong;
+
_playlistPlayer.Reset();
_playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_VIDEO_TEMP;
PlayList newPlayList = _playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO_TEMP);
@@ -1710,7 +1726,9 @@ public static void PlayMovieFromPlayList(bool askForResumeMovie, int iMovieIndex
else
{
filename = _playlistPlayer.Get(iMovieIndex);
- }
+ }
+
+ _playlistPlayer.Reset();
// If the file is an image file, it should be mounted before playing
bool isImage = false;
@@ -1765,19 +1783,24 @@ public static void PlayMovieFromPlayList(bool askForResumeMovie, int iMovieIndex
{
GUIResumeDialog.Result result =
GUIResumeDialog.ShowResumeDialog(title, timeMovieStopped,
- GUIResumeDialog.MediaType.Video);
-
- if (result == GUIResumeDialog.Result.Abort)
- return;
-
+ GUIResumeDialog.MediaType.Video);
+
+ if (result == GUIResumeDialog.Result.Abort)
+ {
+ _playlistPlayer.Reset();
+ _playlistPlayer.CurrentPlaylistType = _currentPlaylistType;
+ _playlistPlayer.CurrentSong = _currentPlaylistIndex;
+ return;
+ }
+
if (result == GUIResumeDialog.Result.PlayFromBeginning)
timeMovieStopped = 0;
}
}
}
- }
-
- // TODO Handle STP when it comes from MyMusic otherwise Video Playlist will not work
+ }
+
+ // TODO Handle STOP when it comes from MyMusic otherwise Video Playlist will not work
//if (g_Player.Playing && !g_Player.IsDVD)
// g_Player.Stop();
@@ -2093,11 +2116,16 @@ public static void PlayMovie(int idMovie, bool requestPin)
GUIResumeDialog.Result result =
GUIResumeDialog.ShowResumeDialog(title, movieDuration + timeMovieStopped,
- GUIResumeDialog.MediaType.Video);
-
- if (result == GUIResumeDialog.Result.Abort)
- return;
-
+ GUIResumeDialog.MediaType.Video);
+
+ if (result == GUIResumeDialog.Result.Abort)
+ {
+ _playlistPlayer.Reset();
+ _playlistPlayer.CurrentPlaylistType = _currentPlaylistType;
+ _playlistPlayer.CurrentSong = _currentPlaylistIndex;
+ return;
+ }
+
if (result == GUIResumeDialog.Result.PlayFromBeginning)
{
VideoDatabase.DeleteMovieStopTime(idFile);
@@ -2129,8 +2157,13 @@ public static void PlayMovie(int idMovie, bool requestPin)
}
}
}
- }
-
+ }
+
+ // Get current playlist
+ _currentPlaylistType = new PlayListType();
+ _currentPlaylistType = _playlistPlayer.CurrentPlaylistType;
+ _currentPlaylistIndex = _playlistPlayer.CurrentSong;
+
_playlistPlayer.Reset();
_playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_VIDEO_TEMP;
PlayList playlist = _playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO_TEMP);
@@ -3354,7 +3387,12 @@ private void OnPlayAll(string path)
else // Don't ask, sort according to setting and play videos
{
selectedOption = _howToPlayAll;
- }
+ }
+
+ // Get current playlist
+ _currentPlaylistType = new PlayListType();
+ _currentPlaylistType = _playlistPlayer.CurrentPlaylistType;
+ _currentPlaylistIndex = _playlistPlayer.CurrentSong;
// Reset playlist
_playlistPlayer.Reset();

0 comments on commit be91f65

Please sign in to comment.