Merge pull request #1640 from MediaBrowser/dev

Dev
pull/702/head
Luke 9 years ago
commit 4346b53679

@ -1,101 +0,0 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Model.Channels;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading;
namespace MediaBrowser.Controller.Channels
{
public class ChannelAudioItem : Audio
{
public ChannelMediaContentType ContentType { get; set; }
public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
public override UnratedItem GetBlockUnratedType()
{
return UnratedItem.ChannelContent;
}
protected override string CreateUserDataKey()
{
return ExternalId;
}
[IgnoreDataMember]
public override bool SupportsLocalMetadata
{
get
{
return false;
}
}
public override bool IsSaveLocalMetadataEnabled()
{
return false;
}
public ChannelAudioItem()
{
ChannelMediaSources = new List<ChannelMediaInfo>();
}
[IgnoreDataMember]
public override LocationType LocationType
{
get
{
if (string.IsNullOrEmpty(Path))
{
return LocationType.Remote;
}
return base.LocationType;
}
}
protected override string GetInternalMetadataPath(string basePath)
{
return System.IO.Path.Combine(basePath, "channels", ChannelId, Id.ToString("N"));
}
public override IEnumerable<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution)
{
var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None)
.Result.ToList();
if (sources.Count > 0)
{
return sources;
}
var list = base.GetMediaSources(enablePathSubstitution).ToList();
foreach (var mediaSource in list)
{
if (string.IsNullOrWhiteSpace(mediaSource.Path))
{
mediaSource.Type = MediaSourceType.Placeholder;
}
}
return list;
}
public override bool CanDelete()
{
return false;
}
public override bool IsVisibleStandalone(User user)
{
return IsVisibleStandaloneInternal(user, false) && ChannelVideoItem.IsChannelVisible(this, user);
}
}
}

@ -1,89 +0,0 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Channels;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Users;
using System;
using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Controller.Channels
{
public class ChannelFolderItem : Folder
{
public ChannelFolderType ChannelFolderType { get; set; }
protected override bool GetBlockUnratedValue(UserPolicy config)
{
// Don't block.
return false;
}
public override UnratedItem GetBlockUnratedType()
{
return UnratedItem.ChannelContent;
}
[IgnoreDataMember]
public override bool SupportsLocalMetadata
{
get
{
return false;
}
}
public override bool IsSaveLocalMetadataEnabled()
{
return false;
}
protected override string CreateUserDataKey()
{
return ExternalId;
}
protected override async Task<QueryResult<BaseItem>> GetItemsInternal(InternalItemsQuery query)
{
try
{
// Don't blow up here because it could cause parent screens with other content to fail
return await ChannelManager.GetChannelItemsInternal(new ChannelItemQuery
{
ChannelId = ChannelId,
FolderId = Id.ToString("N"),
Limit = query.Limit,
StartIndex = query.StartIndex,
UserId = query.User.Id.ToString("N"),
SortBy = query.SortBy,
SortOrder = query.SortOrder
}, new Progress<double>(), CancellationToken.None);
}
catch
{
// Already logged at lower levels
return new QueryResult<BaseItem>
{
};
}
}
protected override string GetInternalMetadataPath(string basePath)
{
return System.IO.Path.Combine(basePath, "channels", ChannelId, Id.ToString("N"));
}
public override bool CanDelete()
{
return false;
}
public override bool IsVisibleStandalone(User user)
{
return IsVisibleStandaloneInternal(user, false) && ChannelVideoItem.IsChannelVisible(this, user);
}
}
}

