Added Video3DFormat property

This commit is contained in:
Luke Pulverenti 2013-06-25 14:10:39 -04:00
parent 640de9ef79
commit 07e230c2eb
14 changed files with 86 additions and 20 deletions

View File

@ -117,8 +117,8 @@ namespace MediaBrowser.Api.UserLibrary
/// Gets or sets the video formats.
/// </summary>
/// <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>
/// Gets or sets the series status.
@ -535,11 +535,9 @@ namespace MediaBrowser.Api.UserLibrary
}
// 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

View File

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

View File

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

View File

@ -62,7 +62,26 @@ namespace MediaBrowser.Controller.Resolvers
{
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;
}
}
}
}

View File

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

View File

@ -36,6 +36,12 @@ namespace MediaBrowser.Model.Dto
/// <value>The name of the sort.</value>
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>
/// Gets or sets the premiere date.
/// </summary>

View File

@ -0,0 +1,14 @@

namespace MediaBrowser.Model.Entities
{
public enum Video3DFormat
{
HalfSideBySide,
FullSideBySide,
FullTopAndBottom,
HalfTopAndBottom
}
}

View File

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

View File

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

View File

@ -27,12 +27,28 @@ namespace MediaBrowser.Providers.Savers
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
public bool Supports(BaseItem item)
{
if (!_config.Configuration.SaveLocalMeta || item.LocationType != LocationType.FileSystem)
if (item.LocationType != LocationType.FileSystem)
{
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>

View File

@ -35,7 +35,12 @@ namespace MediaBrowser.Server.Implementations.Library
}
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
EnsureName(item);

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common.Internal</id>
<version>3.0.129</version>
<version>3.0.130</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.129" />
<dependency id="MediaBrowser.Common" version="3.0.130" />
<dependency id="NLog" version="2.0.1.2" />
<dependency id="ServiceStack.Text" version="3.9.45" />
<dependency id="SimpleInjector" version="2.2.3" />

View File

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

View File

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