Browse Source

Added Video3DFormat property

Luke Pulverenti 12 years ago
parent
commit
07e230c2eb

+ 4 - 6
MediaBrowser.Api/UserLibrary/ItemsService.cs

@@ -117,8 +117,8 @@ namespace MediaBrowser.Api.UserLibrary
         /// Gets or sets the video formats.
         /// Gets or sets the video formats.
         /// </summary>
         /// </summary>
         /// <value>The video formats.</value>
         /// <value>The video formats.</value>
-        [ApiMember(Name = "VideoFormats", Description = "Optional filter by VideoFormat (Standard, Digital3D, Sbs3D). Allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
-        public string VideoFormats { get; set; }
+        [ApiMember(Name = "Is3D", Description = "Optional filter by items that are 3D, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
+        public bool? Is3D { get; set; }
 
 
         /// <summary>
         /// <summary>
         /// Gets or sets the series status.
         /// Gets or sets the series status.
@@ -535,11 +535,9 @@ namespace MediaBrowser.Api.UserLibrary
             }
             }
 
 
             // Filter by VideoFormat
             // Filter by VideoFormat
-            if (!string.IsNullOrEmpty(request.VideoFormats))
+            if (request.Is3D.HasValue)
             {
             {
-                var formats = request.VideoFormats.Split(',');
-
-                items = items.OfType<Video>().Where(i => formats.Contains(i.VideoFormat.ToString(), StringComparer.OrdinalIgnoreCase));
+                items = items.OfType<Video>().Where(i => request.Is3D.Value == i.Video3DFormat.HasValue);
             }
             }
 
 
             // Filter by VideoType
             // Filter by VideoType

+ 1 - 1
MediaBrowser.Controller/Dto/DtoBuilder.cs

@@ -449,7 +449,7 @@ namespace MediaBrowser.Controller.Dto
             if (video != null)
             if (video != null)
             {
             {
                 dto.VideoType = video.VideoType;
                 dto.VideoType = video.VideoType;
-                dto.VideoFormat = video.VideoFormat;
+                dto.Video3DFormat = video.Video3DFormat;
                 dto.IsoType = video.IsoType;
                 dto.IsoType = video.IsoType;
 
 
                 dto.PartCount = video.AdditionalPartIds.Count + 1;
                 dto.PartCount = video.AdditionalPartIds.Count + 1;

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

@@ -39,6 +39,12 @@ namespace MediaBrowser.Controller.Entities
         /// <value>The type of the iso.</value>
         /// <value>The type of the iso.</value>
         public IsoType? IsoType { get; set; }
         public IsoType? IsoType { get; set; }
 
 
+        /// <summary>
+        /// Gets or sets the video3 D format.
+        /// </summary>
+        /// <value>The video3 D format.</value>
+        public Video3DFormat? Video3DFormat { get; set; }
+        
         /// <summary>
         /// <summary>
         /// Gets or sets the format of the video.
         /// Gets or sets the format of the video.
         /// </summary>
         /// </summary>
@@ -101,7 +107,7 @@ namespace MediaBrowser.Controller.Entities
         [IgnoreDataMember]
         [IgnoreDataMember]
         public bool Is3D
         public bool Is3D
         {
         {
-            get { return VideoFormat > 0; }
+            get { return Video3DFormat.HasValue; }
         }
         }
 
 
         /// <summary>
         /// <summary>

+ 20 - 1
MediaBrowser.Controller/Resolvers/BaseVideoResolver.cs

@@ -62,7 +62,26 @@ namespace MediaBrowser.Controller.Resolvers
         {
         {
             base.SetInitialItemValues(item, args);
             base.SetInitialItemValues(item, args);
 
 
-            item.VideoFormat = item.Path.IndexOf("[3d]", StringComparison.OrdinalIgnoreCase) != -1 ? VideoFormat.Digital3D : item.Path.IndexOf("[sbs3d]", StringComparison.OrdinalIgnoreCase) != -1 ? VideoFormat.Sbs3D : VideoFormat.Standard;
+            if (item.Path.IndexOf("[3d]", StringComparison.OrdinalIgnoreCase) != -1 || item.Path.IndexOf("[sbs3d]", StringComparison.OrdinalIgnoreCase) != -1)
+            {
+                item.Video3DFormat = Video3DFormat.HalfSideBySide;
+            }
+            else if (item.Path.IndexOf("[hsbs]", StringComparison.OrdinalIgnoreCase) != -1)
+            {
+                item.Video3DFormat = Video3DFormat.HalfSideBySide;
+            }
+            else if (item.Path.IndexOf("[fsbs]", StringComparison.OrdinalIgnoreCase) != -1)
+            {
+                item.Video3DFormat = Video3DFormat.FullSideBySide;
+            }
+            else if (item.Path.IndexOf("[ftab]", StringComparison.OrdinalIgnoreCase) != -1)
+            {
+                item.Video3DFormat = Video3DFormat.FullTopAndBottom;
+            }
+            else if (item.Path.IndexOf("[htab]", StringComparison.OrdinalIgnoreCase) != -1)
+            {
+                item.Video3DFormat = Video3DFormat.HalfTopAndBottom;
+            }
         }
         }
     }
     }
 }
 }