@ -1,126 +0,0 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Channels;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading;
namespace MediaBrowser.Controller.Channels
{
public class ChannelVideoItem : Video
{
public ChannelMediaContentType ContentType { get; set; }
public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
protected override string CreateUserDataKey()
{
if (ContentType == ChannelMediaContentType.MovieExtra)
{
var key = this.GetProviderId(MetadataProviders.Imdb) ?? this.GetProviderId(MetadataProviders.Tmdb);
if (!string.IsNullOrWhiteSpace(key))
{
key = key + "-" + ExtraType.ToString().ToLower();
// Make sure different trailers have their own data.
if (RunTimeTicks.HasValue)
{
key += "-" + RunTimeTicks.Value.ToString(CultureInfo.InvariantCulture);
}
return key;
}
}
return ExternalId;
}
public override UnratedItem GetBlockUnratedType()
{
return UnratedItem.ChannelContent;
}
[IgnoreDataMember]
public override bool SupportsLocalMetadata
{
get
{
return false;
}
}
public override bool IsSaveLocalMetadataEnabled()
{
return false;
}
public ChannelVideoItem()
{
ChannelMediaSources = new List<ChannelMediaInfo>();
}
[IgnoreDataMember]
public override LocationType LocationType
{
get
{
if (string.IsNullOrEmpty(Path))
{
return LocationType.Remote;
}
return base.LocationType;
}
}
public override IEnumerable<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution)
{
var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None)
.Result.ToList();
if (sources.Count > 0)
{
return sources;
}
var list = base.GetMediaSources(enablePathSubstitution).ToList();
foreach (var mediaSource in list)
{
if (string.IsNullOrWhiteSpace(mediaSource.Path))
{
mediaSource.Type = MediaSourceType.Placeholder;
}
}
return list;
}
protected override string GetInternalMetadataPath(string basePath)
{
return System.IO.Path.Combine(basePath, "channels", ChannelId, Id.ToString("N"));
}
public override bool CanDelete()
{
return false;
}
public override bool IsVisibleStandalone(User user)
{
return IsVisibleStandaloneInternal(user, false) && IsChannelVisible(this, user);
}
internal static bool IsChannelVisible(BaseItem item, User user)
{
var channel = ChannelManager.GetChannel(item.ChannelId);
return channel.IsVisible(user);
}
}
}

@ -306,7 +306,7 @@ namespace MediaBrowser.Controller.Entities
} }
} }
private List<Tuple<StringBuilder,bool>> GetSortChunks(string s1) private List<Tuple<StringBuilder, bool>> GetSortChunks(string s1)
{ {
var list = new List<Tuple<StringBuilder, bool>>(); var list = new List<Tuple<StringBuilder, bool>>();
@ -668,9 +668,30 @@ namespace MediaBrowser.Controller.Entities
} }
[IgnoreDataMember] [IgnoreDataMember]
public virtual BaseItem DisplayParent public virtual Guid? DisplayParentId
{ {
get { return GetParent(); } get
{
if (ParentId == Guid.Empty)
{
return null;
}
return ParentId;
}
}
[IgnoreDataMember]
public BaseItem DisplayParent
{
get
{
var id = DisplayParentId;
if (!id.HasValue)
{
return null;
}
return LibraryManager.GetItemById(id.Value);
}
} }
/// <summary> /// <summary>
@ -1454,7 +1475,7 @@ namespace MediaBrowser.Controller.Entities
public virtual string GetClientTypeName() public virtual string GetClientTypeName()
{ {
if (IsFolder && SourceType == SourceType.Channel) if (IsFolder && SourceType == SourceType.Channel && !(this is Channel))
{ {
return "ChannelFolderItem"; return "ChannelFolderItem";
} }

@ -1,6 +1,7 @@
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Controller.Entities namespace MediaBrowser.Controller.Entities
{ {
@ -18,11 +19,20 @@ namespace MediaBrowser.Controller.Entities
/// <value>The local trailer ids.</value> /// <value>The local trailer ids.</value>
List<Guid> LocalTrailerIds { get; set; } List<Guid> LocalTrailerIds { get; set; }
List<Guid> RemoteTrailerIds { get; set; } List<Guid> RemoteTrailerIds { get; set; }
}
public static class HasTrailerExtensions
{
/// <summary> /// <summary>
/// Gets the trailer ids. /// Gets the trailer ids.
/// </summary> /// </summary>
/// <returns>List&lt;Guid&gt;.</returns> /// <returns>List&lt;Guid&gt;.</returns>
List<Guid> GetTrailerIds(); public static List<Guid> GetTrailerIds(this IHasTrailers item)
{
var list = item.LocalTrailerIds.ToList();
list.AddRange(item.RemoteTrailerIds);
return list;
}
} }
} }

