mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-09 23:30:50 +02:00
Merge pull request #6423 from richlander/mediabrowser-controller
Fix warnings in MediaBrowser.Controller
This commit is contained in:
commit
db0d5b048a
File diff suppressed because it is too large
Load diff
|
@ -64,6 +64,8 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="source">The source object.</param>
|
/// <param name="source">The source object.</param>
|
||||||
/// <param name="dest">The destination object.</param>
|
/// <param name="dest">The destination object.</param>
|
||||||
|
/// <typeparam name="T">Source type.</typeparam>
|
||||||
|
/// <typeparam name="TU">Destination type.</typeparam>
|
||||||
public static void DeepCopy<T, TU>(this T source, TU dest)
|
public static void DeepCopy<T, TU>(this T source, TU dest)
|
||||||
where T : BaseItem
|
where T : BaseItem
|
||||||
where TU : BaseItem
|
where TU : BaseItem
|
||||||
|
@ -109,6 +111,9 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// Copies all properties on newly created object. Skips properties that do not exist.
|
/// Copies all properties on newly created object. Skips properties that do not exist.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="source">The source object.</param>
|
/// <param name="source">The source object.</param>
|
||||||
|
/// <typeparam name="T">Source type.</typeparam>
|
||||||
|
/// <typeparam name="TU">Destination type.</typeparam>
|
||||||
|
/// <returns>Destination object.</returns>
|
||||||
public static TU DeepCopy<T, TU>(this T source)
|
public static TU DeepCopy<T, TU>(this T source)
|
||||||
where T : BaseItem
|
where T : BaseItem
|
||||||
where TU : BaseItem, new()
|
where TU : BaseItem, new()
|
||||||
|
|
|
@ -15,6 +15,12 @@ namespace MediaBrowser.Controller.Entities
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public virtual string CollectionType => null;
|
public virtual string CollectionType => null;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public override bool SupportsInheritedParentImages => false;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public override bool SupportsPeople => false;
|
||||||
|
|
||||||
public override bool CanDelete()
|
public override bool CanDelete()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -24,11 +30,5 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public override bool SupportsInheritedParentImages => false;
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public override bool SupportsPeople => false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,23 @@ namespace MediaBrowser.Controller.Entities
|
||||||
PhysicalFolderIds = Array.Empty<Guid>();
|
PhysicalFolderIds = Array.Empty<Guid>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the display preferences id.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Allow different display preferences for each collection folder.
|
||||||
|
/// </remarks>
|
||||||
|
/// <value>The display prefs id.</value>
|
||||||
|
[JsonIgnore]
|
||||||
|
public override Guid DisplayPreferencesId => Id;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public override string[] PhysicalLocations => PhysicalLocationsList;
|
||||||
|
|
||||||
|
public string[] PhysicalLocationsList { get; set; }
|
||||||
|
|
||||||
|
public Guid[] PhysicalFolderIds { get; set; }
|
||||||
|
|
||||||
public static IXmlSerializer XmlSerializer { get; set; }
|
public static IXmlSerializer XmlSerializer { get; set; }
|
||||||
|
|
||||||
public static IServerApplicationHost ApplicationHost { get; set; }
|
public static IServerApplicationHost ApplicationHost { get; set; }
|
||||||
|
@ -63,6 +80,9 @@ namespace MediaBrowser.Controller.Entities
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public override IEnumerable<BaseItem> Children => GetActualChildren();
|
public override IEnumerable<BaseItem> Children => GetActualChildren();
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public override bool SupportsPeople => false;
|
||||||
|
|
||||||
public override bool CanDelete()
|
public override bool CanDelete()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -160,23 +180,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the display preferences id.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// Allow different display preferences for each collection folder.
|
|
||||||
/// </remarks>
|
|
||||||
/// <value>The display prefs id.</value>
|
|
||||||
[JsonIgnore]
|
|
||||||
public override Guid DisplayPreferencesId => Id;
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public override string[] PhysicalLocations => PhysicalLocationsList;
|
|
||||||
|
|
||||||
public string[] PhysicalLocationsList { get; set; }
|
|
||||||
|
|
||||||
public Guid[] PhysicalFolderIds { get; set; }
|
|
||||||
|
|
||||||
public override bool IsSaveLocalMetadataEnabled()
|
public override bool IsSaveLocalMetadataEnabled()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -373,8 +376,5 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public override bool SupportsPeople => false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds the trailer URL.
|
/// Adds the trailer URL.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="item">Media item.</param>
|
||||||
|
/// <param name="url">Trailer URL.</param>
|
||||||
public static void AddTrailerUrl(this BaseItem item, string url)
|
public static void AddTrailerUrl(this BaseItem item, string url)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(url))
|
if (string.IsNullOrEmpty(url))
|
||||||
|
|
|
@ -1669,7 +1669,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
/// <param name="datePlayed">The date played.</param>
|
/// <param name="datePlayed">The date played.</param>
|
||||||
/// <param name="resetPosition">if set to <c>true</c> [reset position].</param>
|
/// <param name="resetPosition">if set to <c>true</c> [reset position].</param>
|
||||||
/// <returns>Task.</returns>
|
|
||||||
public override void MarkPlayed(
|
public override void MarkPlayed(
|
||||||
User user,
|
User user,
|
||||||
DateTime? datePlayed,
|
DateTime? datePlayed,
|
||||||
|
@ -1711,7 +1710,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// Marks the unplayed.
|
/// Marks the unplayed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
/// <returns>Task.</returns>
|
|
||||||
public override void MarkUnplayed(User user)
|
public override void MarkUnplayed(User user)
|
||||||
{
|
{
|
||||||
var itemsResult = GetItemList(new InternalItemsQuery
|
var itemsResult = GetItemList(new InternalItemsQuery
|
||||||
|
|
|
@ -20,6 +20,8 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the media sources.
|
/// Gets the media sources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="enablePathSubstitution"><c>true</c> to enable path substitution, <c>false</c> to not.</param>
|
||||||
|
/// <returns>A list of media sources.</returns>
|
||||||
List<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution);
|
List<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution);
|
||||||
|
|
||||||
List<MediaStream> GetMediaStreams();
|
List<MediaStream> GetMediaStreams();
|
||||||
|
|
|
@ -39,6 +39,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the trailer count.
|
/// Gets the trailer count.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="item">Media item.</param>
|
||||||
/// <returns><see cref="IReadOnlyList{Guid}" />.</returns>
|
/// <returns><see cref="IReadOnlyList{Guid}" />.</returns>
|
||||||
public static int GetTrailerCount(this IHasTrailers item)
|
public static int GetTrailerCount(this IHasTrailers item)
|
||||||
=> item.LocalTrailerIds.Count + item.RemoteTrailerIds.Count;
|
=> item.LocalTrailerIds.Count + item.RemoteTrailerIds.Count;
|
||||||
|
@ -46,6 +47,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the trailer ids.
|
/// Gets the trailer ids.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="item">Media item.</param>
|
||||||
/// <returns><see cref="IReadOnlyList{Guid}" />.</returns>
|
/// <returns><see cref="IReadOnlyList{Guid}" />.</returns>
|
||||||
public static IReadOnlyList<Guid> GetTrailerIds(this IHasTrailers item)
|
public static IReadOnlyList<Guid> GetTrailerIds(this IHasTrailers item)
|
||||||
{
|
{
|
||||||
|
@ -70,6 +72,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the trailers.
|
/// Gets the trailers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="item">Media item.</param>
|
||||||
/// <returns><see cref="IReadOnlyList{BaseItem}" />.</returns>
|
/// <returns><see cref="IReadOnlyList{BaseItem}" />.</returns>
|
||||||
public static IReadOnlyList<BaseItem> GetTrailers(this IHasTrailers item)
|
public static IReadOnlyList<BaseItem> GetTrailers(this IHasTrailers item)
|
||||||
{
|
{
|
||||||
|
|
|
@ -129,6 +129,8 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is called before any metadata refresh and returns true or false indicating if changes were made.
|
/// This is called before any metadata refresh and returns true or false indicating if changes were made.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="replaceAllMetadata"><c>true</c> to replace all metadata, <c>false</c> to not.</param>
|
||||||
|
/// <returns><c>true</c> if changes were made, <c>false</c> if not.</returns>
|
||||||
public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
|
public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
|
||||||
{
|
{
|
||||||
var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);
|
var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);
|
||||||
|
|
|
@ -105,6 +105,8 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is called before any metadata refresh and returns true or false indicating if changes were made.
|
/// This is called before any metadata refresh and returns true or false indicating if changes were made.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="replaceAllMetadata"><c>true</c> to replace all metadata, <c>false</c> to not.</param>
|
||||||
|
/// <returns><c>true</c> if changes were made, <c>false</c> if not.</returns>
|
||||||
public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
|
public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
|
||||||
{
|
{
|
||||||
var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);
|
var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);
|
||||||
|
|
|
@ -49,12 +49,6 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
/// <value>The index number.</value>
|
/// <value>The index number.</value>
|
||||||
public int? IndexNumberEnd { get; set; }
|
public int? IndexNumberEnd { get; set; }
|
||||||
|
|
||||||
public string FindSeriesSortName()
|
|
||||||
{
|
|
||||||
var series = Series;
|
|
||||||
return series == null ? SeriesName : series.SortName;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
protected override bool SupportsOwnedItems => IsStacked || MediaSourceCount > 1;
|
protected override bool SupportsOwnedItems => IsStacked || MediaSourceCount > 1;
|
||||||
|
|
||||||
|
@ -76,45 +70,6 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
protected override bool EnableDefaultVideoUserDataKeys => false;
|
protected override bool EnableDefaultVideoUserDataKeys => false;
|
||||||
|
|
||||||
public override double GetDefaultPrimaryImageAspectRatio()
|
|
||||||
{
|
|
||||||
// hack for tv plugins
|
|
||||||
if (SourceType == SourceType.Channel)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 16.0 / 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
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--;
|
|
||||||
}
|
|
||||||
|
|
||||||
var newList = seriesUserDataKeys.GetRange(0, take);
|
|
||||||
var suffix = ParentIndexNumber.Value.ToString("000", CultureInfo.InvariantCulture) + IndexNumber.Value.ToString("000", CultureInfo.InvariantCulture);
|
|
||||||
for (int i = 0; i < take; i++)
|
|
||||||
{
|
|
||||||
newList[i] = newList[i] + suffix;
|
|
||||||
}
|
|
||||||
|
|
||||||
newList.AddRange(list);
|
|
||||||
list = newList;
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the Episode's Series Instance.
|
/// Gets the Episode's Series Instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -161,6 +116,74 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string SeasonName { get; set; }
|
public string SeasonName { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public override bool SupportsRemoteImageDownloading
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (IsMissingEpisode)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public bool IsMissingEpisode => LocationType == LocationType.Virtual;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public Guid SeasonId { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public Guid SeriesId { get; set; }
|
||||||
|
|
||||||
|
public string FindSeriesSortName()
|
||||||
|
{
|
||||||
|
var series = Series;
|
||||||
|
return series == null ? SeriesName : series.SortName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override double GetDefaultPrimaryImageAspectRatio()
|
||||||
|
{
|
||||||
|
// hack for tv plugins
|
||||||
|
if (SourceType == SourceType.Channel)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 16.0 / 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
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--;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newList = seriesUserDataKeys.GetRange(0, take);
|
||||||
|
var suffix = ParentIndexNumber.Value.ToString("000", CultureInfo.InvariantCulture) + IndexNumber.Value.ToString("000", CultureInfo.InvariantCulture);
|
||||||
|
for (int i = 0; i < take; i++)
|
||||||
|
{
|
||||||
|
newList[i] = newList[i] + suffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
newList.AddRange(list);
|
||||||
|
list = newList;
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
public string FindSeriesPresentationUniqueKey()
|
public string FindSeriesPresentationUniqueKey()
|
||||||
{
|
{
|
||||||
var series = Series;
|
var series = Series;
|
||||||
|
@ -242,29 +265,6 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public override bool SupportsRemoteImageDownloading
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (IsMissingEpisode)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public bool IsMissingEpisode => LocationType == LocationType.Virtual;
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public Guid SeasonId { get; set; }
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public Guid SeriesId { get; set; }
|
|
||||||
|
|
||||||
public Guid FindSeriesId()
|
public Guid FindSeriesId()
|
||||||
{
|
{
|
||||||
var series = FindParent<Series>();
|
var series = FindParent<Series>();
|
||||||
|
|
|
@ -38,6 +38,50 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public override Guid DisplayParentId => SeriesId;
|
public override Guid DisplayParentId => SeriesId;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets this Episode's Series Instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The series.</value>
|
||||||
|
[JsonIgnore]
|
||||||
|
public Series Series
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var seriesId = SeriesId;
|
||||||
|
if (seriesId == Guid.Empty)
|
||||||
|
{
|
||||||
|
seriesId = FindSeriesId();
|
||||||
|
}
|
||||||
|
|
||||||
|
return seriesId == Guid.Empty ? null : (LibraryManager.GetItemById(seriesId) as Series);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public string SeriesPath
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var series = Series;
|
||||||
|
|
||||||
|
if (series != null)
|
||||||
|
{
|
||||||
|
return series.Path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return System.IO.Path.GetDirectoryName(Path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public string SeriesPresentationUniqueKey { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public string SeriesName { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public Guid SeriesId { get; set; }
|
||||||
|
|
||||||
public override double GetDefaultPrimaryImageAspectRatio()
|
public override double GetDefaultPrimaryImageAspectRatio()
|
||||||
{
|
{
|
||||||
double value = 2;
|
double value = 2;
|
||||||
|
@ -80,41 +124,6 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets this Episode's Series Instance.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The series.</value>
|
|
||||||
[JsonIgnore]
|
|
||||||
public Series Series
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var seriesId = SeriesId;
|
|
||||||
if (seriesId == Guid.Empty)
|
|
||||||
{
|
|
||||||
seriesId = FindSeriesId();
|
|
||||||
}
|
|
||||||
|
|
||||||
return seriesId == Guid.Empty ? null : (LibraryManager.GetItemById(seriesId) as Series);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public string SeriesPath
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var series = Series;
|
|
||||||
|
|
||||||
if (series != null)
|
|
||||||
{
|
|
||||||
return series.Path;
|
|
||||||
}
|
|
||||||
|
|
||||||
return System.IO.Path.GetDirectoryName(Path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string CreatePresentationUniqueKey()
|
public override string CreatePresentationUniqueKey()
|
||||||
{
|
{
|
||||||
if (IndexNumber.HasValue)
|
if (IndexNumber.HasValue)
|
||||||
|
@ -157,6 +166,9 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the episodes.
|
/// Gets the episodes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="user">The user.</param>
|
||||||
|
/// <param name="options">The options to use.</param>
|
||||||
|
/// <returns>Set of episodes.</returns>
|
||||||
public List<BaseItem> GetEpisodes(User user, DtoOptions options)
|
public List<BaseItem> GetEpisodes(User user, DtoOptions options)
|
||||||
{
|
{
|
||||||
return GetEpisodes(Series, user, options);
|
return GetEpisodes(Series, user, options);
|
||||||
|
@ -193,15 +205,6 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
return UnratedItem.Series;
|
return UnratedItem.Series;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public string SeriesPresentationUniqueKey { get; set; }
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public string SeriesName { get; set; }
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public Guid SeriesId { get; set; }
|
|
||||||
|
|
||||||
public string FindSeriesPresentationUniqueKey()
|
public string FindSeriesPresentationUniqueKey()
|
||||||
{
|
{
|
||||||
var series = Series;
|
var series = Series;
|
||||||
|
@ -241,6 +244,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is called before any metadata refresh and returns true or false indicating if changes were made.
|
/// This is called before any metadata refresh and returns true or false indicating if changes were made.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="replaceAllMetadata"><c>true</c> to replace metdata, <c>false</c> to not.</param>
|
||||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||||
public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
|
public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,6 +72,9 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
/// <value>The status.</value>
|
/// <value>The status.</value>
|
||||||
public SeriesStatus? Status { get; set; }
|
public SeriesStatus? Status { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public override bool StopRefreshIfLocalMetadataFound => false;
|
||||||
|
|
||||||
public override double GetDefaultPrimaryImageAspectRatio()
|
public override double GetDefaultPrimaryImageAspectRatio()
|
||||||
{
|
{
|
||||||
double value = 2;
|
double value = 2;
|
||||||
|
@ -394,6 +397,10 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Filters the episodes by season.
|
/// Filters the episodes by season.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="episodes">The episodes.</param>
|
||||||
|
/// <param name="parentSeason">The season.</param>
|
||||||
|
/// <param name="includeSpecials"><c>true</c> to include special, <c>false</c> to not.</param>
|
||||||
|
/// <returns>The set of episodes.</returns>
|
||||||
public static IEnumerable<BaseItem> FilterEpisodesBySeason(IEnumerable<BaseItem> episodes, Season parentSeason, bool includeSpecials)
|
public static IEnumerable<BaseItem> FilterEpisodesBySeason(IEnumerable<BaseItem> episodes, Season parentSeason, bool includeSpecials)
|
||||||
{
|
{
|
||||||
var seasonNumber = parentSeason.IndexNumber;
|
var seasonNumber = parentSeason.IndexNumber;
|
||||||
|
@ -424,6 +431,10 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Filters the episodes by season.
|
/// Filters the episodes by season.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="episodes">The episodes.</param>
|
||||||
|
/// <param name="seasonNumber">The season.</param>
|
||||||
|
/// <param name="includeSpecials"><c>true</c> to include special, <c>false</c> to not.</param>
|
||||||
|
/// <returns>The set of episodes.</returns>
|
||||||
public static IEnumerable<Episode> FilterEpisodesBySeason(IEnumerable<Episode> episodes, int seasonNumber, bool includeSpecials)
|
public static IEnumerable<Episode> FilterEpisodesBySeason(IEnumerable<Episode> episodes, int seasonNumber, bool includeSpecials)
|
||||||
{
|
{
|
||||||
if (!includeSpecials || seasonNumber < 1)
|
if (!includeSpecials || seasonNumber < 1)
|
||||||
|
@ -499,8 +510,5 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public override bool StopRefreshIfLocalMetadataFound => false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,13 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UserItemData
|
public class UserItemData
|
||||||
{
|
{
|
||||||
|
public const double MinLikeValue = 6.5;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The _rating.
|
||||||
|
/// </summary>
|
||||||
|
private double? _rating;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the user id.
|
/// Gets or sets the user id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -24,11 +31,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <value>The key.</value>
|
/// <value>The key.</value>
|
||||||
public string Key { get; set; }
|
public string Key { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The _rating.
|
|
||||||
/// </summary>
|
|
||||||
private double? _rating;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the users 0-10 rating.
|
/// Gets or sets the users 0-10 rating.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -93,8 +95,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <value>The index of the subtitle stream.</value>
|
/// <value>The index of the subtitle stream.</value>
|
||||||
public int? SubtitleStreamIndex { get; set; }
|
public int? SubtitleStreamIndex { get; set; }
|
||||||
|
|
||||||
public const double MinLikeValue = 6.5;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether the item is liked or not.
|
/// Gets or sets a value indicating whether the item is liked or not.
|
||||||
/// This should never be serialized.
|
/// This should never be serialized.
|
||||||
|
|
|
@ -21,8 +21,28 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UserRootFolder : Folder
|
public class UserRootFolder : Folder
|
||||||
{
|
{
|
||||||
private List<Guid> _childrenIds = null;
|
|
||||||
private readonly object _childIdsLock = new object();
|
private readonly object _childIdsLock = new object();
|
||||||
|
private List<Guid> _childrenIds = null;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public override bool SupportsInheritedParentImages => false;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public override bool SupportsPlayedStatus => false;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
protected override bool SupportsShortcutChildren => true;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public override bool IsPreSorted => true;
|
||||||
|
|
||||||
|
private void ClearCache()
|
||||||
|
{
|
||||||
|
lock (_childIdsLock)
|
||||||
|
{
|
||||||
|
_childrenIds = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override List<BaseItem> LoadChildren()
|
protected override List<BaseItem> LoadChildren()
|
||||||
{
|
{
|
||||||
|
@ -39,20 +59,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public override bool SupportsInheritedParentImages => false;
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public override bool SupportsPlayedStatus => false;
|
|
||||||
|
|
||||||
private void ClearCache()
|
|
||||||
{
|
|
||||||
lock (_childIdsLock)
|
|
||||||
{
|
|
||||||
_childrenIds = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query)
|
protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
if (query.Recursive)
|
if (query.Recursive)
|
||||||
|
@ -74,12 +80,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return GetChildren(user, true).Count;
|
return GetChildren(user, true).Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
protected override bool SupportsShortcutChildren => true;
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public override bool IsPreSorted => true;
|
|
||||||
|
|
||||||
protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user)
|
protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user)
|
||||||
{
|
{
|
||||||
var list = base.GetEligibleChildrenForRecursiveChildren(user).ToList();
|
var list = base.GetEligibleChildrenForRecursiveChildren(user).ToList();
|
||||||
|
|
|
@ -28,6 +28,14 @@ namespace MediaBrowser.Controller.Entities
|
||||||
ISupportsPlaceHolders,
|
ISupportsPlaceHolders,
|
||||||
IHasMediaSources
|
IHasMediaSources
|
||||||
{
|
{
|
||||||
|
public Video()
|
||||||
|
{
|
||||||
|
AdditionalParts = Array.Empty<string>();
|
||||||
|
LocalAlternateVersions = Array.Empty<string>();
|
||||||
|
SubtitleFiles = Array.Empty<string>();
|
||||||
|
LinkedAlternateVersions = Array.Empty<LinkedChild>();
|
||||||
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string PrimaryVersionId { get; set; }
|
public string PrimaryVersionId { get; set; }
|
||||||
|
|
||||||
|
@ -74,30 +82,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetPrimaryVersionId(string id)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(id))
|
|
||||||
{
|
|
||||||
PrimaryVersionId = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PrimaryVersionId = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
PresentationUniqueKey = CreatePresentationUniqueKey();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string CreatePresentationUniqueKey()
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(PrimaryVersionId))
|
|
||||||
{
|
|
||||||
return PrimaryVersionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.CreatePresentationUniqueKey();
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public override bool SupportsThemeMedia => true;
|
public override bool SupportsThemeMedia => true;
|
||||||
|
|
||||||
|
@ -151,24 +135,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <value>The aspect ratio.</value>
|
/// <value>The aspect ratio.</value>
|
||||||
public string AspectRatio { get; set; }
|
public string AspectRatio { get; set; }
|
||||||
|
|
||||||
public Video()
|
|
||||||
{
|
|
||||||
AdditionalParts = Array.Empty<string>();
|
|
||||||
LocalAlternateVersions = Array.Empty<string>();
|
|
||||||
SubtitleFiles = Array.Empty<string>();
|
|
||||||
LinkedAlternateVersions = Array.Empty<LinkedChild>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanDownload()
|
|
||||||
{
|
|
||||||
if (VideoType == VideoType.Dvd || VideoType == VideoType.BluRay)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return IsFileProtocol;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public override bool SupportsAddingToPlaylist => true;
|
public override bool SupportsAddingToPlaylist => true;
|
||||||
|
|
||||||
|
@ -196,16 +162,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public override bool HasLocalAlternateVersions => LocalAlternateVersions.Length > 0;
|
public override bool HasLocalAlternateVersions => LocalAlternateVersions.Length > 0;
|
||||||
|
|
||||||
public IEnumerable<Guid> GetAdditionalPartIds()
|
|
||||||
{
|
|
||||||
return AdditionalParts.Select(i => LibraryManager.GetNewItemId(i, typeof(Video)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Guid> GetLocalAlternateVersionIds()
|
|
||||||
{
|
|
||||||
return LocalAlternateVersions.Select(i => LibraryManager.GetNewItemId(i, typeof(Video)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ILiveTvManager LiveTvManager { get; set; }
|
public static ILiveTvManager LiveTvManager { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
|
@ -222,21 +178,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool IsActiveRecording()
|
|
||||||
{
|
|
||||||
return LiveTvManager.GetActiveRecordingInfo(Path) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanDelete()
|
|
||||||
{
|
|
||||||
if (IsActiveRecording())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.CanDelete();
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool IsCompleteMedia
|
public bool IsCompleteMedia
|
||||||
{
|
{
|
||||||
|
@ -254,80 +195,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
protected virtual bool EnableDefaultVideoUserDataKeys => true;
|
protected virtual bool EnableDefaultVideoUserDataKeys => true;
|
||||||
|
|
||||||
public override List<string> GetUserDataKeys()
|
|
||||||
{
|
|
||||||
var list = base.GetUserDataKeys();
|
|
||||||
|
|
||||||
if (EnableDefaultVideoUserDataKeys)
|
|
||||||
{
|
|
||||||
if (ExtraType.HasValue)
|
|
||||||
{
|
|
||||||
var key = this.GetProviderId(MetadataProvider.Tmdb);
|
|
||||||
if (!string.IsNullOrEmpty(key))
|
|
||||||
{
|
|
||||||
list.Insert(0, GetUserDataKey(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
key = this.GetProviderId(MetadataProvider.Imdb);
|
|
||||||
if (!string.IsNullOrEmpty(key))
|
|
||||||
{
|
|
||||||
list.Insert(0, GetUserDataKey(key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var key = this.GetProviderId(MetadataProvider.Imdb);
|
|
||||||
if (!string.IsNullOrEmpty(key))
|
|
||||||
{
|
|
||||||
list.Insert(0, key);
|
|
||||||
}
|
|
||||||
|
|
||||||
key = this.GetProviderId(MetadataProvider.Tmdb);
|
|
||||||
if (!string.IsNullOrEmpty(key))
|
|
||||||
{
|
|
||||||
list.Insert(0, key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetUserDataKey(string providerId)
|
|
||||||
{
|
|
||||||
var key = providerId + "-" + ExtraType.ToString().ToLowerInvariant();
|
|
||||||
|
|
||||||
// Make sure different trailers have their own data.
|
|
||||||
if (RunTimeTicks.HasValue)
|
|
||||||
{
|
|
||||||
key += "-" + RunTimeTicks.Value.ToString(CultureInfo.InvariantCulture);
|
|
||||||
}
|
|
||||||
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Video> GetLinkedAlternateVersions()
|
|
||||||
{
|
|
||||||
return LinkedAlternateVersions
|
|
||||||
.Select(GetLinkedChild)
|
|
||||||
.Where(i => i != null)
|
|
||||||
.OfType<Video>()
|
|
||||||
.OrderBy(i => i.SortName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the additional parts.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>IEnumerable{Video}.</returns>
|
|
||||||
public IOrderedEnumerable<Video> GetAdditionalParts()
|
|
||||||
{
|
|
||||||
return GetAdditionalPartIds()
|
|
||||||
.Select(i => LibraryManager.GetItemById(i))
|
|
||||||
.Where(i => i != null)
|
|
||||||
.OfType<Video>()
|
|
||||||
.OrderBy(i => i.SortName);
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public override string ContainingFolderPath
|
public override string ContainingFolderPath
|
||||||
{
|
{
|
||||||
|
@ -369,6 +236,153 @@ namespace MediaBrowser.Controller.Entities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether [is3 D].
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if [is3 D]; otherwise, <c>false</c>.</value>
|
||||||
|
[JsonIgnore]
|
||||||
|
public bool Is3D => Video3DFormat.HasValue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the type of the media.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The type of the media.</value>
|
||||||
|
[JsonIgnore]
|
||||||
|
public override string MediaType => Model.Entities.MediaType.Video;
|
||||||
|
|
||||||
|
public override List<string> GetUserDataKeys()
|
||||||
|
{
|
||||||
|
var list = base.GetUserDataKeys();
|
||||||
|
|
||||||
|
if (EnableDefaultVideoUserDataKeys)
|
||||||
|
{
|
||||||
|
if (ExtraType.HasValue)
|
||||||
|
{
|
||||||
|
var key = this.GetProviderId(MetadataProvider.Tmdb);
|
||||||
|
if (!string.IsNullOrEmpty(key))
|
||||||
|
{
|
||||||
|
list.Insert(0, GetUserDataKey(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
key = this.GetProviderId(MetadataProvider.Imdb);
|
||||||
|
if (!string.IsNullOrEmpty(key))
|
||||||
|
{
|
||||||
|
list.Insert(0, GetUserDataKey(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var key = this.GetProviderId(MetadataProvider.Imdb);
|
||||||
|
if (!string.IsNullOrEmpty(key))
|
||||||
|
{
|
||||||
|
list.Insert(0, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
key = this.GetProviderId(MetadataProvider.Tmdb);
|
||||||
|
if (!string.IsNullOrEmpty(key))
|
||||||
|
{
|
||||||
|
list.Insert(0, key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetPrimaryVersionId(string id)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(id))
|
||||||
|
{
|
||||||
|
PrimaryVersionId = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PrimaryVersionId = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
PresentationUniqueKey = CreatePresentationUniqueKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string CreatePresentationUniqueKey()
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(PrimaryVersionId))
|
||||||
|
{
|
||||||
|
return PrimaryVersionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.CreatePresentationUniqueKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanDownload()
|
||||||
|
{
|
||||||
|
if (VideoType == VideoType.Dvd || VideoType == VideoType.BluRay)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return IsFileProtocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool IsActiveRecording()
|
||||||
|
{
|
||||||
|
return LiveTvManager.GetActiveRecordingInfo(Path) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanDelete()
|
||||||
|
{
|
||||||
|
if (IsActiveRecording())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.CanDelete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Guid> GetAdditionalPartIds()
|
||||||
|
{
|
||||||
|
return AdditionalParts.Select(i => LibraryManager.GetNewItemId(i, typeof(Video)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Guid> GetLocalAlternateVersionIds()
|
||||||
|
{
|
||||||
|
return LocalAlternateVersions.Select(i => LibraryManager.GetNewItemId(i, typeof(Video)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetUserDataKey(string providerId)
|
||||||
|
{
|
||||||
|
var key = providerId + "-" + ExtraType.ToString().ToLowerInvariant();
|
||||||
|
|
||||||
|
// Make sure different trailers have their own data.
|
||||||
|
if (RunTimeTicks.HasValue)
|
||||||
|
{
|
||||||
|
key += "-" + RunTimeTicks.Value.ToString(CultureInfo.InvariantCulture);
|
||||||
|
}
|
||||||
|
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Video> GetLinkedAlternateVersions()
|
||||||
|
{
|
||||||
|
return LinkedAlternateVersions
|
||||||
|
.Select(GetLinkedChild)
|
||||||
|
.Where(i => i != null)
|
||||||
|
.OfType<Video>()
|
||||||
|
.OrderBy(i => i.SortName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the additional parts.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>IEnumerable{Video}.</returns>
|
||||||
|
public IOrderedEnumerable<Video> GetAdditionalParts()
|
||||||
|
{
|
||||||
|
return GetAdditionalPartIds()
|
||||||
|
.Select(i => LibraryManager.GetItemById(i))
|
||||||
|
.Where(i => i != null)
|
||||||
|
.OfType<Video>()
|
||||||
|
.OrderBy(i => i.SortName);
|
||||||
|
}
|
||||||
|
|
||||||
internal override ItemUpdateType UpdateFromResolvedItem(BaseItem newItem)
|
internal override ItemUpdateType UpdateFromResolvedItem(BaseItem newItem)
|
||||||
{
|
{
|
||||||
var updateType = base.UpdateFromResolvedItem(newItem);
|
var updateType = base.UpdateFromResolvedItem(newItem);
|
||||||
|
@ -397,20 +411,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return updateType;
|
return updateType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a value indicating whether [is3 D].
|
|
||||||
/// </summary>
|
|
||||||
/// <value><c>true</c> if [is3 D]; otherwise, <c>false</c>.</value>
|
|
||||||
[JsonIgnore]
|
|
||||||
public bool Is3D => Video3DFormat.HasValue;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the type of the media.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The type of the media.</value>
|
|
||||||
[JsonIgnore]
|
|
||||||
public override string MediaType => Model.Entities.MediaType.Video;
|
|
||||||
|
|
||||||
protected override async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, List<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken)
|
protected override async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, List<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var hasChanges = await base.RefreshedOwnedItems(options, fileSystemChildren, cancellationToken).ConfigureAwait(false);
|
var hasChanges = await base.RefreshedOwnedItems(options, fileSystemChildren, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591, SA1306, SA1401
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -30,6 +30,21 @@ namespace MediaBrowser.Controller.Net
|
||||||
private readonly List<Tuple<IWebSocketConnection, CancellationTokenSource, TStateType>> _activeConnections =
|
private readonly List<Tuple<IWebSocketConnection, CancellationTokenSource, TStateType>> _activeConnections =
|
||||||
new List<Tuple<IWebSocketConnection, CancellationTokenSource, TStateType>>();
|
new List<Tuple<IWebSocketConnection, CancellationTokenSource, TStateType>>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The logger.
|
||||||
|
/// </summary>
|
||||||
|
protected ILogger<BasePeriodicWebSocketListener<TReturnDataType, TStateType>> Logger;
|
||||||
|
|
||||||
|
protected BasePeriodicWebSocketListener(ILogger<BasePeriodicWebSocketListener<TReturnDataType, TStateType>> logger)
|
||||||
|
{
|
||||||
|
if (logger == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(logger));
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the type used for the messages sent to the client.
|
/// Gets the type used for the messages sent to the client.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -54,21 +69,6 @@ namespace MediaBrowser.Controller.Net
|
||||||
/// <returns>Task{`1}.</returns>
|
/// <returns>Task{`1}.</returns>
|
||||||
protected abstract Task<TReturnDataType> GetDataToSend();
|
protected abstract Task<TReturnDataType> GetDataToSend();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The logger.
|
|
||||||
/// </summary>
|
|
||||||
protected ILogger<BasePeriodicWebSocketListener<TReturnDataType, TStateType>> Logger;
|
|
||||||
|
|
||||||
protected BasePeriodicWebSocketListener(ILogger<BasePeriodicWebSocketListener<TReturnDataType, TStateType>> logger)
|
|
||||||
{
|
|
||||||
if (logger == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(logger));
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Processes the message.
|
/// Processes the message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -18,7 +18,6 @@ namespace MediaBrowser.Controller.Persistence
|
||||||
/// <param name="key">The key.</param>
|
/// <param name="key">The key.</param>
|
||||||
/// <param name="userData">The user data.</param>
|
/// <param name="userData">The user data.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
|
||||||
void SaveUserData(long userId, string key, UserItemData userData, CancellationToken cancellationToken);
|
void SaveUserData(long userId, string key, UserItemData userData, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -31,24 +31,18 @@ namespace MediaBrowser.Controller.Playlists
|
||||||
".zpl"
|
".zpl"
|
||||||
};
|
};
|
||||||
|
|
||||||
public Guid OwnerUserId { get; set; }
|
|
||||||
|
|
||||||
public Share[] Shares { get; set; }
|
|
||||||
|
|
||||||
public Playlist()
|
public Playlist()
|
||||||
{
|
{
|
||||||
Shares = Array.Empty<Share>();
|
Shares = Array.Empty<Share>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Guid OwnerUserId { get; set; }
|
||||||
|
|
||||||
|
public Share[] Shares { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool IsFile => IsPlaylistFile(Path);
|
public bool IsFile => IsPlaylistFile(Path);
|
||||||
|
|
||||||
public static bool IsPlaylistFile(string path)
|
|
||||||
{
|
|
||||||
// The path will sometimes be a directory and "Path.HasExtension" returns true if the name contains a '.' (dot).
|
|
||||||
return System.IO.Path.HasExtension(path) && !Directory.Exists(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public override string ContainingFolderPath
|
public override string ContainingFolderPath
|
||||||
{
|
{
|
||||||
|
@ -80,6 +74,41 @@ namespace MediaBrowser.Controller.Playlists
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public override bool SupportsCumulativeRunTimeTicks => true;
|
public override bool SupportsCumulativeRunTimeTicks => true;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public override bool IsPreSorted => true;
|
||||||
|
|
||||||
|
public string PlaylistMediaType { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public override string MediaType => PlaylistMediaType;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
private bool IsSharedItem
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var path = Path;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(path))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FileSystem.ContainsSubPath(ConfigurationManager.ApplicationPaths.DataPath, path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsPlaylistFile(string path)
|
||||||
|
{
|
||||||
|
// The path will sometimes be a directory and "Path.HasExtension" returns true if the name contains a '.' (dot).
|
||||||
|
return System.IO.Path.HasExtension(path) && !Directory.Exists(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetMediaType(string value)
|
||||||
|
{
|
||||||
|
PlaylistMediaType = value;
|
||||||
|
}
|
||||||
|
|
||||||
public override double GetDefaultPrimaryImageAspectRatio()
|
public override double GetDefaultPrimaryImageAspectRatio()
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -197,35 +226,6 @@ namespace MediaBrowser.Controller.Playlists
|
||||||
return new[] { item };
|
return new[] { item };
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public override bool IsPreSorted => true;
|
|
||||||
|
|
||||||
public string PlaylistMediaType { get; set; }
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public override string MediaType => PlaylistMediaType;
|
|
||||||
|
|
||||||
public void SetMediaType(string value)
|
|
||||||
{
|
|
||||||
PlaylistMediaType = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
private bool IsSharedItem
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var path = Path;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(path))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FileSystem.ContainsSubPath(ConfigurationManager.ApplicationPaths.DataPath, path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool IsVisible(User user)
|
public override bool IsVisible(User user)
|
||||||
{
|
{
|
||||||
if (!IsSharedItem)
|
if (!IsSharedItem)
|
||||||
|
|
|
@ -13,18 +13,18 @@ namespace MediaBrowser.Controller.Resolvers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IItemResolver
|
public interface IItemResolver
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the priority.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The priority.</value>
|
||||||
|
ResolverPriority Priority { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resolves the path.
|
/// Resolves the path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="args">The args.</param>
|
/// <param name="args">The args.</param>
|
||||||
/// <returns>BaseItem.</returns>
|
/// <returns>BaseItem.</returns>
|
||||||
BaseItem ResolvePath(ItemResolveArgs args);
|
BaseItem ResolvePath(ItemResolveArgs args);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the priority.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The priority.</value>
|
|
||||||
ResolverPriority Priority { get; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IMultiItemResolver
|
public interface IMultiItemResolver
|
||||||
|
@ -38,14 +38,14 @@ namespace MediaBrowser.Controller.Resolvers
|
||||||
|
|
||||||
public class MultiItemResolverResult
|
public class MultiItemResolverResult
|
||||||
{
|
{
|
||||||
public List<BaseItem> Items { get; set; }
|
|
||||||
|
|
||||||
public List<FileSystemMetadata> ExtraFiles { get; set; }
|
|
||||||
|
|
||||||
public MultiItemResolverResult()
|
public MultiItemResolverResult()
|
||||||
{
|
{
|
||||||
Items = new List<BaseItem>();
|
Items = new List<BaseItem>();
|
||||||
ExtraFiles = new List<FileSystemMetadata>();
|
ExtraFiles = new List<FileSystemMetadata>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<BaseItem> Items { get; set; }
|
||||||
|
|
||||||
|
public List<FileSystemMetadata> ExtraFiles { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,11 @@ namespace MediaBrowser.Controller.Subtitles
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Searches the subtitles.
|
/// Searches the subtitles.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="video">The video.</param>
|
||||||
|
/// <param name="language">Subtitle language.</param>
|
||||||
|
/// <param name="isPerfectMatch">Require perfect match.</param>
|
||||||
|
/// <param name="cancellationToken">CancellationToken to use for the operation.</param>
|
||||||
|
/// <returns>Subtitles, wrapped in task.</returns>
|
||||||
Task<RemoteSubtitleInfo[]> SearchSubtitles(
|
Task<RemoteSubtitleInfo[]> SearchSubtitles(
|
||||||
Video video,
|
Video video,
|
||||||
string language,
|
string language,
|
||||||
|
@ -47,11 +52,20 @@ namespace MediaBrowser.Controller.Subtitles
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Downloads the subtitles.
|
/// Downloads the subtitles.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="video">The video.</param>
|
||||||
|
/// <param name="subtitleId">Subtitle ID.</param>
|
||||||
|
/// <param name="cancellationToken">CancellationToken to use for the operation.</param>
|
||||||
|
/// <returns>A task.</returns>
|
||||||
Task DownloadSubtitles(Video video, string subtitleId, CancellationToken cancellationToken);
|
Task DownloadSubtitles(Video video, string subtitleId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Downloads the subtitles.
|
/// Downloads the subtitles.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="video">The video.</param>
|
||||||
|
/// <param name="libraryOptions">Library options to use.</param>
|
||||||
|
/// <param name="subtitleId">Subtitle ID.</param>
|
||||||
|
/// <param name="cancellationToken">CancellationToken to use for the operation.</param>
|
||||||
|
/// <returns>A task.</returns>
|
||||||
Task DownloadSubtitles(Video video, LibraryOptions libraryOptions, string subtitleId, CancellationToken cancellationToken);
|
Task DownloadSubtitles(Video video, LibraryOptions libraryOptions, string subtitleId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -73,11 +87,16 @@ namespace MediaBrowser.Controller.Subtitles
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deletes the subtitles.
|
/// Deletes the subtitles.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="item">Media item.</param>
|
||||||
|
/// <param name="index">Subtitle index.</param>
|
||||||
|
/// <returns>A task.</returns>
|
||||||
Task DeleteSubtitles(BaseItem item, int index);
|
Task DeleteSubtitles(BaseItem item, int index);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the providers.
|
/// Gets the providers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="item">The media item.</param>
|
||||||
|
/// <returns>Subtitles providers.</returns>
|
||||||
SubtitleProviderInfo[] GetSupportedProviders(BaseItem item);
|
SubtitleProviderInfo[] GetSupportedProviders(BaseItem item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,15 @@ namespace MediaBrowser.Controller.Subtitles
|
||||||
{
|
{
|
||||||
public class SubtitleSearchRequest : IHasProviderIds
|
public class SubtitleSearchRequest : IHasProviderIds
|
||||||
{
|
{
|
||||||
|
public SubtitleSearchRequest()
|
||||||
|
{
|
||||||
|
SearchAllProviders = true;
|
||||||
|
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
DisabledSubtitleFetchers = Array.Empty<string>();
|
||||||
|
SubtitleFetcherOrder = Array.Empty<string>();
|
||||||
|
}
|
||||||
|
|
||||||
public string Language { get; set; }
|
public string Language { get; set; }
|
||||||
|
|
||||||
public string TwoLetterISOLanguageName { get; set; }
|
public string TwoLetterISOLanguageName { get; set; }
|
||||||
|
@ -42,14 +51,5 @@ namespace MediaBrowser.Controller.Subtitles
|
||||||
public string[] DisabledSubtitleFetchers { get; set; }
|
public string[] DisabledSubtitleFetchers { get; set; }
|
||||||
|
|
||||||
public string[] SubtitleFetcherOrder { get; set; }
|
public string[] SubtitleFetcherOrder { get; set; }
|
||||||
|
|
||||||
public SubtitleSearchRequest()
|
|
||||||
{
|
|
||||||
SearchAllProviders = true;
|
|
||||||
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
DisabledSubtitleFetchers = Array.Empty<string>();
|
|
||||||
SubtitleFetcherOrder = Array.Empty<string>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue