[longomatch/newui: 4/104] Add back support for playlists



commit a9db2e56cd9d465dd52403c3d8094da02462e358
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Fri Aug 8 00:10:43 2014 +0200

    Add back support for playlists

 LongoMatch.Core/Common/EventsBroker.cs             |   77 ++--
 LongoMatch.Core/Common/Job.cs                      |    6 +-
 LongoMatch.Core/Common/PlayList.cs                 |  165 -------
 LongoMatch.Core/Handlers/Handlers.cs               |   34 +-
 LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs  |    1 -
 LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs      |    5 +-
 LongoMatch.Core/Interfaces/GUI/IPlayerBin.cs       |    5 +-
 LongoMatch.Core/Interfaces/IPlayList.cs            |   59 ---
 .../IPlaylistWidget.cs => IPlaylistElement.cs}     |   37 +-
 LongoMatch.Core/Interfaces/Multimedia/IPlayer.cs   |    3 +-
 LongoMatch.Core/LongoMatch.Core.mdp                |   16 +-
 LongoMatch.Core/Makefile.am                        |   11 +-
 LongoMatch.Core/Store/Play.cs                      |   19 +-
 LongoMatch.Core/Store/PlayListPlay.cs              |   78 ----
 LongoMatch.Core/Store/Playlists/Playlist.cs        |  125 +++++
 .../Playlists/PlaylistDrawing.cs}                  |   64 +++-
 .../Playlists/PlaylistImage.cs}                    |   59 ++-
 .../Playlists/PlaylistPlayElement.cs}              |   70 +++-
 LongoMatch.Core/Store/Project.cs                   |    7 +
 LongoMatch.Drawing/Utils.cs                        |   12 +-
 LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs         |  476 +++++++++++---------
 LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs |   16 +-
 LongoMatch.GUI/Gui/Component/AnalysisComponent.cs  |   19 +-
 LongoMatch.GUI/Gui/Component/ButtonsWidget.cs      |    1 +
 LongoMatch.GUI/Gui/Component/CodingWidget.cs       |    2 -
 LongoMatch.GUI/Gui/Component/PlayListWidget.cs     |  141 +++----
 .../Gui/Component/PlayersListTreeWidget.cs         |   10 +-
 .../Gui/Component/PlaysListTreeWidget.cs           |   27 +-
 .../Gui/Component/PlaysPositionViewer.cs           |    8 +-
 .../Gui/Component/PlaysSelectionWidget.cs          |   20 +-
 LongoMatch.GUI/Gui/Component/Timeline.cs           |    6 +-
 LongoMatch.GUI/Gui/GUIToolkit.cs                   |   77 ++--
 LongoMatch.GUI/Gui/Menu/PlaysMenu.cs               |   97 +++--
 LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs    |    5 +-
 LongoMatch.GUI/Gui/TreeView/PlayListTreeView.cs    |  342 ++++++++++----
 .../LongoMatch.Gui.Component.PlayListWidget.cs     |  125 ++----
 ...ongoMatch.Gui.Component.PlaysSelectionWidget.cs |   93 +++--
 .../LongoMatch.Gui.Panel.NewProjectPanel.cs        |    1 +
 .../LongoMatch.Gui.Panel.ProjectsManagerPanel.cs   |    1 -
 LongoMatch.GUI/gtk-gui/gui.stetic                  |   77 +---
 LongoMatch.GUI/gtk-gui/objects.xml                 |   94 ++---
 LongoMatch.Services/Services/EventsManager.cs      |   23 +-
 LongoMatch.Services/Services/PlaylistManager.cs    |  197 +++------
 .../Services/RenderingJobsManager.cs               |   63 ++-
 LongoMatch.mds                                     |    3 -
 45 files changed, 1430 insertions(+), 1347 deletions(-)
---
diff --git a/LongoMatch.Core/Common/EventsBroker.cs b/LongoMatch.Core/Common/EventsBroker.cs
index 36309a7..363bff8 100644
--- a/LongoMatch.Core/Common/EventsBroker.cs
+++ b/LongoMatch.Core/Common/EventsBroker.cs
@@ -19,6 +19,7 @@ using System;
 using LongoMatch.Handlers;
 using System.Collections.Generic;
 using LongoMatch.Store;
+using LongoMatch.Store.Playlists;
 using LongoMatch.Interfaces;
 using LongoMatch.Interfaces.GUI;
 
@@ -31,7 +32,6 @@ namespace LongoMatch.Common
                public event PlaysDeletedHandler PlaysDeleted;
                public event PlaySelectedHandler PlaySelected;
                public event PlayCategoryChangedHandler PlayCategoryChanged;
-               public event PlayListNodeAddedHandler PlayListNodeAdded;
                public event TimeNodeChangedHandler TimeNodeChanged;
                public event SnapshotSeriesHandler SnapshotSeries;
                public event TagPlayHandler TagPlay;
@@ -40,12 +40,12 @@ namespace LongoMatch.Common
                
                /* Playlist */
                public event RenderPlaylistHandler RenderPlaylist;
-               public event PlayListNodeAddedHandler PlayListNodeAddedEvent;
-               public event PlayListNodeSelectedHandler PlayListNodeSelectedEvent;
-               public event OpenPlaylistHandler OpenPlaylistEvent;
+               public event AddPlaylistElementHandler AddPlaylistElementEvent;
+               public event PlaylistElementSelectedHandler PlaylistElementSelectedEvent;
                public event NewPlaylistHandler NewPlaylistEvent;
-               public event SavePlaylistHandler SavePlaylistEvent; 
-               
+               public event NextPlaylistElementHandler NextPlaylistElementEvent;
+               public event PreviousPlaylistElementHandler PreviousPlaylistElementEvent;
+               public event PlaylistsChangedHandler PlaylistsChangedEvent;
                
                public event KeyHandler KeyPressed;
                
@@ -80,20 +80,12 @@ namespace LongoMatch.Common
                public event ErrorHandler MultimediaError;
                public event ErrorHandler CaptureError;
                public event CaptureFinishedHandler CaptureFinished;
-               public event NextButtonClickedHandler Next;
-               public event PrevButtonClickedHandler Prev;
                public event DrawFrameHandler DrawFrame;
                public event DetachPlayerHandler Detach;
                public event PlaybackRateChangedHandler PlaybackRateChanged;
 
-               
-               
-               public EventsBroker ()
-               {
-               }
-               
-               public void EmitNewTag (TaggerButton tagger, List<Player> players = null, List<Tag> tags = 
null,
-                                       Time start = null, Time stop = null) {
+               public void EmitNewTag (TaggerButton tagger, List<Player> players = null,
+                                       List<Tag> tags = null, Time start = null, Time stop = null) {
                        if (NewTagEvent != null)
                                NewTagEvent (tagger, players, tags, start, stop);
                }
@@ -116,15 +108,28 @@ namespace LongoMatch.Common
                                SnapshotSeries(play);
                }
                
-               public void EmitRenderPlaylist(IPlayList playlist) {
+               public void EmitRenderPlaylist(Playlist playlist) {
                        if (RenderPlaylist != null)
                                RenderPlaylist(playlist);
                }
                
-               public void EmitPlayListNodeAdded(List<Play> plays)
+               public void EmitNewPlaylist (Project project)
                {
-                       if (PlayListNodeAdded != null)
-                               PlayListNodeAdded(plays);
+                       if (NewPlaylistEvent != null) {
+                               NewPlaylistEvent (project);
+                       }
+               }
+               
+               public void EmitAddPlaylistElement (Playlist playlist, List<IPlaylistElement> plays)
+               {
+                       if (AddPlaylistElementEvent != null)
+                               AddPlaylistElementEvent (playlist, plays);
+               }
+               
+               public void EmitPlaylistElementSelected (Playlist playlist, IPlaylistElement element)
+               {
+                       if (PlaylistElementSelectedEvent != null)
+                               PlaylistElementSelectedEvent (playlist, element);
                }
                
                public void EmitTimeNodeChanged (TimeNode tn, object val)
@@ -150,21 +155,6 @@ namespace LongoMatch.Common
                                DuplicatePlays (plays);
                }
                
-               public void EmitNewPlaylist() {
-                       if (NewPlaylistEvent != null)
-                               NewPlaylistEvent();
-               }
-               
-               public void EmitOpenPlaylist() {
-                       if (OpenPlaylistEvent != null)
-                               OpenPlaylistEvent();
-               }
-               
-               public void EmitSavePlaylist() {
-                       if (SavePlaylistEvent != null)
-                               SavePlaylistEvent();
-               }
-               
                public void EmitKeyPressed(object sender, int key, int modifier) {
                        if (KeyPressed != null)
                                KeyPressed(sender, key, modifier);
@@ -324,17 +314,17 @@ namespace LongoMatch.Common
                        }
                }
                
-               public void EmitNext ()
+               public void EmitNextPlaylistElement (Playlist playlist)
                {
-                       if (Next != null) {
-                               Next ();
+                       if (NextPlaylistElementEvent != null) {
+                               NextPlaylistElementEvent (playlist);
                        }
                }
                
-               public void EmitPrev ()
+               public void EmitPreviousPlaylistElement (Playlist playlist)
                {
-                       if (Prev != null) {
-                               Prev ();
+                       if (PreviousPlaylistElementEvent != null) {
+                               PreviousPlaylistElementEvent (playlist);
                        }
                }
 
@@ -357,6 +347,11 @@ namespace LongoMatch.Common
                                CreateThumbnailsEvent (project);
                        }
                }
+               
+               public void EmitPlaylistsChanged (object sender) {
+                       if (PlaylistsChangedEvent != null)
+                               PlaylistsChangedEvent (sender);
+               }
        }
 }
 
diff --git a/LongoMatch.Core/Common/Job.cs b/LongoMatch.Core/Common/Job.cs
index 70d79f0..445ea6d 100644
--- a/LongoMatch.Core/Common/Job.cs
+++ b/LongoMatch.Core/Common/Job.cs
@@ -19,8 +19,8 @@ using System;
 using System.Collections.Generic;
 
 using LongoMatch.Common;
-using LongoMatch.Interfaces;
 using LongoMatch.Store;