@ -78,17 +78,6 @@ namespace MediaBrowser.Controller.Entities.Movies
set { TmdbCollectionName = value; } set { TmdbCollectionName = value; }
} }
/// <summary>
/// Gets the trailer ids.
/// </summary>
/// <returns>List&lt;Guid&gt;.</returns>
public List<Guid> GetTrailerIds()
{
var list = LocalTrailerIds.ToList();
list.AddRange(RemoteTrailerIds);
return list;
}
/// <summary> /// <summary>
/// Gets the user data key. /// Gets the user data key.
/// </summary> /// </summary>

@ -90,11 +90,11 @@ namespace MediaBrowser.Controller.Entities.TV
} }
[IgnoreDataMember] [IgnoreDataMember]
public override BaseItem DisplayParent public override Guid? DisplayParentId
{ {
get get
{ {
return Season ?? GetParent(); return SeasonId;
} }
} }

@ -33,9 +33,13 @@ namespace MediaBrowser.Controller.Entities.TV
} }
[IgnoreDataMember] [IgnoreDataMember]
public override BaseItem DisplayParent public override Guid? DisplayParentId
{ {
get { return Series ?? GetParent(); } get
{
var series = Series;
return series == null ? ParentId : series.Id;
}
} }
// Genre, Rating and Stuido will all be the same // Genre, Rating and Stuido will all be the same

@ -75,15 +75,12 @@
</Compile> </Compile>
<Compile Include="Activity\IActivityManager.cs" /> <Compile Include="Activity\IActivityManager.cs" />
<Compile Include="Activity\IActivityRepository.cs" /> <Compile Include="Activity\IActivityRepository.cs" />
<Compile Include="Channels\ChannelAudioItem.cs" />
<Compile Include="Channels\ChannelFolderItem.cs" />
<Compile Include="Channels\ChannelItemInfo.cs" /> <Compile Include="Channels\ChannelItemInfo.cs" />
<Compile Include="Channels\ChannelItemResult.cs" /> <Compile Include="Channels\ChannelItemResult.cs" />
<Compile Include="Channels\ChannelItemType.cs" /> <Compile Include="Channels\ChannelItemType.cs" />
<Compile Include="Channels\ChannelMediaInfo.cs" /> <Compile Include="Channels\ChannelMediaInfo.cs" />
<Compile Include="Channels\ChannelParentalRating.cs" /> <Compile Include="Channels\ChannelParentalRating.cs" />
<Compile Include="Channels\ChannelSearchInfo.cs" /> <Compile Include="Channels\ChannelSearchInfo.cs" />
<Compile Include="Channels\ChannelVideoItem.cs" />
<Compile Include="Channels\IChannel.cs" /> <Compile Include="Channels\IChannel.cs" />
<Compile Include="Channels\IChannelManager.cs" /> <Compile Include="Channels\IChannelManager.cs" />
<Compile Include="Channels\Channel.cs" /> <Compile Include="Channels\Channel.cs" />

