Parcourir la source

Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser

Conflicts:
	MediaBrowser.Installer/MainWindow.xaml.cs
Eric Reed il y a 12 ans
Parent
commit
ae307f1c7d

+ 1 - 1
MediaBrowser.Api/Images/ImageService.cs

@@ -293,7 +293,7 @@ namespace MediaBrowser.Api.Images
 
             if (string.IsNullOrEmpty(imagePath))
             {
-                throw new ResourceNotFoundException();
+                throw new ResourceNotFoundException(string.Format("{0} does not have an image of type {1}", item.Name, request.Type));
             }
 
             // See if we can avoid a file system lookup by looking for the file in ResolveArgs

+ 14 - 10
MediaBrowser.Controller/Dto/DtoBuilder.cs

@@ -566,29 +566,33 @@ namespace MediaBrowser.Controller.Dto
                 return;
             }
 
-            // Attach People by transforming them into BaseItemPerson (DTO)
-            dto.People = new BaseItemPerson[item.People.Count];
-
             // Ordering by person type to ensure actors and artists are at the front.
             // This is taking advantage of the fact that they both begin with A
             // This should be improved in the future
-            var entities = await Task.WhenAll(item.People.OrderBy(i => i.Type).Select(c =>
+            var people = item.People.OrderBy(i => i.Type).ToList();
+
+            // Attach People by transforming them into BaseItemPerson (DTO)
+            dto.People = new BaseItemPerson[people.Count];
+
+            var entities = await Task.WhenAll(people.Select(p => p.Name).Distinct(StringComparer.OrdinalIgnoreCase).Select(c =>
 
                     Task.Run(async () =>
                     {
                         try
                         {
-                            return await _libraryManager.GetPerson(c.Name).ConfigureAwait(false);
+                            return await _libraryManager.GetPerson(c).ConfigureAwait(false);
                         }
                         catch (IOException ex)
                         {
-                            _logger.ErrorException("Error getting person {0}", ex, c.Name);
+                            _logger.ErrorException("Error getting person {0}", ex, c);
                             return null;
                         }
                     })
 
             )).ConfigureAwait(false);
 
+            var dictionary = entities.ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase);
+
             for (var i = 0; i < item.People.Count; i++)
             {
                 var person = item.People[i];
@@ -600,15 +604,15 @@ namespace MediaBrowser.Controller.Dto
                     Type = person.Type
                 };
 
-                var ibnObject = entities[i];
+                Person entity;
 
-                if (ibnObject != null)
+                if (dictionary.TryGetValue(person.Name, out entity))
                 {
-                    var primaryImagePath = ibnObject.PrimaryImagePath;
+                    var primaryImagePath = entity.PrimaryImagePath;
 
                     if (!string.IsNullOrEmpty(primaryImagePath))
                     {
-                        baseItemPerson.PrimaryImageTag = Kernel.Instance.ImageManager.GetImageCacheTag(ibnObject, ImageType.Primary, primaryImagePath);
+                        baseItemPerson.PrimaryImageTag = Kernel.Instance.ImageManager.GetImageCacheTag(entity, ImageType.Primary, primaryImagePath);
                     }
                 }
 

+ 30 - 0
MediaBrowser.Controller/Entities/BaseGame.cs

@@ -0,0 +1,30 @@
+
+namespace MediaBrowser.Controller.Entities
+{
+    /// <summary>
+    /// Class BaseGame
+    /// </summary>
+    public class BaseGame : BaseItem
+    {
+        /// <summary>
+        /// Gets the type of the media.
+        /// </summary>
+        /// <value>The type of the media.</value>
+        public override string MediaType
+        {
+            get { return Model.Entities.MediaType.Game; }
+        }
+
+        /// <summary>
+        /// Gets or sets the players supported.
+        /// </summary>
+        /// <value>The players supported.</value>
+        public int? PlayersSupported { get; set; }
+
+        /// <summary>
+        /// Gets or sets the game system.
+        /// </summary>
+        /// <value>The game system.</value>
+        public string GameSystem { get; set; }
+    }
+}

+ 1 - 0
MediaBrowser.Controller/MediaBrowser.Controller.csproj

@@ -77,6 +77,7 @@
     <Compile Include="Entities\Audio\Audio.cs" />
     <Compile Include="Entities\Audio\MusicAlbum.cs" />
     <Compile Include="Entities\Audio\MusicArtist.cs" />
+    <Compile Include="Entities\BaseGame.cs" />
     <Compile Include="Entities\BaseItem.cs" />
     <Compile Include="Entities\BasePluginFolder.cs" />
     <Compile Include="Entities\Folder.cs" />

+ 51 - 1
MediaBrowser.Controller/Providers/ImageFromMediaLocationProvider.cs

@@ -160,6 +160,7 @@ namespace MediaBrowser.Controller.Providers
         private void PopulateBaseItemImages(BaseItem item)
         {
             var backdropFiles = new List<string>();
+            var screenshotFiles = new List<string>();
 
             // Primary Image
             var image = GetImage(item, "folder");
@@ -201,6 +202,22 @@ namespace MediaBrowser.Controller.Providers
                 item.SetImage(ImageType.Thumb, image.Value.Path);
             }
 
+            // Thumbnail Image
+            image = GetImage(item, "box");
+
+            if (image.HasValue)
+            {
+                item.SetImage(ImageType.Box, image.Value.Path);
+            }
+
+            // Thumbnail Image
+            image = GetImage(item, "menu");
+
+            if (image.HasValue)
+            {
+                item.SetImage(ImageType.Menu, image.Value.Path);
+            }
+
             // Backdrop Image
             image = GetImage(item, "backdrop");
 
@@ -234,7 +251,40 @@ namespace MediaBrowser.Controller.Providers
             {
                 item.BackdropImagePaths = backdropFiles;
             }
-        }
 