+using LongoMatch.Store.Playlists;
 
 namespace LongoMatch.Common
 {
@@ -70,12 +70,12 @@ namespace LongoMatch.Common
        
        public class EditionJob: Job
        {
-               public EditionJob (IPlayList playlist, EncodingSettings encSettings): base (encSettings)
+               public EditionJob (Playlist playlist, EncodingSettings encSettings): base (encSettings)
                {
                        Playlist = Cloner.Clone(playlist);
                }
                
-               public IPlayList Playlist{
+               public Playlist Playlist{
                        get;
                        set;
                }
diff --git a/LongoMatch.Core/Handlers/Handlers.cs b/LongoMatch.Core/Handlers/Handlers.cs
index cef5b0f..d3cfaba 100644
--- a/LongoMatch.Core/Handlers/Handlers.cs
+++ b/LongoMatch.Core/Handlers/Handlers.cs
@@ -20,12 +20,12 @@
 
 using System;
 using System.Collections.Generic;
+using LongoMatch.Common;
 using LongoMatch.Interfaces;
+using LongoMatch.Interfaces.Drawing;
 using LongoMatch.Interfaces.GUI;
 using LongoMatch.Store;
-using LongoMatch.Common;
-using LongoMatch.Store.Drawables;
-using LongoMatch.Interfaces.Drawing;
+using LongoMatch.Store.Playlists;
 
 namespace LongoMatch.Handlers
 {
@@ -82,26 +82,24 @@ namespace LongoMatch.Handlers
        
 
        /*Playlist Events*/
-       /* Add the a play to the opened playlist */
-       public delegate void PlayListNodeAddedHandler(List<Play> play);
+       /* Create a new playlist */
+       public delegate Playlist NewPlaylistHandler (Project project);
+       /* Add a new rendering job */
+       public delegate void RenderPlaylistHandler(Playlist playlist);
        /* A play list element is selected */
-       public delegate void PlayListNodeSelectedHandler(PlayListPlay play);
-       /* Open a playlist */
-       public delegate void OpenPlaylistHandler();
-       /* New a playlist */
-       public delegate void NewPlaylistHandler();
-       /* Save a playlist */
-       public delegate void SavePlaylistHandler();
+       public delegate void PlaylistElementSelectedHandler (Playlist playlist, IPlaylistElement element);
+       /* Add a play to a playlist */
+       public delegate void AddPlaylistElementHandler (Playlist playlist, List<IPlaylistElement> element);
+       /* Play next playlist element */
+       public delegate void NextPlaylistElementHandler (Playlist playlist);
+       /* Play previous playlist element */
+       public delegate void PreviousPlaylistElementHandler (Playlist playlist);
+       /* Playlists have been edited */
+       public delegate void PlaylistsChangedHandler (object sender);
 
-       /* The position of the stream has changed */
-       public delegate void PositionChangedHandler(Time pos);
-       
        /* Create snapshots for a play */
        public delegate void SnapshotSeriesHandler(Play tNode);
        
-       /* Add a new rendering job */
-       public delegate void RenderPlaylistHandler(IPlayList playlist);
-        
        /* Convert a video file */
        public delegate void ConvertVideoFilesHandler (List<MediaFile> inputFiles, EncodingSettings 
encSettings);
        
diff --git a/LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs 
b/LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs
index 3df9abd..5652e76 100644
--- a/LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs
+++ b/LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs
@@ -38,7 +38,6 @@ namespace LongoMatch.Interfaces.GUI
                
                IPlayerBin Player{get;}
                ICapturerBin Capturer{get;}
-               IPlaylistWidget Playlist {get;}
        }
 }
 
diff --git a/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs b/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs
index ff121fc..8faf1c0 100644
--- a/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs
+++ b/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs
@@ -22,7 +22,7 @@ using System.Collections.Generic;
 using LongoMatch.Interfaces;
 using LongoMatch.Common;
 using LongoMatch.Store;
-using LongoMatch.Store.Templates;
+using LongoMatch.Store.Playlists;
 using Image = LongoMatch.Common.Image;
 using LongoMatch.Stats;
 using LongoMatch.Interfaces.Multimedia;
@@ -42,6 +42,7 @@ namespace LongoMatch.Interfaces.GUI
                void WarningMessage(string message, object parent=null);
                void ErrorMessage(string message, object parent=null);
                bool QuestionMessage(string message, string title, object parent=null);
+               string QueryMessage (string key, string title=null, string value="", object parent=null);
                
                /* Files/Folders IO */
                string SaveFile(string title, string defaultName, string defaultFolder,
@@ -55,7 +56,7 @@ namespace LongoMatch.Interfaces.GUI
                        
                IBusyDialog BusyDialog(string message, object parent=null);
                        
-               List<EditionJob> ConfigureRenderingJob (IPlayList playlist);
+               List<EditionJob> ConfigureRenderingJob (Playlist playlist);
                void ExportFrameSeries(Project openenedProject, Play play, string snapshotDir);
                
                void OpenProject (Project project, ProjectType projectType, 
diff --git a/LongoMatch.Core/Interfaces/GUI/IPlayerBin.cs b/LongoMatch.Core/Interfaces/GUI/IPlayerBin.cs
index f2b1951..3d5776d 100644
--- a/LongoMatch.Core/Interfaces/GUI/IPlayerBin.cs
+++ b/LongoMatch.Core/Interfaces/GUI/IPlayerBin.cs
@@ -19,6 +19,7 @@ using System;
 using LongoMatch.Common;
 using LongoMatch.Handlers;
 using LongoMatch.Store;
+using LongoMatch.Store.Playlists;
 
 namespace LongoMatch.Interfaces.GUI
 {
@@ -48,8 +49,8 @@ namespace LongoMatch.Interfaces.GUI
                void SeekToPreviousFrame();
                void FramerateUp();
                void FramerateDown();
-               void LoadPlay (string fileName, Play play, Time seekTime, bool playing);
-               void LoadPlayListPlay (PlayListPlay play, bool hasNext);
+               void LoadPlay (MediaFile file, Play play, Time seekTime, bool playing);
+               void LoadPlayListPlay (Playlist playlist, IPlaylistElement play);
                void CloseSegment();
        }
 }
diff --git a/LongoMatch.Core/Interfaces/GUI/IPlaylistWidget.cs 
b/LongoMatch.Core/Interfaces/IPlaylistElement.cs
similarity index 68%
copy from LongoMatch.Core/Interfaces/GUI/IPlaylistWidget.cs
copy to LongoMatch.Core/Interfaces/IPlaylistElement.cs
index b6bb4fc..4698d50 100644
--- a/LongoMatch.Core/Interfaces/GUI/IPlaylistWidget.cs
+++ b/LongoMatch.Core/Interfaces/IPlaylistElement.cs
@@ -1,32 +1,37 @@
-// 
-//  Copyright (C) 2011 Andoni Morales Alastruey
-// 
+//
+//  Copyright (C) 2014 Andoni Morales Alastruey
+//
 //  This program is free software; you can redistribute it and/or modify
 //  it under the terms of the GNU General Public License as published by
 //  the Free Software Foundation; either version 2 of the License, or
 //  (at your option) any later version.
-// 
+//
 //  This program is distributed in the hope that it will be useful,
 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 //  GNU General Public License for more details.
-//  
+//
 //  You should have received a copy of the GNU General Public License
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-// 
-using System;
+//
+using LongoMatch.Common;
 
-using LongoMatch.Interfaces;
-using LongoMatch.Store;
-
-namespace LongoMatch.Interfaces.GUI
+namespace LongoMatch.Interfaces
 {
-       public interface IPlaylistWidget
+       public interface IPlaylistElement
        {
-               void Load(IPlayList playlist);
-               void Add(PlayListPlay playlistPlay);
-               void SetActivePlay (PlayListPlay playlistplay, int index);
+               string Description {
+                       get;
+               }
+               
+               Image Miniature {
+                       get;
+               }
+               
+               bool Selected {
+                       get;
+                       set;
+               }
        }
 }
-
diff --git a/LongoMatch.Core/Interfaces/Multimedia/IPlayer.cs 
b/LongoMatch.Core/Interfaces/Multimedia/IPlayer.cs
index 53af50f..44428c3 100644
--- a/LongoMatch.Core/Interfaces/Multimedia/IPlayer.cs
+++ b/LongoMatch.Core/Interfaces/Multimedia/IPlayer.cs
@@ -26,7 +26,7 @@ using Image = LongoMatch.Common.Image;
 
 namespace LongoMatch.Interfaces.Multimedia
 {
-       public interface IPlayer
+       public interface IPlayer: IDisposable
        {
                // Events
                event         ErrorHandler Error;
@@ -51,6 +51,5 @@ namespace LongoMatch.Interfaces.Multimedia
                bool SeekToPreviousFrame();
                Image GetCurrentFrame (int width=-1, int height=-1);
                void Expose ();
-               void Dispose();
        }
 }
diff --git a/LongoMatch.Core/LongoMatch.Core.mdp b/LongoMatch.Core/LongoMatch.Core.mdp
index b819374..23cbf10 100644
--- a/LongoMatch.Core/LongoMatch.Core.mdp
+++ b/LongoMatch.Core/LongoMatch.Core.mdp
@@ -24,7 +24,6 @@
     <File subtype="Code" buildaction="Compile" name="Store/PixbufTimeNode.cs" />
     <File subtype="Code" buildaction="Compile" name="Store/Play.cs" />
     <File subtype="Code" buildaction="Compile" name="Store/Player.cs" />
-    <File subtype="Code" buildaction="Compile" name="Store/PlayListPlay.cs" />
     <File subtype="Code" buildaction="Compile" name="Store/Project.cs" />
     <File subtype="Code" buildaction="Compile" name="Store/ProjectDescription.cs" />
     <File subtype="Code" buildaction="Compile" name="Store/Time.cs" />
@@ -46,8 +45,6 @@
     <File subtype="Code" buildaction="Compile" name="Common/VideoStandards.cs" />
     <File subtype="Directory" buildaction="Compile" name="Common" />
     <File subtype="Directory" buildaction="Compile" name="." />
-    <File subtype="Code" buildaction="Compile" name="Interfaces/IPlayList.cs" />
-    <File subtype="Code" buildaction="Compile" name="Common/PlayList.cs" />
     <File subtype="Code" buildaction="Compile" name="Common/CaptureSettings.cs" />
     <File subtype="Code" buildaction="Compile" name="Common/Device.cs" />
     <File subtype="Code" buildaction="Compile" name="Interfaces/IRenderingJobsManager.cs" />
@@ -66,7 +63,6 @@
     <File subtype="Code" buildaction="Compile" name="Handlers/Multimedia.cs" />
     <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/IAnalysisWindow.cs" />
     <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/ICapturerBin.cs" />
-    <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/IPlaylistWidget.cs" />
     <File subtype="Directory" buildaction="Compile" name="Interfaces" />
     <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/IGUIToolkit.cs" />
     <File subtype="Directory" buildaction="Compile" name="Interfaces/Multimedia" />
@@ -140,11 +136,19 @@
     <File subtype="Code" buildaction="Compile" name="Store/PenaltyCardEvent.cs" />
     <File subtype="Code" buildaction="Compile" name="Store/Tag.cs" />
     <File subtype="Code" buildaction="Compile" name="Stats/SubCategoryStat.cs" />
-    <File subtype="Code" buildaction="Compile" name="Store/TaggerButton.cs" />
-    <File subtype="Code" buildaction="Compile" name="Store/TagButton.cs" />
     <File subtype="Code" buildaction="Compile" name="Interfaces/Multimedia/IDiscoverer.cs" />
     <File subtype="Code" buildaction="Compile" name="Store/TaggerButton.cs" />
     <File subtype="Code" buildaction="Compile" name="Store/TagButton.cs" />
+    <File subtype="Directory" buildaction="Compile" name="Common" />
+    <File subtype="Directory" buildaction="Compile" name="Common" />
+    <File subtype="Directory" buildaction="Compile" name="Common" />
+    <File subtype="Directory" buildaction="Compile" name="Interfaces" />
+    <File subtype="Code" buildaction="Compile" name="Interfaces/IPlaylistElement.cs" />
+    <File subtype="Directory" buildaction="Compile" name="Store/Playlists" />
+    <File subtype="Code" buildaction="Compile" name="Store/Playlists/Playlist.cs" />
+    <File subtype="Code" buildaction="Compile" name="Store/Playlists/PlaylistPlayElement.cs" />
+    <File subtype="Code" buildaction="Compile" name="Store/Playlists/PlaylistDrawing.cs" />
+    <File subtype="Code" buildaction="Compile" name="Store/Playlists/PlaylistImage.cs" />
   </Contents>
   <References>
     <ProjectReference type="Package" localcopy="True" refto="System, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089" />
diff --git a/LongoMatch.Core/Makefile.am b/LongoMatch.Core/Makefile.am
index 54af969..802469f 100644
--- a/LongoMatch.Core/Makefile.am
+++ b/LongoMatch.Core/Makefile.am
@@ -21,7 +21,6 @@ SOURCES = Common/Area.cs \
        Common/Image.cs \
        Common/Job.cs \
        Common/Log.cs \
-       Common/PlayList.cs \
        Common/PlaysFilter.cs \
        Common/Serializer.cs \
        Common/SysInfo.cs \
@@ -41,12 +40,11 @@ SOURCES = Common/Area.cs \
        Interfaces/GUI/IMainController.cs \
        Interfaces/GUI/IPanel.cs \
        Interfaces/GUI/IPlayerBin.cs \
-       Interfaces/GUI/IPlaylistWidget.cs \
        Interfaces/GUI/IRenderingStateBar.cs \
        Interfaces/IDataBaseManager.cs \
        Interfaces/IDatabase.cs \
        Interfaces/IIDObject.cs \
-       Interfaces/IPlayList.cs \
+       Interfaces/IPlaylistElement.cs \
        Interfaces/IProjectsImporter.cs \
        Interfaces/IRenderingJobsManager.cs \
        Interfaces/ITemplates.cs \
@@ -87,8 +85,11 @@ SOURCES = Common/Area.cs \
        Store/Period.cs \
        Store/PixbufTimeNode.cs \
        Store/Play.cs \
-       Store/PlayListPlay.cs \
        Store/Player.cs \
+       Store/Playlists/Playlist.cs \
+       Store/Playlists/PlaylistDrawing.cs \
+       Store/Playlists/PlaylistImage.cs \
+       Store/Playlists/PlaylistPlayElement.cs \
        Store/Point.cs \
        Store/Project.cs \
        Store/ProjectDescription.cs \
@@ -96,8 +97,6 @@ SOURCES = Common/Area.cs \
        Store/ScoreEvent.cs \
        Store/Tag.cs \
        Store/TagButton.cs \
-       Store/TagButton.cs \
-       Store/TaggerButton.cs \
        Store/TaggerButton.cs \
        Store/Templates/CategoriesTemplate.cs \
        Store/Templates/TeamTemplate.cs \
diff --git a/LongoMatch.Core/Store/Play.cs b/LongoMatch.Core/Store/Play.cs
index 17900ff..d5faecc 100644
--- a/LongoMatch.Core/Store/Play.cs
+++ b/LongoMatch.Core/Store/Play.cs
@@ -42,7 +42,7 @@ namespace LongoMatch.Store
                        Drawings = new List<FrameDrawing>();
                        Players = new List<Player> ();
                        Tags = new List<Tag>();
-                       PlaybackRate = 1.0;
+                       Rate = 1.0f;
                        ID = Guid.NewGuid ();
                }
                #endregion
@@ -142,11 +142,15 @@ namespace LongoMatch.Store
                        set;
                }
                
-               public double PlaybackRate {
-                       get;
-                       set;
+               [JsonIgnore]
+               public string Description {
+                       get {
+                               return 
+                                       Name + "\n" +
+                                               TagsDescription () + "\n" +
+                                               Start.ToMSecondsString() + " - " + Stop.ToMSecondsString();
+                       }
                }
-               
                #endregion
 
                #region Public methods
@@ -214,10 +218,7 @@ namespace LongoMatch.Store
                
                public override string ToString()
                {
-                       return 
-                               Name + "\n" +
-                               TagsDescription () + "\n" +
-                               Start.ToMSecondsString() + " - " + Stop.ToMSecondsString();
+                       return Description;
                }
                #endregion
        }
diff --git a/LongoMatch.Core/Store/Playlists/Playlist.cs b/LongoMatch.Core/Store/Playlists/Playlist.cs
new file mode 100644
index 0000000..8d77c94
--- /dev/null
+++ b/LongoMatch.Core/Store/Playlists/Playlist.cs
@@ -0,0 +1,125 @@
+// PlayList.cs
+//
+//  Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+using System;
+using System.Collections.Generic;
+using LongoMatch.Interfaces;
+
+namespace LongoMatch.Store.Playlists
+{
+       [Serializable]
+       public class Playlist
+       {
+
+               int indexSelection = 0;
+               #region Constructors
+               public Playlist ()
+               {
+                       Elements = new List<IPlaylistElement> ();
+               }
+               #endregion
+               #region Properties
+               
+               public string Name {
+                       get;
+                       set;
+               }
+               
+               public List<IPlaylistElement> Elements {
+                       get;
+                       set;
+               }
+
+               public int CurrentIndex {
+                       get {
+                               return indexSelection;
+                       }
+               }
+               #endregion
+               #region Public methods
+               public IPlaylistElement Next ()
+               {
+                       if (HasNext ())
+                               indexSelection++;
+                       return Elements [indexSelection];
+               }
+
+               public IPlaylistElement Prev ()
+               {
+                       if (HasPrev ())
+                               indexSelection--;
+                       return Elements [indexSelection];
+               }
+
+               public void Reorder (int indexIn, int indexOut)
+               {
+                       var play = Elements [indexIn];
+                       Elements.RemoveAt (indexIn);
+                       Elements.Insert (indexOut, play);
+                       
+                       /* adjust selection index */
+                       if (indexIn == indexSelection)
+                               indexSelection = indexOut;
+                       if (indexIn < indexOut) {
+                               if (indexSelection < indexIn || indexSelection > indexOut)
+                                       return;
+                               indexSelection++;
+                       } else {
+                               if (indexSelection > indexIn || indexSelection < indexOut)
+                                       return;
+                               indexSelection--;
+                       }
+               }
+
+               public bool Remove (IPlaylistElement plNode)
+               {
+                       bool ret = Elements.Remove (plNode);
+                       if (CurrentIndex >= Elements.Count)
+                               indexSelection --;
+                       return ret;
+               }
+
+               public IPlaylistElement Select (int index)
+               {
+                       indexSelection = index;
+                       return Elements [index];
+               }
+
+               public void SetActive (IPlaylistElement play)
+               {
+                       indexSelection = Elements.IndexOf (play);
+               }
+
+               public bool HasNext ()
+               {
+                       return indexSelection < Elements.Count - 1;
+               }
+
+               public bool HasPrev ()
+               {
+                       return !indexSelection.Equals (0);
+               }
+
+               public Playlist Copy ()
+               {
+                       return (Playlist)(MemberwiseClone ());
+               }
+               #endregion
+       }
+}
diff --git a/LongoMatch.Core/Interfaces/GUI/IPlaylistWidget.cs 
b/LongoMatch.Core/Store/Playlists/PlaylistDrawing.cs
similarity index 54%
copy from LongoMatch.Core/Interfaces/GUI/IPlaylistWidget.cs
copy to LongoMatch.Core/Store/Playlists/PlaylistDrawing.cs
index b6bb4fc..c94b85f 100644
--- a/LongoMatch.Core/Interfaces/GUI/IPlaylistWidget.cs
+++ b/LongoMatch.Core/Store/Playlists/PlaylistDrawing.cs
@@ -1,32 +1,70 @@
-// 
-//  Copyright (C) 2011 Andoni Morales Alastruey
-// 
+//
+//  Copyright (C) 2014 Andoni Morales Alastruey
+//
 //  This program is free software; you can redistribute it and/or modify
 //  it under the terms of the GNU General Public License as published by
 //  the Free Software Foundation; either version 2 of the License, or
 //  (at your option) any later version.
-// 
+//
 //  This program is distributed in the hope that it will be useful,
 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 //  GNU General Public License for more details.
-//  
+//
 //  You should have received a copy of the GNU General Public License
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-// 
+//
 using System;
-
 using LongoMatch.Interfaces;
-using LongoMatch.Store;
+using LongoMatch.Common;
 
-namespace LongoMatch.Interfaces.GUI
+namespace LongoMatch.Store.Playlists
 {
-       public interface IPlaylistWidget
+       [Serializable]
+       public class PlaylistDrawing: IPlaylistElement
        {
-               void Load(IPlayList playlist);
-               void Add(PlayListPlay playlistPlay);
-               void SetActivePlay (PlayListPlay playlistplay, int index);
+               public PlaylistDrawing (FrameDrawing drawing)
+               {
+                       Drawing = drawing;
+               }
+
+               public bool Selected {
+                       get;
+                       set;
+               }
+               
+
+               public int Width {
+                       get;
+                       set;
+               }
+               
+               public int Height {
+                       get;
+                       set;
+               }
+               
+               public FrameDrawing Drawing {
+                       get;
+                       set;
+               }
+
+               public Time Duration {
+                       get;
+                       set;
+               }
+
+               public string Description {
+                       get {
+                               return Duration.ToMSecondsString ();
+                       }
+               }
+
+               public Image Miniature {
+                       get;
+                       set;
+               }
        }
 }
 
diff --git a/LongoMatch.Core/Interfaces/GUI/IPlaylistWidget.cs 
b/LongoMatch.Core/Store/Playlists/PlaylistImage.cs
similarity index 55%
copy from LongoMatch.Core/Interfaces/GUI/IPlaylistWidget.cs
copy to LongoMatch.Core/Store/Playlists/PlaylistImage.cs
index b6bb4fc..21543df 100644
--- a/LongoMatch.Core/Interfaces/GUI/IPlaylistWidget.cs
+++ b/LongoMatch.Core/Store/Playlists/PlaylistImage.cs
@@ -1,32 +1,65 @@
-// 
-//  Copyright (C) 2011 Andoni Morales Alastruey
-// 
+//
+//  Copyright (C) 2014 Andoni Morales Alastruey
+//
 //  This program is free software; you can redistribute it and/or modify
 //  it under the terms of the GNU General Public License as published by
 //  the Free Software Foundation; either version 2 of the License, or
 //  (at your option) any later version.
-// 
+//
 //  This program is distributed in the hope that it will be useful,
 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 //  GNU General Public License for more details.
-//  
+//
 //  You should have received a copy of the GNU General Public License
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-// 
+//
 using System;
-
+using LongoMatch.Common;
 using LongoMatch.Interfaces;
-using LongoMatch.Store;
 
-namespace LongoMatch.Interfaces.GUI
+#if HAVE_GTK
+using SImage = Gdk.Pixbuf;
+#endif
+
+namespace LongoMatch.Store.Playlists
 {
-       public interface IPlaylistWidget
+       [Serializable]
+       public class PlaylistImage: IPlaylistElement
        {
-               void Load(IPlayList playlist);
-               void Add(PlayListPlay playlistPlay);
-               void SetActivePlay (PlayListPlay playlistplay, int index);
+               public PlaylistImage (Image image, Time duration)
+               {
+                       Image = image;
+                       Duration = duration;
+               }
+
+               public Image Image {
+                       get;
+                       set;
+               }
+
+               public bool Selected {
+                       get;
+                       set;
+               }
+
+               public Time Duration {
+                       get;
+                       set;
+               }
+
+               public Image Miniature {
+                       get;
+                       set;
+               }
+
+               public string Description {
+                       get {
+                               return Duration.ToSecondsString ();
+                       }
+               }
+
        }
 }
 
diff --git a/LongoMatch.Core/Interfaces/GUI/IPlaylistWidget.cs 
b/LongoMatch.Core/Store/Playlists/PlaylistPlayElement.cs
similarity index 50%
rename from LongoMatch.Core/Interfaces/GUI/IPlaylistWidget.cs
rename to LongoMatch.Core/Store/Playlists/PlaylistPlayElement.cs
index b6bb4fc..f194a62 100644
--- a/LongoMatch.Core/Interfaces/GUI/IPlaylistWidget.cs
+++ b/LongoMatch.Core/Store/Playlists/PlaylistPlayElement.cs
@@ -1,32 +1,74 @@
-// 
-//  Copyright (C) 2011 Andoni Morales Alastruey
-// 
+//
+//  Copyright (C) 2014 Andoni Morales Alastruey
+//
 //  This program is free software; you can redistribute it and/or modify
 //  it under the terms of the GNU General Public License as published by
 //  the Free Software Foundation; either version 2 of the License, or
 //  (at your option) any later version.
-// 
+//
 //  This program is distributed in the hope that it will be useful,
 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 //  GNU General Public License for more details.
-//  
+//
 //  You should have received a copy of the GNU General Public License
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-// 
-using System;
-
+//
+using Newtonsoft.Json;
+using LongoMatch.Common;
 using LongoMatch.Interfaces;
-using LongoMatch.Store;
 
-namespace LongoMatch.Interfaces.GUI
+namespace LongoMatch.Store.Playlists
 {
-       public interface IPlaylistWidget
+       public class PlaylistPlayElement: IPlaylistElement
        {
-               void Load(IPlayList playlist);
-               void Add(PlayListPlay playlistPlay);
-               void SetActivePlay (PlayListPlay playlistplay, int index);
+               public PlaylistPlayElement (Play play, MediaFile file=null)
+               {
+                       Play = play;
+                       Title = play.Name;
+                       Rate = play.Rate;
+                       File = file;
+               }
+               
+               public Play Play {
+                       get;
+                       set;
+               }
+               
+               public bool Selected {
+                       get;
+                       set;
+               }
+               
+               public string Title {
+                       get;
+                       set;
+               }
+               
+               public double Rate {
+                       get;
+                       set;
+               }
+               
+               public MediaFile File {
+                       get;
+                       set;
+               }
+
+               [JsonIgnore]
+               public string Description {
+                       get {
+                               return Title;
+                       }
+               }
+
+               [JsonIgnore]
+               public Image Miniature {
+                       get {
+                               return Play.Miniature;
+                       }
+               }
        }
 }
 
diff --git a/LongoMatch.Core/Store/Project.cs b/LongoMatch.Core/Store/Project.cs
index 5d3ae8e..b6971c3 100644
--- a/LongoMatch.Core/Store/Project.cs
+++ b/LongoMatch.Core/Store/Project.cs
@@ -28,6 +28,7 @@ using Mono.Unix;
 using LongoMatch.Common;
 using LongoMatch.Interfaces;
 using LongoMatch.Store;
+using LongoMatch.Store.Playlists;
 using LongoMatch.Store.Templates;
 
 namespace LongoMatch.Store
@@ -60,6 +61,7 @@ namespace LongoMatch.Store
                        Periods = new List<Period> ();
                        ScoreTimeline = new List<ScoreEvent>();
                        PenaltyCardsTimeline = new List<PenaltyCardEvent> ();
+                       Playlists = new List<Playlist> ();
                }
                #endregion
 
@@ -137,6 +139,11 @@ namespace LongoMatch.Store
                        set;
                }
                
+               public List<Playlist> Playlists {
+                       get;
+                       set;
+               }
+               
                [JsonIgnore]
                public IEnumerable<IGrouping<Category, Play>> PlaysGroupedByCategory {
                        get {
diff --git a/LongoMatch.Drawing/Utils.cs b/LongoMatch.Drawing/Utils.cs
index a2d224e..7ceebe5 100644
--- a/LongoMatch.Drawing/Utils.cs
+++ b/LongoMatch.Drawing/Utils.cs
@@ -66,7 +66,7 @@ namespace LongoMatch.Drawing
                        return d;
                }
 
-               public static Image RenderFrameDrawingToImage (IDrawingToolkit tk, Image image, FrameDrawing 
fd)
+               protected static Image RenderFrameDrawing (IDrawingToolkit tk, int width, int height, 
FrameDrawing fd, Image image)
                {
                        Image img;
                        ISurface surface;
@@ -84,6 +84,16 @@ namespace LongoMatch.Drawing
                        surface.Dispose ();
                        return img;
                }
+               
+               public static Image RenderFrameDrawing (IDrawingToolkit tk, int width, int height, 
FrameDrawing fd)
+               {
+                       return RenderFrameDrawing (tk, width, height, fd, null);
+               }
+               
+               public static Image RenderFrameDrawingToImage (IDrawingToolkit tk, Image image, FrameDrawing 
fd)
+               {
+                       return RenderFrameDrawing (tk, image.Width, image.Height, fd, image);
+               }
        }
 }
 
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
index e9fbe16..7523a8c 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
@@ -19,69 +19,67 @@
 //
 using System;
 using System.Linq;
-using Gtk;
 using Gdk;
-using Mono.Unix;
-using System.Runtime.InteropServices;
-
-using Image = LongoMatch.Common.Image;
+using Gtk;
+using LongoMatch.Drawing.Cairo;
+using LongoMatch.Drawing.Widgets;
 using LongoMatch.Handlers;
+using LongoMatch.Interfaces;
 using LongoMatch.Interfaces.GUI;
 using LongoMatch.Interfaces.Multimedia;
-using LongoMatch.Video;
+using LongoMatch.Multimedia.Utils;
+using LongoMatch.Store;
+using LongoMatch.Store.Playlists;
 using LongoMatch.Video.Common;
-using LongoMatch.Video.Player;
 using LongoMatch.Video.Utils;