@ -93,10 +93,10 @@ namespace MediaBrowser.Dlna.Didl
} }
else else
{ {
var parent = item.DisplayParent; var parent = item.DisplayParentId;
if (parent != null) if (parent.HasValue)
{ {
element.SetAttribute("parentID", GetClientId(parent, null)); element.SetAttribute("parentID", GetClientId(parent.Value, null));
} }
} }
@ -499,14 +499,21 @@ namespace MediaBrowser.Dlna.Didl
{ {
container.SetAttribute("id", clientId); container.SetAttribute("id", clientId);
var parent = context ?? folder.DisplayParent; if (context != null)
if (parent == null)
{ {
container.SetAttribute("parentID", "0"); container.SetAttribute("parentID", GetClientId(context, null));
} }
else else
{ {
container.SetAttribute("parentID", GetClientId(parent, null)); var parent = folder.DisplayParentId;
if (!parent.HasValue)
{
container.SetAttribute("parentID", "0");
}
else
{
container.SetAttribute("parentID", GetClientId(parent.Value, null));
}
} }
} }
@ -1059,7 +1066,12 @@ namespace MediaBrowser.Dlna.Didl
public static string GetClientId(BaseItem item, StubType? stubType) public static string GetClientId(BaseItem item, StubType? stubType)
{ {
var id = item.Id.ToString("N"); return GetClientId(item.Id, stubType);
}
public static string GetClientId(Guid idValue, StubType? stubType)
{
var id = idValue.ToString("N");
if (stubType.HasValue) if (stubType.HasValue)
{ {

@ -1149,10 +1149,10 @@ namespace MediaBrowser.Server.Implementations.Dto
if (fields.Contains(ItemFields.ParentId)) if (fields.Contains(ItemFields.ParentId))
{ {
var displayParent = item.DisplayParent; var displayParentId = item.DisplayParentId;
if (displayParent != null) if (displayParentId.HasValue)
{ {
dto.ParentId = GetDtoId(displayParent); dto.ParentId = displayParentId.Value.ToString("N");
} }
} }

@ -251,7 +251,7 @@ namespace MediaBrowser.Server.Implementations.IO
/// <exception cref="System.ArgumentNullException">path</exception> /// <exception cref="System.ArgumentNullException">path</exception>
private static bool ContainsParentFolder(IEnumerable<string> lst, string path) private static bool ContainsParentFolder(IEnumerable<string> lst, string path)
{ {
if (string.IsNullOrEmpty(path)) if (string.IsNullOrWhiteSpace(path))
{ {
throw new ArgumentNullException("path"); throw new ArgumentNullException("path");
} }

@ -415,6 +415,7 @@ namespace MediaBrowser.WebDashboard.Api
sb.Append("<link rel=\"shortcut icon\" href=\"css/images/favicon.ico\">"); sb.Append("<link rel=\"shortcut icon\" href=\"css/images/favicon.ico\">");
sb.Append("<meta name=\"msapplication-TileImage\" content=\"css/images/touchicon144.png\">"); sb.Append("<meta name=\"msapplication-TileImage\" content=\"css/images/touchicon144.png\">");
sb.Append("<meta name=\"msapplication-TileColor\" content=\"#333333\">"); sb.Append("<meta name=\"msapplication-TileColor\" content=\"#333333\">");
sb.Append("<meta name=\"theme-color\" content=\"#43A047\">");
return sb.ToString(); return sb.ToString();
} }

@ -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.644</version> <version>3.0.645</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 Emby Theater and Emby Server. Not intended for plugin developer consumption.</description> <description>Contains common components shared by Emby Theater and Emby Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Emby 2013</copyright> <copyright>Copyright © Emby 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.644" /> <dependency id="MediaBrowser.Common" version="3.0.645" />
<dependency id="NLog" version="4.2.3" /> <dependency id="NLog" version="4.2.3" />
<dependency id="SimpleInjector" version="3.1.2" /> <dependency id="SimpleInjector" version="3.1.2" />
</dependencies> </dependencies>

@ -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.644</version> <version>3.0.645</version>
<title>MediaBrowser.Common</title> <title>MediaBrowser.Common</title>
<authors>Emby Team</authors> <authors>Emby Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>

@ -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.Model.Signed</id> <id>MediaBrowser.Model.Signed</id>
<version>3.0.644</version> <version>3.0.645</version>
<title>MediaBrowser.Model - Signed Edition</title> <title>MediaBrowser.Model - Signed Edition</title>
<authors>Emby Team</authors> <authors>Emby Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>

@ -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.644</version> <version>3.0.645</version>
<title>Media Browser.Server.Core</title> <title>Media Browser.Server.Core</title>
<authors>Emby Team</authors> <authors>Emby 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 Emby Server.</description> <description>Contains core components required to build plugins for Emby Server.</description>
<copyright>Copyright © Emby 2013</copyright> <copyright>Copyright © Emby 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.644" /> <dependency id="MediaBrowser.Common" version="3.0.645" />
<dependency id="Interfaces.IO" version="1.0.0.5" /> <dependency id="Interfaces.IO" version="1.0.0.5" />
</dependencies> </dependencies>
</metadata> </metadata>

Loading…
Cancel
Save