update live tv startup
This commit is contained in:
parent
acfd90b6ff
commit
e91f569c15
|
@ -1378,12 +1378,6 @@ namespace Emby.Server.Implementations.Channels
|
|||
item.SetImagePath(ImageType.Primary, info.ImageUrl);
|
||||
}
|
||||
|
||||
if (item.SourceType != SourceType.Channel)
|
||||
{
|
||||
item.SourceType = SourceType.Channel;
|
||||
forceUpdate = true;
|
||||
}
|
||||
|
||||
if (isNew)
|
||||
{
|
||||
await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
|
||||
|
|
|
@ -199,10 +199,11 @@ namespace Emby.Server.Implementations.Data
|
|||
AddColumn(db, "TypedBaseItems", "ParentId", "GUID", existingColumnNames);
|
||||
AddColumn(db, "TypedBaseItems", "Genres", "Text", existingColumnNames);
|
||||
AddColumn(db, "TypedBaseItems", "SortName", "Text", existingColumnNames);
|
||||
AddColumn(db, "TypedBaseItems", "ForcedSortName", "Text", existingColumnNames);
|
||||
|
||||
AddColumn(db, "TypedBaseItems", "RunTimeTicks", "BIGINT", existingColumnNames);
|
||||
|
||||
AddColumn(db, "TypedBaseItems", "HomePageUrl", "Text", existingColumnNames);
|
||||
AddColumn(db, "TypedBaseItems", "VoteCount", "INT", existingColumnNames);
|
||||
AddColumn(db, "TypedBaseItems", "DisplayMediaType", "Text", existingColumnNames);
|
||||
AddColumn(db, "TypedBaseItems", "DateCreated", "DATETIME", existingColumnNames);
|
||||
AddColumn(db, "TypedBaseItems", "DateModified", "DATETIME", existingColumnNames);
|
||||
|
@ -233,7 +234,6 @@ namespace Emby.Server.Implementations.Data
|
|||
AddColumn(db, "TypedBaseItems", "UnratedType", "Text", existingColumnNames);
|
||||
AddColumn(db, "TypedBaseItems", "TopParentId", "Text", existingColumnNames);
|
||||
AddColumn(db, "TypedBaseItems", "IsItemByName", "BIT", existingColumnNames);
|
||||
AddColumn(db, "TypedBaseItems", "SourceType", "Text", existingColumnNames);
|
||||
AddColumn(db, "TypedBaseItems", "TrailerTypes", "Text", existingColumnNames);
|
||||
AddColumn(db, "TypedBaseItems", "CriticRating", "Float", existingColumnNames);
|
||||
AddColumn(db, "TypedBaseItems", "InheritedTags", "Text", existingColumnNames);
|
||||
|
@ -424,9 +424,8 @@ namespace Emby.Server.Implementations.Data
|
|||
"OfficialRating",
|
||||
"HomePageUrl",
|
||||
"DisplayMediaType",
|
||||
"SortName",
|
||||
"ForcedSortName",
|
||||
"RunTimeTicks",
|
||||
"VoteCount",
|
||||
"DateCreated",
|
||||
"DateModified",
|
||||
"guid",
|
||||
|
@ -439,7 +438,6 @@ namespace Emby.Server.Implementations.Data
|
|||
"LockedFields",
|
||||
"Studios",
|
||||
"Tags",
|
||||
"SourceType",
|
||||
"TrailerTypes",
|
||||
"OriginalTitle",
|
||||
"PrimaryVersionId",
|
||||
|
@ -541,9 +539,9 @@ namespace Emby.Server.Implementations.Data
|
|||
"Genres",
|
||||
"InheritedParentalRatingValue",
|
||||
"SortName",
|
||||
"ForcedSortName",
|
||||
"RunTimeTicks",
|
||||
"HomePageUrl",
|
||||
"VoteCount",
|
||||
"DisplayMediaType",
|
||||
"DateCreated",
|
||||
"DateModified",
|
||||
|
@ -563,7 +561,6 @@ namespace Emby.Server.Implementations.Data
|
|||
"UnratedType",
|
||||
"TopParentId",
|
||||
"IsItemByName",
|
||||
"SourceType",
|
||||
"TrailerTypes",
|
||||
"CriticRating",
|
||||
"InheritedTags",
|
||||
|
@ -815,10 +812,12 @@ namespace Emby.Server.Implementations.Data
|
|||
saveItemStatement.TryBind("@InheritedParentalRatingValue", item.InheritedParentalRatingValue);
|
||||
|
||||
saveItemStatement.TryBind("@SortName", item.SortName);
|
||||
|
||||
saveItemStatement.TryBind("@ForcedSortName", item.ForcedSortName);
|
||||
|
||||
saveItemStatement.TryBind("@RunTimeTicks", item.RunTimeTicks);
|
||||
|
||||
saveItemStatement.TryBind("@HomePageUrl", item.HomePageUrl);
|
||||
saveItemStatement.TryBind("@VoteCount", item.VoteCount);
|
||||
saveItemStatement.TryBind("@DisplayMediaType", item.DisplayMediaType);
|
||||
saveItemStatement.TryBind("@DateCreated", item.DateCreated);
|
||||
saveItemStatement.TryBind("@DateModified", item.DateModified);
|
||||
|
@ -909,7 +908,6 @@ namespace Emby.Server.Implementations.Data
|
|||
isByName = dualAccess == null || dualAccess.IsAccessedByName;
|
||||
}
|
||||
saveItemStatement.TryBind("@IsItemByName", isByName);
|
||||
saveItemStatement.TryBind("@SourceType", item.SourceType.ToString());
|
||||
|
||||
var trailer = item as Trailer;
|
||||
if (trailer != null && trailer.TrailerTypes.Count > 0)
|
||||
|
@ -1624,7 +1622,7 @@ namespace Emby.Server.Implementations.Data
|
|||
{
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
item.SortName = reader.GetString(index);
|
||||
item.ForcedSortName = reader.GetString(index);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
@ -1635,15 +1633,6 @@ namespace Emby.Server.Implementations.Data
|
|||
}
|
||||
index++;
|
||||
|
||||
if (HasField(query, ItemFields.VoteCount))
|
||||
{
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
item.VoteCount = reader.GetInt32(index);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
if (HasField(query, ItemFields.DateCreated))
|
||||
{
|
||||
if (!reader.IsDBNull(index))
|
||||
|
@ -1733,12 +1722,6 @@ namespace Emby.Server.Implementations.Data
|
|||
index++;
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
item.SourceType = (SourceType)Enum.Parse(typeof(SourceType), reader.GetString(index), true);
|
||||
}
|
||||
index++;
|
||||
|
||||
if (hasTrailerTypes)
|
||||
{
|
||||
var trailer = item as Trailer;
|
||||
|
@ -2283,7 +2266,7 @@ namespace Emby.Server.Implementations.Data
|
|||
}
|
||||
if (field == ItemFields.SortName)
|
||||
{
|
||||
return new[] { "SortName" };
|
||||
return new[] { "ForcedSortName" };
|
||||
}
|
||||
if (field == ItemFields.Taglines)
|
||||
{
|
||||
|
@ -2306,7 +2289,6 @@ namespace Emby.Server.Implementations.Data
|
|||
case ItemFields.HomePageUrl:
|
||||
case ItemFields.Keywords:
|
||||
case ItemFields.DisplayMediaType:
|
||||
case ItemFields.VoteCount:
|
||||
case ItemFields.CustomRating:
|
||||
case ItemFields.ProductionLocations:
|
||||
case ItemFields.Settings:
|
||||
|
@ -3872,34 +3854,6 @@ namespace Emby.Server.Implementations.Data
|
|||
}
|
||||
}
|
||||
|
||||
if (query.SourceTypes.Length == 1)
|
||||
{
|
||||
whereClauses.Add("SourceType=@SourceType");
|
||||
if (statement != null)
|
||||
{
|
||||
statement.TryBind("@SourceType", query.SourceTypes[0].ToString());
|
||||
}
|
||||
}
|
||||
else if (query.SourceTypes.Length > 1)
|
||||
{
|
||||
var inClause = string.Join(",", query.SourceTypes.Select(i => "'" + i + "'").ToArray());
|
||||
whereClauses.Add(string.Format("SourceType in ({0})", inClause));
|
||||
}
|
||||
|
||||
if (query.ExcludeSourceTypes.Length == 1)
|
||||
{
|
||||
whereClauses.Add("SourceType<>@ExcludeSourceTypes");
|
||||
if (statement != null)
|
||||
{
|
||||
statement.TryBind("@ExcludeSourceTypes", query.ExcludeSourceTypes[0].ToString());
|
||||
}
|
||||
}
|
||||
else if (query.ExcludeSourceTypes.Length > 1)
|
||||
{
|
||||
var inClause = string.Join(",", query.ExcludeSourceTypes.Select(i => "'" + i + "'").ToArray());
|
||||
whereClauses.Add(string.Format("SourceType not in ({0})", inClause));
|
||||
}
|
||||
|
||||
if (query.TrailerTypes.Length > 0)
|
||||
{
|
||||
var clauses = new List<string>();
|
||||
|
@ -5017,14 +4971,6 @@ namespace Emby.Server.Implementations.Data
|
|||
statement.TryBind("@NameContains", "%" + query.NameContains + "%");
|
||||
}
|
||||
}
|
||||
if (query.SourceTypes.Length == 1)
|
||||
{
|
||||
whereClauses.Add("(select sourcetype from typedbaseitems where guid=ItemId) = @SourceTypes");
|
||||
if (statement != null)
|
||||
{
|
||||
statement.TryBind("@SourceTypes", query.SourceTypes[0].ToString());
|
||||
}
|
||||
}
|
||||
|
||||
return whereClauses;
|
||||
}
|
||||
|
|
|
@ -1058,11 +1058,6 @@ namespace Emby.Server.Implementations.Dto
|
|||
dto.CommunityRating = item.CommunityRating;
|
||||
}
|
||||
|
||||
if (fields.Contains(ItemFields.VoteCount))
|
||||
{
|
||||
dto.VoteCount = item.VoteCount;
|
||||
}
|
||||
|
||||
//if (item.IsFolder)
|
||||
//{
|
||||
// var folder = (Folder)item;
|
||||
|
|
|
@ -1292,7 +1292,7 @@ namespace Emby.Server.Implementations.Library
|
|||
return item;
|
||||
}
|
||||
|
||||
public IEnumerable<BaseItem> GetItemList(InternalItemsQuery query)
|
||||
public IEnumerable<BaseItem> GetItemList(InternalItemsQuery query, bool allowExternalContent)
|
||||
{
|
||||
if (query.Recursive && query.ParentId.HasValue)
|
||||
{
|
||||
|
@ -1305,12 +1305,17 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
if (query.User != null)
|
||||
{
|
||||
AddUserToQuery(query, query.User);
|
||||
AddUserToQuery(query, query.User, allowExternalContent);
|
||||
}
|
||||
|
||||
return ItemRepository.GetItemList(query);
|
||||
}
|
||||
|
||||
public IEnumerable<BaseItem> GetItemList(InternalItemsQuery query)
|
||||
{
|
||||
return GetItemList(query, true);
|
||||
}
|
||||
|
||||
public int GetCount(InternalItemsQuery query)
|
||||
{
|
||||
if (query.Recursive && query.ParentId.HasValue)
|
||||
|
@ -1548,7 +1553,7 @@ namespace Emby.Server.Implementations.Library
|
|||
query.Parent = null;
|
||||
}
|
||||
|
||||
private void AddUserToQuery(InternalItemsQuery query, User user)
|
||||
private void AddUserToQuery(InternalItemsQuery query, User user, bool allowExternalContent = true)
|
||||
{
|
||||
if (query.AncestorIds.Length == 0 &&
|
||||
!query.ParentId.HasValue &&
|
||||
|
@ -1561,7 +1566,8 @@ namespace Emby.Server.Implementations.Library
|
|||
var userViews = _userviewManager().GetUserViews(new UserViewQuery
|
||||
{
|
||||
UserId = user.Id.ToString("N"),
|
||||
IncludeHidden = true
|
||||
IncludeHidden = true,
|
||||
IncludeExternalContent = allowExternalContent
|
||||
|
||||
}, CancellationToken.None).Result.ToList();
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
} : new string[] { };
|
||||
|
||||
return _libraryManager.GetItemList(new InternalItemsQuery(user)
|
||||
var query = new InternalItemsQuery(user)
|
||||
{
|
||||
IncludeItemTypes = includeItemTypes,
|
||||
SortOrder = SortOrder.Descending,
|
||||
|
@ -289,11 +289,16 @@ namespace Emby.Server.Implementations.Library
|
|||
ExcludeItemTypes = excludeItemTypes,
|
||||
IsVirtualItem = false,
|
||||
Limit = limit * 5,
|
||||
SourceTypes = parents.Count == 0 ? new[] { SourceType.Library } : new SourceType[] { },
|
||||
IsPlayed = isPlayed,
|
||||
DtoOptions = options
|
||||
};
|
||||
|
||||
}, parents);
|
||||
if (parents.Count == 0)
|
||||
{
|
||||
return _libraryManager.GetItemList(query, false);
|
||||
}
|
||||
|
||||
return _libraryManager.GetItemList(query, parents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2270,11 +2270,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
writer.WriteElementString("studio", studio);
|
||||
}
|
||||
|
||||
if (item.VoteCount.HasValue)
|
||||
{
|
||||
writer.WriteElementString("votes", item.VoteCount.Value.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
writer.WriteEndElement();
|
||||
writer.WriteEndDocument();
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
private readonly IMediaEncoder _mediaEncoder;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
const int AnalyzeDurationMs = 2000;
|
||||
const int AnalyzeDurationMs = 1000;
|
||||
|
||||
public LiveStreamHelper(IMediaEncoder mediaEncoder, ILogger logger)
|
||||
{
|
||||
|
|
|
@ -422,6 +422,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
SupportsTranscoding = true,
|
||||
IsInfiniteStream = true,
|
||||
IgnoreDts = true,
|
||||
//SupportsProbing = false,
|
||||
//AnalyzeDurationMs = 2000000
|
||||
//IgnoreIndex = true,
|
||||
//ReadAtNativeFramerate = true
|
||||
};
|
||||
|
|
|
@ -243,7 +243,6 @@ namespace MediaBrowser.Api
|
|||
|
||||
item.DisplayMediaType = request.DisplayMediaType;
|
||||
item.CommunityRating = request.CommunityRating;
|
||||
item.VoteCount = request.VoteCount;
|
||||
item.HomePageUrl = request.HomePageUrl;
|
||||
item.IndexNumber = request.IndexNumber;
|
||||
item.ParentIndexNumber = request.ParentIndexNumber;
|
||||
|
|
|
@ -675,7 +675,6 @@ namespace MediaBrowser.Api.Library
|
|||
Limit = 0,
|
||||
Recursive = true,
|
||||
IsVirtualItem = false,
|
||||
SourceTypes = new[] { SourceType.Library },
|
||||
IsFavorite = request.IsFavorite,
|
||||
DtoOptions = new DtoOptions(false)
|
||||
{
|
||||
|
|
|
@ -106,6 +106,13 @@ namespace MediaBrowser.Api.Playback
|
|||
}
|
||||
|
||||
public async Task<object> Post(OpenMediaSource request)
|
||||
{
|
||||
var result = await OpenMediaSource(request).ConfigureAwait(false);
|
||||
|
||||
return ToOptimizedResult(result);
|
||||
}
|
||||
|
||||
private async Task<LiveStreamResponse> OpenMediaSource(OpenMediaSource request)
|
||||
{
|
||||
var authInfo = _authContext.GetAuthorizationInfo(Request);
|
||||
|
||||
|
@ -137,7 +144,7 @@ namespace MediaBrowser.Api.Playback
|
|||
}
|
||||
}
|
||||
|
||||
return ToOptimizedResult(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void Post(CloseMediaSource request)
|
||||
|
@ -172,6 +179,34 @@ namespace MediaBrowser.Api.Playback
|
|||
SetDeviceSpecificData(request.Id, info, profile, authInfo, request.MaxStreamingBitrate ?? profile.MaxStreamingBitrate, request.StartTimeTicks ?? 0, mediaSourceId, request.AudioStreamIndex, request.SubtitleStreamIndex, request.MaxAudioChannels, request.UserId, request.EnableDirectPlay, request.ForceDirectPlayRemoteMediaSource, request.EnableDirectStream, request.EnableTranscoding, request.AllowVideoStreamCopy, request.AllowAudioStreamCopy);
|
||||
}
|
||||
|
||||
if (request.AutoOpenLiveStream)
|
||||
{
|
||||
var mediaSource = string.IsNullOrWhiteSpace(request.MediaSourceId) ? info.MediaSources.FirstOrDefault() : info.MediaSources.FirstOrDefault(i => string.Equals(i.Id, request.MediaSourceId, StringComparison.Ordinal));
|
||||
|
||||
if (mediaSource != null && mediaSource.RequiresOpening && string.IsNullOrWhiteSpace(mediaSource.LiveStreamId))
|
||||
{
|
||||
var openStreamResult = await OpenMediaSource(new OpenMediaSource
|
||||
{
|
||||
AudioStreamIndex = request.AudioStreamIndex,
|
||||
DeviceProfile = request.DeviceProfile,
|
||||
EnableDirectPlay = request.EnableDirectPlay,
|
||||
EnableDirectStream = request.EnableDirectStream,
|
||||
ForceDirectPlayRemoteMediaSource = request.ForceDirectPlayRemoteMediaSource,
|
||||
ItemId = request.Id,
|
||||
MaxAudioChannels = request.MaxAudioChannels,
|
||||
MaxStreamingBitrate = request.MaxStreamingBitrate,
|
||||
PlaySessionId = info.PlaySessionId,
|
||||
StartTimeTicks = request.StartTimeTicks,
|
||||
SubtitleStreamIndex = request.SubtitleStreamIndex,
|
||||
UserId = request.UserId,
|
||||
OpenToken = mediaSource.OpenToken
|
||||
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
info.MediaSources = new List<MediaSourceInfo> { openStreamResult.MediaSource };
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,6 @@ namespace MediaBrowser.Api
|
|||
config.EnableSimpleArtistDetection = true;
|
||||
config.EnableNormalizedItemByNameIds = true;
|
||||
config.DisableLiveTvChannelUserDataName = true;
|
||||
config.EnableSimpleSortNameHandling = true;
|
||||
}
|
||||
|
||||
public void Post(UpdateStartupConfiguration request)
|
||||
|
|
|
@ -35,7 +35,6 @@ namespace MediaBrowser.Controller.Channels
|
|||
public override SourceType SourceType
|
||||
{
|
||||
get { return SourceType.Channel; }
|
||||
set { }
|
||||
}
|
||||
|
||||
protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query)
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
private List<Guid> _childrenIds = null;
|
||||
private readonly object _childIdsLock = new object();
|
||||
protected override IEnumerable<BaseItem> LoadChildren()
|
||||
protected override List<BaseItem> LoadChildren()
|
||||
{
|
||||
lock (_childIdsLock)
|
||||
{
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||
/// Creates the name of the sort.
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
protected override string CreateSortNameInternal()
|
||||
protected override string CreateSortName()
|
||||
{
|
||||
return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "")
|
||||
+ (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name;
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
protected override IEnumerable<BaseItem> ActualChildren
|
||||
public override IEnumerable<BaseItem> Children
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -99,7 +99,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||
return new List<BaseItem>();
|
||||
}
|
||||
|
||||
return base.ActualChildren;
|
||||
return base.Children;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
ImageInfos = new List<ItemImageInfo>();
|
||||
InheritedTags = new List<string>();
|
||||
ProductionLocations = new List<string>();
|
||||
SourceType = SourceType.Library;
|
||||
}
|
||||
|
||||
public static readonly char[] SlugReplaceChars = { '?', '/', '&' };
|
||||
|
@ -187,15 +186,10 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
set
|
||||
{
|
||||
var isSortNameDefault = IsSortNameDefault(SortName);
|
||||
|
||||
_name = value;
|
||||
|
||||
if (isSortNameDefault)
|
||||
{
|
||||
// lazy load this again
|
||||
SortName = null;
|
||||
}
|
||||
// lazy load this again
|
||||
_sortName = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,7 +273,18 @@ namespace MediaBrowser.Controller.Entities
|
|||
public virtual string Path { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
public virtual SourceType SourceType { get; set; }
|
||||
public virtual SourceType SourceType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(ChannelId))
|
||||
{
|
||||
return SourceType.Channel;
|
||||
}
|
||||
|
||||
return SourceType.Library;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the folder containing the item.
|
||||
|
@ -586,6 +591,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
}
|
||||
|
||||
private string _forcedSortName;
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the forced sort.
|
||||
/// </summary>
|
||||
|
@ -593,42 +599,8 @@ namespace MediaBrowser.Controller.Entities
|
|||
[IgnoreDataMember]
|
||||
public string ForcedSortName
|
||||
{
|
||||
get
|
||||
{
|
||||
var sortName = SortName;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(sortName))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (string.Equals(sortName, CreateSortName(), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return sortName;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
SortName = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
var newValue = CreateSortNameFromCustomValue(value);
|
||||
|
||||
if (string.Equals(newValue, CreateSortName(), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
SortName = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
SortName = newValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
get { return _forcedSortName; }
|
||||
set { _forcedSortName = value; _sortName = null; }
|
||||
}
|
||||
|
||||
private string _sortName;
|
||||
|
@ -643,7 +615,15 @@ namespace MediaBrowser.Controller.Entities
|
|||
{
|
||||
if (_sortName == null)
|
||||
{
|
||||
_sortName = CreateSortName();
|
||||
if (!string.IsNullOrWhiteSpace(ForcedSortName))
|
||||
{
|
||||
// Need the ToLower because that's what CreateSortName does
|
||||
_sortName = ModifySortChunks(ForcedSortName).ToLower();
|
||||
}
|
||||
else
|
||||
{
|
||||
_sortName = CreateSortName();
|
||||
}
|
||||
}
|
||||
return _sortName;
|
||||
}
|
||||
|
@ -653,31 +633,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
}
|
||||
|
||||
private string CreateSortNameFromCustomValue(string value)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(value) ? null : NormalizeCustomSortName(value);
|
||||
}
|
||||
|
||||
protected virtual string NormalizeCustomSortName(string value)
|
||||
{
|
||||
if (ConfigurationManager.Configuration.EnableSimpleSortNameHandling)
|
||||
{
|
||||
return value.RemoveDiacritics().ToLower();
|
||||
}
|
||||
|
||||
return ModifySortChunks(value).ToLower();
|
||||
}
|
||||
|
||||
public bool IsSortNameDefault(string value)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return string.Equals(CreateSortNameFromCustomValue(value), CreateSortName(), StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public string GetInternalMetadataPath()
|
||||
{
|
||||
var basePath = ConfigurationManager.ApplicationPaths.InternalMetadataPath;
|
||||
|
@ -699,22 +654,14 @@ namespace MediaBrowser.Controller.Entities
|
|||
return System.IO.Path.Combine(basePath, idString.Substring(0, 2), idString);
|
||||
}
|
||||
|
||||
protected string CreateSortName()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Name))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return CreateSortNameInternal();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the name of the sort.
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
protected virtual string CreateSortNameInternal()
|
||||
protected virtual string CreateSortName()
|
||||
{
|
||||
if (Name == null) return null; //some items may not have name filled in properly
|
||||
|
||||
if (!EnableAlphaNumericSorting)
|
||||
{
|
||||
return Name.TrimStart();
|
||||
|
@ -951,13 +898,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
[IgnoreDataMember]
|
||||
public float? CommunityRating { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the community rating vote count.
|
||||
/// </summary>
|
||||
/// <value>The community rating vote count.</value>
|
||||
[IgnoreDataMember]
|
||||
public int? VoteCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the run time ticks.
|
||||
/// </summary>
|
||||
|
@ -1367,6 +1307,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
public void AfterMetadataRefresh()
|
||||
{
|
||||
_sortName = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -2253,6 +2194,8 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// </summary>
|
||||
public virtual bool BeforeMetadataRefresh()
|
||||
{
|
||||
_sortName = null;
|
||||
|
||||
var hasChanges = false;
|
||||
|
||||
if (string.IsNullOrEmpty(Name) && !string.IsNullOrEmpty(Path))
|
||||
|
|
|
@ -311,12 +311,12 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// </summary>
|
||||
/// <value>The actual children.</value>
|
||||
[IgnoreDataMember]
|
||||
protected override IEnumerable<BaseItem> ActualChildren
|
||||
public override IEnumerable<BaseItem> Children
|
||||
{
|
||||
get { return GetActualChildren(); }
|
||||
}
|
||||
|
||||
private IEnumerable<BaseItem> GetActualChildren()
|
||||
public IEnumerable<BaseItem> GetActualChildren()
|
||||
{
|
||||
return GetPhysicalFolders(true).SelectMany(c => c.Children);
|
||||
}
|
||||
|
|
|
@ -185,7 +185,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
item.Id = LibraryManager.GetNewItemId(item.Path, item.GetType());
|
||||
}
|
||||
|
||||
if (ActualChildren.Any(i => i.Id == item.Id))
|
||||
if (Children.Any(i => i.Id == item.Id))
|
||||
{
|
||||
throw new ArgumentException(string.Format("A child with the Id {0} already exists.", item.Id));
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// </summary>
|
||||
/// <value>The actual children.</value>
|
||||
[IgnoreDataMember]
|
||||
protected virtual IEnumerable<BaseItem> ActualChildren
|
||||
public virtual IEnumerable<BaseItem> Children
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -251,16 +251,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// thread-safe access to the actual children of this folder - without regard to user
|
||||
/// </summary>
|
||||
/// <value>The children.</value>
|
||||
[IgnoreDataMember]
|
||||
public IEnumerable<BaseItem> Children
|
||||
{
|
||||
get { return ActualChildren.ToList(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// thread-safe access to all recursive children of this folder - without regard to user
|
||||
/// </summary>
|
||||
|
@ -301,7 +291,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// Loads our children. Validation will occur externally.
|
||||
/// We want this sychronous.
|
||||
/// </summary>
|
||||
protected virtual IEnumerable<BaseItem> LoadChildren()
|
||||
protected virtual List<BaseItem> LoadChildren()
|
||||
{
|
||||
//Logger.Debug("Loading children from {0} {1} {2}", GetType().Name, Id, Path);
|
||||
//just load our children from the repo - the library will be validated and maintained in other processes
|
||||
|
@ -330,7 +320,9 @@ namespace MediaBrowser.Controller.Entities
|
|||
{
|
||||
var dictionary = new Dictionary<Guid, BaseItem>();
|
||||
|
||||
foreach (var child in ActualChildren)
|
||||
var childrenList = Children.ToList();
|
||||
|
||||
foreach (var child in childrenList)
|
||||
{
|
||||
var id = child.Id;
|
||||
if (dictionary.ContainsKey(id))
|
||||
|
@ -466,7 +458,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
if (recursive)
|
||||
{
|
||||
await ValidateSubFolders(ActualChildren.OfType<Folder>().ToList(), directoryService, progress, cancellationToken).ConfigureAwait(false);
|
||||
await ValidateSubFolders(Children.ToList().OfType<Folder>().ToList(), directoryService, progress, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
progress.Report(20);
|
||||
|
@ -494,7 +486,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
private async Task RefreshMetadataRecursive(MetadataRefreshOptions refreshOptions, bool recursive, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
var children = ActualChildren.ToList();
|
||||
var children = Children.ToList();
|
||||
|
||||
var percentages = new Dictionary<Guid, double>(children.Count);
|
||||
var numComplete = 0;
|
||||
|
@ -668,7 +660,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// Get our children from the repo - stubbed for now
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||
protected IEnumerable<BaseItem> GetCachedChildren()
|
||||
protected List<BaseItem> GetCachedChildren()
|
||||
{
|
||||
return ItemRepository.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <value>The date last saved.</value>
|
||||
DateTime DateLastSaved { get; set; }
|
||||
|
||||
SourceType SourceType { get; set; }
|
||||
SourceType SourceType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date last refreshed.
|
||||
|
|
|
@ -148,8 +148,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
|
||||
public string[] PresetViews { get; set; }
|
||||
public SourceType[] SourceTypes { get; set; }
|
||||
public SourceType[] ExcludeSourceTypes { get; set; }
|
||||
public TrailerType[] TrailerTypes { get; set; }
|
||||
|
||||
public DayOfWeek[] AirDays { get; set; }
|
||||
|
@ -215,8 +213,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
ExcludeTags = new string[] { };
|
||||
ExcludeInheritedTags = new string[] { };
|
||||
PresetViews = new string[] { };
|
||||
SourceTypes = new SourceType[] { };
|
||||
ExcludeSourceTypes = new SourceType[] { };
|
||||
TrailerTypes = new TrailerType[] { };
|
||||
AirDays = new DayOfWeek[] { };
|
||||
SeriesStatuses = new SeriesStatus[] { };
|
||||
|
|
|
@ -11,13 +11,11 @@ namespace MediaBrowser.Controller.Entities
|
|||
public int? MaxListOrder { get; set; }
|
||||
public Guid AppearsInItemId { get; set; }
|
||||
public string NameContains { get; set; }
|
||||
public SourceType[] SourceTypes { get; set; }
|
||||
|
||||
public InternalPeopleQuery()
|
||||
{
|
||||
PersonTypes = new List<string>();
|
||||
ExcludePersonTypes = new List<string>();
|
||||
SourceTypes = new SourceType[] { };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
|||
return new List<BaseItem>();
|
||||
}
|
||||
|
||||
protected override IEnumerable<BaseItem> LoadChildren()
|
||||
protected override List<BaseItem> LoadChildren()
|
||||
{
|
||||
if (IsLegacyBoxSet)
|
||||
{
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities.TV
|
||||
{
|
||||
/// <summary>
|
||||
/// Class Episode
|
||||
/// </summary>
|
||||
public class Episode : Video, IHasTrailers, IHasLookupInfo<EpisodeInfo>, IHasSeries
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities.TV
|
||||
{
|
||||
/// <summary>
|
||||
/// Class Episode
|
||||
/// </summary>
|
||||
public class Episode : Video, IHasTrailers, IHasLookupInfo<EpisodeInfo>, IHasSeries
|
||||
{
|
||||
public Episode()
|
||||
{
|
||||
|
@ -26,35 +26,35 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||
public List<Guid> RemoteTrailerIds { get; set; }
|
||||
public List<MediaUrl> RemoteTrailers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the season in which it aired.
|
||||
/// </summary>
|
||||
/// <value>The aired season.</value>
|
||||
public int? AirsBeforeSeasonNumber { get; set; }
|
||||
public int? AirsAfterSeasonNumber { get; set; }
|
||||
public int? AirsBeforeEpisodeNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the DVD season number.
|
||||
/// </summary>
|
||||
/// <value>The DVD season number.</value>
|
||||
public int? DvdSeasonNumber { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the DVD episode number.
|
||||
/// </summary>
|
||||
/// <value>The DVD episode number.</value>
|
||||
public float? DvdEpisodeNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the absolute episode number.
|
||||
/// </summary>
|
||||
/// <value>The absolute episode number.</value>
|
||||
public int? AbsoluteEpisodeNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is the ending episode number for double episodes.
|
||||
/// </summary>
|
||||
/// <value>The index number.</value>
|
||||
/// <summary>
|
||||
/// Gets the season in which it aired.
|
||||
/// </summary>
|
||||
/// <value>The aired season.</value>
|
||||
public int? AirsBeforeSeasonNumber { get; set; }
|
||||
public int? AirsAfterSeasonNumber { get; set; }
|
||||
public int? AirsBeforeEpisodeNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the DVD season number.
|
||||
/// </summary>
|
||||
/// <value>The DVD season number.</value>
|
||||
public int? DvdSeasonNumber { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the DVD episode number.
|
||||
/// </summary>
|
||||
/// <value>The DVD episode number.</value>
|
||||
public float? DvdEpisodeNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the absolute episode number.
|
||||
/// </summary>
|
||||
/// <value>The absolute episode number.</value>
|
||||
public int? AbsoluteEpisodeNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is the ending episode number for double episodes.
|
||||
/// </summary>
|
||||
/// <value>The index number.</value>
|
||||
public int? IndexNumberEnd { get; set; }
|
||||
|
||||
public string FindSeriesSortName()
|
||||
|
@ -62,56 +62,56 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||
var series = Series;
|
||||
return series == null ? SeriesName : series.SortName;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
protected override bool SupportsOwnedItems
|
||||
{
|
||||
get
|
||||
{
|
||||
return IsStacked || MediaSourceCount > 1;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
protected override bool SupportsOwnedItems
|
||||
{
|
||||
get
|
||||
{
|
||||
return IsStacked || MediaSourceCount > 1;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool SupportsInheritedParentImages
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public int? AiredSeasonNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return AirsAfterSeasonNumber ?? AirsBeforeSeasonNumber ?? ParentIndexNumber;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override Folder LatestItemsIndexContainer
|
||||
{
|
||||
get
|
||||
{
|
||||
return Series;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override Guid? DisplayParentId
|
||||
{
|
||||
get
|
||||
{
|
||||
return SeasonId;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
protected override bool EnableDefaultVideoUserDataKeys
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public int? AiredSeasonNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return AirsAfterSeasonNumber ?? AirsBeforeSeasonNumber ?? ParentIndexNumber;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override Folder LatestItemsIndexContainer
|
||||
{
|
||||
get
|
||||
{
|
||||
return Series;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override Guid? DisplayParentId
|
||||
{
|
||||
get
|
||||
{
|
||||
return SeasonId;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
protected override bool EnableDefaultVideoUserDataKeys
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override double? GetDefaultPrimaryImageAspectRatio()
|
||||
|
@ -120,64 +120,64 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||
value /= 9;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public override List<string> GetUserDataKeys()
|
||||
{
|
||||
var list = base.GetUserDataKeys();
|
||||
|
||||
var series = Series;
|
||||
if (series != null && ParentIndexNumber.HasValue && IndexNumber.HasValue)
|
||||
{
|
||||
var seriesUserDataKeys = series.GetUserDataKeys();
|
||||
var take = seriesUserDataKeys.Count;
|
||||
if (seriesUserDataKeys.Count > 1)
|
||||
{
|
||||
take--;
|
||||
}
|
||||
list.InsertRange(0, seriesUserDataKeys.Take(take).Select(i => i + ParentIndexNumber.Value.ToString("000") + IndexNumber.Value.ToString("000")));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This Episode's Series Instance
|
||||
/// </summary>
|
||||
/// <value>The series.</value>
|
||||
[IgnoreDataMember]
|
||||
public Series Series
|
||||
{
|
||||
get
|
||||
{
|
||||
}
|
||||
|
||||
public override List<string> GetUserDataKeys()
|
||||
{
|
||||
var list = base.GetUserDataKeys();
|
||||
|
||||
var series = Series;
|
||||
if (series != null && ParentIndexNumber.HasValue && IndexNumber.HasValue)
|
||||
{
|
||||
var seriesUserDataKeys = series.GetUserDataKeys();
|
||||
var take = seriesUserDataKeys.Count;
|
||||
if (seriesUserDataKeys.Count > 1)
|
||||
{
|
||||
take--;
|
||||
}
|
||||
list.InsertRange(0, seriesUserDataKeys.Take(take).Select(i => i + ParentIndexNumber.Value.ToString("000") + IndexNumber.Value.ToString("000")));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This Episode's Series Instance
|
||||
/// </summary>
|
||||
/// <value>The series.</value>
|
||||
[IgnoreDataMember]
|
||||
public Series Series
|
||||
{
|
||||
get
|
||||
{
|
||||
var seriesId = SeriesId ?? FindSeriesId();
|
||||
return seriesId.HasValue ? (LibraryManager.GetItemById(seriesId.Value) as Series) : null;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public Season Season
|
||||
{
|
||||
get
|
||||
{
|
||||
return seriesId.HasValue ? (LibraryManager.GetItemById(seriesId.Value) as Series) : null;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public Season Season
|
||||
{
|
||||
get
|
||||
{
|
||||
var seasonId = SeasonId ?? FindSeasonId();
|
||||
return seasonId.HasValue ? (LibraryManager.GetItemById(seasonId.Value) as Season) : null;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public bool IsInSeasonFolder
|
||||
{
|
||||
get
|
||||
{
|
||||
return FindParent<Season>() != null;
|
||||
}
|
||||
return seasonId.HasValue ? (LibraryManager.GetItemById(seasonId.Value) as Season) : null;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public bool IsInSeasonFolder
|
||||
{
|
||||
get
|
||||
{
|
||||
return FindParent<Season>() != null;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public string SeriesPresentationUniqueKey { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
|
||||
[IgnoreDataMember]
|
||||
public string SeriesName { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
|
@ -187,17 +187,17 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||
{
|
||||
var series = Series;
|
||||
return series == null ? null : series.PresentationUniqueKey;
|
||||
}
|
||||
|
||||
public string FindSeasonName()
|
||||
}
|
||||
|
||||
public string FindSeasonName()
|
||||
{
|
||||
var season = Season;
|
||||
|
||||
if (season == null)
|
||||
{
|
||||
if (ParentIndexNumber.HasValue)
|
||||
{
|
||||
return "Season " + ParentIndexNumber.Value.ToString(CultureInfo.InvariantCulture);
|
||||
var season = Season;
|
||||
|
||||
if (season == null)
|
||||
{
|
||||
if (ParentIndexNumber.HasValue)
|
||||
{
|
||||
return "Season " + ParentIndexNumber.Value.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
return "Season Unknown";
|
||||
}
|
||||
|
@ -231,92 +231,92 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||
}
|
||||
|
||||
return season == null ? (Guid?)null : season.Id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the name of the sort.
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
protected override string CreateSortNameInternal()
|
||||
{
|
||||
return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("000 - ") : "")
|
||||
+ (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether [contains episode number] [the specified number].
|
||||
/// </summary>
|
||||
/// <param name="number">The number.</param>
|
||||
/// <returns><c>true</c> if [contains episode number] [the specified number]; otherwise, <c>false</c>.</returns>
|
||||
public bool ContainsEpisodeNumber(int number)
|
||||
{
|
||||
if (IndexNumber.HasValue)
|
||||
{
|
||||
if (IndexNumberEnd.HasValue)
|
||||
{
|
||||
return number >= IndexNumber.Value && number <= IndexNumberEnd.Value;
|
||||
}
|
||||
|
||||
return IndexNumber.Value == number;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool SupportsRemoteImageDownloading
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsMissingEpisode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public bool IsMissingEpisode
|
||||
{
|
||||
get
|
||||
{
|
||||
return LocationType == LocationType.Virtual && !IsUnaired;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public bool IsVirtualUnaired
|
||||
{
|
||||
get { return LocationType == LocationType.Virtual && IsUnaired; }
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the name of the sort.
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
protected override string CreateSortName()
|
||||
{
|
||||
return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("000 - ") : "")
|
||||
+ (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether [contains episode number] [the specified number].
|
||||
/// </summary>
|
||||
/// <param name="number">The number.</param>
|
||||
/// <returns><c>true</c> if [contains episode number] [the specified number]; otherwise, <c>false</c>.</returns>
|
||||
public bool ContainsEpisodeNumber(int number)
|
||||
{
|
||||
if (IndexNumber.HasValue)
|
||||
{
|
||||
if (IndexNumberEnd.HasValue)
|
||||
{
|
||||
return number >= IndexNumber.Value && number <= IndexNumberEnd.Value;
|
||||
}
|
||||
|
||||
return IndexNumber.Value == number;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool SupportsRemoteImageDownloading
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsMissingEpisode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public bool IsMissingEpisode
|
||||
{
|
||||
get
|
||||
{
|
||||
return LocationType == LocationType.Virtual && !IsUnaired;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public bool IsVirtualUnaired
|
||||
{
|
||||
get { return LocationType == LocationType.Virtual && IsUnaired; }
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public Guid? SeasonId { get; set; }
|
||||
[IgnoreDataMember]
|
||||
public Guid? SeriesId { get; set; }
|
||||
|
||||
public Guid? FindSeriesId()
|
||||
{
|
||||
var series = FindParent<Series>();
|
||||
var series = FindParent<Series>();
|
||||
return series == null ? (Guid?)null : series.Id;
|
||||
}
|
||||
|
||||
public override IEnumerable<Guid> GetAncestorIds()
|
||||
{
|
||||
var list = base.GetAncestorIds().ToList();
|
||||
|
||||
var seasonId = SeasonId;
|
||||
|
||||
if (seasonId.HasValue && !list.Contains(seasonId.Value))
|
||||
{
|
||||
list.Add(seasonId.Value);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override IEnumerable<Guid> GetAncestorIds()
|
||||
{
|
||||
var list = base.GetAncestorIds().ToList();
|
||||
|
||||
var seasonId = SeasonId;
|
||||
|
||||
if (seasonId.HasValue && !list.Contains(seasonId.Value))
|
||||
{
|
||||
list.Add(seasonId.Value);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override IEnumerable<FileSystemMetadata> GetDeletePaths()
|
||||
{
|
||||
return new[] {
|
||||
|
@ -327,60 +327,60 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||
}
|
||||
}.Concat(GetLocalMetadataFilesToDelete());
|
||||
}
|
||||
|
||||
public override UnratedItem GetBlockUnratedType()
|
||||
{
|
||||
return UnratedItem.Series;
|
||||
}
|
||||
|
||||
public EpisodeInfo GetLookupInfo()
|
||||
{
|
||||
var id = GetItemLookupInfo<EpisodeInfo>();
|
||||
|
||||
var series = Series;
|
||||
|
||||
if (series != null)
|
||||
{
|
||||
id.SeriesProviderIds = series.ProviderIds;
|
||||
}
|
||||
|
||||
id.IsMissingEpisode = IsMissingEpisode;
|
||||
id.IndexNumberEnd = IndexNumberEnd;
|
||||
id.IsVirtualUnaired = IsVirtualUnaired;
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
public override bool BeforeMetadataRefresh()
|
||||
{
|
||||
var hasChanges = base.BeforeMetadataRefresh();
|
||||
|
||||
try
|
||||
{
|
||||
if (LibraryManager.FillMissingEpisodeNumbersFromPath(this))
|
||||
{
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error in FillMissingEpisodeNumbersFromPath. Episode: {0}", ex, Path ?? Name ?? Id.ToString());
|
||||
}
|
||||
|
||||
if (!ParentIndexNumber.HasValue)
|
||||
{
|
||||
var season = Season;
|
||||
if (season != null)
|
||||
{
|
||||
if (season.ParentIndexNumber.HasValue)
|
||||
{
|
||||
ParentIndexNumber = season.ParentIndexNumber;
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hasChanges;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override UnratedItem GetBlockUnratedType()
|
||||
{
|
||||
return UnratedItem.Series;
|
||||
}
|
||||
|
||||
public EpisodeInfo GetLookupInfo()
|
||||
{
|
||||
var id = GetItemLookupInfo<EpisodeInfo>();
|
||||
|
||||
var series = Series;
|
||||
|
||||
if (series != null)
|
||||
{
|
||||
id.SeriesProviderIds = series.ProviderIds;
|
||||
}
|
||||
|
||||
id.IsMissingEpisode = IsMissingEpisode;
|
||||
id.IndexNumberEnd = IndexNumberEnd;
|
||||
id.IsVirtualUnaired = IsVirtualUnaired;
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
public override bool BeforeMetadataRefresh()
|
||||
{
|
||||
var hasChanges = base.BeforeMetadataRefresh();
|
||||
|
||||
try
|
||||
{
|
||||
if (LibraryManager.FillMissingEpisodeNumbersFromPath(this))
|
||||
{
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error in FillMissingEpisodeNumbersFromPath. Episode: {0}", ex, Path ?? Name ?? Id.ToString());
|
||||
}
|
||||
|
||||
if (!ParentIndexNumber.HasValue)
|
||||
{
|
||||
var season = Season;
|
||||
if (season != null)
|
||||
{
|
||||
if (season.ParentIndexNumber.HasValue)
|
||||
{
|
||||
ParentIndexNumber = season.ParentIndexNumber;
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hasChanges;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||
/// Creates the name of the sort.
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
protected override string CreateSortNameInternal()
|
||||
protected override string CreateSortName()
|
||||
{
|
||||
return IndexNumber != null ? IndexNumber.Value.ToString("0000") : Name;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
{
|
||||
private List<Guid> _childrenIds = null;
|
||||
private readonly object _childIdsLock = new object();
|
||||
protected override IEnumerable<BaseItem> LoadChildren()
|
||||
protected override List<BaseItem> LoadChildren()
|
||||
{
|
||||
lock (_childIdsLock)
|
||||
{
|
||||
|
|
|
@ -527,6 +527,8 @@ namespace MediaBrowser.Controller.Library
|
|||
/// <returns>QueryResult<BaseItem>.</returns>
|
||||
IEnumerable<BaseItem> GetItemList(InternalItemsQuery query);
|
||||
|
||||
IEnumerable<BaseItem> GetItemList(InternalItemsQuery query, bool allowExternalContent);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the items.
|
||||
/// </summary>
|
||||
|
|
|
@ -43,7 +43,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
public override SourceType SourceType
|
||||
{
|
||||
get { return SourceType.LiveTV; }
|
||||
set { }
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
|
|
|
@ -55,7 +55,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
public override SourceType SourceType
|
||||
{
|
||||
get { return SourceType.LiveTV; }
|
||||
set { }
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
|
@ -89,7 +88,7 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
}
|
||||
}
|
||||
|
||||
protected override string CreateSortNameInternal()
|
||||
protected override string CreateSortName()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Number))
|
||||
{
|
||||
|
|
|
@ -65,7 +65,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
public override SourceType SourceType
|
||||
{
|
||||
get { return SourceType.LiveTV; }
|
||||
set { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -42,7 +42,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
public override SourceType SourceType
|
||||
{
|
||||
get { return SourceType.LiveTV; }
|
||||
set { }
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
|
|
|
@ -30,7 +30,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
public override SourceType SourceType
|
||||
{
|
||||
get { return SourceType.LiveTV; }
|
||||
set { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1604,7 +1604,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
}
|
||||
|
||||
// Only do this for video files due to sometimes unpredictable codec names coming from BDInfo
|
||||
if (state.RunTimeTicks.HasValue && state.VideoType == VideoType.VideoFile && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType))
|
||||
if (state.VideoType == VideoType.VideoFile && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType))
|
||||
{
|
||||
foreach (var stream in state.MediaSource.MediaStreams)
|
||||
{
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace MediaBrowser.Controller.Playlists
|
|||
return true;
|
||||
}
|
||||
|
||||
protected override IEnumerable<BaseItem> LoadChildren()
|
||||
protected override List<BaseItem> LoadChildren()
|
||||
{
|
||||
// Save a trip to the database
|
||||
return new List<BaseItem>();
|
||||
|
|
|
@ -598,20 +598,6 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
break;
|
||||
}
|
||||
|
||||
case "VoteCount":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
{
|
||||
int num;
|
||||
|
||||
if (int.TryParse(val, NumberStyles.Integer, _usCulture, out num))
|
||||
{
|
||||
item.VoteCount = num;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "CollectionNumber":
|
||||
var tmdbCollection = reader.ReadElementContentAsString();
|
||||
if (!string.IsNullOrWhiteSpace(tmdbCollection))
|
||||
|
|
|
@ -109,7 +109,6 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
"TvDbId",
|
||||
"Type",
|
||||
"TVRageId",
|
||||
"VoteCount",
|
||||
"Website",
|
||||
"Zap2ItId",
|
||||
"CollectionItems",
|
||||
|
@ -407,10 +406,6 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
{
|
||||
writer.WriteElementString("Rating", item.CommunityRating.Value.ToString(UsCulture));
|
||||
}
|
||||
if (item.VoteCount.HasValue)
|
||||
{
|
||||
writer.WriteElementString("VoteCount", item.VoteCount.Value.ToString(UsCulture));
|
||||
}
|
||||
|
||||
if (item.ProductionYear.HasValue && !(item is Person))
|
||||
{
|
||||
|
|
|
@ -17,8 +17,6 @@ namespace MediaBrowser.Model.Configuration
|
|||
/// <value><c>true</c> if [enable u pn p]; otherwise, <c>false</c>.</value>
|
||||
public bool EnableUPnP { get; set; }
|
||||
|
||||
public bool EnableSimpleSortNameHandling { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the public mapped port.
|
||||
/// </summary>
|
||||
|
|
|
@ -221,12 +221,6 @@ namespace MediaBrowser.Model.Dto
|
|||
/// <value>The community rating.</value>
|
||||
public float? CommunityRating { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the vote count.
|
||||
/// </summary>
|
||||
/// <value>The vote count.</value>
|
||||
public int? VoteCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the cumulative run time ticks.
|
||||
/// </summary>
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace MediaBrowser.Model.MediaInfo
|
|||
public bool ForceDirectPlayRemoteMediaSource { get; set; }
|
||||
public bool AllowVideoStreamCopy { get; set; }
|
||||
public bool AllowAudioStreamCopy { get; set; }
|
||||
public bool AutoOpenLiveStream { get; set; }
|
||||
|
||||
public PlaybackInfoRequest()
|
||||
{
|
||||
|
|
|
@ -206,11 +206,6 @@
|
|||
/// </summary>
|
||||
Tags,
|
||||
|
||||
/// <summary>
|
||||
/// The vote count
|
||||
/// </summary>
|
||||
VoteCount,
|
||||
|
||||
/// <summary>
|
||||
/// The trailer url of the item
|
||||
/// </summary>
|
||||
|
|
|
@ -180,11 +180,6 @@ namespace MediaBrowser.Providers.Manager
|
|||
}
|
||||
}
|
||||
|
||||
if (replaceData || !target.VoteCount.HasValue)
|
||||
{
|
||||
target.VoteCount = source.VoteCount;
|
||||
}
|
||||
|
||||
foreach (var id in source.ProviderIds)
|
||||
{
|
||||
var key = id.Key;
|
||||
|
@ -200,6 +195,32 @@ namespace MediaBrowser.Providers.Manager
|
|||
MergeCriticRating(source, target, lockedFields, replaceData);
|
||||
MergeTrailers(source, target, lockedFields, replaceData);
|
||||
MergeVideoInfo(source, target, lockedFields, replaceData);
|
||||
MergeDisplayOrder(source, target, lockedFields, replaceData);
|
||||
|
||||
//if (!lockedFields.Contains(MetadataFields.SortName))
|
||||
{
|
||||
if (replaceData || string.IsNullOrEmpty(target.ForcedSortName))
|
||||
{
|
||||
var forcedSortName = source.ForcedSortName;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(forcedSortName))
|
||||
{
|
||||
target.ForcedSortName = forcedSortName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if (!lockedFields.Contains(MetadataFields.DisplayMediaType))
|
||||
{
|
||||
if (replaceData || string.IsNullOrEmpty(target.DisplayMediaType))
|
||||
{
|
||||
// Safeguard against incoming data having an emtpy name
|
||||
if (!string.IsNullOrWhiteSpace(source.DisplayMediaType))
|
||||
{
|
||||
target.DisplayMediaType = source.DisplayMediaType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mergeMetadataSettings)
|
||||
{
|
||||
|
@ -235,10 +256,8 @@ namespace MediaBrowser.Providers.Manager
|
|||
public static void MergeMetadataSettings(BaseItem source,
|
||||
BaseItem target)
|
||||
{
|
||||
target.ForcedSortName = source.ForcedSortName;
|
||||
target.LockedFields = source.LockedFields;
|
||||
target.IsLocked = source.IsLocked;
|
||||
target.DisplayMediaType = source.DisplayMediaType;
|
||||
|
||||
// Grab the value if it's there, but if not then don't overwrite the default
|
||||
if (source.DateCreated != default(DateTime))
|
||||
|
@ -248,7 +267,10 @@ namespace MediaBrowser.Providers.Manager
|
|||
|
||||
target.PreferredMetadataCountryCode = source.PreferredMetadataCountryCode;
|
||||
target.PreferredMetadataLanguage = source.PreferredMetadataLanguage;
|
||||
}
|
||||
|
||||
private static void MergeDisplayOrder(BaseItem source, BaseItem target, List<MetadataFields> lockedFields, bool replaceData)
|
||||
{
|
||||
var sourceHasDisplayOrder = source as IHasDisplayOrder;
|
||||
var targetHasDisplayOrder = target as IHasDisplayOrder;
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
movie.CommunityRating = rating;
|
||||
}
|
||||
|
||||
movie.VoteCount = movieData.vote_count;
|
||||
//movie.VoteCount = movieData.vote_count;
|
||||
|
||||
//release date and certification are retrieved based on configured country and we fall back on US if not there and to minimun release date if still no match
|
||||
if (movieData.releases != null && movieData.releases.countries != null)
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace MediaBrowser.Providers.Omdb
|
|||
&& int.TryParse(result.imdbVotes, NumberStyles.Number, _usCulture, out voteCount)
|
||||
&& voteCount >= 0)
|
||||
{
|
||||
item.VoteCount = voteCount;
|
||||
//item.VoteCount = voteCount;
|
||||
}
|
||||
|
||||
float imdbRating;
|
||||
|
@ -185,7 +185,7 @@ namespace MediaBrowser.Providers.Omdb
|
|||
&& int.TryParse(result.imdbVotes, NumberStyles.Number, _usCulture, out voteCount)
|
||||
&& voteCount >= 0)
|
||||
{
|
||||
item.VoteCount = voteCount;
|
||||
//item.VoteCount = voteCount;
|
||||
}
|
||||
|
||||
float imdbRating;
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace MediaBrowser.Providers.TV
|
|||
item.Overview = response.overview;
|
||||
|
||||
item.CommunityRating = (float)response.vote_average;
|
||||
item.VoteCount = response.vote_count;
|
||||
//item.VoteCount = response.vote_count;
|
||||
|
||||
if (response.videos != null && response.videos.results != null)
|
||||
{
|
||||
|
|
|
@ -217,7 +217,7 @@ namespace MediaBrowser.Providers.TV
|
|||
series.Name = seriesInfo.name;
|
||||
series.SetProviderId(MetadataProviders.Tmdb, seriesInfo.id.ToString(_usCulture));
|
||||
|
||||
series.VoteCount = seriesInfo.vote_count;
|
||||
//series.VoteCount = seriesInfo.vote_count;
|
||||
|
||||
string voteAvg = seriesInfo.vote_average.ToString(CultureInfo.InvariantCulture);
|
||||
float rating;
|
||||
|
|
|
@ -680,7 +680,7 @@ namespace MediaBrowser.Providers.TV
|
|||
// int.TryParse is local aware, so it can be probamatic, force us culture
|
||||
if (int.TryParse(val, NumberStyles.Integer, _usCulture, out rval))
|
||||
{
|
||||
item.VoteCount = rval;
|
||||
//item.VoteCount = rval;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1150,7 +1150,7 @@ namespace MediaBrowser.Providers.TV
|
|||
// int.TryParse is local aware, so it can be probamatic, force us culture
|
||||
if (int.TryParse(val, NumberStyles.Integer, _usCulture, out rval))
|
||||
{
|
||||
item.VoteCount = rval;
|
||||
//item.VoteCount = rval;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -704,21 +704,6 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||
break;
|
||||
}
|
||||
|
||||
case "votes":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
{
|
||||
int num;
|
||||
|
||||
if (int.TryParse(val, NumberStyles.Integer, _usCulture, out num))
|
||||
{
|
||||
item.VoteCount = num;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "genre":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
|
|
@ -63,7 +63,6 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||
"releasedate",
|
||||
"outline",
|
||||
"id",
|
||||
"votes",
|
||||
"credits",
|
||||
"originaltitle",
|
||||
"watched",
|
||||
|
@ -659,11 +658,6 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||
}
|
||||
}
|
||||
|
||||
if (item.VoteCount.HasValue)
|
||||
{
|
||||
writer.WriteElementString("votes", item.VoteCount.Value.ToString(UsCulture));
|
||||
}
|
||||
|
||||
// Use original runtime here, actual file runtime later in MediaInfo
|
||||
var runTimeTicks = item.RunTimeTicks;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user