浏览代码

added logging during app update, and IsHD

Luke Pulverenti 11 年之前
父节点
当前提交
02ebeb0e5b

+ 1 - 1
MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs

@@ -229,7 +229,7 @@ namespace MediaBrowser.Api.DefaultTheme
             var movies = items.OfType<Movie>()
                 .ToList();
 
-            var hdMovies = movies.Where(i => i.IsHd).ToList();
+            var hdMovies = movies.Where(i => i.IsHD).ToList();
 
             var familyGenres = request.FamilyGenre.Split(',').ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
 

+ 18 - 1
MediaBrowser.Api/Playback/BaseStreamingService.cs

@@ -5,6 +5,7 @@ using MediaBrowser.Common.MediaInfo;
 using MediaBrowser.Controller;
 using MediaBrowser.Controller.Dto;
 using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities.Audio;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.MediaInfo;
 using MediaBrowser.Model.Drawing;
@@ -442,7 +443,23 @@ namespace MediaBrowser.Api.Playback
         /// <returns>System.String.</returns>
         protected string GetProbeSizeArgument(BaseItem item)
         {
-            return MediaEncoder.GetProbeSizeArgument(MediaEncoderHelpers.GetInputType(item));
+            var type = InputType.AudioFile;
+
+            if (item is Audio)
+            {
+                type = MediaEncoderHelpers.GetInputType(item.Path, null, null);
+            }
+            else
+            {
+                var video = item as Video;
+
+                if (video != null)
+                {
+                    type = MediaEncoderHelpers.GetInputType(item.Path, video.VideoType, video.IsoType);
+                }
+            }
+
+            return MediaEncoder.GetProbeSizeArgument(type);
         }
 
         /// <summary>

+ 1 - 1
MediaBrowser.Api/UserLibrary/ItemsService.cs

@@ -756,7 +756,7 @@ namespace MediaBrowser.Api.UserLibrary
 
             if (request.IsHD.HasValue)
             {
-                items = items.OfType<Video>().Where(i => i.IsHd == request.IsHD.Value);
+                items = items.OfType<Video>().Where(i => i.IsHD == request.IsHD.Value);
             }
 
             if (request.ParentIndexNumber.HasValue)

+ 2 - 0
MediaBrowser.Common.Implementations/BaseApplicationHost.cs

@@ -586,6 +586,8 @@ namespace MediaBrowser.Common.Implementations
         /// <param name="newVersion">The new version.</param>
         protected void OnApplicationUpdated(Version newVersion)
         {
+            Logger.Info("Application has been updated to version {0}", newVersion);
+
             EventHelper.QueueEventIfNotNull(ApplicationUpdated, this, new GenericEventArgs<Version> { Argument = newVersion }, Logger);
 
             NotifyPendingRestart();

+ 1 - 0
MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj

@@ -79,6 +79,7 @@
     <Compile Include="ScheduledTasks\TaskManager.cs" />
     <Compile Include="ScheduledTasks\Tasks\DeleteCacheFileTask.cs" />
     <Compile Include="ScheduledTasks\Tasks\DeleteLogFileTask.cs" />
+    <Compile Include="ScheduledTasks\Tasks\PluginUpdateTask.cs" />
     <Compile Include="ScheduledTasks\Tasks\ReloadLoggerTask.cs" />
     <Compile Include="ScheduledTasks\Tasks\SystemUpdateTask.cs" />
     <Compile Include="Security\MBLicenseFile.cs" />

+ 2 - 3
MediaBrowser.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs → MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs

@@ -1,5 +1,4 @@
-using MediaBrowser.Common;
-using MediaBrowser.Common.ScheduledTasks;
+using MediaBrowser.Common.ScheduledTasks;
 using MediaBrowser.Common.Updates;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Net;
@@ -10,7 +9,7 @@ using System.Linq;
 using System.Threading;
 using System.Threading.Tasks;
 
-namespace MediaBrowser.Server.Implementations.ScheduledTasks
+namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
 {
     /// <summary>
     /// Plugin Update Task

+ 5 - 5
MediaBrowser.Common.Implementations/Updates/InstallationManager.cs

@@ -439,7 +439,6 @@ namespace MediaBrowser.Common.Implementations.Updates
             finally
             {
                 // Dispose the progress object and remove the installation from the in-progress list
-
                 innerProgress.Dispose();
                 tuple.Item2.Dispose();
             }
@@ -457,8 +456,10 @@ namespace MediaBrowser.Common.Implementations.Updates
             // Do the install
             await PerformPackageInstallation(progress, package, cancellationToken).ConfigureAwait(false);
 
+            var extension = Path.GetExtension(package.targetFilename) ?? "";
+
             // Do plugin-specific processing
-            if (!(Path.GetExtension(package.targetFilename) ?? "").Equals(".zip", StringComparison.OrdinalIgnoreCase))
+            if (!string.Equals(extension, ".zip", StringComparison.OrdinalIgnoreCase) && !string.Equals(extension, ".rar", StringComparison.OrdinalIgnoreCase) && !string.Equals(extension, ".7z", StringComparison.OrdinalIgnoreCase))
             {
                 // Set last update time if we were installed before
                 var plugin = _applicationHost.Plugins.FirstOrDefault(p => p.Name.Equals(package.name, StringComparison.OrdinalIgnoreCase));
@@ -471,7 +472,6 @@ namespace MediaBrowser.Common.Implementations.Updates
                 {
                     OnPluginInstalled(package);
                 }
-
             }
         }
 
@@ -479,7 +479,8 @@ namespace MediaBrowser.Common.Implementations.Updates
         {
             // Target based on if it is an archive or single assembly
             //  zip archives are assumed to contain directory structures relative to our ProgramDataPath
-            var isArchive = string.Equals(Path.GetExtension(package.targetFilename), ".zip", StringComparison.OrdinalIgnoreCase);
+            var extension = Path.GetExtension(package.targetFilename);
+            var isArchive = string.Equals(extension, ".zip", StringComparison.OrdinalIgnoreCase) || string.Equals(extension, ".rar", StringComparison.OrdinalIgnoreCase) || string.Equals(extension, ".7z", StringComparison.OrdinalIgnoreCase);
             var target = Path.Combine(isArchive ? _appPaths.TempUpdatePath : _appPaths.PluginsPath, package.targetFilename);
 
             // Download to temporary file so that, if interrupted, it won't destroy the existing installation
@@ -536,7 +537,6 @@ namespace MediaBrowser.Common.Implementations.Updates
             }
         }
 