+            // Screenshot Image
+            image = GetImage(item, "screenshot");
+
+            if (image.HasValue)
+            {
+                screenshotFiles.Add(image.Value.Path);
+            }
+
+            unfound = 0;
+            for (var i = 1; i <= 20; i++)
+            {
+                // Screenshot Image
+                image = GetImage(item, "screenshot" + i);
+
+                if (image.HasValue)
+                {
+                    screenshotFiles.Add(image.Value.Path);
+                }
+                else
+                {
+                    unfound++;
+
+                    if (unfound >= 3)
+                    {
+                        break;
+                    }
+                }
+            }
+
+            if (screenshotFiles.Count > 0)
+            {
+                item.ScreenshotImagePaths = screenshotFiles;
+            }
+        }
     }
 }

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

@@ -256,7 +256,7 @@
   <ItemGroup>
     <EmbeddedResource Include="MediaEncoder\fonts\ARIALUNI.TTF" />
     <EmbeddedResource Include="MediaEncoder\fonts\fonts.conf" />
-    <EmbeddedResource Include="MediaEncoder\ffmpeg20130408.zip" />
+    <EmbeddedResource Include="MediaEncoder\ffmpeg20130412.zip" />
     <None Include="packages.config" />
   </ItemGroup>
   <ItemGroup />

+ 0 - 1
MediaBrowser.Server.Implementations/MediaEncoder/ffmpeg20130408.zip.REMOVED.git-id

@@ -1 +0,0 @@
-13efb0e506699c6d90c23a7600b3556d91dd31a1

+ 1 - 0
MediaBrowser.Server.Implementations/MediaEncoder/ffmpeg20130412.zip.REMOVED.git-id

@@ -0,0 +1 @@
+1b75cc4abcfd185b6db07bbe433d010f947d50ae

+ 1 - 1
MediaBrowser.Server.Implementations/Providers/ProviderManager.cs

@@ -237,7 +237,7 @@ namespace MediaBrowser.Server.Implementations.Providers
             }
             catch (OperationCanceledException ex)
             {
-                _logger.Debug("{0} cancelled for {1}", provider.GetType().Name, item.Name);
+                _logger.Debug("{0} canceled for {1}", provider.GetType().Name, item.Name);
 
                 // If the outer cancellation token is the one that caused the cancellation, throw it
                 if (cancellationToken.IsCancellationRequested && ex.CancellationToken == cancellationToken)

+ 8 - 1
MediaBrowser.WebDashboard/Api/DashboardService.cs

@@ -484,7 +484,14 @@ namespace MediaBrowser.WebDashboard.Api
                                       "userprofilespage.js",
                                       "wizardfinishpage.js",
                                       "wizardstartpage.js",
-                                      "wizarduserpage.js"
+                                      "wizarduserpage.js",
+                                      "gamesrecommendedpage.js",
+                                      "gamesystemspage.js",
+                                      "gamesystempage.js",
+                                      "gamespage.js",
+                                      "gamegenrepage.js",
+                                      "gamestudiospage.js",
+                                      "gamedetailpage.js"
                                   };
 
             var memoryStream = new MemoryStream();

+ 15 - 11
MediaBrowser.WebDashboard/ApiClient.js

@@ -95,6 +95,10 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
             return name;
         }());
 
+        function encodeName(name) {
+            return encodeURIComponent(name).replace("'", '%27');
+        }
+
         /**
          * Wraps around jQuery ajax methods to add additional info to the request.
          */
@@ -867,7 +871,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
                 throw new Error("null name");
             }
 