-using LongoMatch.Store;
-using LongoMatch.Multimedia.Utils;
-using LongoMatch.Drawing.Widgets;
-using LongoMatch.Drawing.Cairo;
-
+using Image = LongoMatch.Common.Image;
 
 namespace LongoMatch.Gui
 {
        [System.ComponentModel.Category("LongoMatch")]
        [System.ComponentModel.ToolboxItem(true)]
 
-       public partial class PlayerBin : Gtk.Bin, LongoMatch.Interfaces.GUI.IPlayerBin
+       public partial class PlayerBin : Gtk.Bin, IPlayerBin
        {
-               struct Segment {
+               struct Segment
+               {
                        public Time Start;
                        public Time Stop;
-               }       
-
+               }
 
                public event TickHandler Tick;
-               public event LongoMatch.Handlers.StateChangeHandler PlayStateChanged;
+               public event StateChangeHandler PlayStateChanged;
                public event SeekEventHandler SeekEvent;
 
                const int THUMBNAIL_MAX_WIDTH = 100;
                const int SCALE_FPS = 25;
                IPlayer player;
                Play loadedPlay;
+               IPlaylistElement loadedPlaylistElement;
+               Playlist loadedPlaylist;
                Time length, lastTime;
                bool seeking, IsPlayingPrevState, muted, emitRateScale, readyToSeek;
+               bool ignoreTick, stillimageLoaded;
                string filename;
                double previousVLevel = 1;
                double[] seeksQueue;
-               object[] pendingSeek; //{seekTime, rate, playing}
+               object[] pendingSeek;
+               //{seekTime, rate, playing}
                protected VolumeWindow vwin;
                Seeker seeker;
                Segment segment;
                Blackboard blackboard;
                uint timeout;
-               bool ignoreTick;
-
 
                #region Constructors
-               public PlayerBin()
+               public PlayerBin ()
                {
-                       this.Build();
-                       vwin = new VolumeWindow();
+                       this.Build ();
+                       vwin = new VolumeWindow ();
                        ConnectSignals ();
                        blackboard = new Blackboard (new WidgetWrapper (blackboarddrawingarea));
                        controlsbox.Visible = false;
-                       UnSensitive();
+                       UnSensitive ();
                        timescale.Adjustment.PageIncrement = 0.01;
                        timescale.Adjustment.StepIncrement = 0.0001;
                        LongoMatch.Gui.Helpers.Misc.DisableFocus (vbox3);
@@ -90,16 +88,15 @@ namespace LongoMatch.Gui
                        seeksQueue [0] = -1;
                        seeksQueue [1] = -1;
                        detachbutton.Clicked += (sender, e) => Config.EventsBroker.EmitDetach ();
-                       seeker = new Seeker();
+                       seeker = new Seeker ();
                        seeker.SeekEvent += HandleSeekEvent;
-                       segment.Start = new Time(-1);
-                       segment.Stop = new Time(int.MaxValue);
+                       segment.Start = new Time (-1);
+                       segment.Stop = new Time (int.MaxValue);
                        lastTime = new Time (0);
                        length = new Time (0);
                        
                        CreatePlayer ();
                }
-
                #endregion
                protected override void OnDestroyed ()
                {
@@ -108,9 +105,7 @@ namespace LongoMatch.Gui
                        blackboard.Dispose ();
                        base.OnDestroyed ();
                }
-
                #region Properties
-
                public Time CurrentTime {
                        get {
                                return player.CurrentTime;
@@ -131,22 +126,22 @@ namespace LongoMatch.Gui
 
                public bool FullScreen {
                        set {
-                               if(value)
-                                       GdkWindow.Fullscreen();
+                               if (value)
+                                       GdkWindow.Fullscreen ();
                                else
-                                       GdkWindow.Unfullscreen();
+                                       GdkWindow.Unfullscreen ();
                        }
                }
 
                public Image CurrentMiniatureFrame {
                        get {
-                               return player.GetCurrentFrame(THUMBNAIL_MAX_WIDTH, THUMBNAIL_MAX_WIDTH);
+                               return player.GetCurrentFrame (THUMBNAIL_MAX_WIDTH, THUMBNAIL_MAX_WIDTH);
                        }
                }
 
                public Image CurrentFrame {
                        get {
-                               return player.GetCurrentFrame();
+                               return player.GetCurrentFrame ();
                        }
                }
 
@@ -161,7 +156,7 @@ namespace LongoMatch.Gui
                                return ((Gtk.EventBox)player);
                        }
                }
-               
+
                public bool ShowControls {
                        set {
                                controlsbox.Visible = value;
@@ -169,151 +164,179 @@ namespace LongoMatch.Gui
                        }
                }
                #endregion
-
                #region Public methods
-
-               public void Open (string filename) {
+               public void Open (string filename)
+               {
                        Open (filename, true);
                }
 
-               public void Play() {
+               public void Play ()
+               {
                        DrawingsVisible = false;
-                       player.Play();
+                       player.Play ();
                }
 
-               public void Pause() {
-                       player.Pause();
+               public void Pause ()
+               {
+                       player.Pause ();
                }
 
-               public void TogglePlay() {
-                       if(player.Playing)
-                               Pause();
+               public void TogglePlay ()
+               {
+                       if (player.Playing)
+                               Pause ();
                        else
-                               Play();
+                               Play ();
                }
 
-               public void ResetGui() {
-                       closebutton.Hide();
-                       SetSensitive();
-                       timescale.Value=0;
-                       timelabel.Text="";
+               public void ResetGui ()
+               {
+                       closebutton.Hide ();
+                       SetSensitive ();
+                       timescale.Value = 0;
+                       timelabel.Text = "";
                        SeekingEnabled = true;
-                       seeking=false;
+                       seeking = false;
                        IsPlayingPrevState = false;
-                       muted=false;
+                       muted = false;
                        emitRateScale = true;
                        videodrawingarea.Visible = true;
                        blackboarddrawingarea.Visible = false;
                }
 
-               public void LoadPlayListPlay (PlayListPlay play, bool hasNext) {
-                       if(hasNext)
+               public void LoadPlayListPlay (Playlist playlist, IPlaylistElement element)
+               {
+                       if (playlist.HasNext ())
                                nextbutton.Sensitive = true;
                        else
                                nextbutton.Sensitive = false;
 
-                       LoadSegment (play.MediaFile.FilePath, play.Start, play.Stop,
-                                    play.Start, true, play.Rate);
+                       loadedPlay = null;
+                       loadedPlaylist = playlist;
+                       loadedPlaylistElement = element;
+
+                       if (element is PlaylistPlayElement) {
+                               PlaylistPlayElement ple = element as PlaylistPlayElement;
+                               Play play = ple.Play;
+                               LoadSegment (ple.File, play.Start, play.Stop, play.Start, true, play.Rate);
+                       } else if (element is PlaylistImage) {
+                               //LoadStillImage (element as PlaylistImage);
+                       } else if (element is PlaylistDrawing) {
+                               //LoadFrameDrawing (element as PlaylistDrawing);
+                       }
                }
-               
-               public void LoadPlay (string filename, Play play, Time seekTime, bool playing) {
+
+               public void LoadPlay (MediaFile file, Play play, Time seekTime, bool playing)
+               {
+                       loadedPlaylist = null;
+                       loadedPlaylistElement = null;
                        loadedPlay = play;
-                       LoadSegment (filename, play.Start, play.Stop, seekTime, playing, play.Rate);
+                       LoadSegment (file, play.Start, play.Stop, seekTime, playing, play.Rate);
                }
-               
-               public void Close() {
+
+               public void Close ()
+               {
                        ReconfigureTimeout (0);
-                       player.Close();
+                       player.Close ();
                        filename = null;
                        timescale.Value = 0;
-                       UnSensitive();
+                       UnSensitive ();
                }
 
-               public void Seek (Time time, bool accurate) {
+               public void Seek (Time time, bool accurate)
+               {
                        DrawingsVisible = false;
                        player.Seek (time, accurate);
-                       if(SeekEvent != null)
+                       if (SeekEvent != null)
                                SeekEvent (time);
                }
 
-               public void SeekToNextFrame () {
+               public void SeekToNextFrame ()
+               {
                        DrawingsVisible = false;
                        if (player.CurrentTime < segment.Stop) {
                                player.SeekToNextFrame ();
-                               if(SeekEvent != null)
+                               if (SeekEvent != null)
                                        SeekEvent (player.CurrentTime);
                        }
                }
 
-               public void SeekToPreviousFrame () {
+               public void SeekToPreviousFrame ()
+               {
                        DrawingsVisible = false;
                        if (player.CurrentTime > segment.Start) {
                                seeker.Seek (SeekType.StepDown);
                        }
                }
 
-               public void StepForward() {
+               public void StepForward ()
+               {
                        DrawingsVisible = false;
-                       Jump((int)jumpspinbutton.Value);
+                       Jump ((int)jumpspinbutton.Value);
                }
 
-               public void StepBackward() {
+               public void StepBackward ()
+               {
                        DrawingsVisible = false;
-                       Jump(-(int)jumpspinbutton.Value);
+                       Jump (-(int)jumpspinbutton.Value);
                }
-               
-               public void FramerateUp() {
+
+               public void FramerateUp ()
+               {
                        DrawingsVisible = false;
                        vscale1.Adjustment.Value += vscale1.Adjustment.StepIncrement;
                }
 
-               public void FramerateDown() {
+               public void FramerateDown ()
+               {
                        DrawingsVisible = false;
                        vscale1.Adjustment.Value -= vscale1.Adjustment.StepIncrement;
                }
 
-               public void CloseSegment() {
-                       closebutton.Hide();
+               public void CloseSegment ()
+               {
+                       ImageLoaded = false;
+                       closebutton.Hide ();
                        segment.Start = new Time (-1);
                        segment.Stop = new Time (int.MaxValue);
                        SetScaleValue (SCALE_FPS);
                        //timescale.Sensitive = true;
                        loadedPlay = null;
+                       ImageLoaded = false;
                        Config.EventsBroker.EmitPlaySelected (null);
                }
 
-               public void SetSensitive() {
+               public void SetSensitive ()
+               {
                        controlsbox.Sensitive = true;
                        vscale1.Sensitive = true;
                }
 
-               public void UnSensitive() {
+               public void UnSensitive ()
+               {
                        controlsbox.Sensitive = false;
                        vscale1.Sensitive = false;
                }
-
                #endregion
-
                #region Private methods
-
                bool DrawingsVisible {
                        set {
                                videodrawingarea.Visible = !value;
                                blackboarddrawingarea.Visible = value;
                        }
                }
-               
-               void Open(string filename, bool seek) {
-                       ResetGui();
-                       CloseSegment();
+
+               void Open (string filename, bool seek)
+               {
+                       ResetGui ();
+                       CloseSegment ();
                        if (filename != this.filename) {
                                readyToSeek = false;
                                this.filename = filename;
                                try {
                                        Log.Debug ("Openning new file " + filename);
-                                       player.Open(filename);
-                               }
-                               catch (Exception ex) {
+                                       player.Open (filename);
+                               } catch (Exception ex) {
                                        Log.Exception (ex);
                                        //We handle this error async
                                }
@@ -328,9 +351,25 @@ namespace LongoMatch.Gui
                                return segment.Start.MSeconds != -1;
                        }
                }
-               
-               void ConnectSignals () {
-                       vwin.VolumeChanged += new VolumeChangedHandler(OnVolumeChanged);
+
+               bool ImageLoaded {
+                       set {
+                               stillimageLoaded = value;
+                               drawbutton.Sensitive = !stillimageLoaded;
+                               playbutton.Sensitive = !stillimageLoaded;
+                               pausebutton.Sensitive = !stillimageLoaded;
+                               jumpspinbutton.Sensitive = !stillimageLoaded;
+                               timescale.Sensitive = !stillimageLoaded;
+                               vscale1.Sensitive = !stillimageLoaded;
+                       }
+                       get {
+                               return stillimageLoaded;
+                       }
+               }
+
+               void ConnectSignals ()
+               {
+                       vwin.VolumeChanged += new VolumeChangedHandler (OnVolumeChanged);
                        closebutton.Clicked += OnClosebuttonClicked;
                        prevbutton.Clicked += OnPrevbuttonClicked;
                        nextbutton.Clicked += OnNextbuttonClicked;
@@ -341,96 +380,118 @@ namespace LongoMatch.Gui
                        timescale.ValueChanged += OnTimescaleValueChanged;
                        timescale.AdjustBounds += OnTimescaleAdjustBounds;                      
                        vscale1.FormatValue += OnVscale1FormatValue;
-            vscale1.ValueChanged += OnVscale1ValueChanged;
+                       vscale1.ValueChanged += OnVscale1ValueChanged;
 
                }
-               
-               void LoadSegment (string filename, Time start, Time stop, Time seekTime,
-                                 bool playing, float rate = 1) {
+
+               void LoadSegment (MediaFile file, Time start, Time stop, Time seekTime,
+                                 bool playing, float rate = 1)
+               {
                        Log.Debug (String.Format ("Update player segment {0} {1} {2}",
-                                                 start.ToMSecondsString(),
-                                                 stop.ToMSecondsString(), rate));
+                                                 start.ToMSecondsString (),
+                                                 stop.ToMSecondsString (), rate));
                        if (filename != this.filename) {
-                               Open (filename, false);
+                               Open (file.FilePath, false);
                        }
                        Pause ();
                        segment.Start = start;
                        segment.Stop = stop;
                        rate = rate == 0 ? 1 : rate;
-                       closebutton.Show();
+                       closebutton.Show ();
+                       ImageLoaded = false;
                        if (readyToSeek) {
                                Log.Debug ("Player is ready to seek, seeking to " +
-                                          start.ToMSecondsString());
-                               SetScaleValue ((int) (rate * SCALE_FPS));
-                               player.Rate = (double) rate;
+                                       start.ToMSecondsString ());
+                               SetScaleValue ((int)(rate * SCALE_FPS));
+                               player.Rate = (double)rate;
                                player.Seek (seekTime, true);
                                if (playing) {
                                        Play ();
                                }
                        } else {
                                Log.Debug ("Delaying seek until player is ready");
-                               pendingSeek = new object[3] {seekTime, rate, playing};
+                               pendingSeek = new object[3] { seekTime, rate, playing };
                        }
                }
 
-               void LoadDrawing (FrameDrawing drawing) {
-                       Pause ();
-                       ignoreTick = true;
-                       player.Seek (drawing.Render, true);
-                       ignoreTick = false;
-                       blackboard.Background = player.GetCurrentFrame () ;
+               void LoadImage (Image image, FrameDrawing drawing)
+               {
+                       blackboard.Background = image;
                        blackboard.Drawing = drawing;
                        DrawingsVisible = true;
                        blackboarddrawingarea.QueueDraw ();
                        videodrawingarea.Visible = false;
                }
 
-               void SetScaleValue (int value) {
+               void LoadStillImage (Image image)
+               {
+                       ImageLoaded = true;
+                       LoadImage (image, null);
+               }
+
+               void LoadFrameDrawing (FrameDrawing drawing)
+               {
+                       ImageLoaded = true;
+                       LoadImage (null, drawing);
+               }
+
+               void LoadPlayDrawing (FrameDrawing drawing)
+               {
+                       Pause ();
+                       ignoreTick = true;
+                       player.Seek (drawing.Render, true);
+                       ignoreTick = false;
+                       LoadImage (player.GetCurrentFrame (), drawing);
+               }
+
+               void SetScaleValue (int value)
+               {
                        emitRateScale = false;
                        vscale1.Value = value;
                        emitRateScale = true;
                }
-               
-               float GetRateFromScale() {
-                       VScale scale= vscale1;
+
+               float GetRateFromScale ()
+               {
+                       VScale scale = vscale1;
                        double val = scale.Value;
 
-                       if(val > SCALE_FPS) {
-                               val = val + 1 - SCALE_FPS ;
-                       }
-                       else if(val <= SCALE_FPS) {
+                       if (val > SCALE_FPS) {
+                               val = val + 1 - SCALE_FPS;
+                       } else if (val <= SCALE_FPS) {
                                val = val / SCALE_FPS;
                        }
                        return (float)val;
                }
 
-               void Jump (int jump) {
+               void Jump (int jump)
+               {
                        Time pos = CurrentTime + (jump * 1000);
                        if (pos.MSeconds < 0)
                                pos.MSeconds = 0;
-                       Log.Debug (String.Format("Stepping {0} seconds from {1} to {2}", jump, CurrentTime, 
pos));
+                       Log.Debug (String.Format ("Stepping {0} seconds from {1} to {2}", jump, CurrentTime, 
pos));
                        DrawingsVisible = false;
                        Seek (pos, true);
                }
 
-               void SeekFromTimescale (double pos) {
+               void SeekFromTimescale (double pos)
+               {
                        Time seekPos, duration;
                        SeekType seekType;
 
-                       if(SegmentLoaded) {
+                       if (SegmentLoaded) {
                                duration = segment.Stop - segment.Start;
                                seekPos = segment.Start + duration * pos;
                                seekType = SeekType.Accurate;
-                       }
-                       else {
+                       } else {
                                duration = length;
                                seekPos = length * pos;
                                seekType = SeekType.Keyframe;
                        }
                        seeker.Seek (seekType, seekPos);
-                       timelabel.Text = seekPos.ToMSecondsString() + "/" + duration.ToMSecondsString();
+                       timelabel.Text = seekPos.ToMSecondsString () + "/" + duration.ToMSecondsString ();
                }
-               
+
                void CreatePlayer ()
                {
                        videodrawingarea.DoubleBuffered = false;
@@ -446,8 +507,9 @@ namespace LongoMatch.Gui
                        videodrawingarea.ExposeEvent += HandleExposeEvent;
                        videodrawingarea.CanFocus = false;
                }
-               
-               void ReconfigureTimeout (uint mseconds) {
+
+               void ReconfigureTimeout (uint mseconds)
+               {
                        if (timeout != 0) {
                                GLib.Source.Remove (timeout);
                                timeout = 0;
@@ -463,8 +525,7 @@ namespace LongoMatch.Gui
                                ReconfigureTimeout (20);
                                playbutton.Hide ();
                                pausebutton.Show ();
-                       }
-                       else {
+                       } else {
                                ReconfigureTimeout (0);
                                playbutton.Show ();
                                pausebutton.Hide ();
@@ -487,26 +548,29 @@ namespace LongoMatch.Gui
                        }
                        OnTick ();
                }
-
                #endregion
-
                #region Callbacks
                void HandleExposeEvent (object sender, ExposeEventArgs args)
                {
-                       player.Expose();
+                       player.Expose ();
                }
-               
-               void OnStateChanged(bool playing) {
+
+               void OnStateChanged (bool playing)
+               {
                        Application.Invoke (delegate {
-                               DoStateChanged (playing);});
+                               DoStateChanged (playing);
+                       });
                }
 
-               void OnReadyToSeek() {
+               void OnReadyToSeek ()
+               {
                        Application.Invoke (delegate {
-                               ReadyToSeek ();});
+                               ReadyToSeek ();
+                       });
                }
 
-               bool OnTick () {
+               bool OnTick ()
+               {
                        string slength;
                        Time currentTime;
 
@@ -521,24 +585,25 @@ namespace LongoMatch.Gui
 
                                dur = segment.Stop - segment.Start;
                                if (currentTime > segment.Stop) {
-                                       Pause();
+                                       Pause ();
+                                       Config.EventsBroker.EmitNextPlaylistElement (loadedPlaylist);
                                }
                                ct = currentTime - segment.Start;
-                               cp = (float)ct.MSeconds/(float)(dur.MSeconds);
-                               slength = dur.ToMSecondsString();
-                               timelabel.Text = ct.ToMSecondsString() + "/" + slength;
+                               cp = (float)ct.MSeconds / (float)(dur.MSeconds);
+                               slength = dur.ToMSecondsString ();
+                               timelabel.Text = ct.ToMSecondsString () + "/" + slength;
                                timescale.Value = cp;
                                if (loadedPlay != null && loadedPlay.Drawings.Count > 0) {
-                                       FrameDrawing fd = loadedPlay.Drawings.FirstOrDefault (f => f.Render > 
lastTime &&  f.Render <= currentTime);
+                                       FrameDrawing fd = loadedPlay.Drawings.FirstOrDefault (f => f.Render > 
lastTime && f.Render <= currentTime);
                                        if (fd != null) {
-                                               LoadDrawing (fd);
+                                               LoadPlayDrawing (fd);
                                        }
                                }
                        } else {
                                slength = length.ToMSecondsString ();
-                               timelabel.Text = currentTime.ToMSecondsString() + "/" + slength;
+                               timelabel.Text = currentTime.ToMSecondsString () + "/" + slength;
                                if (timescale.Visible) {
-                                       timescale.Value = (double) currentTime.MSeconds / length.MSeconds;
+                                       timescale.Value = (double)currentTime.MSeconds / length.MSeconds;
                                }
                        }
                        lastTime = currentTime;
@@ -551,11 +616,11 @@ namespace LongoMatch.Gui
                        return true;
                }
 
-               void OnTimescaleAdjustBounds(object o, Gtk.AdjustBoundsArgs args)
+               void OnTimescaleAdjustBounds (object o, Gtk.AdjustBoundsArgs args)
                {
                        double pos;
 
-                       if(!seeking) {
+                       if (!seeking) {
                                seeking = true;
                                IsPlayingPrevState = player.Playing;
                                ignoreTick = true;
@@ -565,103 +630,103 @@ namespace LongoMatch.Gui
                        }
 
                        pos = timescale.Value;
-                       seeksQueue[0] = seeksQueue[1];
-                       seeksQueue[1] = pos;
+                       seeksQueue [0] = seeksQueue [1];
+                       seeksQueue [1] = pos;
 
-                       SeekFromTimescale(pos);
+                       SeekFromTimescale (pos);
                }
 
-               void OnTimescaleValueChanged(object sender, System.EventArgs e)
+               void OnTimescaleValueChanged (object sender, System.EventArgs e)
                {
-                       if(seeking) {
+                       if (seeking) {
                                /* Releasing the timescale always report value different from the real one.
                                 * We need to cache previous position and seek again to the this position */
-                               SeekFromTimescale(seeksQueue[0] != -1 ? seeksQueue[0] : seeksQueue[1]);
-                               seeking=false;
+                               SeekFromTimescale (seeksQueue [0] != -1 ? seeksQueue [0] : seeksQueue [1]);
+                               seeking = false;
                                ignoreTick = false;
-                               if(IsPlayingPrevState)
+                               if (IsPlayingPrevState)
                                        Play ();
                        }
                }
 
-               void OnPlaybuttonClicked(object sender, System.EventArgs e)
+               void OnPlaybuttonClicked (object sender, System.EventArgs e)
                {
-                       Play();
+                       Play ();
                }
 
-               void OnVolumebuttonClicked(object sender, System.EventArgs e)
+               void OnVolumebuttonClicked (object sender, System.EventArgs e)
                {
-                       vwin.SetLevel(player.Volume);
-                       vwin.Show();
+                       vwin.SetLevel (player.Volume);
+                       vwin.Show ();
                }
 
-               void OnVolumeChanged(double level) {
+               void OnVolumeChanged (double level)
+               {
                        player.Volume = level;
-                       if(level == 0)
+                       if (level == 0)
                                muted = true;
                        else
                                muted = false;
                }
 
-               void OnPausebuttonClicked(object sender, System.EventArgs e)
+               void OnPausebuttonClicked (object sender, System.EventArgs e)
                {
                        Pause ();
                }
 
-               void OnEndOfStream (object o, EventArgs args) {
+               void OnEndOfStream (object o, EventArgs args)
+               {
                        Application.Invoke (delegate {
                                player.Seek (new Time (0), true);
                                Pause ();
                        });
                }
 
-               void OnError(string message) {
+               void OnError (string message)
+               {
                        Application.Invoke (delegate {
                                Config.EventsBroker.EmitMultimediaError (message);
                        });
                }
 
-               void OnClosebuttonClicked(object sender, System.EventArgs e)
+               void OnClosebuttonClicked (object sender, System.EventArgs e)
                {
-                       CloseSegment();
+                       CloseSegment ();
                        Play ();
                }
 
-               void OnPrevbuttonClicked(object sender, System.EventArgs e)
+               void OnPrevbuttonClicked (object sender, System.EventArgs e)
                {
-                       if (segment.Start.MSeconds > 0)
-                               Seek (segment.Start, true);
-                       Config.EventsBroker.EmitPrev();
+                       Config.EventsBroker.EmitPreviousPlaylistElement (loadedPlaylist);
                }
 
-               void OnNextbuttonClicked(object sender, System.EventArgs e)
+               void OnNextbuttonClicked (object sender, System.EventArgs e)
                {
-                       Config.EventsBroker.EmitNext();
+                       Config.EventsBroker.EmitNextPlaylistElement (loadedPlaylist);
                }
 
-               void OnVscale1FormatValue(object o, Gtk.FormatValueArgs args)
+               void OnVscale1FormatValue (object o, Gtk.FormatValueArgs args)
                {
                        double val = args.Value;
-                       if(val >= SCALE_FPS) {
-                               val = val + 1 - SCALE_FPS ;
-                               args.RetVal = val +"X";
-                       } else if(val < SCALE_FPS) {
-                               args.RetVal = "-"+val+"/"+SCALE_FPS+"X";
+                       if (val >= SCALE_FPS) {
+                               val = val + 1 - SCALE_FPS;
+                               args.RetVal = val + "X";
+                       } else if (val < SCALE_FPS) {
+                               args.RetVal = "-" + val + "/" + SCALE_FPS + "X";
                        }
                }
 
-               void OnVscale1ValueChanged(object sender, System.EventArgs e)
+               void OnVscale1ValueChanged (object sender, System.EventArgs e)
                {
-                       float val = GetRateFromScale();
+                       float val = GetRateFromScale ();
 
                        // Mute for rate != 1
-                       if(val != 1 && player.Volume != 0) {
+                       if (val != 1 && player.Volume != 0) {
                                previousVLevel = player.Volume;
-                               player.Volume=0;
-                       }
-                       else if(val != 1 && muted)
+                               player.Volume = 0;
+                       } else if (val != 1 && muted)
                                previousVLevel = 0;
-                       else if(val ==1)
+                       else if (val == 1)
                                player.Volume = previousVLevel;
 
                        player.Rate = val;
@@ -670,23 +735,23 @@ namespace LongoMatch.Gui
                        }
                }
 
-               void OnVideoboxButtonPressEvent(object o, Gtk.ButtonPressEventArgs args)
+               void OnVideoboxButtonPressEvent (object o, Gtk.ButtonPressEventArgs args)
                {
-                       if(filename == null)
+                       if (filename == null)
                                return;
                        /* FIXME: The pointer is grabbed when the event box is clicked.
                         * Make sure to ungrab it in order to avoid clicks outisde the window
                         * triggering this callback. This should be fixed properly.*/
-                       Pointer.Ungrab(Gtk.Global.CurrentEventTime);
-                       if(!player.Playing)
-                               Play();
+                       Pointer.Ungrab (Gtk.Global.CurrentEventTime);
+                       if (!player.Playing)
+                               Play ();
                        else
-                               Pause();
+                               Pause ();
                }
 
-               void OnVideoboxScrollEvent(object o, Gtk.ScrollEventArgs args)
+               void OnVideoboxScrollEvent (object o, Gtk.ScrollEventArgs args)
                {
-                       switch(args.Event.Direction) {
+                       switch (args.Event.Direction) {
                        case ScrollDirection.Down:
                                SeekToPreviousFrame ();
                                break;
@@ -694,30 +759,30 @@ namespace LongoMatch.Gui
                                SeekToNextFrame ();
                                break;
                        case ScrollDirection.Left:
-                               StepBackward();
+                               StepBackward ();
                                break;
                        case ScrollDirection.Right:
-                               StepForward();
+                               StepForward ();
                                break;
                        }
                }
 
-               void OnDrawButtonClicked(object sender, System.EventArgs e)
+               void OnDrawButtonClicked (object sender, System.EventArgs e)
                {
                        Config.EventsBroker.EmitDrawFrame (null, -1);
                }
-               
+
                void HandleRealized (object sender, EventArgs e)
                {
                        player.WindowHandle = WindowHandle.GetWindowHandle (videodrawingarea.GdkWindow);
                }
-               
+
                void HandleSeekEvent (SeekType type, Time start, float rate)
                {
                        DrawingsVisible = false;
                        /* We only use it for backwards framestepping for now */
                        if (type == SeekType.StepDown || type == SeekType.StepUp) {
-                               if(player.Playing)
+                               if (player.Playing)
                                        Pause ();
                                if (type == SeekType.StepDown)
                                        player.SeekToPreviousFrame ();
@@ -727,13 +792,12 @@ namespace LongoMatch.Gui
                                        SeekEvent (CurrentTime);
                        }
                        if (type == SeekType.Accurate || type == SeekType.Keyframe) {
-                               player.Rate = (double) rate;
+                               player.Rate = (double)rate;
                                player.Seek (start, type == SeekType.Accurate);
                                if (SeekEvent != null)
                                        SeekEvent (start);
                        }
                }
-
                #endregion
        }
 }
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs 
b/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
index fff9aa3..3fcca97 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
@@ -22,6 +22,8 @@ using LongoMatch.Interfaces.GUI;
 using LongoMatch.Common;
 using LongoMatch.Store;
 using System.Collections.Generic;
+using LongoMatch.Interfaces;
+using LongoMatch.Store.Playlists;
 
 namespace LongoMatch.Gui
 {
@@ -209,17 +211,17 @@ namespace LongoMatch.Gui
                        playerbin.ResetGui ();
                }
                
-               public void LoadPlayListPlay (PlayListPlay play, bool hasNext) {
-                       playerbin.LoadPlayListPlay (play, hasNext);
+               public void LoadPlayListPlay (Playlist playlist, IPlaylistElement play) {
+                       playerbin.LoadPlayListPlay (playlist, play);
                }
                
-               public void LoadPlay (string filename, Play play, Time seekTime, bool playing) {
+               public void LoadPlay (MediaFile file, Play play, Time seekTime, bool playing) {
                        if (mode == PlayerOperationMode.PreviewCapturer) {
                                backtolivebutton.Visible = true;
                                ShowPlayer ();
-                               LoadBackgroundPlayer(filename);
+                               LoadBackgroundPlayer(file);
                        }
-                       playerbin.LoadPlay (filename, play, seekTime, playing);
+                       playerbin.LoadPlay (file, play, seekTime, playing);
                }
                
                public void Seek (Time time, bool accurate) {
@@ -283,13 +285,13 @@ namespace LongoMatch.Gui
                        
                }
                
-               void LoadBackgroundPlayer (string filename) {
+               void LoadBackgroundPlayer (MediaFile file) {
                        if (backLoaded)
                                return;
                                
                        /* The output video file is now created, it's time to 
                                 * load it in the player */
-                       playerbin.Open (filename);
+                       playerbin.Open (file.FilePath);
                        playerbin.SeekingEnabled = false;
                        Log.Debug ("Loading encoded file in the backround player");
                        backLoaded = true;
diff --git a/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs 
b/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
index 8437c3e..bce8696 100644
--- a/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
+++ b/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
@@ -15,18 +15,11 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 //
-using System;
-using LongoMatch.Interfaces.GUI;
-using LongoMatch.Handlers;
-using LongoMatch.Common;
-using LongoMatch.Store;
-using LongoMatch.Interfaces;
-using LongoMatch.Store.Templates;
 using System.Collections.Generic;
-using Gdk;
 using Gtk;
-using LongoMatch.Gui.Helpers;
-using Mono.Unix;
+using LongoMatch.Common;
+using LongoMatch.Interfaces.GUI;
+using LongoMatch.Store;
 
 namespace LongoMatch.Gui.Component
 {
@@ -69,12 +62,6 @@ namespace LongoMatch.Gui.Component
                        }
                }
                
-               public IPlaylistWidget Playlist{
-                       get {
-                               return null;
-                       }
-               }
-               
                public bool Fullscreen {
                        set {
                                playercapturer.FullScreen = value;
diff --git a/LongoMatch.GUI/Gui/Component/ButtonsWidget.cs b/LongoMatch.GUI/Gui/Component/ButtonsWidget.cs
index 2cdb51f..302c59d 100644
--- a/LongoMatch.GUI/Gui/Component/ButtonsWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/ButtonsWidget.cs
@@ -50,6 +50,7 @@ namespace LongoMatch.Gui.Component
                {
                        this.Build();
                        tagger = new PlaysTagger (new WidgetWrapper (drawingarea1));
+                       tagger.FitMode = FitMode.Original;
                        tagger.TaggersSelectedEvent += HandleTaggersSelectedEvent;
                        tagger.ShowMenuEvent += HandleShowMenuEvent;
                        tagger.NewTagEvent += HandleNewTagEvent;
diff --git a/LongoMatch.GUI/Gui/Component/CodingWidget.cs b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
index 844c4e9..85f062d 100644
--- a/LongoMatch.GUI/Gui/Component/CodingWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
@@ -31,7 +31,6 @@ namespace LongoMatch.Gui.Component
        public partial class CodingWidget : Gtk.Bin
        {
                TeamTagger teamtagger;
-               Project project;
                ProjectType projectType;
                List<Player> selectedPlayers;
                Play loadedPlay;
@@ -78,7 +77,6 @@ namespace LongoMatch.Gui.Component
                }
 
                public void SetProject (Project project, ProjectType projectType, PlaysFilter filter) {
-                       this.project = project; 
                        this.projectType = projectType;
                        autoTaggingMode.Active = true;
                        buttonswidget.Visible = true;
diff --git a/LongoMatch.GUI/Gui/Component/PlayListWidget.cs b/LongoMatch.GUI/Gui/Component/PlayListWidget.cs
index b8dc78a..7e74fbb 100644
--- a/LongoMatch.GUI/Gui/Component/PlayListWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/PlayListWidget.cs
@@ -17,113 +17,102 @@
 //Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 //
 //
-
-using System;
+using System.Linq;
+using System.Collections.Generic;
 using Gtk;
 using LongoMatch.Common;
 using LongoMatch.Handlers;
-using LongoMatch.Store;
 using LongoMatch.Interfaces;
-using LongoMatch.Interfaces.GUI;
-
+using LongoMatch.Store.Playlists;
+using LongoMatch.Store;
+using Mono.Unix;
 
 namespace LongoMatch.Gui.Component
 {
-
        [System.ComponentModel.Category("LongoMatch")]
        [System.ComponentModel.ToolboxItem(true)]
-       public partial class PlayListWidget : Gtk.Bin, IPlaylistWidget
+       public partial class PlayListWidget : Gtk.Bin
        {
-               public event PlayListNodeSelectedHandler PlayListNodeSelected;
-               public event OpenPlaylistHandler OpenPlaylistEvent;
-               public event NewPlaylistHandler NewPlaylistEvent;
-               public event SavePlaylistHandler SavePlaylistEvent;
-               public event RenderPlaylistHandler RenderPlaylistEvent;
-               
-               IPlayList playlist;
-               
-               public PlayListWidget()
+               Project project;
+
+               public PlayListWidget ()
                {
-                       this.Build();
+                       this.Build ();
                        playlisttreeview1.Reorderable = true;
-                       playlisttreeview1.RowActivated += OnPlaylisttreeview1RowActivated;
-                       savebutton.Sensitive = false;
-                       newvideobutton.Sensitive = false;
-
+                       playlisttreeview1.RowActivated += HandleRowActivated;
                        newbutton.CanFocus = false;
-                       openbutton.CanFocus = false;
-                       savebutton.CanFocus = false;
                        newvideobutton.CanFocus = false;
+                       Config.EventsBroker.PlaylistsChangedEvent += HandlePlaylistsChangedEvent;
+                       Config.EventsBroker.PlaylistElementSelectedEvent += 
HandlePlaylistElementSelectedEvent;
                }
 
-               public void Load(IPlayList playlist) {
-                       this.playlist = playlist;
-                       label1.Visible = false;
-                       newvideobutton.Show();
-                       playlisttreeview1.PlayList = playlist;
-                       playlisttreeview1.Sensitive = true;
-                       savebutton.Sensitive = true;
-                       newvideobutton.Sensitive = true;
-                       Model = GetModel(playlist);
+               protected override void OnDestroyed ()
+               {
+                       Config.EventsBroker.PlaylistsChangedEvent -= HandlePlaylistsChangedEvent;
+                       Config.EventsBroker.PlaylistElementSelectedEvent -= 
HandlePlaylistElementSelectedEvent;
+                       base.OnDestroyed ();
                }
 
-               public ListStore Model {
-                       set {
-                               playlisttreeview1.Model = value;
-                       }
-                       get {
-                               return (ListStore)playlisttreeview1.Model;
-                       }
+               void HandlePlaylistsChangedEvent (object sender)
+               {
+                       if (sender != playlisttreeview1)
+                               playlisttreeview1.Reload ();
                }
 
-               public void Add(PlayListPlay plNode) {
-                       Model.AppendValues(plNode);
-               }
-               
-               public void SetActivePlay (PlayListPlay plNode, int index) {
-                       playlisttreeview1.Selection.SelectPath(new TreePath(index.ToString()));
-                       playlisttreeview1.LoadedPlay = plNode;
-               }
-               
-               ListStore GetModel(IPlayList playlist) {
-                       ListStore listStore = new ListStore(typeof(PlayListPlay));
-                       foreach(PlayListPlay plNode in playlist) {
-                               listStore.AppendValues(plNode);
-                       }
-                       return listStore;
+               void HandlePlaylistElementSelectedEvent (Playlist playlist, IPlaylistElement element)
+               {
+                       playlisttreeview1.QueueDraw ();
                }
 
-               protected virtual void OnPlaylisttreeview1RowActivated(object o, Gtk.RowActivatedArgs args)
+               void HandleRowActivated (object o, RowActivatedArgs args)
                {
-                       if (PlayListNodeSelected != null) {
                                TreeIter iter;
-                               Model.GetIterFromString(out iter, args.Path.ToString());
-                               PlayListNodeSelected(Model.GetValue(iter, 0) as PlayListPlay);
-                       }
-               }
-               
-               protected virtual void OnSavebuttonClicked(object sender, System.EventArgs e)
-               {
-                       if (SavePlaylistEvent != null)
-                               SavePlaylistEvent();
+                               Playlist playlist;
+                               IPlaylistElement element;
+                               
+                               playlisttreeview1.Model.GetIterFromString (out iter, args.Path.ToString ());
+                               var el = playlisttreeview1.Model.GetValue (iter, 0);
+                               if (el is Playlist) {
+                                       playlist = el as Playlist;
+                                       element = playlist.Elements.FirstOrDefault ();
+                               } else {
+                                       TreeIter parent;
+                                       playlisttreeview1.Model.IterParent (out parent, iter);
+                                       playlist = playlisttreeview1.Model.GetValue (parent, 0) as Playlist;
+                                       element = el as IPlaylistElement;
+                               }
+                       Config.EventsBroker.EmitPlaylistElementSelected (playlist, element);
                }
 
-               protected virtual void OnOpenbuttonClicked(object sender, System.EventArgs e)
-               {
-                       if (OpenPlaylistEvent != null)
-                               OpenPlaylistEvent();
+               public Project Project {
+                       set {
+                               project = value;
+                               playlisttreeview1.Project = value;
+                       }
+                       get {
+                               return project;
+                       }
                }
 
-               protected virtual void OnNewbuttonClicked(object sender, System.EventArgs e)
+               protected virtual void OnNewbuttonClicked (object sender, System.EventArgs e)
                {
-                       if (NewPlaylistEvent != null)
-                               NewPlaylistEvent();
+                       Config.EventsBroker.EmitNewPlaylist (Project);
                }
-               
-               protected virtual void OnNewvideobuttonClicked(object sender, System.EventArgs e)
+
+               protected virtual void OnNewvideobuttonClicked (object sender, System.EventArgs ea)
                {
-                       if (RenderPlaylistEvent != null)
-                               RenderPlaylistEvent((PlayList)playlist);
+                       Menu menu;
+
+                       menu = new Menu ();
+                       foreach (Playlist playlist in Project.Playlists) {
+                               MenuItem plmenu = new MenuItem (playlist.Name);
+                               plmenu.Activated += (s, e) => {
+                                       Config.EventsBroker.EmitRenderPlaylist (playlist);
+                               };
+                               menu.Append (plmenu);
+                       }
+                       menu.ShowAll ();
+                       menu.Popup ();
                }
        }
 }
diff --git a/LongoMatch.GUI/Gui/Component/PlayersListTreeWidget.cs 
b/LongoMatch.GUI/Gui/Component/PlayersListTreeWidget.cs
index efa7003..361567a 100644
--- a/LongoMatch.GUI/Gui/Component/PlayersListTreeWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/PlayersListTreeWidget.cs
@@ -22,6 +22,7 @@ using Gtk;
 using LongoMatch.Common;
 using LongoMatch.Handlers;
 using LongoMatch.Store;
+using LongoMatch.Store.Playlists;
 using LongoMatch.Store.Templates;
 
 
@@ -89,16 +90,17 @@ namespace LongoMatch.Gui.Component
 
                protected virtual void OnNewRenderingJob (object sender, EventArgs args)
                {
-                       PlayList playlist = new PlayList();
+                       Playlist playlist = new Playlist();
                        TreePath[] paths = playerstreeview.Selection.GetSelectedRows();
 
                        foreach(var path in paths) {
                                TreeIter iter;
-                               Play play;
+                               PlaylistPlayElement element;
                                
                                playerstreeview.Model.GetIter(out iter, path);
-                               play = (Play)playerstreeview.Model.GetValue(iter, 0);
-                               playlist.Add(new PlayListPlay(play, Project.Description.File, true));
+                               element = new PlaylistPlayElement (playerstreeview.Model.GetValue(iter, 0) as 
Play,
+                                                                  Project.Description.File);
+                               playlist.Elements.Add (element);
                        }
                        
                        Config.EventsBroker.EmitRenderPlaylist (playlist);
diff --git a/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs 
b/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
index eb730f3..9035885 100644
--- a/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
@@ -28,6 +28,7 @@ using LongoMatch.Interfaces;
 using LongoMatch.Store;
 using LongoMatch.Store.Templates;
 using LongoMatch.Common;
+using LongoMatch.Store.Playlists;
 
 namespace LongoMatch.Gui.Component
 {
@@ -38,7 +39,7 @@ namespace LongoMatch.Gui.Component
        public partial class PlaysListTreeWidget : Gtk.Bin
        {
 
-               private Project project;
+               Project project;
 
                public PlaysListTreeWidget()
                {
@@ -106,15 +107,17 @@ namespace LongoMatch.Gui.Component
                public Project Project {
                        set {
                                project = value;
-                               if(project != null) {
-                                       treeview.Model = GetModel(project);
+                               if (project != null) {
+                                       treeview.Model = GetModel (project);
                                        treeview.Colors = true;
                                        treeview.Project = value;
-                               }
-                               else {
+                               } else {
                                        treeview.Model = null;
                                }
                        }
+                       get {
+                               return project;
+                       }
                }
 
                private TreeStore GetModel(Project project){
@@ -150,16 +153,20 @@ namespace LongoMatch.Gui.Component
 
                protected virtual void OnNewRenderingJob (object sender, EventArgs args)
                {
-                       PlayList playlist = new PlayList();
-                       TreePath[] paths = treeview.Selection.GetSelectedRows();
+                       Playlist playlist;
+                       TreePath[] paths;
+
+                       playlist = new Playlist();
+                       paths = treeview.Selection.GetSelectedRows();
 
                        foreach(var path in paths) {
                                TreeIter iter;
-                               Play play;
+                               PlaylistPlayElement element;
                                
                                treeview.Model.GetIter(out iter, path);
-                               play = (Play)treeview.Model.GetValue(iter, 0);
-                               playlist.Add (new PlayListPlay(play, project.Description.File, true));
+                               element = new PlaylistPlayElement (treeview.Model.GetValue(iter, 0) as Play,
+                                                                  project.Description.File);
+                               playlist.Elements.Add (element);
                        }
                        
                        Config.EventsBroker.EmitRenderPlaylist (playlist);
diff --git a/LongoMatch.GUI/Gui/Component/PlaysPositionViewer.cs 
b/LongoMatch.GUI/Gui/Component/PlaysPositionViewer.cs
index 1053497..ed73ccc 100644
--- a/LongoMatch.GUI/Gui/Component/PlaysPositionViewer.cs
+++ b/LongoMatch.GUI/Gui/Component/PlaysPositionViewer.cs
@@ -28,7 +28,7 @@ namespace LongoMatch.Gui.Component
        {
        
                PlaysMenu menu;
-               MediaFile file;
+               Project project;
 
                public PlaysPositionViewer ()
                {
@@ -44,8 +44,8 @@ namespace LongoMatch.Gui.Component
                }
 
                public void LoadProject (Project project) {
+                       this.project = project;
                        if (project != null) {
-                               file = project.Description.File;
                                field.Tagger.Background = project.GetBackground (FieldPositionType.Field);
                                hfield.Tagger.Background = project.GetBackground 
(FieldPositionType.HalfField);
                                goal.Tagger.Background = project.GetBackground (FieldPositionType.Goal);
@@ -82,12 +82,12 @@ namespace LongoMatch.Gui.Component
                        }
                }
 
-               void HandleShowMenuEvent (System.Collections.Generic.List<Play> plays)
+               void HandleShowMenuEvent (List<Play> plays)
                {
                        if (plays == null || plays.Count == 0) {
                                return;
                        }
-                       menu.ShowMenu (plays, file);
+                       menu.ShowMenu (project, plays);
                }
 
                protected override void OnDestroyed ()
diff --git a/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs 
b/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs
index b4ade9a..c563688 100644
--- a/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs
@@ -43,6 +43,18 @@ namespace LongoMatch.Gui.Component
                        visitorPlayersList.Team = Team.VISITOR;
                        AddFilters();
                        Config.EventsBroker.TeamTagsChanged += UpdateTeamsModels;
+                       notebook1.Page = 0;
+                       notebook2.Page = 0;
+               }
+               
+               protected override void OnDestroyed ()
+               {
+                       Config.EventsBroker.TeamTagsChanged -= UpdateTeamsModels;
+                       playsList.Project = null;
+                       localPlayersList.Clear();
+                       visitorPlayersList.Clear();
+                       playsList1.Destroy ();
+                       base.OnDestroyed ();
                }
                
                #region Plubic Methods
@@ -58,18 +70,12 @@ namespace LongoMatch.Gui.Component
                        playsList.Project=project;
                        visitorPlayersList.Project = project;
                        localPlayersList.Project = project;
+                       playlistwidget.Project = project;
                        visitorPlaysList.LabelProp = project.VisitorTeamTemplate.TeamName;
                        localPlaysList.LabelProp = project.LocalTeamTemplate.TeamName;
                        UpdateTeamsModels();
                }
                
-               public void Clear() {
-                       Config.EventsBroker.TeamTagsChanged -= UpdateTeamsModels;
-                       playsList.Project = null;
-                       localPlayersList.Clear();
-                       visitorPlayersList.Clear();
-               }
-               
                public void AddPlay(Play play) {
                        playsList.AddPlay(play);
                        UpdateTeamsModels();
diff --git a/LongoMatch.GUI/Gui/Component/Timeline.cs b/LongoMatch.GUI/Gui/Component/Timeline.cs
index 41f1384..50c2e0f 100644
--- a/LongoMatch.GUI/Gui/Component/Timeline.cs
+++ b/LongoMatch.GUI/Gui/Component/Timeline.cs
@@ -43,6 +43,7 @@ namespace LongoMatch.Gui.Component
                uint timeoutID;
                Time currentTime, nextCurrentTime;
                PlaysMenu menu;
+               Project project;
 
                public Timeline ()
                {
@@ -80,9 +81,10 @@ namespace LongoMatch.Gui.Component
                }
                
                public void SetProject (Project project, PlaysFilter filter) {
+                       this.project = project;
                        timeline.LoadProject (project, filter);
                        labels.LoadProject (project, filter);
-                       
+
                        if(project == null) {
                                if (timeoutID != 0) {
                                        GLib.Source.Remove (timeoutID);
@@ -160,7 +162,7 @@ namespace LongoMatch.Gui.Component
                
                void HandleShowMenu (List<Play> plays, Category cat, Time time)
                {
-                       menu.ShowTimelineMenu (plays, cat, time, projectFile);
+                       menu.ShowTimelineMenu (project, plays, cat, time);
                }
        }
 }
diff --git a/LongoMatch.GUI/Gui/GUIToolkit.cs b/LongoMatch.GUI/Gui/GUIToolkit.cs
index e08d91a..4d19ab2 100644
--- a/LongoMatch.GUI/Gui/GUIToolkit.cs
+++ b/LongoMatch.GUI/Gui/GUIToolkit.cs
@@ -19,23 +19,18 @@ using System;
 using System.Collections.Generic;
 using System.IO;
 using Gtk;
-using Gdk;
-using Mono.Unix;
-
-using Image = LongoMatch.Common.Image;
 using LongoMatch.Common;
-using LongoMatch.Interfaces;
+using LongoMatch.Gui.Helpers;
 using LongoMatch.Interfaces.GUI;
-using LongoMatch.Gui.Component;
-using LongoMatch.Gui.Dialog;
-using LongoMatch.Gui.Popup;
 using LongoMatch.Store;
-using LongoMatch.Store.Templates;
+using LongoMatch.Store.Playlists;
 using LongoMatch.Video.Utils;
-using LongoMatch.Gui.Helpers;
-using LongoMatch.Stats;
+using Mono.Unix;
+using LongoMatch.Gui.Component;
+using LongoMatch.Gui.Dialog;
 using LongoMatch.Gui.Panel;
-using LongoMatch.Interfaces.Multimedia;
+using Image = LongoMatch.Common.Image;
+using LongoMatch.Interfaces;
 
 namespace LongoMatch.Gui
 {
@@ -93,12 +88,20 @@ namespace LongoMatch.Gui
                        MessagesHelpers.WarningMessage (parent as Widget, message);
                }
                
-               public bool QuestionMessage(string question, string title, object parent=null) {
+               public bool QuestionMessage (string question, string title, object parent=null)
+               {
                        if (parent == null)
                                parent = mainWindow as Widget;
                        return MessagesHelpers.QuestionMessage (parent as Widget, question, title);
                }
                
+               public string QueryMessage (string key, string title=null, string value="", object 
parent=null)
+               {
+                       if (parent == null)
+                               parent = mainWindow;
+                       return MessagesHelpers.QueryMessage (parent as Widget, key, title, value);
+               }
+               
                public string SaveFile(string title, string defaultName, string defaultFolder,
                        string filterName, string[] extensionFilter)
                {
@@ -127,44 +130,54 @@ namespace LongoMatch.Gui
                                                            defaultFolder, filterName, extensionFilter);
                }
                
-               public List<EditionJob> ConfigureRenderingJob (IPlayList playlist)
+               public List<EditionJob> ConfigureRenderingJob (Playlist playlist)
                {
                        VideoEditionProperties vep;
-                       List<EditionJob> jobs = new List<EditionJob>();
+                       List<EditionJob> jobs = new List<EditionJob> ();
                        int response;
                        
                        Log.Information ("Configure rendering job");
-                       if (playlist.Count == 0) {
-                               WarningMessage(Catalog.GetString("The playlist you want to render is 
empty."));
+                       if (playlist.Elements.Count == 0) {
+                               WarningMessage (Catalog.GetString ("The playlist you want to render is 
empty."));
                                return null;
                        }
 
-                       vep = new VideoEditionProperties();
+                       vep = new VideoEditionProperties ();
                        vep.TransientFor = mainWindow as Gtk.Window;
-                       response = vep.Run();
-                       while(response == (int)ResponseType.Ok) {
+                       response = vep.Run ();
+                       while (response == (int)ResponseType.Ok) {
                                if (!vep.SplitFiles && vep.EncodingSettings.OutputFile == "") {
-                                       WarningMessage(Catalog.GetString("Please, select a video file."));
-                                       response=vep.Run();
+                                       WarningMessage (Catalog.GetString ("Please, select a video file."));
+                                       response = vep.Run ();
                                } else if (vep.SplitFiles && vep.OutputDir == null) {
-                                       WarningMessage(Catalog.GetString("Please, select an output 
directory."));
-                                       response=vep.Run();
+                                       WarningMessage (Catalog.GetString ("Please, select an output 
directory."));
+                                       response = vep.Run ();
                                } else {
                                        break;
                                }
                        }
-                       if(response ==(int)ResponseType.Ok) {
+                       if (response == (int)ResponseType.Ok) {
                                if (!vep.SplitFiles) {
-                                       jobs.Add(new EditionJob(playlist, vep.EncodingSettings));
+                                       jobs.Add (new EditionJob (playlist, vep.EncodingSettings));
                                } else {
                                        int i = 0;
-                                       foreach (PlayListPlay play in playlist) {
-                                               EncodingSettings settings = vep.EncodingSettings;
-                                               PlayList pl = new PlayList();
-                                               string filename = String.Format ("{0}-{1}.{2}", 
i.ToString("d4"), play.Name,
-                                                                                
settings.EncodingProfile.Extension);
+                                       foreach (IPlaylistElement play in playlist.Elements) {
+                                               EncodingSettings settings;
+                                               Playlist pl;
+                                               string name, ext, filename;
+
+                                               settings = vep.EncodingSettings;
+                                               pl = new Playlist ();
+                                               if (play is PlaylistPlayElement) {
+                                                       name = (play as PlaylistPlayElement).Play.Name;
+                                                       ext = settings.EncodingProfile.Extension;
+                                               } else {
+                                                       name = "image";
+                                                       ext = "png";
+                                               }
+                                               filename = String.Format ("{0}-{1}.{2}", i.ToString("d4"), 
name, ext);
                                                
-                                               pl.Add(play);
+                                               pl.Elements.Add(play);
                                                settings.OutputFile = Path.Combine (vep.OutputDir, filename);
                                                jobs.Add(new EditionJob(pl, settings));
                                                i++;
diff --git a/LongoMatch.GUI/Gui/Menu/PlaysMenu.cs b/LongoMatch.GUI/Gui/Menu/PlaysMenu.cs
index f168554..29352c7 100644
--- a/LongoMatch.GUI/Gui/Menu/PlaysMenu.cs
+++ b/LongoMatch.GUI/Gui/Menu/PlaysMenu.cs
@@ -16,12 +16,13 @@
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 //
 using System;
+using System.Linq;
 using System.Collections.Generic;
 using Gtk;
+using LongoMatch.Interfaces;
 using LongoMatch.Store;
-using LongoMatch.Handlers;
+using LongoMatch.Store.Playlists;
 using Mono.Unix;
-using LongoMatch.Common;
 
 namespace LongoMatch.Gui.Menus
 {
@@ -35,7 +36,7 @@ namespace LongoMatch.Gui.Menus
                List<Play> plays;
                Category cat;
                Time time;
-               MediaFile projectFile;
+               Project project;
        
                
                public PlaysMenu ()
@@ -43,31 +44,29 @@ namespace LongoMatch.Gui.Menus
                        CreateMenu ();
                }
                
-               public void ShowListMenu (List<Play> plays, MediaFile projectFile,
-                                         List<Category> categories) {
-                       ShowMenu (plays, null, null, projectFile, categories, true);
+               public void ShowListMenu (Project project, List<Play> plays) {
+                       ShowMenu (project, plays, null, null, project.Categories.CategoriesList, true);
                }
 
-               public void ShowMenu (List<Play> plays, MediaFile projectFile) {
-                       ShowMenu (plays, null, null, projectFile, null, false);
+               public void ShowMenu (Project project, List<Play> plays) {
+                       ShowMenu (project, plays, null, null, null, false);
                }
                
-               public void ShowTimelineMenu (List<Play> plays, Category cat, Time time,
-                                             MediaFile projectFile)
+               public void ShowTimelineMenu (Project project, List<Play> plays, Category cat, Time time)
                {
-                       ShowMenu (plays, cat, time, projectFile, null, false);
+                       ShowMenu (project, plays, cat, time, null, false);
                }
                
-               private void ShowMenu (List<Play> plays, Category cat, Time time,
-                                      MediaFile projectFile, List<Category> categories,
-                                      bool editableName) {
+               private void ShowMenu (Project project, List<Play> plays, Category cat, Time time,
+                                    List<Category> categories, bool editableName)
+               {
                        this.plays = plays;
                        this.cat = cat;
                        this.time = time;
-                       this.projectFile = projectFile;
+                       this.project = project;
 
                        if (cat != null) {
-                               string label = String.Format ("{0} in {1}", Catalog.GetString("Add new 
play"), cat.Name);
+                               string label = String.Format ("{0} in {1}", Catalog.GetString ("Add new 
play"), cat.Name);
                                GtkGlue.MenuItemSetLabel (newPlay, label); 
                                newPlay.Visible = true;
                        } else {
@@ -80,63 +79,90 @@ namespace LongoMatch.Gui.Menus
                        edit.Visible = editableName;
                        snapshot.Visible = plays.Count == 1;
                        moveCat.Visible = plays.Count == 1 && categories != null;
-                       drawings.Visible = plays.Count == 1 && plays[0].Drawings.Count > 0;
+                       drawings.Visible = plays.Count == 1 && plays [0].Drawings.Count > 0;
                        del.Visible = plays.Count > 0;
                        addPLN.Visible = plays.Count > 0;
                        render.Visible = plays.Count > 0;
                        duplicate.Visible = plays.Count > 0;
 
-                       if (plays.Count > 0 ) {
-                               string label = String.Format ("{0} ({1})",Catalog.GetString("Delete"), 
plays.Count);
+                       if (plays.Count > 0) {
+                               string label = String.Format ("{0} ({1})", Catalog.GetString ("Delete"), 
plays.Count);
                                GtkGlue.MenuItemSetLabel (del, label);
-                               label = String.Format ("{0} ({1})",Catalog.GetString("Add to playlist"), 
plays.Count);
+                               label = String.Format ("{0} ({1})", Catalog.GetString ("Add to playlist"), 
plays.Count);
                                GtkGlue.MenuItemSetLabel (addPLN, label);
-                               label = String.Format ("{0} ({1})", Catalog.GetString("Export to video 
file"), plays.Count);
+                               label = String.Format ("{0} ({1})", Catalog.GetString ("Export to video 
file"), plays.Count);
                                GtkGlue.MenuItemSetLabel (render, label);
-                               label = String.Format ("{0} ({1})", Catalog.GetString("Duplicate "), 
plays.Count);
+                               label = String.Format ("{0} ({1})", Catalog.GetString ("Duplicate "), 
plays.Count);
                                GtkGlue.MenuItemSetLabel (duplicate, label);
                        }
                        
                        if (moveCat.Visible) {
-                               Menu catMenu = new Menu();
+                               Menu catMenu = new Menu ();
                                foreach (Category c in categories) {
-                                       if (plays[0].Category == c)
+                                       if (plays [0].Category == c)
                                                continue;
                                        var item = new MenuItem (c.Name);
                                        catMenu.Append (item);
                                        item.Activated += (sender, e) => {
-                                               Config.EventsBroker.EmitPlayCategoryChanged (plays[0], c);
+                                               Config.EventsBroker.EmitPlayCategoryChanged (plays [0], c);
                                        }; 
                                }
-                               catMenu.ShowAll();
+                               catMenu.ShowAll ();
                                moveCat.Submenu = catMenu;
                        }
                        
                        if (drawings.Visible) {
-                               Menu drawingsMenu = new Menu();
+                               Menu drawingsMenu = new Menu ();
                                for (int i=0; i < plays[0].Drawings.Count; i++) {
                                        int index = i;
                                        MenuItem drawingItem = new MenuItem (Catalog.GetString ("Drawing ") + 
(i + 1));
                                        MenuItem editItem = new MenuItem (Catalog.GetString ("Edit"));
                                        MenuItem deleteItem = new MenuItem (Catalog.GetString ("Delete"));
-                                       Menu drawingMenu = new Menu();
+                                       Menu drawingMenu = new Menu ();
 
                                        drawingsMenu.Append (drawingItem);
-                                       drawingMenu.Append  (editItem);
+                                       drawingMenu.Append (editItem);
                                        drawingMenu.Append (deleteItem);
                                        editItem.Activated += (sender, e) => {
-                                               Config.EventsBroker.EmitDrawFrame (plays[0], index);
+                                               Config.EventsBroker.EmitDrawFrame (plays [0], index);
                                        }; 
                                        deleteItem.Activated += (sender, e) => {
-                                               plays[0].Drawings.RemoveAt (index);
+                                               plays [0].Drawings.RemoveAt (index);
                                        }; 
                                        drawingItem.Submenu = drawingMenu;
                                        drawingMenu.ShowAll ();
                                }
-                               drawingsMenu.ShowAll();
+                               drawingsMenu.ShowAll ();
                                drawings.Submenu = drawingsMenu;
                        }
                        
+                       if (project.Playlists != null) {
+                               Menu plMenu = new Menu ();
+                               MenuItem item;
+
+                               foreach (Playlist pl in project.Playlists) {
+                                        item = new MenuItem (pl.Name);
+                                       plMenu.Append (item);
+                                       item.Activated += (sender, e) => {
+                                               IEnumerable<IPlaylistElement> elements;
+                                               
+                                               elements = plays.Select (p => new PlaylistPlayElement (p, 
project.Description.File));
+                                               Config.EventsBroker.EmitAddPlaylistElement (pl, 
elements.ToList());
+                                       }; 
+                               }
+                               
+                               item = new MenuItem (Catalog.GetString ("Create new playlist..."));
+                               plMenu.Append (item);
+                               item.Activated += (sender, e) => {
+                                       IEnumerable<IPlaylistElement> elements;
+                                       elements = plays.Select (p => new PlaylistPlayElement (p, 
project.Description.File));
+                                       Config.EventsBroker.EmitAddPlaylistElement (null, elements.ToList());
+                               }; 
+                               
+                               plMenu.ShowAll ();
+                               addPLN.Submenu = plMenu;
+                       }
+
                        Popup();
                }
                
@@ -167,8 +193,7 @@ namespace LongoMatch.Gui.Menus
                        drawings = new MenuItem (Catalog.GetString ("Drawings"));
                        Add (drawings);
 
-                       addPLN = new MenuItem ("");
-                       addPLN.Activated += (sender, e) => Config.EventsBroker.EmitPlayListNodeAdded (plays);
+                       addPLN = new MenuItem ("Add to playlist");
                        Add (addPLN);
                        
                        render = new MenuItem ("");
@@ -189,9 +214,9 @@ namespace LongoMatch.Gui.Menus
                
                void EmitRenderPlaylist (List<Play> plays)
                {
-                       PlayList pl = new PlayList();
+                       Playlist pl = new Playlist();
                        foreach (Play p in plays) {
-                               pl.Add (new PlayListPlay (p, projectFile, true));
+                               pl.Elements.Add (new PlaylistPlayElement (p, project.Description.File));
                        }
                        Config.EventsBroker.EmitRenderPlaylist (pl);
                }
diff --git a/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs b/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs
index dc4965f..2646fc2 100644
--- a/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs
+++ b/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs
@@ -131,8 +131,7 @@ namespace LongoMatch.Gui.Component
                }
                
                protected void ShowMenu () {
-                       playsMenu.ShowListMenu (SelectedPlays, Project.Description.File,
-                                               Project.Categories.CategoriesList);
+                       playsMenu.ShowListMenu (Project, SelectedPlays);
                }
 
                protected object GetValueFromPath(TreePath path) {
@@ -177,7 +176,7 @@ namespace LongoMatch.Gui.Component
                                if(o is Player)
                                        c.Markup = GLib.Markup.EscapeText ((o as Player).Name);
                                else
-                                       c.Markup = GLib.Markup.EscapeText ((o as TimeNode).Name);
+                                       c.Markup = GLib.Markup.EscapeText ((o as Category).Name);
                                return;
                        }
 
diff --git a/LongoMatch.GUI/Gui/TreeView/PlayListTreeView.cs b/LongoMatch.GUI/Gui/TreeView/PlayListTreeView.cs
index c6a21a5..644fef2 100644
--- a/LongoMatch.GUI/Gui/TreeView/PlayListTreeView.cs
+++ b/LongoMatch.GUI/Gui/TreeView/PlayListTreeView.cs
@@ -21,151 +21,303 @@ using System;
 using Gtk;
 using Gdk;
 using Mono.Unix;
-using LongoMatch.Store;
 using LongoMatch.Common;
 using LongoMatch.Handlers;
+using LongoMatch.Store.Playlists;
 using LongoMatch.Interfaces;
 using LongoMatch.Gui.Dialog;
+using LongoMatch.Store;
 
 namespace LongoMatch.Gui.Component
 {
-
-
        [System.ComponentModel.Category("LongoMatch")]
        [System.ComponentModel.ToolboxItem(true)]
        public class PlayListTreeView : Gtk.TreeView
        {
-               Menu menu;
-               ListStore ls;
-               IPlayList playlist;
-               PlayListPlay loadedPlay = null; //The play currently loaded in the player
-               PlayListPlay selectedPlay = null; //The play selected in the tree
-               int preDragPos = 0;
+               Project project;
+               Playlist selectedPlaylist;
+               IPlaylistElement selectedElement;
                TreeIter selectedIter;
+               Playlist dragSourcePlaylist;
+               IPlaylistElement dragSourceElement;
 
+               public PlayListTreeView ()
+               {
+                       HeadersVisible = false;
+                       EnableGridLines = TreeViewGridLines.None;
+                       EnableTreeLines = false;
+                       
+                       TreeViewColumn imageColumn = new TreeViewColumn ();
+                       imageColumn.Title = Catalog.GetString ("Image");
+                       CellRendererPixbuf imageCell = new CellRendererPixbuf ();
+                       imageColumn.PackStart (imageCell, true);
+                       imageColumn.SetCellDataFunc (imageCell, new TreeCellDataFunc (RenderImage));
+                       AppendColumn (imageColumn);
+                       
+                       TreeViewColumn nameColumn = new TreeViewColumn ();
+                       nameColumn.Title = Catalog.GetString ("Name");
+                       CellRendererText nameCell = new CellRendererText ();
+                       nameColumn.PackStart (nameCell, true);
+                       nameColumn.SetCellDataFunc (nameCell, new TreeCellDataFunc (RenderName));
+                       AppendColumn (nameColumn);
+               }
 
-               public PlayListTreeView() {
-
-                       this.HeadersVisible = false;
-
-                       ls = new ListStore(typeof(PlayListPlay));
-                       this.Model = ls;
-
-                       menu = new Menu();
-                       MenuItem title = new MenuItem(Catalog.GetString("Edit Title"));
-                       title.Activated += new EventHandler(OnTitle);
-                       title.Show();
-                       MenuItem delete = new MenuItem(Catalog.GetString("Delete"));
-                       delete.Activated += new EventHandler(OnDelete);
-                       delete.Show();
-                       menu.Append(title);
-                       menu.Append(delete);
+               public Project Project {
+                       set {
+                               project = value;
+                               Reload ();
+                       }
+                       get {
+                               return project;
+                       }
+               }
 
+               public void Reload ()
+               {
+                       TreeIter iter;
+                       TreeStore store = new TreeStore (typeof(object));
+                       
+                       if (project != null) {
+                               foreach (Playlist playlist in project.Playlists) {
+                                       iter = store.AppendValues (playlist);
+                                       foreach (IPlaylistElement el in playlist.Elements) {
+                                               store.AppendValues (iter, el);
+                                       }
+                               }
+                       }
+                       Model = store;
+               }
 
-                       Gtk.TreeViewColumn nameColumn = new Gtk.TreeViewColumn();
-                       nameColumn.Title = Catalog.GetString("Name");
-                       Gtk.CellRendererText nameCell = new Gtk.CellRendererText();
-                       nameColumn.PackStart(nameCell, true);
-                       nameColumn.SetCellDataFunc(nameCell, new Gtk.TreeCellDataFunc(RenderName));
-                       this.AppendColumn(nameColumn);
+               void RenderName (TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
+               {
+                       var obj = model.GetValue (iter, 0);
+                       
+                       if (obj is IPlaylistElement) {
+                               IPlaylistElement ple = obj as IPlaylistElement;
+                               (cell as Gtk.CellRendererText).Text = ple.Description;
+                               if (ple.Selected) {
+                                       (cell as Gtk.CellRendererText).Foreground = "blue";
+                               } else {
+                                       (cell as Gtk.CellRendererText).Foreground = "black";
+                               }
+                       } else {
+                               (cell as Gtk.CellRendererText).Text = (obj as Playlist).Name;
+                               (cell as Gtk.CellRendererText).Foreground = "black";
+                       }
                }
 
-               public IPlayList PlayList {
-                       set {
-                               this.playlist = value;
+               void RenderImage (TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
+               {
+                       var obj = model.GetValue (iter, 0);
+                       
+                       if (obj is IPlaylistElement) {
+                               IPlaylistElement ple = obj as IPlaylistElement;
+                               (cell as CellRendererPixbuf).Pixbuf = ple.Miniature.Value;
+                       } else {
+                               (cell as CellRendererPixbuf).Pixbuf = null;
                        }
                }
 
-               public PlayListPlay LoadedPlay {
-                       set {
-                               loadedPlay = value;
-                               this.QueueDraw();
+               void ShowPlaylistElementMenu (Playlist playlist, IPlaylistElement element)
+               {
+                       Menu menu;
+                       MenuItem edit, delete;
+
+                       menu = new Menu ();
+
+                       delete = new MenuItem (Catalog.GetString ("Delete"));
+                       delete.Activated += (sender, e) => {
+                               project.Playlists.Remove (playlist);
+                               (Model as TreeStore).Remove (ref selectedIter);
+                               Config.EventsBroker.EmitPlaylistsChanged (this);
+                       };
+                       menu.Append (delete);
+                       
+                       if (element is PlaylistPlayElement) {
+                               PlaylistPlayElement pl = element as PlaylistPlayElement;
+                               edit = new MenuItem (Catalog.GetString ("Edit"));
+                               edit.Activated += (sender, e) => {
+                                       string name = Config.GUIToolkit.QueryMessage (Catalog.GetString 
("Name:"), null,
+                                                                                    pl.Title);
+                                       if (!String.IsNullOrEmpty (name)) {
+                                               pl.Title = name; 
+                                       }
+                               };
+                               menu.Append (edit);
                        }
+                       
+                       menu.ShowAll ();
+                       menu.Popup ();
                }
 
-               ~PlayListTreeView()
+               void ShowPlaylistMenu (Playlist playlist)
                {
+                       Menu menu;
+                       MenuItem delete, render;
+
+                       menu = new Menu ();
+
+                       delete = new MenuItem (Catalog.GetString ("Delete"));
+                       delete.Activated += (sender, e) => {
+                               project.Playlists.Remove (playlist);
+                               (Model as TreeStore).Remove (ref selectedIter);
+                               Config.EventsBroker.EmitPlaylistsChanged (this);
+                       };
+                       menu.Append (delete);
+                       
+                       render = new MenuItem (Catalog.GetString ("Render"));
+                       render.Activated += (sender, e) => {
+                               Config.EventsBroker.EmitRenderPlaylist (playlist);
+                       };
+                       menu.Append (render);
+                       
+                       menu.ShowAll ();
+                       menu.Popup ();
                }
 
-               protected override bool OnButtonPressEvent(Gdk.EventButton evnt)
+               protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
                {
-                       if((evnt.Type == EventType.ButtonPress) && (evnt.Button == 3))
-                       {
+                       if ((evnt.Type == EventType.ButtonPress) && (evnt.Button == 3)) {
                                TreePath path;
-                               GetPathAtPos((int)evnt.X,(int)evnt.Y,out path);
-                               if(path!=null) {
-                                       ListStore list = ((ListStore)Model);
-                                       Model.GetIter(out selectedIter,path);
-                                       selectedPlay = (PlayListPlay)(list.GetValue(selectedIter,0));
-                                       menu.Popup();
+                               GetPathAtPos ((int)evnt.X, (int)evnt.Y, out path);
+                               if (path != null) {
+                                       Model.GetIter (out selectedIter, path);
+                                       object el = Model.GetValue (selectedIter, 0);
+                                       if (el is Playlist) {
+                                               ShowPlaylistMenu (el as Playlist);
+                                       } else {
+                                               TreeIter parent;
+                                               Model.IterParent (out parent, selectedIter);
+                                               Playlist playlist = Model.GetValue (parent, 0) as Playlist;
+                                               ShowPlaylistElementMenu (playlist, el as IPlaylistElement);
+                                       }
                                }
                        }
-                       return base.OnButtonPressEvent(evnt);
+                       return base.OnButtonPressEvent (evnt);
                }
 
-               protected void OnTitle(object o, EventArgs args) {
-                       EntryDialog ed = new EntryDialog();
-                       ed.Title = Catalog.GetString("Edit Title");
-                       ed.Text = selectedPlay.Name;
-                       if(ed.Run() == (int)ResponseType.Ok) {
-                               selectedPlay.Name = ed.Text;
-                               this.QueueDraw();
+               protected void OnTitle (object o, EventArgs args)
+               {
+                       PlaylistPlayElement ple;
+                       EntryDialog ed;
+                       
+                       ple = selectedElement as PlaylistPlayElement;
+                       ed = new EntryDialog ();
+                       ed.Title = Catalog.GetString ("Edit Title");
+                       ed.Text = ple.Title;
+                       if (ed.Run () == (int)ResponseType.Ok) {
+                               ple.Title = ed.Text;
+                               this.QueueDraw ();
                        }
-                       ed.Destroy();
+                       ed.Destroy ();
                }
 
-               protected void OnDelete(object obj, EventArgs args) {
-                       ListStore list = ((ListStore)Model);
-                       playlist.Remove(selectedPlay);
-                       list.Remove(ref selectedIter);
+               protected void OnDelete (object obj, EventArgs args)
+               {
+                       selectedPlaylist.Remove (selectedElement);
+                       (Model as TreeStore).Remove (ref selectedIter);
                }
 
-               private void RenderName(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel 
model, Gtk.TreeIter iter)
+               protected override bool OnKeyPressEvent (EventKey evnt)
                {
-                       PlayListPlay tNode = (PlayListPlay) model.GetValue(iter, 0);
-                       (cell as Gtk.CellRendererText).Text =   Catalog.GetString("Title")+": "+tNode.Name 
+"\n"+
-                                                               Catalog.GetString("Start")+": 
"+tNode.Start.ToMSecondsString()+Catalog.GetString(" sec")+"\n"+
-                                                               Catalog.GetString("Duration")+": 
"+tNode.Duration.ToMSecondsString()+Catalog.GetString(" sec")+"\n"+
-                                                               Catalog.GetString("Play Rate")+": 
"+tNode.Rate.ToString();
-                       if(!tNode.Valid) {
-                               (cell as Gtk.CellRendererText).Foreground = "red";
-                               (cell as Gtk.CellRendererText).Text += "\n"+Catalog.GetString("File not 
found")+": "+tNode.MediaFile.FilePath;
-                       }
-                       else if(tNode == loadedPlay)
-                               (cell as Gtk.CellRendererText).Foreground = "blue";
-                       else
-                               (cell as Gtk.CellRendererText).Foreground = "black";
+                       return false;
+               }
 
+               void FillElementAndPlaylist (TreeIter iter, out Playlist playlist, out IPlaylistElement 
element)
+               {
+                       TreeIter parent;
+
+                       var obj = Model.GetValue (iter, 0);
+                       if (obj is IPlaylistElement) {
+                               Model.IterParent (out parent, selectedIter);
+                               element = obj as IPlaylistElement;
+                               playlist = Model.GetValue (parent, 0) as Playlist;
+                       } else {
+                               element = null;
+                               playlist = obj as Playlist;
+                       }
                }
 
-               protected override bool OnKeyPressEvent(Gdk.EventKey evnt)
+               protected override void OnDragDataReceived (DragContext context, int x, int y, SelectionData 
selection, uint info, uint time)
                {
-                       return false;
+                       TreeIter iter;
+                       TreePath path;
+                       TreeViewDropPosition pos;
+                       Playlist destPlaylist;
+                       IPlaylistElement destElement;
+
+                       if (GetDestRowAtPos (x, y, out path, out pos)) {
+                               Model.GetIter (out iter, path);
+                               FillElementAndPlaylist (iter, out destPlaylist, out destElement);
+                               
+                               /* Moving playlists */
+                               if (dragSourceElement == null) {
+                                       project.Playlists.Remove (dragSourcePlaylist);
+                                       project.Playlists.Insert (path.Indices [0], dragSourcePlaylist);
+                               } else {
+                                       dragSourcePlaylist.Elements.Remove (dragSourceElement);
+                                       destPlaylist.Elements.Insert (path.Indices [1], dragSourceElement);
+                               }
+                               
+                               if (pos == TreeViewDropPosition.Before ||
+                                       pos == TreeViewDropPosition.IntoOrBefore) {
+                                       (Model as TreeStore).MoveBefore (selectedIter, iter);
+                               } else {
+                                       (Model as TreeStore).MoveAfter (selectedIter, iter);
+                               }
+                       }
+                       Gtk.Drag.Finish (context, true, false, time);
                }
-               
-               protected override void OnDragBegin (DragContext context)
+
+               void DisableDragInto (TreePath path, DragContext context, uint time, TreeViewDropPosition pos)
                {
-                       Model.GetIter(out selectedIter, Selection.GetSelectedRows()[0]);
-                       selectedPlay = (PlayListPlay) Model.GetValue(selectedIter, 0);
-                       preDragPos = Model.GetPath(selectedIter).Indices[0];
-                       base.OnDragBegin (context);
+                       if (pos == TreeViewDropPosition.IntoOrAfter) {
+                               pos = TreeViewDropPosition.After;
+                       } else if (pos == TreeViewDropPosition.IntoOrBefore) {
+                               pos = TreeViewDropPosition.Before;
+                       }
+                       SetDragDestRow (path, pos);
+                       Gdk.Drag.Status (context, context.SuggestedAction, time);
                }
-               
-               protected override void OnDragEnd (DragContext context)
+
+               protected override bool OnDragMotion (DragContext context, int x, int y, uint time)
                {
+                       TreePath path;
+                       TreeViewDropPosition pos;
                        TreeIter iter;
-                       int postDragPos = -1;
                        
-                       Model.GetIterFirst (out iter);
-                       do {
-                               if (Model.GetValue (iter, 0) == selectedPlay) {
-                                       postDragPos = Model.GetPath (iter).Indices[0];
-                                       break;
+                       if (GetDestRowAtPos (x, y, out path, out pos)) {
+                               Model.GetIter (out iter, path);
+                               var el = Model.GetValue (iter, 0);
+
+                               /* Drag a playlist*/
+                               if (dragSourceElement == null) {
+                                       if (el is Playlist) {
+                                               DisableDragInto (path, context, time, pos);
+                                               return true;
+                                       } else {
+                                               return false;
+                                       }
                                }
-                       } while (Model.IterNext(ref iter));
-                       
-                       playlist.Reorder(preDragPos, postDragPos);
-                       base.OnDragEnd (context);
+                               /* Drag an element */
+                               else {
+                                       if (el is IPlaylistElement) {
+                                               DisableDragInto (path, context, time, pos);
+                                               return true;
+                                       } else {
+                                               return false;
+                                       }
+                               }
+                       }
+                       return false;
+               }
+
+               protected override void OnDragBegin (DragContext context)
+               {
+                       Selection.GetSelected (out selectedIter);
+                       FillElementAndPlaylist (selectedIter, out dragSourcePlaylist,
+                                               out dragSourceElement);
+                       base.OnDragBegin (context);
                }
        }
 }
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.PlayListWidget.cs 
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.PlayListWidget.cs
index 5a1cf6b..c7788cb 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.PlayListWidget.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.PlayListWidget.cs
@@ -7,12 +7,9 @@ namespace LongoMatch.Gui.Component
                private global::Gtk.VBox vbox2;
                private global::Gtk.ScrolledWindow scrolledwindow1;
                private global::Gtk.VBox vbox1;
-               private global::Gtk.Label label1;
                private global::LongoMatch.Gui.Component.PlayListTreeView playlisttreeview1;
                private global::Gtk.HBox hbox2;
                private global::Gtk.Button newbutton;
-               private global::Gtk.Button openbutton;
-               private global::Gtk.Button savebutton;
                private global::Gtk.Button newvideobutton;
 
                protected virtual void Build ()
@@ -39,27 +36,17 @@ namespace LongoMatch.Gui.Component
                        this.vbox1.Name = "vbox1";
                        this.vbox1.Spacing = 6;
                        // Container child vbox1.Gtk.Box+BoxChild
-                       this.label1 = new global::Gtk.Label ();
-                       this.label1.Name = "label1";
-                       this.label1.LabelProp = global::Mono.Unix.Catalog.GetString ("Load a playlist\nor 
create a \nnew one.");
-                       this.vbox1.Add (this.label1);
-                       global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.label1]));
-                       w2.Position = 0;
-                       w2.Expand = false;
-                       w2.Fill = false;
-                       // Container child vbox1.Gtk.Box+BoxChild
                        this.playlisttreeview1 = new global::LongoMatch.Gui.Component.PlayListTreeView ();
-                       this.playlisttreeview1.Sensitive = false;
                        this.playlisttreeview1.CanFocus = true;
                        this.playlisttreeview1.Name = "playlisttreeview1";
                        this.vbox1.Add (this.playlisttreeview1);
-                       global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox1 
[this.playlisttreeview1]));
-                       w3.Position = 1;
+                       global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox1 
[this.playlisttreeview1]));
+                       w2.Position = 0;
                        w1.Add (this.vbox1);
                        this.scrolledwindow1.Add (w1);
                        this.vbox2.Add (this.scrolledwindow1);
-                       global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox2 
[this.scrolledwindow1]));
-                       w6.Position = 0;
+                       global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox2 
[this.scrolledwindow1]));
+                       w5.Position = 0;
                        // Container child vbox2.Gtk.Box+BoxChild
                        this.hbox2 = new global::Gtk.HBox ();
                        this.hbox2.Name = "hbox2";
@@ -72,68 +59,22 @@ namespace LongoMatch.Gui.Component
                        this.newbutton.Name = "newbutton";
                        this.newbutton.UseUnderline = true;
                        // Container child newbutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w7 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+                       global::Gtk.Alignment w6 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
                        // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w8 = new global::Gtk.HBox ();
-                       w8.Spacing = 2;
+                       global::Gtk.HBox w7 = new global::Gtk.HBox ();
+                       w7.Spacing = 2;
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w9 = new global::Gtk.Image ();
-                       w9.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-new", 
global::Gtk.IconSize.Button);
-                       w8.Add (w9);
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w11 = new global::Gtk.Label ();
-                       w8.Add (w11);
+                       global::Gtk.Image w8 = new global::Gtk.Image ();
+                       w8.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-new", 
global::Gtk.IconSize.Button);
                        w7.Add (w8);
-                       this.newbutton.Add (w7);
-                       this.hbox2.Add (this.newbutton);
-                       global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.hbox2 
[this.newbutton]));
-                       w15.Position = 0;
-                       // Container child hbox2.Gtk.Box+BoxChild
-                       this.openbutton = new global::Gtk.Button ();
-                       this.openbutton.TooltipMarkup = "Open a playlist";
-                       this.openbutton.CanFocus = true;
-                       this.openbutton.Name = "openbutton";
-                       this.openbutton.UseUnderline = true;
-                       // Container child openbutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w16 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
-                       // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w17 = new global::Gtk.HBox ();
-                       w17.Spacing = 2;
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w18 = new global::Gtk.Image ();
-                       w18.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-open", 
global::Gtk.IconSize.Button);
-                       w17.Add (w18);
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w20 = new global::Gtk.Label ();
-                       w17.Add (w20);
-                       w16.Add (w17);
-                       this.openbutton.Add (w16);
-                       this.hbox2.Add (this.openbutton);
-                       global::Gtk.Box.BoxChild w24 = ((global::Gtk.Box.BoxChild)(this.hbox2 
[this.openbutton]));
-                       w24.Position = 1;
-                       // Container child hbox2.Gtk.Box+BoxChild
-                       this.savebutton = new global::Gtk.Button ();
-                       this.savebutton.TooltipMarkup = "Save the playlist";
-                       this.savebutton.CanFocus = true;
-                       this.savebutton.Name = "savebutton";
-                       this.savebutton.UseUnderline = true;
-                       // Container child savebutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w25 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
-                       // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w26 = new global::Gtk.HBox ();
-                       w26.Spacing = 2;
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w27 = new global::Gtk.Image ();
-                       w27.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-save", 
global::Gtk.IconSize.Button);
-                       w26.Add (w27);
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w29 = new global::Gtk.Label ();
-                       w26.Add (w29);
-                       w25.Add (w26);
-                       this.savebutton.Add (w25);
-                       this.hbox2.Add (this.savebutton);
-                       global::Gtk.Box.BoxChild w33 = ((global::Gtk.Box.BoxChild)(this.hbox2 
[this.savebutton]));
-                       w33.Position = 2;
+                       global::Gtk.Label w10 = new global::Gtk.Label ();
+                       w7.Add (w10);
+                       w6.Add (w7);
+                       this.newbutton.Add (w6);
+                       this.hbox2.Add (this.newbutton);
+                       global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.hbox2 
[this.newbutton]));
+                       w14.Position = 0;
                        // Container child hbox2.Gtk.Box+BoxChild
                        this.newvideobutton = new global::Gtk.Button ();
                        this.newvideobutton.TooltipMarkup = "Export the playlist to new video file";
@@ -141,35 +82,33 @@ namespace LongoMatch.Gui.Component
                        this.newvideobutton.Name = "newvideobutton";
                        this.newvideobutton.UseUnderline = true;
                        // Container child newvideobutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w34 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+                       global::Gtk.Alignment w15 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
                        // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w35 = new global::Gtk.HBox ();
-                       w35.Spacing = 2;
+                       global::Gtk.HBox w16 = new global::Gtk.HBox ();
+                       w16.Spacing = 2;
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w36 = new global::Gtk.Image ();
-                       w36.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-record", 
global::Gtk.IconSize.Button);
-                       w35.Add (w36);
+                       global::Gtk.Image w17 = new global::Gtk.Image ();
+                       w17.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-record", 
global::Gtk.IconSize.Button);
+                       w16.Add (w17);
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w38 = new global::Gtk.Label ();
-                       w35.Add (w38);
-                       w34.Add (w35);
-                       this.newvideobutton.Add (w34);
+                       global::Gtk.Label w19 = new global::Gtk.Label ();
+                       w16.Add (w19);
+                       w15.Add (w16);
+                       this.newvideobutton.Add (w15);
                        this.hbox2.Add (this.newvideobutton);
-                       global::Gtk.Box.BoxChild w42 = ((global::Gtk.Box.BoxChild)(this.hbox2 
[this.newvideobutton]));
-                       w42.Position = 3;
+                       global::Gtk.Box.BoxChild w23 = ((global::Gtk.Box.BoxChild)(this.hbox2 
[this.newvideobutton]));
+                       w23.Position = 1;
                        this.vbox2.Add (this.hbox2);
-                       global::Gtk.Box.BoxChild w43 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.hbox2]));
-                       w43.Position = 1;
-                       w43.Expand = false;
-                       w43.Fill = false;
+                       global::Gtk.Box.BoxChild w24 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.hbox2]));
+                       w24.Position = 1;
+                       w24.Expand = false;
+                       w24.Fill = false;
                        this.Add (this.vbox2);
                        if ((this.Child != null)) {
                                this.Child.ShowAll ();
                        }
                        this.Show ();
                        this.newbutton.Clicked += new global::System.EventHandler (this.OnNewbuttonClicked);
-                       this.openbutton.Clicked += new global::System.EventHandler (this.OnOpenbuttonClicked);
-                       this.savebutton.Clicked += new global::System.EventHandler (this.OnSavebuttonClicked);
                        this.newvideobutton.Clicked += new global::System.EventHandler 
(this.OnNewvideobuttonClicked);
                }
        }
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.PlaysSelectionWidget.cs 
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.PlaysSelectionWidget.cs
index e41b587..9091648 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.PlaysSelectionWidget.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.PlaysSelectionWidget.cs
@@ -14,6 +14,8 @@ namespace LongoMatch.Gui.Component
                private global::LongoMatch.Gui.Component.PlayersListTreeWidget visitorPlayersList;
                private global::Gtk.Label visitorPlaysList;
                private global::Gtk.Label label1;
+               private global::LongoMatch.Gui.Component.PlayListWidget playlistwidget;
+               private global::Gtk.Label label3;
                private global::Gtk.VBox vbox2;
                private global::Gtk.Notebook filtersnotebook;
                private global::Gtk.ToggleButton catfiltersbutton;
@@ -87,6 +89,21 @@ namespace LongoMatch.Gui.Component
                        this.notebook2.SetTabLabel (this.notebook1, this.label1);
                        this.label1.ShowAll ();
                        // Container child notebook2.Gtk.Notebook+NotebookChild
+                       this.playlistwidget = new global::LongoMatch.Gui.Component.PlayListWidget ();
+                       this.playlistwidget.WidthRequest = 100;
+                       this.playlistwidget.Events = ((global::Gdk.EventMask)(256));
+                       this.playlistwidget.Name = "playlistwidget";
+                       this.notebook2.Add (this.playlistwidget);
+                       global::Gtk.Notebook.NotebookChild w5 = 
((global::Gtk.Notebook.NotebookChild)(this.notebook2 [this.playlistwidget]));
+                       w5.Position = 1;
+                       // Notebook tab
+                       this.label3 = new global::Gtk.Label ();
+                       this.label3.Name = "label3";
+                       this.label3.LabelProp = global::Mono.Unix.Catalog.GetString ("Playlists");
+                       this.label3.Angle = 90;
+                       this.notebook2.SetTabLabel (this.playlistwidget, this.label3);
+                       this.label3.ShowAll ();
+                       // Container child notebook2.Gtk.Notebook+NotebookChild
                        this.vbox2 = new global::Gtk.VBox ();
                        this.vbox2.Name = "vbox2";
                        this.vbox2.Spacing = 6;
@@ -97,63 +114,63 @@ namespace LongoMatch.Gui.Component
                        this.filtersnotebook.CurrentPage = 0;
                        this.filtersnotebook.TabPos = ((global::Gtk.PositionType)(3));
                        this.vbox2.Add (this.filtersnotebook);
-                       global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox2 
[this.filtersnotebook]));
-                       w5.Position = 0;
+                       global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox2 
[this.filtersnotebook]));
+                       w6.Position = 0;
                        // Container child vbox2.Gtk.Box+BoxChild
                        this.catfiltersbutton = new global::Gtk.ToggleButton ();
                        this.catfiltersbutton.CanFocus = true;
                        this.catfiltersbutton.Name = "catfiltersbutton";
                        this.catfiltersbutton.UseUnderline = true;
                        // Container child catfiltersbutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w6 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+                       global::Gtk.Alignment w7 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
                        // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w7 = new global::Gtk.HBox ();
-                       w7.Spacing = 2;
+                       global::Gtk.HBox w8 = new global::Gtk.HBox ();
+                       w8.Spacing = 2;
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w8 = new global::Gtk.Image ();
-                       w8.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-find", 
global::Gtk.IconSize.Menu);
-                       w7.Add (w8);
+                       global::Gtk.Image w9 = new global::Gtk.Image ();
+                       w9.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-find", 
global::Gtk.IconSize.Menu);
+                       w8.Add (w9);
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w10 = new global::Gtk.Label ();
-                       w10.LabelProp = global::Mono.Unix.Catalog.GetString ("Activate categories filters");
-                       w10.UseUnderline = true;
-                       w7.Add (w10);
-                       w6.Add (w7);
-                       this.catfiltersbutton.Add (w6);
+                       global::Gtk.Label w11 = new global::Gtk.Label ();
+                       w11.LabelProp = global::Mono.Unix.Catalog.GetString ("Activate categories filters");
+                       w11.UseUnderline = true;
+                       w8.Add (w11);
+                       w7.Add (w8);
+                       this.catfiltersbutton.Add (w7);
                        this.vbox2.Add (this.catfiltersbutton);
-                       global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.vbox2 
[this.catfiltersbutton]));
-                       w14.Position = 1;
-                       w14.Expand = false;
-                       w14.Fill = false;
+                       global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.vbox2 
[this.catfiltersbutton]));
+                       w15.Position = 1;
+                       w15.Expand = false;
+                       w15.Fill = false;
                        // Container child vbox2.Gtk.Box+BoxChild
                        this.playersfiltersbutton = new global::Gtk.ToggleButton ();
                        this.playersfiltersbutton.CanFocus = true;
                        this.playersfiltersbutton.Name = "playersfiltersbutton";
                        this.playersfiltersbutton.UseUnderline = true;
                        // Container child playersfiltersbutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w15 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+                       global::Gtk.Alignment w16 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
                        // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w16 = new global::Gtk.HBox ();
-                       w16.Spacing = 2;
+                       global::Gtk.HBox w17 = new global::Gtk.HBox ();
+                       w17.Spacing = 2;
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w17 = new global::Gtk.Image ();
-                       w17.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-find", 
global::Gtk.IconSize.Menu);
-                       w16.Add (w17);
+                       global::Gtk.Image w18 = new global::Gtk.Image ();
+                       w18.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-find", 
global::Gtk.IconSize.Menu);
+                       w17.Add (w18);
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w19 = new global::Gtk.Label ();
-                       w19.LabelProp = global::Mono.Unix.Catalog.GetString ("Activate players filters");
-                       w19.UseUnderline = true;
-                       w16.Add (w19);
-                       w15.Add (w16);
-                       this.playersfiltersbutton.Add (w15);
+                       global::Gtk.Label w20 = new global::Gtk.Label ();
+                       w20.LabelProp = global::Mono.Unix.Catalog.GetString ("Activate players filters");
+                       w20.UseUnderline = true;
+                       w17.Add (w20);
+                       w16.Add (w17);
+                       this.playersfiltersbutton.Add (w16);
                        this.vbox2.Add (this.playersfiltersbutton);
-                       global::Gtk.Box.BoxChild w23 = ((global::Gtk.Box.BoxChild)(this.vbox2 
[this.playersfiltersbutton]));
-                       w23.Position = 2;
-                       w23.Expand = false;
-                       w23.Fill = false;
+                       global::Gtk.Box.BoxChild w24 = ((global::Gtk.Box.BoxChild)(this.vbox2 
[this.playersfiltersbutton]));
+                       w24.Position = 2;
+                       w24.Expand = false;
+                       w24.Fill = false;
                        this.notebook2.Add (this.vbox2);
-                       global::Gtk.Notebook.NotebookChild w24 = 
((global::Gtk.Notebook.NotebookChild)(this.notebook2 [this.vbox2]));
-                       w24.Position = 1;
+                       global::Gtk.Notebook.NotebookChild w25 = 
((global::Gtk.Notebook.NotebookChild)(this.notebook2 [this.vbox2]));
+                       w25.Position = 2;
                        // Notebook tab
                        this.label2 = new global::Gtk.Label ();
                        this.label2.Name = "label2";
@@ -162,8 +179,8 @@ namespace LongoMatch.Gui.Component
                        this.notebook2.SetTabLabel (this.vbox2, this.label2);
                        this.label2.ShowAll ();
                        this.hbox1.Add (this.notebook2);
-                       global::Gtk.Box.BoxChild w25 = ((global::Gtk.Box.BoxChild)(this.hbox1 
[this.notebook2]));
-                       w25.Position = 0;
+                       global::Gtk.Box.BoxChild w26 = ((global::Gtk.Box.BoxChild)(this.hbox1 
[this.notebook2]));
+                       w26.Position = 0;
                        this.Add (this.hbox1);
                        if ((this.Child != null)) {
                                this.Child.ShowAll ();
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Panel.NewProjectPanel.cs 
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Panel.NewProjectPanel.cs
index b5430ec..1f1d6c4 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Panel.NewProjectPanel.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Panel.NewProjectPanel.cs
@@ -148,6 +148,7 @@ namespace LongoMatch.Gui.Panel
                        this.fromfileradiobutton = new global::Gtk.RadioButton 
(global::Mono.Unix.Catalog.GetString ("New project using a video file"));
                        this.fromfileradiobutton.CanFocus = true;
                        this.fromfileradiobutton.Name = "fromfileradiobutton";
+                       this.fromfileradiobutton.Active = true;
                        this.fromfileradiobutton.DrawIndicator = true;
                        this.fromfileradiobutton.UseUnderline = true;
                        this.fromfileradiobutton.FocusOnClick = false;
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Panel.ProjectsManagerPanel.cs 
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Panel.ProjectsManagerPanel.cs
index dc0a441..b6fbbb2 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Panel.ProjectsManagerPanel.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Panel.ProjectsManagerPanel.cs
@@ -463,7 +463,6 @@ namespace LongoMatch.Gui.Panel
                        w61.Position = 0;
                        // Container child rbox.Gtk.Box+BoxChild
                        this.hbuttonbox1 = new global::Gtk.HButtonBox ();
-                       this.hbuttonbox1.Name = "hbuttonbox1";
                        // Container child hbuttonbox1.Gtk.ButtonBox+ButtonBoxChild
                        this.savebutton = new global::Gtk.Button ();
                        this.savebutton.Sensitive = false;
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index c5be4e2..74c2727 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -1561,27 +1561,12 @@ Circle</property>
                     <property name="MemberName" />
                     <property name="Spacing">6</property>
                     <child>
-                      <widget class="Gtk.Label" id="label1">
-                        <property name="MemberName" />
-                        <property name="LabelProp" translatable="yes">Load a playlist
-or create a 
-new one.</property>
-                      </widget>
-                      <packing>
-                        <property name="Position">0</property>
-                        <property name="AutoSize">True</property>
-                        <property name="Expand">False</property>
-                        <property name="Fill">False</property>
-                      </packing>
-                    </child>
-                    <child>
                       <widget class="LongoMatch.Gui.Component.PlayListTreeView" id="playlisttreeview1">
                         <property name="MemberName" />
-                        <property name="Sensitive">False</property>
                         <property name="CanFocus">True</property>
                       </widget>
                       <packing>
-                        <property name="Position">1</property>
+                        <property name="Position">0</property>
                         <property name="AutoSize">False</property>
                       </packing>
                     </child>
@@ -1617,38 +1602,6 @@ new one.</property>
               </packing>
             </child>
             <child>
-              <widget class="Gtk.Button" id="openbutton">
-                <property name="MemberName" />
-                <property name="Tooltip" translatable="yes">Open a playlist</property>
-                <property name="CanFocus">True</property>
-                <property name="Type">TextAndIcon</property>
-                <property name="Icon">stock:gtk-open Button</property>
-                <property name="Label" translatable="yes" />
-                <property name="UseUnderline">True</property>
-                <signal name="Clicked" handler="OnOpenbuttonClicked" />
-              </widget>
-              <packing>
-                <property name="Position">1</property>
-                <property name="AutoSize">False</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="Gtk.Button" id="savebutton">
-                <property name="MemberName" />
-                <property name="Tooltip" translatable="yes">Save the playlist</property>
-                <property name="CanFocus">True</property>
-                <property name="Type">TextAndIcon</property>
-                <property name="Icon">stock:gtk-save Button</property>
-                <property name="Label" translatable="yes" />
-                <property name="UseUnderline">True</property>
-                <signal name="Clicked" handler="OnSavebuttonClicked" />
-              </widget>
-              <packing>
-                <property name="Position">2</property>
-                <property name="AutoSize">False</property>
-              </packing>
-            </child>
-            <child>
               <widget class="Gtk.Button" id="newvideobutton">
                 <property name="MemberName" />
                 <property name="Tooltip" translatable="yes">Export the playlist to new video file</property>
@@ -1660,7 +1613,7 @@ new one.</property>
                 <signal name="Clicked" handler="OnNewvideobuttonClicked" />
               </widget>
               <packing>
-                <property name="Position">3</property>
+                <property name="Position">1</property>
                 <property name="AutoSize">False</property>
               </packing>
             </child>
@@ -3989,7 +3942,7 @@ You can continue with the current capture, cancel it or save your project.
       </widget>
     </child>
   </widget>
-  <widget class="Gtk.Bin" id="LongoMatch.Gui.Component.PlaysSelectionWidget" design-size="568 495">
+  <widget class="Gtk.Bin" id="LongoMatch.Gui.Component.PlaysSelectionWidget" design-size="567 495">
     <property name="MemberName" />
     <property name="Visible">False</property>
     <child>
@@ -4071,6 +4024,26 @@ You can continue with the current capture, cancel it or save your project.
               </packing>
             </child>
             <child>
+              <widget class="LongoMatch.Gui.Component.PlayListWidget" id="playlistwidget">
+                <property name="MemberName" />
+                <property name="WidthRequest">100</property>
+                <property name="Events">ButtonPressMask</property>
+              </widget>
+              <packing>
+                <property name="Position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="Gtk.Label" id="label3">
+                <property name="MemberName" />
+                <property name="LabelProp" translatable="yes">Playlists</property>
+                <property name="Angle">90</property>
+              </widget>
+              <packing>
+                <property name="type">tab</property>
+              </packing>
+            </child>
+            <child>
               <widget class="Gtk.VBox" id="vbox2">
                 <property name="MemberName" />
                 <property name="Spacing">6</property>
@@ -4128,7 +4101,7 @@ You can continue with the current capture, cancel it or save your project.
                 </child>
               </widget>
               <packing>
-                <property name="Position">1</property>
+                <property name="Position">2</property>
               </packing>
             </child>
             <child>
@@ -9241,7 +9214,7 @@ Click 2 players to swap them</property>
       </widget>
     </child>
   </widget>
-  <widget class="Gtk.Bin" id="LongoMatch.Gui.Panel.SportsTemplatesPanel" design-size="1242 783">
+  <widget class="Gtk.Bin" id="LongoMatch.Gui.Panel.SportsTemplatesPanel" design-size="1372 783">
     <property name="MemberName" />
     <property name="Visible">False</property>
     <child>
diff --git a/LongoMatch.GUI/gtk-gui/objects.xml b/LongoMatch.GUI/gtk-gui/objects.xml
index 61a8a55..2ff59e5 100644
--- a/LongoMatch.GUI/gtk-gui/objects.xml
+++ b/LongoMatch.GUI/gtk-gui/objects.xml
@@ -41,15 +41,7 @@
   </object>
   <object type="LongoMatch.Gui.Component.PlayListWidget" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
     <itemgroups />
-    <signals>
-      <itemgroup label="PlayListWidget Signals">
-        <signal name="PlayListNodeSelected" />
-        <signal name="OpenPlaylistEvent" />
-        <signal name="NewPlaylistEvent" />
-        <signal name="SavePlaylistEvent" />
-        <signal name="RenderPlaylistEvent" />
-      </itemgroup>
-    </signals>
+    <signals />
   </object>
   <object type="LongoMatch.Gui.Component.ProjectListWidget" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
     <itemgroups />
@@ -169,6 +161,48 @@
     <itemgroups />
     <signals />
   </object>
+  <object type="LongoMatch.Gui.Component.TeamTemplateEditor" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
+    <itemgroups>
+      <itemgroup label="TeamTemplateEditor Properties">
+        <property name="Edited" />
+      </itemgroup>
+    </itemgroups>
+    <signals>
+      <itemgroup label="TeamTemplateEditor Signals">
+        <signal name="TemplateSaved" />
+      </itemgroup>
+    </signals>
+  </object>
+  <object type="LongoMatch.Gui.Component.PlayerPropertiesTreeView" palette-category="General" 
allow-children="false" base-type="Gtk.TreeView">
+    <itemgroups />
+    <signals>
+      <itemgroup label="PlayerPropertiesTreeView Signals">
+        <signal name="PlayerClicked" />
+        <signal name="PlayersSelected" />
+      </itemgroup>
+    </signals>
+  </object>
+  <object type="LongoMatch.Gui.Component.CategoriesTreeView" palette-category="General" 
allow-children="false" base-type="Gtk.TreeView">
+    <itemgroups />
+    <signals>
+      <itemgroup label="CategoriesTreeView Signals">
+        <signal name="CategoryClicked" />
+        <signal name="CategoriesSelected" />
+      </itemgroup>
+    </signals>
+  </object>
+  <object type="LongoMatch.Gui.Component.Stats.SubCategoryViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
+    <itemgroups />
+    <signals />
+  </object>
+  <object type="LongoMatch.Gui.Component.Timeline" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
+    <itemgroups />
+    <signals />
+  </object>
+  <object type="LongoMatch.Gui.Component.PlaysPositionViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
+    <itemgroups />
+    <signals />
+  </object>
   <object type="LongoMatch.Gui.Component.AnalysisComponent" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
     <itemgroups />
     <signals />
@@ -205,18 +239,6 @@
       </itemgroup>
     </signals>
   </object>
-  <object type="LongoMatch.Gui.Component.TeamTemplateEditor" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
-    <itemgroups>
-      <itemgroup label="TeamTemplateEditor Properties">
-        <property name="Edited" />
-      </itemgroup>
-    </itemgroups>
-    <signals>
-      <itemgroup label="TeamTemplateEditor Signals">
-        <signal name="TemplateSaved" />
-      </itemgroup>
-    </signals>
-  </object>
   <object type="LongoMatch.Gui.Panel.ProjectsManagerPanel" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
     <itemgroups />
     <signals>
@@ -241,10 +263,6 @@
       </itemgroup>
     </signals>
   </object>
-  <object type="LongoMatch.Gui.Component.Timeline" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
-    <itemgroups />
-    <signals />
-  </object>
   <object type="LongoMatch.Gui.Component.CodingWidget" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
     <itemgroups />
     <signals />
@@ -257,32 +275,6 @@
     <itemgroups />
     <signals />
   </object>
-  <object type="LongoMatch.Gui.Component.PlaysPositionViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
-    <itemgroups />
-    <signals />
-  </object>
-  <object type="LongoMatch.Gui.Component.PlayerPropertiesTreeView" palette-category="General" 
allow-children="false" base-type="Gtk.TreeView">
-    <itemgroups />
-    <signals>
-      <itemgroup label="PlayerPropertiesTreeView Signals">
-        <signal name="PlayerClicked" />
-        <signal name="PlayersSelected" />
-      </itemgroup>
-    </signals>
-  </object>
-  <object type="LongoMatch.Gui.Component.CategoriesTreeView" palette-category="General" 
allow-children="false" base-type="Gtk.TreeView">
-    <itemgroups />
-    <signals>
-      <itemgroup label="CategoriesTreeView Signals">
-        <signal name="CategoryClicked" />
-        <signal name="CategoriesSelected" />
-      </itemgroup>
-    </signals>
-  </object>
-  <object type="LongoMatch.Gui.Component.Stats.SubCategoryViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
-    <itemgroups />
-    <signals />
-  </object>
   <object type="LongoMatch.Gui.CapturerBin" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
     <itemgroups>
       <itemgroup label="CapturerBin Properties">
diff --git a/LongoMatch.Services/Services/EventsManager.cs b/LongoMatch.Services/Services/EventsManager.cs
index 71a0a7d..5478da0 100644
--- a/LongoMatch.Services/Services/EventsManager.cs
+++ b/LongoMatch.Services/Services/EventsManager.cs
@@ -26,6 +26,7 @@ using LongoMatch.Store;
 using Mono.Unix;
 using System.IO;
 using LongoMatch.Interfaces.Multimedia;
+using LongoMatch.Store.Playlists;
 
 namespace LongoMatch.Services
 {
@@ -83,8 +84,8 @@ namespace LongoMatch.Services
                        Config.EventsBroker.PlaySelected += OnPlaySelected;
                        Config.EventsBroker.PlayCategoryChanged += OnPlayCategoryChanged;
                        Config.EventsBroker.DuplicatePlays += OnDuplicatePlays;
-                       Config.EventsBroker.PlayListNodeSelectedEvent += (tn) => {
-                               loadedPlay = tn;};
+                       //Config.EventsBroker.PlayListNodeSelectedEvent += (tn) => {
+                       //      loadedPlay = tn;};
                        Config.EventsBroker.SnapshotSeries += OnSnapshotSeries;
                        
                        Config.EventsBroker.ShowProjectStatsEvent += HandleShowProjectStatsEvent;
@@ -92,7 +93,6 @@ namespace LongoMatch.Services
                        
                        Config.EventsBroker.OpenedProjectChanged += HandleOpenedProjectChanged;
 
-                       Config.EventsBroker.Prev += OnPrev;
                        Config.EventsBroker.DrawFrame += OnDrawFrame;
                        Config.EventsBroker.PlaybackRateChanged += HandlePlaybackRateChanged;
                        Config.EventsBroker.Detach += HandleDetach;
@@ -115,7 +115,7 @@ namespace LongoMatch.Services
 
                void RenderPlay (Project project, Play play, MediaFile file)
                {
-                       PlayList playlist;
+                       Playlist playlist;
                        EncodingSettings settings;
                        EditionJob job;
                        string outputDir, outputFile;
@@ -130,11 +130,14 @@ namespace LongoMatch.Services
                        outputFile = String.Format ("{0}-{1}.mp4", play.Category.Name, play.Name);
                        outputFile = Path.Combine (outputDir, project.Description.Title, outputFile);
                        try {
+                               PlaylistPlayElement element;
+                               
                                Directory.CreateDirectory (Path.GetDirectoryName (outputFile));
                                settings = EncodingSettings.DefaultRenderingSettings (outputFile);
-                               playlist = new PlayList ();
-                               playlist.Add (new PlayListPlay (play, file, true));
-                       
+                               playlist = new Playlist ();
+                               element = new PlaylistPlayElement (play);
+                               element.File = file;
+                               playlist.Elements.Add (element);
                                job = new EditionJob (playlist, settings);
                                renderer.AddJob (job);
                        } catch (Exception ex) {
@@ -145,7 +148,7 @@ namespace LongoMatch.Services
 
                void LoadPlay (Play play, Time seekTime, bool playing)
                {
-                       player.LoadPlay (openedProject.Description.File.FilePath, play,
+                       player.LoadPlay (openedProject.Description.File, play,
                                         seekTime, playing);
                        loadedPlay = play;
                        if (playing) {
@@ -286,10 +289,6 @@ namespace LongoMatch.Services
                        guiToolkit.ExportFrameSeries (openedProject, play, Config.SnapshotsDir);
                }
 
-               protected virtual void OnPrev ()
-               {
-               }
-
                protected virtual void OnDrawFrame (Play play, int drawingIndex)
                {
                        Image pixbuf;
diff --git a/LongoMatch.Services/Services/PlaylistManager.cs b/LongoMatch.Services/Services/PlaylistManager.cs
index 057a651..1b0b4c3 100644
--- a/LongoMatch.Services/Services/PlaylistManager.cs
+++ b/LongoMatch.Services/Services/PlaylistManager.cs
@@ -15,13 +15,13 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 // 
-using System;
 using System.Collections.Generic;
 using System.Threading;
 using LongoMatch.Common;
 using LongoMatch.Interfaces;
 using LongoMatch.Interfaces.GUI;
 using LongoMatch.Store;
+using LongoMatch.Store.Playlists;
 using Mono.Unix;
 using Timer = System.Threading.Timer;
 
@@ -30,15 +30,12 @@ namespace LongoMatch.Services
        public class PlaylistManager
        {
                IGUIToolkit guiToolkit;
-               IPlaylistWidget playlistWidget;
-               IPlayList playlist;
                IPlayerBin player;
                IRenderingJobsManager videoRenderer;
-               /* FIXME */
-               TimeNode selectedTimeNode;
-               bool clockStarted;
-               Timer timeout;
                Project openedProject;
+               IPlaylistElement loadedElement;
+               Playlist loadedPlaylist;
+               Play loadedPlay;
 
                public PlaylistManager (IGUIToolkit guiToolkit, IRenderingJobsManager videoRenderer)
                {
@@ -56,125 +53,99 @@ namespace LongoMatch.Services
                        }
                }
 
-               public void Stop ()
+               void BindEvents ()
                {
-                       StopClock ();
+                       Config.EventsBroker.NewPlaylistEvent += HandleNewPlaylist;
+                       Config.EventsBroker.AddPlaylistElementEvent += HandleAddPlaylistElement;
+                       Config.EventsBroker.RenderPlaylist += HandleRenderPlaylist;
+                       Config.EventsBroker.OpenedProjectChanged += HandleOpenedProjectChanged;
+                       Config.EventsBroker.PreviousPlaylistElementEvent += HandlePrev;
+                       Config.EventsBroker.NextPlaylistElementEvent += HandleNext;
+                       Config.EventsBroker.PlaySelected += HandlePlaySelected;
+                       Config.EventsBroker.PlaylistElementSelectedEvent += HandlePlaylistElementSelected;
                }
 
-               public void Load (string filePath)
+               void Switch (Play play, Playlist playlist, IPlaylistElement element)
                {
-                       try {
-                               playlist = PlayList.Load (filePath);
-                               playlistWidget.Load (playlist);
-                       } catch (Exception e) {
-                               Log.Exception (e);
-                               guiToolkit.ErrorMessage (Catalog.GetString ("The file you are trying to load 
" +
-                                       "is not a playlist or it's not compatible with the current version"));
+                       if (loadedElement != null) {
+                               loadedElement.Selected = false;
+                       }
+                       if (element != null) {
+                               element.Selected = true;
                        }
+                       
+                       loadedPlay = play;
+                       loadedPlaylist = playlist;
+                       loadedElement = element;
                }
-
-               private void BindEvents ()
+               
+               void HandlePlaylistElementSelected (Playlist playlist, IPlaylistElement element)
                {
-                       Config.EventsBroker.OpenedProjectChanged += HandleOpenedProjectChanged;
-                       Config.EventsBroker.PlaySelected += (p) => {
-                               selectedTimeNode = p;};
-                       Config.EventsBroker.OpenPlaylistEvent += OnOpenPlaylist;
-                       Config.EventsBroker.NewPlaylistEvent += OnNewPlaylist;
-                       Config.EventsBroker.SavePlaylistEvent += OnSavePlaylist;
-                       Config.EventsBroker.PlayListNodeAddedEvent += OnPlayListNodeAdded;
-                       Config.EventsBroker.PlayListNodeSelectedEvent += LoadPlaylistPlay;
-                       Config.EventsBroker.RenderPlaylist += OnRenderPlaylistEvent;
-                       Config.EventsBroker.Next += () => {
-                               Next ();};
-                       Config.EventsBroker.Prev += () => {
-                               if (selectedTimeNode is PlayListPlay)
-                                       Prev ();
-                       };
+                       Switch (null, playlist, element);
+                       player.LoadPlayListPlay (playlist, element);
                }
 
-               private void Add (List<Play> plays)
+               void HandlePlaySelected (Play play)
                {
-                       if (playlist == null) {
-                               guiToolkit.InfoMessage (Catalog.GetString ("You have not loaded any playlist 
yet."));
-                       } else {
-                               foreach (Play p in plays) {
-                                       PlayListPlay pl = new PlayListPlay (p, 
openedProject.Description.File, true);
-                                       playlist.Add (pl);
-                                       playlistWidget.Add (pl);
-                               }
-                       }
+                       Switch (play, null, null);
                }
 
-               private void LoadPlaylistPlay (PlayListPlay play)
+               void HandleNext (Playlist playlist)
                {
-                       if (openedProject != null) {
-                               guiToolkit.ErrorMessage (Catalog.GetString (
-                                       "Please, close the opened project to play the playlist."));
-                               Stop ();
-                               return;
+                       if (playlist != null && playlist.HasNext ()) {
+                               HandlePlaylistElementSelected (playlist, playlist.Next ()); 
                        }
-                       
-                       StartClock ();
-                       player.LoadPlayListPlay (play, playlist.HasNext ());
-                       selectedTimeNode = play;
-                       playlist.SetActive (play);
-                       playlistWidget.SetActivePlay (play, playlist.GetCurrentIndex ());
                }
-
-               private bool Next ()
+               
+               void HandlePrev (Playlist playlist)
                {
-                       if (!playlist.HasNext ()) {
-                               Stop ();
-                               return false;
+                       /* Select the previous element if it's a regular play */
+                       if (playlist == null && loadedPlay != null) {
+                               player.Seek (loadedPlay.Start, true);
+                               return;
                        }
                        
-                       var plNode = playlist.Next ();
-                       
-                       if (!plNode.Valid)
-                               return Next ();
-                       
-                       LoadPlaylistPlay (plNode);
-                       return true;
-               }
-
-               private void Prev ()
-               {
-                       /* Select the previous element if we haven't played 500ms */
-                       if ((player.CurrentTime - selectedTimeNode.Start).MSeconds < 500) {
+                       if (loadedElement != null) {
+                               /* Select the previous element if we haven't played 500ms */
+                               if (loadedElement is PlaylistPlayElement) {
+                                       Play play = (loadedElement as PlaylistPlayElement).Play;
+                                       if ((player.CurrentTime - play.Start).MSeconds > 500) {
+                                               player.Seek (play.Start, true);
+                                               return;
+                                       }
+                               }
+                               /* Load the next playlist element */
                                if (playlist.HasPrev ()) {
-                                       var play = playlist.Prev ();
-                                       LoadPlaylistPlay (play);
+                                       HandlePlaylistElementSelected (playlist, playlist.Prev ());
                                }
-                       } else {
-                               /* Seek to the beginning of the segment */
-                               player.Seek (selectedTimeNode.Start, true);
                        }
                }
 
-               private void StartClock ()
+               void HandleAddPlaylistElement (Playlist playlist, List<IPlaylistElement> element)
                {
-                       if (player != null && !clockStarted) {
-                               timeout = new Timer (new TimerCallback (CheckStopTime), this, 20, 20);
-                               clockStarted = true;
+                       if (playlist == null) {
+                               playlist = HandleNewPlaylist (openedProject);
                        }
+                       playlist.Elements.AddRange (element);
+                       Config.EventsBroker.EmitPlaylistsChanged (this);
                }
 
-               private void StopClock ()
+               Playlist HandleNewPlaylist (Project project)
                {
-                       if (clockStarted) {
-                               timeout.Dispose ();
-                               clockStarted = false;
+                       string name;
+                       Playlist playlist = null;
+                       
+                       name = Config.GUIToolkit.QueryMessage (Catalog.GetString ("Playlist name:"), null,
+                                                              Catalog.GetString ("New playlist"));
+                       if (name != null) {
+                               playlist = new Playlist {Name = name};
+                               project.Playlists.Add (playlist);
+                               Config.EventsBroker.EmitPlaylistsChanged (this);
                        }
+                       return playlist;
                }
 
-               private void CheckStopTime (object self)
-               {
-                       if (player.CurrentTime >= selectedTimeNode.Stop - new Time { MSeconds=200 })
-                               Next ();
-                       return;
-               }
-
-               protected virtual void OnRenderPlaylistEvent (IPlayList playlist)
+               void HandleRenderPlaylist (Playlist playlist)
                {
                        List<EditionJob> jobs = guiToolkit.ConfigureRenderingJob (playlist);
                        if (jobs == null)
@@ -182,41 +153,5 @@ namespace LongoMatch.Services
                        foreach (Job job in jobs)
                                videoRenderer.AddJob (job);
                }
-
-               protected virtual void OnPlayListNodeAdded (List<Play> plays)
-               {
-                       Add (plays);
-               }
-
-               protected virtual void OnSavePlaylist ()
-               {
-                       if (playlist != null) {
-                               playlist.Save ();
-                       }
-               }
-
-               protected virtual void OnOpenPlaylist ()
-               {
-                       string filename;
-                       
-                       filename = guiToolkit.OpenFile (Catalog.GetString ("Open playlist"), null, 
Config.PlayListDir,
-                                                       Constants.PROJECT_NAME + Catalog.GetString 
("playlists"),
-                                                       new string [] { "*" + Constants.PLAYLIST_EXT });
-                       if (filename != null)
-                               Load (filename);
-               }
-
-               protected virtual void OnNewPlaylist ()
-               {
-                       string filename;
-                       
-                       filename = guiToolkit.SaveFile (Catalog.GetString ("New playlist"), null, 
Config.PlayListDir,
-                                                       Constants.PROJECT_NAME + Catalog.GetString 
("playlists"),
-                                                       new string [] { "*" + Constants.PLAYLIST_EXT });
-
-                       if (filename != null)
-                               Load (filename);
-               }
        }
 }
-
diff --git a/LongoMatch.Services/Services/RenderingJobsManager.cs 
b/LongoMatch.Services/Services/RenderingJobsManager.cs
index 04731f1..3d50a8d 100644
--- a/LongoMatch.Services/Services/RenderingJobsManager.cs
+++ b/LongoMatch.Services/Services/RenderingJobsManager.cs
@@ -23,6 +23,7 @@ using LongoMatch.Interfaces.GUI;
 using LongoMatch.Interfaces.Multimedia;
 using LongoMatch.Store;
 using Mono.Unix;
+using LongoMatch.Store.Playlists;
 
 namespace LongoMatch.Services
 {
@@ -176,9 +177,14 @@ namespace LongoMatch.Services
                        videoEditor.Progress += OnProgress;
                        videoEditor.Error += OnError;
                        
-                       foreach (PlayListPlay segment in job.Playlist) {
-                               if (!ProcessSegment (segment))
-                                       continue;
+                       foreach (IPlaylistElement segment in job.Playlist.Elements) {
+                               if (segment is PlaylistPlayElement) {
+                                       ProcessPlay (segment as PlaylistPlayElement);
+                               } else if (segment is PlaylistImage) {
+                                       ProcessImage (segment as PlaylistImage);
+                               } else if (segment is PlaylistDrawing) {
+                                       ProcessDrawing (segment as PlaylistDrawing);
+                               }
                        }
                        
                        try {
@@ -192,28 +198,51 @@ namespace LongoMatch.Services
                        }
                }
 
-               private bool ProcessSegment (PlayListPlay segment)
+               void ProcessImage (Image image, Time duration) {
+                       string path = System.IO.Path.GetTempFileName ().Replace (@"\", @"\\");
+                       image.Save (path);
+                       videoEditor.AddImageSegment (path, 0, duration.MSeconds, "");
+               }
+
+               void ProcessImage (PlaylistImage image)
+               {
+                       Log.Debug (String.Format ("Adding still image with duration {0}s",
+                                                 image.Duration));
+                       ProcessImage (image.Image, image.Duration);
+               }
+               
+               void ProcessDrawing (PlaylistDrawing drawing)
+               {
+                       Image img;
+                       
+                       Log.Debug (String.Format ("Adding still drawing with duration {0}s",
+                                                 drawing.Duration));
+                       img = Drawing.Utils.RenderFrameDrawing (Config.DrawingToolkit, drawing.Width,
+                                                               drawing.Height, drawing.Drawing);
+                       ProcessImage (img, drawing.Duration);
+               }
+
+               bool ProcessPlay (PlaylistPlayElement element)
                {
                        Time lastTS;
+                       Play play;
 
-                       if (!segment.Valid)
-                               return false;
-                       
-                       Log.Debug (String.Format ("Adding segment with {0} drawings", 
segment.Drawings.Count));
+                       play = element.Play;
+                       Log.Debug (String.Format ("Adding segment with {0} drawings", play.Drawings.Count));
                        
-                       lastTS = segment.Start;
-                       foreach (FrameDrawing fd in segment.Drawings) {
-                               string image_path = CreateStillImage (segment.MediaFile.FilePath, fd);
-                               videoEditor.AddSegment (segment.MediaFile.FilePath, lastTS.MSeconds,
+                       lastTS = play.Start;
+                       foreach (FrameDrawing fd in play.Drawings) {
+                               string image_path = CreateStillImage (element.File.FilePath, fd);
+                               videoEditor.AddSegment (element.File.FilePath, lastTS.MSeconds,
                                                       fd.Render.MSeconds - lastTS.MSeconds,
-                                                      segment.Rate, segment.Name, 
segment.MediaFile.HasAudio);
+                                                      element.Rate, play.Name, element.File.HasAudio);
                                videoEditor.AddImageSegment (image_path, fd.Render.MSeconds,
-                                                           fd.Pause.MSeconds, segment.Name);
+                                                           fd.Pause.MSeconds, play.Name);
                                lastTS = fd.Render;
                        }
-                       videoEditor.AddSegment (segment.MediaFile.FilePath, lastTS.MSeconds,
-                                              segment.Stop.MSeconds - lastTS.MSeconds,
-                                              segment.Rate, segment.Name, segment.MediaFile.HasAudio);
+                       videoEditor.AddSegment (element.File.FilePath, lastTS.MSeconds,
+                                              play.Stop.MSeconds - lastTS.MSeconds,
+                                              element.Rate, play.Name, element.File.HasAudio);
                        return true;
                }
 
diff --git a/LongoMatch.mds b/LongoMatch.mds
index 230b42c..b449cb2 100644
--- a/LongoMatch.mds
+++ b/LongoMatch.mds
@@ -34,7 +34,6 @@
       <Entry build="True" name="LongoMatch.Drawing" configuration="Debug" />
       <Entry build="True" name="LongoMatch.Drawing.Cairo" configuration="Debug" />
       <Entry build="True" name="LongoMatch.Migration" configuration="Debug" />
-      <Entry build="True" name="OneplayLongomatch" configuration="Debug" />
     </Configuration>
     <Configuration name="Release" ctype="CombineConfiguration">
       <Entry build="True" name="LongoMatch.GUI" configuration="Release" />
@@ -52,7 +51,6 @@
       <Entry build="True" name="LongoMatch.Drawing" configuration="Release" />
       <Entry build="True" name="LongoMatch.Drawing.Cairo" configuration="Release" />
       <Entry build="True" name="LongoMatch.Migration" configuration="Release" />
-      <Entry build="True" name="OneplayLongomatch" configuration="Release" />
     </Configuration>
   </Configurations>
   <StartMode startupentry="LongoMatchGtk" single="True">
@@ -71,7 +69,6 @@
     <Execute type="None" entry="LongoMatch.Drawing" />
     <Execute type="None" entry="LongoMatch.Drawing.Cairo" />
     <Execute type="None" entry="LongoMatch.Migration" />
-    <Execute type="None" entry="OneplayLongomatch" />
   </StartMode>
   <Entries>
     <Entry filename="LongoMatch.GUI/LongoMatch.GUI.mdp" />



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]