+ 3 - 0
MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj

@@ -154,6 +154,9 @@
     <Compile Include="..\MediaBrowser.Model\Entities\SeriesStatus.cs">
     <Compile Include="..\MediaBrowser.Model\Entities\SeriesStatus.cs">
       <Link>Entities\SeriesStatus.cs</Link>
       <Link>Entities\SeriesStatus.cs</Link>
     </Compile>
     </Compile>
+    <Compile Include="..\MediaBrowser.Model\Entities\Video3DFormat.cs">
+      <Link>Entities\Video3DFormat.cs</Link>
+    </Compile>
     <Compile Include="..\MediaBrowser.Model\Entities\VideoFormat.cs">
     <Compile Include="..\MediaBrowser.Model\Entities\VideoFormat.cs">
       <Link>Entities\VideoFormat.cs</Link>
       <Link>Entities\VideoFormat.cs</Link>
     </Compile>
     </Compile>

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

@@ -36,6 +36,12 @@ namespace MediaBrowser.Model.Dto
         /// <value>The name of the sort.</value>
         /// <value>The name of the sort.</value>
         public string SortName { get; set; }
         public string SortName { get; set; }
 
 
+        /// <summary>
+        /// Gets or sets the video3 D format.
+        /// </summary>
+        /// <value>The video3 D format.</value>
+        public Video3DFormat? Video3DFormat { get; set; }
+        
         /// <summary>
         /// <summary>
         /// Gets or sets the premiere date.
         /// Gets or sets the premiere date.
         /// </summary>
         /// </summary>

+ 14 - 0
MediaBrowser.Model/Entities/Video3DFormat.cs

@@ -0,0 +1,14 @@
+
+namespace MediaBrowser.Model.Entities
+{
+    public enum Video3DFormat
+    {
+        HalfSideBySide,
+
+        FullSideBySide,
+
+        FullTopAndBottom,
+
+        HalfTopAndBottom
+    }
+}

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

@@ -53,6 +53,7 @@
     <Compile Include="Dto\StudioDto.cs" />
     <Compile Include="Dto\StudioDto.cs" />
     <Compile Include="Entities\ItemReview.cs" />
     <Compile Include="Entities\ItemReview.cs" />
     <Compile Include="Entities\MetadataFields.cs" />
     <Compile Include="Entities\MetadataFields.cs" />
+    <Compile Include="Entities\Video3DFormat.cs" />
     <Compile Include="Net\WebSocketMessage.cs" />
     <Compile Include="Net\WebSocketMessage.cs" />
     <Compile Include="Net\WebSocketMessageType.cs" />
     <Compile Include="Net\WebSocketMessageType.cs" />
     <Compile Include="Net\WebSocketState.cs" />
     <Compile Include="Net\WebSocketState.cs" />

+ 1 - 3
MediaBrowser.Model/Querying/ItemQuery.cs

