Răsfoiți Sursa

fixed user image scaling

Luke Pulverenti 11 ani în urmă
părinte
comite
3228f50895

+ 41 - 2
MediaBrowser.Api/Images/ImageService.cs

@@ -1,8 +1,7 @@
-using MediaBrowser.Common.Configuration;
+using System.Globalization;
 using MediaBrowser.Common.Extensions;
 using MediaBrowser.Common.IO;
 using MediaBrowser.Controller.Drawing;
-using MediaBrowser.Controller.Dto;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Persistence;
@@ -48,6 +47,8 @@ namespace MediaBrowser.Api.Images
         /// <value>The id.</value>
         [ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
         public string Id { get; set; }
+
+        public string Params { get; set; }
     }
 
     /// <summary>
@@ -358,9 +359,47 @@ namespace MediaBrowser.Api.Images
                 _libraryManager.RootFolder :
                 _libraryManager.GetItemById(request.Id);
 
+            if (!string.IsNullOrEmpty(request.Params))
+            {
+                ParseOptions(request, request.Params);
+            }
+
             return GetImage(request, item);
         }
 
+        private readonly CultureInfo _usCulture = new CultureInfo("en-US");
+        private void ParseOptions(ImageRequest request, string options)
+        {
+            var vals = options.Split(';');
+
+            for (var i = 0; i < vals.Length; i++)
+            {
+                var val = vals[i];
+
+                if (string.IsNullOrWhiteSpace(val))
+                {
+                    continue;
+                }
+
+                if (i == 0)
+                {
+                    request.Tag = val;
+                }
+                else if (i == 1)
+                {
+                    request.Format = (ImageOutputFormat)Enum.Parse(typeof(ImageOutputFormat), val, true);
+                }
+                else if (i == 2)
+                {
+                    request.MaxWidth = int.Parse(val, _usCulture);
+                }
+                else if (i == 3)
+                {
+                    request.MaxHeight = int.Parse(val, _usCulture);
+                }
+            }
+        }
+
         /// <summary>
         /// Gets the specified request.
         /// </summary>

+ 0 - 3
MediaBrowser.Api/UserLibrary/ItemsService.cs

@@ -502,9 +502,6 @@ namespace MediaBrowser.Api.UserLibrary
                         return userdata != null && userdata.IsFavorite;
                     });
 
