Index: InfoService/InfoService.csproj
===================================================================
--- InfoService/InfoService.csproj	(revision 66719)
+++ InfoService/InfoService.csproj	(working copy)
@@ -82,10 +82,16 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\Externals\MP\Core.dll</HintPath>
     </Reference>
+    <Reference Include="Cornerstone">
+      <HintPath>..\Externals\MovingPictures\Cornerstone.dll</HintPath>
+    </Reference>
     <Reference Include="Dialogs, Version=1.0.8.15669, Culture=neutral, processorArchitecture=x86">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\Externals\MP\Dialogs.dll</HintPath>
     </Reference>
+    <Reference Include="MovingPictures">
+      <HintPath>..\Externals\MovingPictures\MovingPictures.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core">
       <RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -199,6 +205,7 @@
     <Compile Include="Twitter\TwitterConnector\Xml\TimelineXmlParser.cs" />
     <Compile Include="Twitter\TwitterConnector\Xml\TwitterXmlParser.cs" />
     <Compile Include="Twitter\TwitterService.cs" />
+    <Compile Include="Utils\AssemblyUtils.cs" />
     <Compile Include="Utils\DownloadWorker.cs" />
     <Compile Include="Utils\FeedUtils.cs" />
     <Compile Include="Utils\InfoServiceUtils.cs" />
@@ -358,7 +365,7 @@
   </PropertyGroup>
   <ProjectExtensions>
     <VisualStudio>
-      <UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_ConfigurationName="Release" BuildVersion_BuildVersioningStyle="Increment.Increment.Increment.DeltaBaseDate" BuildVersion_StartDate="2009/11/6" />
+      <UserProperties BuildVersion_StartDate="2009/11/6" BuildVersion_BuildVersioningStyle="Increment.Increment.Increment.DeltaBaseDate" BuildVersion_ConfigurationName="Release" BuildVersion_UpdateFileVersion="True" />
     </VisualStudio>
   </ProjectExtensions>
 </Project>
\ No newline at end of file
Index: InfoService/InfoServiceCore.cs
===================================================================
--- InfoService/InfoServiceCore.cs	(revision 66719)
+++ InfoService/InfoServiceCore.cs	(working copy)
@@ -385,8 +385,17 @@
             InfoServiceUtils.InitLog();
             Logger.FlushTempLog();
 
+            #region RecentlyAdded
             //RecentlyAddedUtils.LoadLastRecentlyAddedItems();
             RecentlyAddedUpdater.SetupUpdater();
+            if (AssemblyUtils.IsAssemblyAvailable("MovingPictures", new Version(1, 0, 6, 1116)))
+            {
+                RecentlyAddedUpdater.SetupMovingPicturesRecentlyAdded();
+                RecentlyAddedUpdater.GetRecentlyAddedMovies();
+                RecentlyAddedUpdater.GetRecentlyWatchedMovies();
+            }           
+            #endregion
+
             UpdateTimer.SetTimer();
 
             #region Load infoservice.xml
Index: InfoService/RecentlyAdded/RecentlyAddedUpdater.cs
===================================================================
--- InfoService/RecentlyAdded/RecentlyAddedUpdater.cs	(revision 66719)
+++ InfoService/RecentlyAdded/RecentlyAddedUpdater.cs	(working copy)
@@ -5,6 +5,11 @@
 using InfoService.Enums;
 using InfoService.Utils;
 using MediaPortal.GUI.Library;
+using Cornerstone.Tools;
+using Cornerstone.Database;
+using Cornerstone.Database.Tables;
+using MediaPortal.Plugins.MovingPictures;
+using MediaPortal.Plugins.MovingPictures.Database;
 
 namespace InfoService.RecentlyAdded
 {
@@ -17,9 +22,17 @@
         public static void SetupUpdater()
         {
             UpdateTimer.OnTimeForUpdateProperties += new UpdateTimer.UpdatePropertiesHandler(UpdateTimer_UpdateProperties);
-            GUIWindowManager.Receivers += new SendMessageHandler(GUIWindowManager_Receivers);
+            GUIWindowManager.Receivers += new SendMessageHandler(GUIWindowManager_Receivers);         
         }
 
+        /// <summary>
+        /// Handle this event in seperate method in case movingpictures library doesnt exist
+        /// </summary>
+        public static void SetupMovingPicturesRecentlyAdded()
+        {
+            MovingPicturesCore.DatabaseManager.ObjectInserted += new DatabaseManager.ObjectAffectedDelegate(OnObjectInserted);
+        }
+
         private static void GUIWindowManager_Receivers(GUIMessage message)
         {
             if (message.Message == GUIMessage.MessageType.GUI_MSG_USER)
@@ -139,6 +152,184 @@
             }
         }
 