-            var url = self.getUrl("Studios/" + name);
+            var url = self.getUrl("Studios/" + encodeName(name));
 
             return self.ajax({
                 type: "GET",
@@ -885,7 +889,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
                 throw new Error("null name");
             }
 
-            var url = self.getUrl("Genres/" + name);
+            var url = self.getUrl("Genres/" + encodeName(name));
 
             return self.ajax({
                 type: "GET",
@@ -921,7 +925,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
                 throw new Error("null name");
             }
 
-            var url = self.getUrl("Persons/" + name);
+            var url = self.getUrl("Persons/" + encodeName(name));
 
             return self.ajax({
                 type: "GET",
@@ -1047,7 +1051,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
 
             };
 
-            var url = "Persons/" + name + "/Images/" + options.type;
+            var url = "Persons/" + encodeName(name) + "/Images/" + options.type;
 
             if (options.index != null) {
                 url += "/" + options.index;
@@ -1117,7 +1121,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
 
             };
 
-            var url = "Genres/" + name + "/Images/" + options.type;
+            var url = "Genres/" + encodeName(name) + "/Images/" + options.type;
 
             if (options.index != null) {
                 url += "/" + options.index;
@@ -1131,7 +1135,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
         };
 
         /**
-         * Constructs a url for a genre image
+         * Constructs a url for a studio image
          * @param {String} name
          * @param {Object} options
          * Options supports the following properties:
@@ -1152,7 +1156,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
 
             };
 
-            var url = "Studios/" + name + "/Images/" + options.type;
+            var url = "Studios/" + encodeName(name) + "/Images/" + options.type;
 
             if (options.index != null) {
                 url += "/" + options.index;
@@ -1739,7 +1743,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
                 throw new Error("null name");
             }
 
-            var url = self.getUrl("Users/" + userId + "/ItemsByName/Favorites/" + name);
+            var url = self.getUrl("Users/" + userId + "/ItemsByName/Favorites/" + encodeName(name));
 
             var method = isFavorite ? "POST" : "DELETE";
 
@@ -1766,7 +1770,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
                 throw new Error("null name");
             }
 
-            var url = self.getUrl("Users/" + userId + "/ItemsByName/" + name + "/Rating", {
+            var url = self.getUrl("Users/" + userId + "/ItemsByName/" + encodeName(name) + "/Rating", {
                 likes: likes
             });
 
@@ -1791,7 +1795,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
                 throw new Error("null name");
             }
 
-            var url = self.getUrl("Users/" + userId + "/ItemsByName/" + name + "/Rating");
+            var url = self.getUrl("Users/" + userId + "/ItemsByName/" + encodeName(name) + "/Rating");
 
             return self.ajax({
                 type: "DELETE",
@@ -1815,7 +1819,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
                 throw new Error("null name");
             }
 
-            var url = self.getUrl("Users/" + userId + "/ItemsByName/" + name + "/UserData");
+            var url = self.getUrl("Users/" + userId + "/ItemsByName/" + encodeName(name) + "/UserData");
 
             return self.ajax({
                 type: "GET",

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

@@ -186,6 +186,27 @@
     <Content Include="dashboard-ui\css\userimage.css">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
+    <Content Include="dashboard-ui\gamedetail.html">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\gamegenres.html">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\games.html">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\gamesrecommended.html">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\gamestudios.html">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\gamesystem.html">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\gamesystems.html">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="dashboard-ui\index.html">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
@@ -228,6 +249,27 @@
     <Content Include="dashboard-ui\scripts\boxsets.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
+    <Content Include="dashboard-ui\scripts\gamedetailpage.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\scripts\gamegenrepage.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\scripts\gamespage.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\scripts\gamesrecommendedpage.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\scripts\gamestudiospage.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\scripts\gamesystempage.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\scripts\gamesystemspage.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="dashboard-ui\scripts\itembynamedetailpage.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
@@ -308,6 +350,18 @@
     <Content Include="dashboard-ui\thirdparty\video-js\video.min.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
+    <Content Include="dashboard-ui\thirdparty\video-js\video-js.min.css">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\thirdparty\video-js\video-js.png">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\thirdparty\video-js\video-js.swf">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\thirdparty\video-js\video.min.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="dashboard-ui\tvgenres.html">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>

+ 1 - 1
MediaBrowser.WebDashboard/packages.config

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="MediaBrowser.ApiClient.Javascript" version="3.0.76" targetFramework="net45" />
+  <package id="MediaBrowser.ApiClient.Javascript" version="3.0.77" targetFramework="net45" />
   <package id="ServiceStack.Common" version="3.9.43" targetFramework="net45" />
   <package id="ServiceStack.Text" version="3.9.43" targetFramework="net45" />
 </packages>

+ 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.76</version>
+        <version>3.0.77</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 Theatre 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.74" />
+            <dependency id="MediaBrowser.Common" version="3.0.77" />
             <dependency id="NLog" version="2.0.0.2000" />
             <dependency id="ServiceStack.Text" version="3.9.38" />
             <dependency id="protobuf-net" version="2.0.0.621" />

+ 1 - 1
Nuget/MediaBrowser.Common.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
     <metadata>
         <id>MediaBrowser.Common</id>
-        <version>3.0.76</version>
+        <version>3.0.77</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.76</version>
+        <version>3.0.77</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.76" />
+            <dependency id="MediaBrowser.Common" version="3.0.77" />
         </dependencies>
     </metadata>
     <files>