-                case ItemFilter.IsRecentlyAdded:
-                    return items.Where(item => item.IsRecentlyAdded());
-
                 case ItemFilter.IsResumable:
                     return items.Where(item =>
                     {

+ 0 - 10
MediaBrowser.Controller/Entities/BaseItem.cs

@@ -948,16 +948,6 @@ namespace MediaBrowser.Controller.Entities
             return GetType().Name;
         }
 
-        /// <summary>
-        /// Determines if the item is considered new based on user settings
-        /// </summary>
-        /// <returns><c>true</c> if [is recently added] [the specified user]; otherwise, <c>false</c>.</returns>
-        /// <exception cref="System.ArgumentNullException"></exception>
-        public bool IsRecentlyAdded()
-        {
-            return (DateTime.UtcNow - DateCreated).TotalDays < ConfigurationManager.Configuration.RecentItemDays;
-        }
-
         /// <summary>
         /// Gets the linked child.
         /// </summary>

+ 14 - 6
MediaBrowser.Dlna/Didl/DidlBuilder.cs

@@ -1,4 +1,5 @@
-using MediaBrowser.Common.Net;
+using System.Collections.Generic;
+using MediaBrowser.Common.Net;
 using MediaBrowser.Controller.Drawing;
 using MediaBrowser.Controller.Dto;
 using MediaBrowser.Controller.Entities;
@@ -672,22 +673,29 @@ namespace MediaBrowser.Dlna.Didl
 
         private ImageUrlInfo GetImageUrl(ImageDownloadInfo info, int? maxWidth, int? maxHeight)
         {
-            var url = string.Format("{0}/Items/{1}/Images/{2}?tag={3}&format=jpg",
+            var url = string.Format("{0}/Items/{1}/Images/{2}?params=",
                 _serverAddress,
                 info.ItemId,
-                info.Type,
-                info.ImageTag);
+                info.Type);
+
+            var options = new List<string>
+            {
+                info.ImageTag,
+                "jpg"
+            };
 
             if (maxWidth.HasValue)
             {
-                url += "&maxWidth=" + maxWidth.Value.ToString(_usCulture);
+                options.Add(maxWidth.Value.ToString(_usCulture));
             }
 
             if (maxHeight.HasValue)
             {
-                url += "&maxHeight=" + maxHeight.Value.ToString(_usCulture);
+                options.Add(maxHeight.Value.ToString(_usCulture));
             }
 
+            url += string.Join(";", options.ToArray());
+
             var width = info.Width;
             var height = info.Height;
 

+ 0 - 13
MediaBrowser.Model/Configuration/ServerConfiguration.cs

@@ -123,12 +123,6 @@ namespace MediaBrowser.Model.Configuration
         /// <value><c>true</c> if [show log window]; otherwise, <c>false</c>.</value>
         public bool ShowLogWindow { get; set; }
 
-        /// <summary>
-        /// Gets or sets the recent item days.
-        /// </summary>
-        /// <value>The recent item days.</value>
-        public int RecentItemDays { get; set; }
-
         /// <summary>
         /// Gets or sets the minimum percentage of an item that must be played in order for playstate to be updated.
         /// </summary>
@@ -227,9 +221,6 @@ namespace MediaBrowser.Model.Configuration
 
         public NotificationOptions NotificationOptions { get; set; }
 
-        [Obsolete("Please use RequireManualLoginForMobileApps")]
-        public string[] ManualLoginClients { get; set; }
-
         /// <summary>
         /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
         /// </summary>
@@ -258,8 +249,6 @@ namespace MediaBrowser.Model.Configuration
 
             RealtimeMonitorDelay = 30;
 
-            RecentItemDays = 10;
-
             EnableInternetProviders = true; //initial installs will need these
 
             PathSubstitutions = new PathSubstitution[] { };
@@ -295,8 +284,6 @@ namespace MediaBrowser.Model.Configuration
             UICulture = "en-us";
 
             NotificationOptions = new NotificationOptions();
-
-            ManualLoginClients = new string[] { };
         }
     }
 

+ 0 - 4
MediaBrowser.Model/Querying/ItemFilter.cs

@@ -27,10 +27,6 @@ namespace MediaBrowser.Model.Querying
         /// </summary>
         IsFavorite = 5,
         /// <summary>
-        /// The item is recently added
-        /// </summary>
-        IsRecentlyAdded = 6,
-        /// <summary>
         /// The item is resumable
         /// </summary>
         IsResumable = 7,

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

@@ -1458,10 +1458,10 @@ namespace MediaBrowser.Server.Implementations.Dto
                 recursiveItemCount++;
 
                 // Check is recently added
-                if (child.IsRecentlyAdded())
-                {
-                    rcentlyAddedItemCount++;
-                }
+                //if (child.IsRecentlyAdded())
+                //{
+                //    rcentlyAddedItemCount++;
+                //}
 
                 var isUnplayed = true;
 

+ 3 - 1
MediaBrowser.Server.Implementations/Localization/Server/server.json

@@ -621,5 +621,7 @@
 	"ButtonVolumeUp": "Volume up",
 	"ButtonVolumeDown": "Volume down",
 	"ButtonMute": "Mute",
-	"HeaderLatestMedia": "Latest Media"
+	"HeaderLatestMedia": "Latest Media",
+	"OptionNoSubtitles": "No Subtitles",
+	"OptionSpecialFeatures": "Special Features"
 }

+ 12 - 0
MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj

@@ -2025,6 +2025,18 @@
     <None Include="dashboard-ui\css\fonts\OpenSans-Light.woff">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="dashboard-ui\css\fonts\RobotoLight.woff">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="dashboard-ui\css\fonts\RobotoMedium.woff">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="dashboard-ui\css\fonts\RobotoRegular.woff">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="dashboard-ui\css\fonts\RobotoThin.woff">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
     <None Include="packages.config" />
     <None Include="WebMarkupMin.Configuration.xsd">
       <SubType>Designer</SubType>