+        #region MovingPictures
+        private static void OnObjectInserted(DatabaseTable obj)
+        {
+            // Update Recent Added
+            if (obj.GetType() == typeof(DBMovieInfo))
+            {
+                logger.WriteLog(string.Format("New movie added: {0}", ((DBMovieInfo)obj).Title), LogLevel.Info, InfoServiceModul.RecentlyAdded);
+                GetRecentlyAddedMovies();
+            }
+
+            if (obj.GetType() == typeof(DBWatchedHistory))
+            {
+                logger.WriteLog(string.Format("Movie watched: {0}", ((DBMovieInfo)obj).Title), LogLevel.Info, InfoServiceModul.RecentlyWatched);                
+                GetRecentlyWatchedMovies();
+            }
+        }
+
+        public static void  GetRecentlyAddedMovies()
+        {
+            logger.WriteLog("Get Most Recent Added Movies", LogLevel.Info, InfoServiceModul.RecentlyAdded);
+
+            // get list of movies in database
+            List<DBMovieInfo> movies = DBMovieInfo.GetAll();
+
+            // get filter criteria of movies protected by parental conrols
+            bool pcFilterEnabled = MovingPicturesCore.Settings.ParentalControlsEnabled;
+            DBFilter<DBMovieInfo> pcFilter = MovingPicturesCore.Settings.ParentalControlsFilter;
+
+            // apply parental control filter to movie list
+            List<DBMovieInfo> filteredMovies = pcFilterEnabled ? pcFilter.Filter(movies).ToList() : movies;
+
+            logger.WriteLog(string.Format("{0} Movies found in database", movies.Count.ToString()), LogLevel.Info, InfoServiceModul.RecentlyAdded);
+            logger.WriteLog(string.Format("{0} Movies filtered by parental controls", movies.Count - filteredMovies.Count), LogLevel.Info, InfoServiceModul.RecentlyAdded);
+
+            // Sort list in to most recent first
+            filteredMovies.Sort((m1, m2) =>
+            { 
+                return m2.DateAdded.CompareTo(m1.DateAdded);
+            });
+
+            // Clear Properties
+            ClearRecentAddedProperties();
+
+            string type = "movie";
+            
+            // Update properties    
+            int i = 1;
+            foreach (DBMovieInfo movie in filteredMovies)
+            {
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyAdded.Title, type, i), movie.Title);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyAdded.Thumb, type, i), movie.CoverThumbFullPath);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyAdded.Fanart, type, i), movie.BackdropFullPath);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyAdded.DateAdded, type, i), movie.DateAdded.ToString());
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyAdded.Runtime, type, i), GetMovieRuntime(movie) + " mins");
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyAdded.Certification, type, i), movie.Certification);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyAdded.Score, type, i), movie.Score.ToString());
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyAdded.RoundedScore, type, i), Math.Round(movie.Score, MidpointRounding.AwayFromZero).ToString());
+                
+                logger.WriteLog(string.Format("Recently Added Movie {0} is {1}", i, movie.Title), LogLevel.Info, InfoServiceModul.RecentlyAdded);
+                ++i;
+                if (i == 4)
+                    break;
+            }
+        }
+
+        public static void GetRecentlyWatchedMovies()
+        {
+            logger.WriteLog("Get Most Recent Watched Movies", LogLevel.Info, InfoServiceModul.RecentlyWatched);            
+
+            // get list of movies in database
+            List<DBMovieInfo> movies = DBMovieInfo.GetAll();
+
+            // get filter criteria of movies protected by parental conrols
+            bool pcFilterEnabled = MovingPicturesCore.Settings.ParentalControlsEnabled;
+            DBFilter<DBMovieInfo> pcFilter = MovingPicturesCore.Settings.ParentalControlsFilter;
+
+            // apply parental control filter to movie list
+            List<DBMovieInfo> filteredMovies = pcFilterEnabled ? pcFilter.Filter(movies).ToList() : movies;
+
+            // sort based on most recently watched
+            filteredMovies.Sort((m1, m2) =>
+            {
+                // get watched count for each movie         
+                int watchCount1 = m1.WatchedHistory.Count;
+                int watchCount2 = m2.WatchedHistory.Count;
+
+                // compare most recently watched dates
+                // WatchedHistory stores a list of dates each time the movie was watched
+                DateTime lastWatchDate1 = watchCount1 > 0 ? m1.WatchedHistory[watchCount1 - 1].DateWatched : DateTime.MinValue;
+                DateTime lastWatchDate2 = watchCount2 > 0 ? m2.WatchedHistory[watchCount2 - 1].DateWatched : DateTime.MinValue;
+                return lastWatchDate2.CompareTo(lastWatchDate1);
+            });
+
+            // Clear Properties
+            ClearRecentWatchedProperties();
+
+            string type = "movie";
+
+            int i = 1;
+            foreach (DBMovieInfo movie in filteredMovies)
+            {
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.Title, type, i), movie.Title);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.Thumb, type, i), movie.CoverThumbFullPath);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.Fanart, type, i), movie.BackdropFullPath);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.DateAdded, type, i), movie.DateAdded.ToString());
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.DateWatched, type, i), movie.WatchedHistory.Count > 0 ? movie.WatchedHistory[movie.WatchedHistory.Count - 1].DateWatched.ToString() : "N/A");
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.Runtime, type, i), GetMovieRuntime(movie) + " mins");
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.Certification, type, i), movie.Certification);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.Score, type, i), movie.Score.ToString());
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.RoundedScore, type, i), Math.Round(movie.Score, MidpointRounding.AwayFromZero).ToString());
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.WatchedCount, type, i), movie.WatchedHistory.Count.ToString());
+
+                logger.WriteLog(string.Format("Recently Watched Movie {0} is {1}", i, movie.Title), LogLevel.Info, InfoServiceModul.RecentlyWatched);                
+                ++i;
+                if (i == 4)
+                    break;
+            }
+
+        }
+
+        /// <summary>
+        /// Get the runtime of a movie using its MediaInfo property
+        /// </summary>
+        /// <param name="movie"></param>
+        /// <returns></returns>
+        private static string GetMovieRuntime(DBMovieInfo movie)
+        {
+            string minutes = string.Empty;
+            if (movie == null) return minutes;
+
+            if (MovingPicturesCore.Settings.DisplayActualRuntime && movie.ActualRuntime > 0)
+            {
+                // Actual Runtime or (MediaInfo result) is in milliseconds
+                // convert to minutes
+                minutes = ((movie.ActualRuntime / 1000) / 60).ToString();
+            }
+            else
+                minutes = movie.Runtime.ToString();
+
+            return minutes;
+        }
+
+        private static void ClearRecentAddedProperties()
+        {
+            string type = "movie";
+
+            for (int i = 1; i <= 4; i++)
+            {
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyAdded.Title, type, i), string.Empty);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyAdded.Thumb, type, i), string.Empty);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyAdded.Fanart, type, i), string.Empty);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyAdded.DateAdded, type, i), string.Empty);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyAdded.Runtime, type, i), string.Empty);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyAdded.Certification, type, i), string.Empty);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyAdded.Score, type, i), string.Empty);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyAdded.RoundedScore, type, i), string.Empty);
+            }
+        }
+
+        private static void ClearRecentWatchedProperties()
+        {
+            string type = "movie";
+
+            for (int i = 1; i <= 4; i++)
+            {
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.Title, type, i), string.Empty);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.Thumb, type, i), string.Empty);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.Fanart, type, i), string.Empty);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.DateAdded, type, i), string.Empty);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.DateWatched, type, i), string.Empty);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.Runtime, type, i), string.Empty);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.Certification, type, i), string.Empty);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.Score, type, i), string.Empty);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.RoundedScore, type, i), string.Empty);
+                PropertyUtils.SetProperty(string.Format(PropertyUtils.Properties.RecentlyWatched.WatchedCount, type, i), string.Empty);
+            }
+        }
+        #endregion
         static void UpdateTimer_UpdateProperties()
         {
             if (FirstRefresh)
Index: InfoService/Utils/AssemblyUtils.cs
===================================================================
--- InfoService/Utils/AssemblyUtils.cs	(revision 0)
+++ InfoService/Utils/AssemblyUtils.cs	(revision 0)
@@ -0,0 +1,56 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace InfoService.Utils
+{
+    public static class AssemblyUtils
+    {
+        private static readonly Logger logger = Logger.GetInstance();
+
+        public static bool IsAssemblyAvailable(string name, Version ver)
+        {
+            bool result = false;
+
+            logger.WriteLog(string.Format("Checking whether assembly {0} is available and loaded...", name), LogLevel.Info, InfoServiceModul.InfoService);
+            
+            Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
+            foreach (Assembly a in assemblies)
+            {
+                try
+                {
+                    if (a.GetName().Name == name && a.GetName().Version >= ver)
+                    {
+                        logger.WriteLog(string.Format("Assembly {0} v{1} is available and loaded.", name, a.GetName().Version.ToString()), LogLevel.Info, InfoServiceModul.InfoService);
+                        result = true;
+                        break;
+                    }
+                }
+                catch (Exception e)
+                {
+                    logger.WriteLog(string.Format("Assembly.GetName() call failed for '{0}'!\nException: {1}", a.Location, e), LogLevel.Warning, InfoServiceModul.InfoService);
+                }
+            }
+
+            if (!result)
+            {
+                logger.WriteLog(string.Format("Assembly {0} is not loaded (not available?), trying to load it manually...", name), LogLevel.Info, InfoServiceModul.InfoService);                
+                try
+                {
+                    Assembly assembly = Assembly.ReflectionOnlyLoad(name);
+                    logger.WriteLog(string.Format("Assembly {0} v{1} is available and loaded successfully.", name, assembly.GetName().Version.ToString()), LogLevel.Info, InfoServiceModul.InfoService);
+                    result = true;
+                }
+                catch (Exception e)
+                {
+                    logger.WriteLog(string.Format("Assembly {0} is unavailable, load unsuccessful: {1}:{2}", name, e.GetType(), e.Message), LogLevel.Info, InfoServiceModul.InfoService);                    
+                }
+            }
+
+            return result;
+        }
+
+    }
+}
Index: InfoService/Utils/Log.cs
===================================================================
--- InfoService/Utils/Log.cs	(revision 66719)
+++ InfoService/Utils/Log.cs	(working copy)
@@ -21,6 +21,7 @@
         Feed,
         Twitter,
         RecentlyAdded,
+        RecentlyWatched,
         SkinSettings,
     }
 