@@ -72,7 +72,7 @@ namespace MediaBrowser.Model.Querying
         /// Gets or sets the video formats.
         /// Gets or sets the video formats.
         /// </summary>
         /// </summary>
         /// <value>The video formats.</value>
         /// <value>The video formats.</value>
-        public VideoFormat[] VideoFormats { get; set; }
+        public bool? Is3D { get; set; }
 
 
         /// <summary>
         /// <summary>
         /// Gets or sets the video types.
         /// Gets or sets the video types.
@@ -189,8 +189,6 @@ namespace MediaBrowser.Model.Querying
 
 
             MediaTypes = new string[] {};
             MediaTypes = new string[] {};
 
 
-            VideoFormats = new VideoFormat[] { };
-
             VideoTypes = new VideoType[] {};
             VideoTypes = new VideoType[] {};
 
 
             Genres = new string[] { };
             Genres = new string[] { };

+ 18 - 2
MediaBrowser.Providers/Savers/FolderXmlSaver.cs

@@ -27,12 +27,28 @@ namespace MediaBrowser.Providers.Savers
         /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
         /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
         public bool Supports(BaseItem item)
         public bool Supports(BaseItem item)
         {
         {
-            if (!_config.Configuration.SaveLocalMeta || item.LocationType != LocationType.FileSystem)
+            if (item.LocationType != LocationType.FileSystem)
             {
             {
                 return false;
                 return false;
             }
             }
 
 
-            return item is Folder && !(item is Series) && !(item is BoxSet) && !(item is MusicArtist) && !(item is MusicAlbum);
+            if (!(item is Folder))
+            {
+                return false;
+            }
+
+            // For these we can proceed even if save local metadata is off
+            if (item is AggregateFolder || item is UserRootFolder || item is CollectionFolder)
+            {
+                return true;
+            }
+            
+            if (!_config.Configuration.SaveLocalMeta)
+            {
+                return false;
+            }
+
+            return !(item is Series) && !(item is BoxSet) && !(item is MusicArtist) && !(item is MusicAlbum);
         }
         }
 
 
         /// <summary>
         /// <summary>

+ 6 - 1
MediaBrowser.Server.Implementations/Library/ResolverHelper.cs

@@ -35,7 +35,12 @@ namespace MediaBrowser.Server.Implementations.Library
             }
             }
 
 
             item.Id = item.Path.GetMBId(item.GetType());
             item.Id = item.Path.GetMBId(item.GetType());
-            item.DisplayMediaType = item.GetType().Name;
+
+            // If the resolver didn't specify this
+            if (string.IsNullOrEmpty(item.DisplayMediaType))
+            {
+                item.DisplayMediaType = item.GetType().Name;
+            }
 
 
             // Make sure the item has a name
             // Make sure the item has a name
             EnsureName(item);
             EnsureName(item);

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

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
     <metadata>
     <metadata>
         <id>MediaBrowser.Common.Internal</id>
         <id>MediaBrowser.Common.Internal</id>
-        <version>3.0.129</version>
+        <version>3.0.130</version>
         <title>MediaBrowser.Common.Internal</title>
         <title>MediaBrowser.Common.Internal</title>
         <authors>Luke</authors>
         <authors>Luke</authors>
         <owners>ebr,Luke,scottisafool</owners>
         <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>
         <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>
         <copyright>Copyright © Media Browser 2013</copyright>
         <dependencies>
         <dependencies>
-            <dependency id="MediaBrowser.Common" version="3.0.129" />
+            <dependency id="MediaBrowser.Common" version="3.0.130" />
             <dependency id="NLog" version="2.0.1.2" />
             <dependency id="NLog" version="2.0.1.2" />
             <dependency id="ServiceStack.Text" version="3.9.45" />
             <dependency id="ServiceStack.Text" version="3.9.45" />
             <dependency id="SimpleInjector" version="2.2.3" />
             <dependency id="SimpleInjector" version="2.2.3" />

+ 1 - 1
Nuget/MediaBrowser.Common.nuspec

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