-
         /// <summary>
         /// Uninstalls a plugin
         /// </summary>

+ 1 - 1
MediaBrowser.Controller/Entities/Video.cs

@@ -136,7 +136,7 @@ namespace MediaBrowser.Controller.Entities
             get { return Video3DFormat.HasValue; }
         }
 
-        public bool IsHd
+        public bool IsHD
         {
             get { return MediaStreams != null && MediaStreams.Any(i => i.Type == MediaStreamType.Video && i.Width.HasValue && i.Width.Value >= 1280); }
         }

+ 9 - 10
MediaBrowser.Controller/MediaInfo/MediaEncoderHelpers.cs

@@ -1,5 +1,4 @@
-using MediaBrowser.Common.IO;
-using MediaBrowser.Common.MediaInfo;
+using MediaBrowser.Common.MediaInfo;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.IO;
@@ -64,17 +63,17 @@ namespace MediaBrowser.Controller.MediaInfo
         /// <summary>
         /// Gets the type of the input.
         /// </summary>
-        /// <param name="item">The item.</param>
+        /// <param name="path">The path.</param>
+        /// <param name="videoType">Type of the video.</param>
+        /// <param name="isoType">Type of the iso.</param>
         /// <returns>InputType.</returns>
-        public static InputType GetInputType(BaseItem item)
+        public static InputType GetInputType(string path, VideoType? videoType, IsoType? isoType)
         {
             var type = InputType.AudioFile;
 
-            var video = item as Video;
-
-            if (video != null)
+            if (videoType.HasValue)
             {
-                switch (video.VideoType)
+                switch (videoType.Value)
                 {
                     case VideoType.BluRay:
                         type = InputType.Bluray;
@@ -83,9 +82,9 @@ namespace MediaBrowser.Controller.MediaInfo
                         type = InputType.Dvd;
                         break;
                     case VideoType.Iso:
-                        if (video.IsoType.HasValue)
+                        if (isoType.HasValue)
                         {
-                            switch (video.IsoType.Value)
+                            switch (isoType.Value)
                             {
                                 case IsoType.BluRay:
                                     type = InputType.Bluray;

+ 10 - 0
MediaBrowser.Model/Dto/BaseItemDto.cs

@@ -138,6 +138,10 @@ namespace MediaBrowser.Model.Dto
         /// <value>The production year.</value>
         public int? ProductionYear { get; set; }
 
+        /// <summary>
+        /// Gets or sets the season count.
+        /// </summary>
+        /// <value>The season count.</value>
         public int? SeasonCount { get; set; }
         
         /// <summary>
@@ -188,6 +192,12 @@ namespace MediaBrowser.Model.Dto
         /// <value>The language.</value>
         public string Language { get; set; }
 
+        /// <summary>
+        /// Gets or sets a value indicating whether this instance is HD.
+        /// </summary>
+        /// <value><c>null</c> if [is HD] contains no value, <c>true</c> if [is HD]; otherwise, <c>false</c>.</value>
+        public bool? IsHD { get; set; }
+        
         /// <summary>
         /// Gets or sets a value indicating whether this instance is folder.
         /// </summary>

+ 0 - 6
MediaBrowser.Model/Entities/BaseItemInfo.cs

@@ -32,12 +32,6 @@ namespace MediaBrowser.Model.Entities
         /// <value>The type of the media.</value>
         public string MediaType { get; set; }
         
-        /// <summary>
-        /// Gets or sets a value indicating whether this instance is folder.
-        /// </summary>
-        /// <value><c>true</c> if this instance is folder; otherwise, <c>false</c>.</value>
-        public bool IsFolder { get; set; }
-
         /// <summary>
         /// Gets or sets the run time ticks.
         /// </summary>

+ 4 - 0
MediaBrowser.Providers/TV/SeriesPostScanTask.cs

@@ -54,6 +54,10 @@ namespace MediaBrowser.Providers.TV
                     .Distinct()
                     .Count();
 
+                series.DateLastEpisodeAdded = episodes.Select(i => i.DateCreated)
+                    .OrderByDescending(i => i)
+                    .FirstOrDefault();
+
                 numComplete++;
                 double percent = numComplete;
                 percent /= seriesList.Count;

+ 1 - 1
MediaBrowser.Server.Implementations/Dto/DtoService.cs

@@ -275,7 +275,6 @@ namespace MediaBrowser.Server.Implementations.Dto
                 Name = item.Name,
                 MediaType = item.MediaType,
                 Type = item.GetType().Name,
-                IsFolder = item.IsFolder,
                 RunTimeTicks = item.RunTimeTicks
             };
 
@@ -959,6 +958,7 @@ namespace MediaBrowser.Server.Implementations.Dto
                 dto.VideoType = video.VideoType;
                 dto.Video3DFormat = video.Video3DFormat;
                 dto.IsoType = video.IsoType;
+                dto.IsHD = video.IsHD;
 
                 dto.PartCount = video.AdditionalPartIds.Count + 1;
 

+ 0 - 1
MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj

@@ -168,7 +168,6 @@
     <Compile Include="Providers\ProviderManager.cs" />
     <Compile Include="ScheduledTasks\PeopleValidationTask.cs" />
     <Compile Include="ScheduledTasks\ChapterImagesTask.cs" />
-    <Compile Include="ScheduledTasks\PluginUpdateTask.cs" />
     <Compile Include="ScheduledTasks\RefreshMediaLibraryTask.cs" />
     <Compile Include="ServerApplicationPaths.cs" />
     <Compile Include="ServerManager\ServerManager.cs" />

+ 2 - 2
Nuget/MediaBrowser.Common.Internal.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
     <metadata>
         <id>MediaBrowser.Common.Internal</id>
-        <version>3.0.209</version>
+        <version>3.0.210</version>
         <title>MediaBrowser.Common.Internal</title>
         <authors>Luke</authors>
         <owners>ebr,Luke,scottisafool</owners>
@@ -12,7 +12,7 @@
         <description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
         <copyright>Copyright © Media Browser 2013</copyright>
         <dependencies>
-            <dependency id="MediaBrowser.Common" version="3.0.209" />
+            <dependency id="MediaBrowser.Common" version="3.0.210" />
             <dependency id="NLog" version="2.0.1.2" />
             <dependency id="ServiceStack.Text" version="3.9.58" />
             <dependency id="SimpleInjector" version="2.3.2" />

+ 1 - 1
Nuget/MediaBrowser.Common.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
     <metadata>
         <id>MediaBrowser.Common</id>
-        <version>3.0.209</version>
+        <version>3.0.210</version>
         <title>MediaBrowser.Common</title>
         <authors>Media Browser Team</authors>
         <owners>ebr,Luke,scottisafool</owners>

+ 2 - 2
Nuget/MediaBrowser.Server.Core.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
     <metadata>
         <id>MediaBrowser.Server.Core</id>
-        <version>3.0.209</version>
+        <version>3.0.210</version>
         <title>Media Browser.Server.Core</title>
         <authors>Media Browser Team</authors>
         <owners>ebr,Luke,scottisafool</owners>
@@ -12,7 +12,7 @@
         <description>Contains core components required to build plugins for Media Browser Server.</description>
         <copyright>Copyright © Media Browser 2013</copyright>
         <dependencies>
-            <dependency id="MediaBrowser.Common" version="3.0.209" />
+            <dependency id="MediaBrowser.Common" version="3.0.210" />
         </dependencies>
     </metadata>
     <files>