Index: InfoService/Utils/PropertyUtils.cs
===================================================================
--- InfoService/Utils/PropertyUtils.cs	(revision 66719)
+++ InfoService/Utils/PropertyUtils.cs	(working copy)
@@ -126,8 +126,28 @@
                 public const string Thumb = "#infoservice.recentlyAdded.{0}{1}.thumb";
                 public const string Fanart = "#infoservice.recentlyAdded.{0}{1}.fanart";
                 public const string DateAdded = "#infoservice.recentlyAdded.{0}{1}.dateadded";
+                public const string Runtime = "#infoservice.recentlyAdded.{0}{1}.runtime";
+                public const string Certification = "#infoservice.recentlyAdded.{0}{1}.certification";
+                public const string Score = "#infoservice.recentlyAdded.{0}{1}.score";
+                public const string RoundedScore = "#infoservice.recentlyAdded.{0}{1}.roundedscore";
             }
             #endregion
+
+            #region Recently Watched Properties
+            public struct RecentlyWatched
+            {
+                public const string Title = "#infoservice.recentlyWatched.{0}{1}.title";
+                public const string Thumb = "#infoservice.recentlyWatched.{0}{1}.thumb";
+                public const string Fanart = "#infoservice.recentlyWatched.{0}{1}.fanart";
+                public const string DateAdded = "#infoservice.recentlyWatched.{0}{1}.dateadded";
+                public const string DateWatched = "#infoservice.recentlyWatched.{0}{1}.datewatched";
+                public const string Runtime = "#infoservice.recentlyWatched.{0}{1}.runtime";
+                public const string Certification = "#infoservice.recentlyWatched.{0}{1}.certification";
+                public const string Score = "#infoservice.recentlyWatched.{0}{1}.score";
+                public const string RoundedScore = "#infoservice.recentlyWatched.{0}{1}.roundedscore";
+                public const string WatchedCount = "#infoservice.recentlyWatched.{0}{1}.watchedcount";
+            }
+            #endregion
         }
 
         public static void SetProperty(string property, string value)
