mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-02 22:08:27 +01:00
Merge branch 'master' into hwaccel
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Model.Users;
|
||||
|
||||
namespace MediaBrowser.Controller.Authentication
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Model.Users;
|
||||
|
||||
namespace MediaBrowser.Controller.Authentication
|
||||
|
||||
@@ -3,6 +3,8 @@ using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using Jellyfin.Data.Entities;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Common.Progress;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Querying;
|
||||
@@ -13,16 +15,18 @@ namespace MediaBrowser.Controller.Channels
|
||||
{
|
||||
public override bool IsVisible(User user)
|
||||
{
|
||||
if (user.Policy.BlockedChannels != null)
|
||||
if (user.GetPreference(PreferenceKind.BlockedChannels) != null)
|
||||
{
|
||||
if (user.Policy.BlockedChannels.Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase))
|
||||
if (user.GetPreference(PreferenceKind.BlockedChannels).Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!user.Policy.EnableAllChannels && !user.Policy.EnabledChannels.Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase))
|
||||
if (!user.HasPermission(PermissionKind.EnableAllChannels)
|
||||
&& !user.GetPreference(PreferenceKind.EnabledChannels)
|
||||
.Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -35,12 +35,10 @@ namespace MediaBrowser.Controller.Channels
|
||||
|
||||
public interface IDisableMediaSourceDisplay
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public interface ISupportsMediaProbe
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public interface IHasFolderAttributes
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Model.Devices;
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Querying;
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Drawing;
|
||||
using MediaBrowser.Model.Entities;
|
||||
@@ -57,6 +58,8 @@ namespace MediaBrowser.Controller.Drawing
|
||||
|
||||
string GetImageCacheTag(BaseItem item, ChapterInfo info);
|
||||
|
||||
string GetImageCacheTag(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Processes the image.
|
||||
/// </summary>
|
||||
|
||||
@@ -57,6 +57,7 @@ namespace MediaBrowser.Controller.Drawing
|
||||
case ImageType.BoxRear:
|
||||
case ImageType.Disc:
|
||||
case ImageType.Menu:
|
||||
case ImageType.Profile:
|
||||
return 1;
|
||||
case ImageType.Logo:
|
||||
return 2.58;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Querying;
|
||||
|
||||
@@ -2,9 +2,9 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
|
||||
@@ -4,12 +4,13 @@ using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Users;
|
||||
using MetadataProvider = MediaBrowser.Model.Entities.MetadataProvider;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities.Audio
|
||||
{
|
||||
@@ -97,14 +98,14 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
list.Insert(0, albumArtist + "-" + Name);
|
||||
}
|
||||
|
||||
var id = this.GetProviderId(MetadataProviders.MusicBrainzAlbum);
|
||||
var id = this.GetProviderId(MetadataProvider.MusicBrainzAlbum);
|
||||
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
{
|
||||
list.Insert(0, "MusicAlbum-Musicbrainz-" + id);
|
||||
}
|
||||
|
||||
id = this.GetProviderId(MetadataProviders.MusicBrainzReleaseGroup);
|
||||
id = this.GetProviderId(MetadataProvider.MusicBrainzReleaseGroup);
|
||||
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
{
|
||||
@@ -114,9 +115,9 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
return list;
|
||||
}
|
||||
|
||||
protected override bool GetBlockUnratedValue(UserPolicy config)
|
||||
protected override bool GetBlockUnratedValue(User user)
|
||||
{
|
||||
return config.BlockUnratedItems.Contains(UnratedItem.Music);
|
||||
return user.GetPreference(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Music.ToString());
|
||||
}
|
||||
|
||||
public override UnratedItem GetBlockUnratedType()
|
||||
|
||||
@@ -4,12 +4,13 @@ using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Extensions;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Users;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MetadataProvider = MediaBrowser.Model.Entities.MetadataProvider;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities.Audio
|
||||
{
|
||||
@@ -76,11 +77,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
|
||||
public override int GetChildCount(User user)
|
||||
{
|
||||
if (IsAccessedByName)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return base.GetChildCount(user);
|
||||
return IsAccessedByName ? 0 : base.GetChildCount(user);
|
||||
}
|
||||
|
||||
public override bool IsSaveLocalMetadataEnabled()
|
||||
@@ -128,7 +125,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
private static List<string> GetUserDataKeys(MusicArtist item)
|
||||
{
|
||||
var list = new List<string>();
|
||||
var id = item.GetProviderId(MetadataProviders.MusicBrainzArtist);
|
||||
var id = item.GetProviderId(MetadataProvider.MusicBrainzArtist);
|
||||
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
{
|
||||
@@ -142,9 +139,10 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
{
|
||||
return "Artist-" + (Name ?? string.Empty).RemoveDiacritics();
|
||||
}
|
||||
protected override bool GetBlockUnratedValue(UserPolicy config)
|
||||
|
||||
protected override bool GetBlockUnratedValue(User user)
|
||||
{
|
||||
return config.BlockUnratedItems.Contains(UnratedItem.Music);
|
||||
return user.GetPreference(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Music.ToString());
|
||||
}
|
||||
|
||||
public override UnratedItem GetBlockUnratedType()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
|
||||
@@ -7,6 +7,8 @@ using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller.Channels;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
@@ -24,7 +26,6 @@ using MediaBrowser.Model.Library;
|
||||
using MediaBrowser.Model.LiveTv;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using MediaBrowser.Model.Providers;
|
||||
using MediaBrowser.Model.Users;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
@@ -63,7 +64,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
Genres = Array.Empty<string>();
|
||||
Studios = Array.Empty<string>();
|
||||
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
LockedFields = Array.Empty<MetadataFields>();
|
||||
LockedFields = Array.Empty<MetadataField>();
|
||||
ImageInfos = Array.Empty<ItemImageInfo>();
|
||||
ProductionLocations = Array.Empty<string>();
|
||||
RemoteTrailers = Array.Empty<MediaUrl>();
|
||||
@@ -299,7 +300,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
get
|
||||
{
|
||||
//if (IsOffline)
|
||||
// if (IsOffline)
|
||||
//{
|
||||
// return LocationType.Offline;
|
||||
//}
|
||||
@@ -481,12 +482,12 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public virtual bool IsAuthorizedToDelete(User user, List<Folder> allCollectionFolders)
|
||||
{
|
||||
if (user.Policy.EnableContentDeletion)
|
||||
if (user.HasPermission(PermissionKind.EnableContentDeletion))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var allowed = user.Policy.EnableContentDeletionFromFolders;
|
||||
var allowed = user.GetPreference(PreferenceKind.EnableContentDeletionFromFolders);
|
||||
|
||||
if (SourceType == SourceType.Channel)
|
||||
{
|
||||
@@ -527,7 +528,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public virtual bool IsAuthorizedToDownload(User user)
|
||||
{
|
||||
return user.Policy.EnableContentDownloading;
|
||||
return user.HasPermission(PermissionKind.EnableContentDownloading);
|
||||
}
|
||||
|
||||
public bool CanDownload(User user)
|
||||
@@ -557,7 +558,8 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
public static ILogger Logger { get; set; }
|
||||
public static ILoggerFactory LoggerFactory { get; set; }
|
||||
public static ILogger<BaseItem> Logger { get; set; }
|
||||
public static ILibraryManager LibraryManager { get; set; }
|
||||
public static IServerConfigurationManager ConfigurationManager { get; set; }
|
||||
public static IProviderManager ProviderManager { get; set; }
|
||||
@@ -585,7 +587,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// </summary>
|
||||
/// <value>The locked fields.</value>
|
||||
[JsonIgnore]
|
||||
public MetadataFields[] LockedFields { get; set; }
|
||||
public MetadataField[] LockedFields { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of the media.
|
||||
@@ -674,7 +676,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <returns>System.String.</returns>
|
||||
protected virtual string CreateSortName()
|
||||
{
|
||||
if (Name == null) return null; //some items may not have name filled in properly
|
||||
if (Name == null) return null; // some items may not have name filled in properly
|
||||
|
||||
if (!EnableAlphaNumericSorting)
|
||||
{
|
||||
@@ -734,7 +736,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
builder.Append(chunkBuilder);
|
||||
}
|
||||
//logger.LogDebug("ModifySortChunks Start: {0} End: {1}", name, builder.ToString());
|
||||
// logger.LogDebug("ModifySortChunks Start: {0} End: {1}", name, builder.ToString());
|
||||
return builder.ToString().RemoveDiacritics();
|
||||
}
|
||||
|
||||
@@ -765,7 +767,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
get => GetParent() as Folder;
|
||||
set
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1004,12 +1005,12 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <returns>PlayAccess.</returns>
|
||||
public PlayAccess GetPlayAccess(User user)
|
||||
{
|
||||
if (!user.Policy.EnableMediaPlayback)
|
||||
if (!user.HasPermission(PermissionKind.EnableMediaPlayback))
|
||||
{
|
||||
return PlayAccess.None;
|
||||
}
|
||||
|
||||
//if (!user.IsParentalScheduleAllowed())
|
||||
// if (!user.IsParentalScheduleAllowed())
|
||||
//{
|
||||
// return PlayAccess.None;
|
||||
//}
|
||||
@@ -1062,7 +1063,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
}).ThenBy(i => i.Video3DFormat.HasValue ? 1 : 0)
|
||||
.ThenByDescending(i =>
|
||||
{
|
||||
@@ -1213,11 +1213,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
if (video.IsoType.HasValue)
|
||||
{
|
||||
if (video.IsoType.Value == Model.Entities.IsoType.BluRay)
|
||||
if (video.IsoType.Value == IsoType.BluRay)
|
||||
{
|
||||
terms.Add("Bluray");
|
||||
}
|
||||
else if (video.IsoType.Value == Model.Entities.IsoType.Dvd)
|
||||
else if (video.IsoType.Value == IsoType.Dvd)
|
||||
{
|
||||
terms.Add("DVD");
|
||||
}
|
||||
@@ -1245,8 +1245,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
// Support plex/xbmc convention
|
||||
files.AddRange(fileSystemChildren
|
||||
.Where(i => !i.IsDirectory && string.Equals(FileSystem.GetFileNameWithoutExtension(i), ThemeSongFilename, StringComparison.OrdinalIgnoreCase))
|
||||
);
|
||||
.Where(i => !i.IsDirectory && string.Equals(FileSystem.GetFileNameWithoutExtension(i), ThemeSongFilename, StringComparison.OrdinalIgnoreCase)));
|
||||
|
||||
return LibraryManager.ResolvePaths(files, directoryService, null, new LibraryOptions())
|
||||
.OfType<Audio.Audio>()
|
||||
@@ -1345,12 +1344,10 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
protected virtual void TriggerOnRefreshStart()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected virtual void TriggerOnRefreshComplete()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1773,7 +1770,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
var maxAllowedRating = user.Policy.MaxParentalRating;
|
||||
var maxAllowedRating = user.MaxParentalAgeRating;
|
||||
|
||||
if (maxAllowedRating == null)
|
||||
{
|
||||
@@ -1789,7 +1786,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
if (string.IsNullOrEmpty(rating))
|
||||
{
|
||||
return !GetBlockUnratedValue(user.Policy);
|
||||
return !GetBlockUnratedValue(user);
|
||||
}
|
||||
|
||||
var value = LocalizationManager.GetRatingLevel(rating);
|
||||
@@ -1797,7 +1794,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
// Could not determine the integer value
|
||||
if (!value.HasValue)
|
||||
{
|
||||
var isAllowed = !GetBlockUnratedValue(user.Policy);
|
||||
var isAllowed = !GetBlockUnratedValue(user);
|
||||
|
||||
if (!isAllowed)
|
||||
{
|
||||
@@ -1859,8 +1856,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
private bool IsVisibleViaTags(User user)
|
||||
{
|
||||
var policy = user.Policy;
|
||||
if (policy.BlockedTags.Any(i => Tags.Contains(i, StringComparer.OrdinalIgnoreCase)))
|
||||
if (user.GetPreference(PreferenceKind.BlockedTags).Any(i => Tags.Contains(i, StringComparer.OrdinalIgnoreCase)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1886,22 +1882,18 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <summary>
|
||||
/// Gets the block unrated value.
|
||||
/// </summary>
|
||||
/// <param name="config">The configuration.</param>
|
||||
/// <param name="user">The configuration.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
protected virtual bool GetBlockUnratedValue(UserPolicy config)
|
||||
protected virtual bool GetBlockUnratedValue(User user)
|
||||
{
|
||||
// Don't block plain folders that are unrated. Let the media underneath get blocked
|
||||
// Special folders like series and albums will override this method.
|
||||
if (IsFolder)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (this is IItemByName)
|
||||
if (IsFolder || this is IItemByName)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return config.BlockUnratedItems.Contains(GetBlockUnratedType());
|
||||
return user.GetPreference(PreferenceKind.BlockUnratedItems).Contains(GetBlockUnratedType().ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2131,7 +2123,8 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <param name="resetPosition">if set to <c>true</c> [reset position].</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public virtual void MarkPlayed(User user,
|
||||
public virtual void MarkPlayed(
|
||||
User user,
|
||||
DateTime? datePlayed,
|
||||
bool resetPosition)
|
||||
{
|
||||
@@ -2177,7 +2170,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
var data = UserDataManager.GetUserData(user, this);
|
||||
|
||||
//I think it is okay to do this here.
|
||||
// I think it is okay to do this here.
|
||||
// if this is only called when a user is manually forcing something to un-played
|
||||
// then it probably is what we want to do...
|
||||
data.PlayCount = 0;
|
||||
@@ -2762,8 +2755,8 @@ namespace MediaBrowser.Controller.Entities
|
||||
newOptions.ForceSave = true;
|
||||
}
|
||||
|
||||
//var parentId = Id;
|
||||
//if (!video.IsOwnedItem || video.ParentId != parentId)
|
||||
// var parentId = Id;
|
||||
// if (!video.IsOwnedItem || video.ParentId != parentId)
|
||||
//{
|
||||
// video.IsOwnedItem = true;
|
||||
// video.ParentId = parentId;
|
||||
@@ -2805,14 +2798,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
return this;
|
||||
}
|
||||
|
||||
foreach (var parent in GetParents())
|
||||
{
|
||||
if (parent.IsTopParent)
|
||||
{
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return GetParents().FirstOrDefault(parent => parent.IsTopParent);
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
[JsonIgnore]
|
||||
public override bool SupportsPeople => false;
|
||||
|
||||
//public override double? GetDefaultPrimaryImageAspectRatio()
|
||||
// public override double? GetDefaultPrimaryImageAspectRatio()
|
||||
//{
|
||||
// double value = 16;
|
||||
// value /= 9;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
public static class DayOfWeekHelper
|
||||
{
|
||||
public static List<DayOfWeek> GetDaysOfWeek(DynamicDayOfWeek day)
|
||||
{
|
||||
return GetDaysOfWeek(new List<DynamicDayOfWeek> { day });
|
||||
}
|
||||
|
||||
public static List<DayOfWeek> GetDaysOfWeek(List<DynamicDayOfWeek> days)
|
||||
{
|
||||
var list = new List<DayOfWeek>();
|
||||
|
||||
if (days.Contains(DynamicDayOfWeek.Sunday) ||
|
||||
days.Contains(DynamicDayOfWeek.Weekend) ||
|
||||
days.Contains(DynamicDayOfWeek.Everyday))
|
||||
{
|
||||
list.Add(DayOfWeek.Sunday);
|
||||
}
|
||||
|
||||
if (days.Contains(DynamicDayOfWeek.Saturday) ||
|
||||
days.Contains(DynamicDayOfWeek.Weekend) ||
|
||||
days.Contains(DynamicDayOfWeek.Everyday))
|
||||
{
|
||||
list.Add(DayOfWeek.Saturday);
|
||||
}
|
||||
|
||||
if (days.Contains(DynamicDayOfWeek.Monday) ||
|
||||
days.Contains(DynamicDayOfWeek.Weekday) ||
|
||||
days.Contains(DynamicDayOfWeek.Everyday))
|
||||
{
|
||||
list.Add(DayOfWeek.Monday);
|
||||
}
|
||||
|
||||
if (days.Contains(DynamicDayOfWeek.Tuesday) ||
|
||||
days.Contains(DynamicDayOfWeek.Weekday) ||
|
||||
days.Contains(DynamicDayOfWeek.Everyday))
|
||||
{
|
||||
list.Add(DayOfWeek.Tuesday
|
||||
);
|
||||
}
|
||||
|
||||
if (days.Contains(DynamicDayOfWeek.Wednesday) ||
|
||||
days.Contains(DynamicDayOfWeek.Weekday) ||
|
||||
days.Contains(DynamicDayOfWeek.Everyday))
|
||||
{
|
||||
list.Add(DayOfWeek.Wednesday);
|
||||
}
|
||||
|
||||
if (days.Contains(DynamicDayOfWeek.Thursday) ||
|
||||
days.Contains(DynamicDayOfWeek.Weekday) ||
|
||||
days.Contains(DynamicDayOfWeek.Everyday))
|
||||
{
|
||||
list.Add(DayOfWeek.Thursday);
|
||||
}
|
||||
|
||||
if (days.Contains(DynamicDayOfWeek.Friday) ||
|
||||
days.Contains(DynamicDayOfWeek.Weekday) ||
|
||||
days.Contains(DynamicDayOfWeek.Everyday))
|
||||
{
|
||||
list.Add(DayOfWeek.Friday);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Common.Progress;
|
||||
using MediaBrowser.Controller.Channels;
|
||||
using MediaBrowser.Controller.Collections;
|
||||
@@ -15,13 +17,16 @@ using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
|
||||
using MusicAlbum = MediaBrowser.Controller.Entities.Audio.MusicAlbum;
|
||||
using Season = MediaBrowser.Controller.Entities.TV.Season;
|
||||
using Series = MediaBrowser.Controller.Entities.TV.Series;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
@@ -177,19 +182,22 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
if (this is ICollectionFolder && !(this is BasePluginFolder))
|
||||
{
|
||||
if (user.Policy.BlockedMediaFolders != null)
|
||||
var blockedMediaFolders = user.GetPreference(PreferenceKind.BlockedMediaFolders);
|
||||
if (blockedMediaFolders.Length > 0)
|
||||
{
|
||||
if (user.Policy.BlockedMediaFolders.Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase) ||
|
||||
if (blockedMediaFolders.Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase) ||
|
||||
|
||||
// Backwards compatibility
|
||||
user.Policy.BlockedMediaFolders.Contains(Name, StringComparer.OrdinalIgnoreCase))
|
||||
blockedMediaFolders.Contains(Name, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!user.Policy.EnableAllFolders && !user.Policy.EnabledFolders.Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase))
|
||||
if (!user.HasPermission(PermissionKind.EnableAllFolders)
|
||||
&& !user.GetPreference(PreferenceKind.EnabledFolders)
|
||||
.Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -205,8 +213,8 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// </summary>
|
||||
protected virtual List<BaseItem> LoadChildren()
|
||||
{
|
||||
//logger.LogDebug("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
|
||||
// logger.LogDebug("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
|
||||
return GetCachedChildren();
|
||||
}
|
||||
|
||||
@@ -492,7 +500,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
if (series != null)
|
||||
{
|
||||
await series.RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
}
|
||||
await container.RefreshAllMetadata(refreshOptions, progress, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
@@ -607,7 +614,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
EnableImages = false
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return result.TotalRecordCount;
|
||||
@@ -882,7 +888,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
try
|
||||
{
|
||||
query.Parent = this;
|
||||
query.ChannelIds = new Guid[] { ChannelId };
|
||||
query.ChannelIds = new[] { ChannelId };
|
||||
|
||||
// Don't blow up here because it could cause parent screens with other content to fail
|
||||
return ChannelManager.GetChannelItemsInternal(query, new SimpleProgress<double>(), CancellationToken.None).Result;
|
||||
@@ -952,11 +958,13 @@ namespace MediaBrowser.Controller.Entities
|
||||
return UserViewBuilder.SortAndPage(items, null, query, LibraryManager, enableSorting);
|
||||
}
|
||||
|
||||
private static IEnumerable<BaseItem> CollapseBoxSetItemsIfNeeded(IEnumerable<BaseItem> items,
|
||||
private static IEnumerable<BaseItem> CollapseBoxSetItemsIfNeeded(
|
||||
IEnumerable<BaseItem> items,
|
||||
InternalItemsQuery query,
|
||||
BaseItem queryParent,
|
||||
User user,
|
||||
IServerConfigurationManager configurationManager, ICollectionManager collectionManager)
|
||||
IServerConfigurationManager configurationManager,
|
||||
ICollectionManager collectionManager)
|
||||
{
|
||||
if (items == null)
|
||||
{
|
||||
@@ -1213,7 +1221,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
throw new ArgumentNullException(nameof(user));
|
||||
}
|
||||
|
||||
//the true root should return our users root folder children
|
||||
// the true root should return our users root folder children
|
||||
if (IsPhysicalRoot)
|
||||
{
|
||||
return LibraryManager.GetUserRootFolder().GetChildren(user, includeLinkedChildren);
|
||||
@@ -1582,7 +1590,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
EnableTotalRecordCount = false
|
||||
};
|
||||
|
||||
if (!user.Configuration.DisplayMissingEpisodes)
|
||||
if (!user.DisplayMissingEpisodes)
|
||||
{
|
||||
query.IsVirtualItem = false;
|
||||
}
|
||||
@@ -1619,7 +1627,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
Recursive = true,
|
||||
IsFolder = false,
|
||||
EnableTotalRecordCount = false
|
||||
|
||||
});
|
||||
|
||||
// Sweep through recursively and update status
|
||||
@@ -1637,7 +1644,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
IsFolder = false,
|
||||
IsVirtualItem = false,
|
||||
EnableTotalRecordCount = false
|
||||
|
||||
});
|
||||
|
||||
return itemsResult
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Jellyfin.Data.Entities;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
@@ -223,15 +224,16 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
if (user != null)
|
||||
{
|
||||
var policy = user.Policy;
|
||||
MaxParentalRating = policy.MaxParentalRating;
|
||||
MaxParentalRating = user.MaxParentalAgeRating;
|
||||
|
||||
if (policy.MaxParentalRating.HasValue)
|
||||
if (MaxParentalRating.HasValue)
|
||||
{
|
||||
BlockUnratedItems = policy.BlockUnratedItems.Where(i => i != UnratedItem.Other).ToArray();
|
||||
BlockUnratedItems = user.GetPreference(PreferenceKind.BlockUnratedItems)
|
||||
.Where(i => i != UnratedItem.Other.ToString())
|
||||
.Select(e => Enum.Parse<UnratedItem>(e, true)).ToArray();
|
||||
}
|
||||
|
||||
ExcludeInheritedTags = policy.BlockedTags;
|
||||
ExcludeInheritedTags = user.GetPreference(PreferenceKind.BlockedTags);
|
||||
|
||||
User = user;
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using Jellyfin.Data.Entities;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using MediaBrowser.Model.Users;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities.Movies
|
||||
{
|
||||
@@ -45,9 +45,9 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
/// <value>The display order.</value>
|
||||
public string DisplayOrder { get; set; }
|
||||
|
||||
protected override bool GetBlockUnratedValue(UserPolicy config)
|
||||
protected override bool GetBlockUnratedValue(User user)
|
||||
{
|
||||
return config.BlockUnratedItems.Contains(UnratedItem.Movie);
|
||||
return user.GetPreference(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Movie.ToString());
|
||||
}
|
||||
|
||||
public override double GetDefaultPrimaryImageAspectRatio()
|
||||
|
||||
@@ -4,8 +4,8 @@ using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Providers;
|
||||
@@ -173,7 +173,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
{
|
||||
var list = base.GetRelatedUrls();
|
||||
|
||||
var imdbId = this.GetProviderId(MetadataProviders.Imdb);
|
||||
var imdbId = this.GetProviderId(MetadataProvider.Imdb);
|
||||
if (!string.IsNullOrEmpty(imdbId))
|
||||
{
|
||||
list.Add(new ExternalUrl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
|
||||
@@ -3,8 +3,8 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.IO;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@@ -2,11 +2,11 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using Jellyfin.Data.Entities;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using MediaBrowser.Model.Users;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities.TV
|
||||
{
|
||||
@@ -168,7 +168,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
return GetEpisodes(user, new DtoOptions(true));
|
||||
}
|
||||
|
||||
protected override bool GetBlockUnratedValue(UserPolicy config)
|
||||
protected override bool GetBlockUnratedValue(User user)
|
||||
{
|
||||
// Don't block. Let either the entire series rating or episode rating determine it
|
||||
return false;
|
||||
@@ -203,7 +203,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
public Guid FindSeriesId()
|
||||
{
|
||||
var series = FindParent<Series>();
|
||||
return series == null ? Guid.Empty : series.Id;
|
||||
return series?.Id ?? Guid.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -234,7 +234,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
|
||||
if (!IndexNumber.HasValue && !string.IsNullOrEmpty(Path))
|
||||
{
|
||||
IndexNumber = IndexNumber ?? LibraryManager.GetSeasonNumberFromPath(Path);
|
||||
IndexNumber ??= LibraryManager.GetSeasonNumberFromPath(Path);
|
||||
|
||||
// If a change was made record it
|
||||
if (IndexNumber.HasValue)
|
||||
|
||||
@@ -5,13 +5,14 @@ using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Providers;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using MediaBrowser.Model.Users;
|
||||
using MetadataProvider = MediaBrowser.Model.Entities.MetadataProvider;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities.TV
|
||||
{
|
||||
@@ -119,7 +120,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
{
|
||||
AncestorWithPresentationUniqueKey = null,
|
||||
SeriesPresentationUniqueKey = seriesKey,
|
||||
IncludeItemTypes = new[] { typeof(Season).Name },
|
||||
IncludeItemTypes = new[] { nameof(Season) },
|
||||
IsVirtualItem = false,
|
||||
Limit = 0,
|
||||
DtoOptions = new DtoOptions(false)
|
||||
@@ -164,13 +165,13 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
{
|
||||
var list = base.GetUserDataKeys();
|
||||
|
||||
var key = this.GetProviderId(MetadataProviders.Imdb);
|
||||
var key = this.GetProviderId(MetadataProvider.Imdb);
|
||||
if (!string.IsNullOrEmpty(key))
|
||||
{
|
||||
list.Insert(0, key);
|
||||
}
|
||||
|
||||
key = this.GetProviderId(MetadataProviders.Tvdb);
|
||||
key = this.GetProviderId(MetadataProvider.Tvdb);
|
||||
if (!string.IsNullOrEmpty(key))
|
||||
{
|
||||
list.Insert(0, key);
|
||||
@@ -205,14 +206,9 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
query.IncludeItemTypes = new[] { typeof(Season).Name };
|
||||
query.OrderBy = new[] { ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Ascending)).ToArray();
|
||||
|
||||
if (user != null)
|
||||
if (user != null && !user.DisplayMissingEpisodes)
|
||||
{
|
||||
var config = user.Configuration;
|
||||
|
||||
if (!config.DisplayMissingEpisodes)
|
||||
{
|
||||
query.IsMissing = false;
|
||||
}
|
||||
query.IsMissing = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,8 +253,8 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
OrderBy = new[] { ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Ascending)).ToArray(),
|
||||
DtoOptions = options
|
||||
};
|
||||
var config = user.Configuration;
|
||||
if (!config.DisplayMissingEpisodes)
|
||||
|
||||
if (!user.DisplayMissingEpisodes)
|
||||
{
|
||||
query.IsMissing = false;
|
||||
}
|
||||
@@ -311,7 +307,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
// Refresh episodes and other children
|
||||
foreach (var item in items)
|
||||
{
|
||||
if ((item is Season))
|
||||
if (item is Season)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -370,8 +366,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
};
|
||||
if (user != null)
|
||||
{
|
||||
var config = user.Configuration;
|
||||
if (!config.DisplayMissingEpisodes)
|
||||
if (!user.DisplayMissingEpisodes)
|
||||
{
|
||||
query.IsMissing = false;
|
||||
}
|
||||
@@ -452,9 +447,9 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
}
|
||||
|
||||
|
||||
protected override bool GetBlockUnratedValue(UserPolicy config)
|
||||
protected override bool GetBlockUnratedValue(User user)
|
||||
{
|
||||
return config.BlockUnratedItems.Contains(UnratedItem.Series);
|
||||
return user.GetPreference(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Series.ToString());
|
||||
}
|
||||
|
||||
public override UnratedItem GetBlockUnratedType()
|
||||
@@ -493,7 +488,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
{
|
||||
var list = base.GetRelatedUrls();
|
||||
|
||||
var imdbId = this.GetProviderId(MetadataProviders.Imdb);
|
||||
var imdbId = this.GetProviderId(MetadataProvider.Imdb);
|
||||
if (!string.IsNullOrEmpty(imdbId))
|
||||
{
|
||||
list.Add(new ExternalUrl
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Providers;
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var list = base.GetRelatedUrls();
|
||||
|
||||
var imdbId = this.GetProviderId(MetadataProviders.Imdb);
|
||||
var imdbId = this.GetProviderId(MetadataProvider.Imdb);
|
||||
if (!string.IsNullOrEmpty(imdbId))
|
||||
{
|
||||
list.Add(new ExternalUrl
|
||||
|
||||
@@ -1,262 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Users;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Class User
|
||||
/// </summary>
|
||||
public class User : BaseItem
|
||||
{
|
||||
public static IUserManager UserManager { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the password.
|
||||
/// </summary>
|
||||
/// <value>The password.</value>
|
||||
public string Password { get; set; }
|
||||
public string EasyPassword { get; set; }
|
||||
|
||||
// Strictly to remove JsonIgnore
|
||||
public override ItemImageInfo[] ImageInfos
|
||||
{
|
||||
get => base.ImageInfos;
|
||||
set => base.ImageInfos = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path.
|
||||
/// </summary>
|
||||
/// <value>The path.</value>
|
||||
[JsonIgnore]
|
||||
public override string Path
|
||||
{
|
||||
get => ConfigurationDirectoryPath;
|
||||
set => base.Path = value;
|
||||
}
|
||||
|
||||
private string _name;
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public override string Name
|
||||
{
|
||||
get => _name;
|
||||
set
|
||||
{
|
||||
_name = value;
|
||||
|
||||
// lazy load this again
|
||||
SortName = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the folder containing the item.
|
||||
/// If the item is a folder, it returns the folder itself
|
||||
/// </summary>
|
||||
/// <value>The containing folder path.</value>
|
||||
[JsonIgnore]
|
||||
public override string ContainingFolderPath => Path;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the root folder.
|
||||
/// </summary>
|
||||
/// <value>The root folder.</value>
|
||||
[JsonIgnore]
|
||||
public Folder RootFolder => LibraryManager.GetUserRootFolder();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the last login date.
|
||||
/// </summary>
|
||||
/// <value>The last login date.</value>
|
||||
public DateTime? LastLoginDate { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the last activity date.
|
||||
/// </summary>
|
||||
/// <value>The last activity date.</value>
|
||||
public DateTime? LastActivityDate { get; set; }
|
||||
|
||||
private volatile UserConfiguration _config;
|
||||
private readonly object _configSyncLock = new object();
|
||||
[JsonIgnore]
|
||||
public UserConfiguration Configuration
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_config == null)
|
||||
{
|
||||
lock (_configSyncLock)
|
||||
{
|
||||
if (_config == null)
|
||||
{
|
||||
_config = UserManager.GetUserConfiguration(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _config;
|
||||
}
|
||||
set => _config = value;
|
||||
}
|
||||
|
||||
private volatile UserPolicy _policy;
|
||||
private readonly object _policySyncLock = new object();
|
||||
[JsonIgnore]
|
||||
public UserPolicy Policy
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_policy == null)
|
||||
{
|
||||
lock (_policySyncLock)
|
||||
{
|
||||
if (_policy == null)
|
||||
{
|
||||
_policy = UserManager.GetUserPolicy(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _policy;
|
||||
}
|
||||
set => _policy = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Renames the user.
|
||||
/// </summary>
|
||||
/// <param name="newName">The new name.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public Task Rename(string newName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(newName))
|
||||
{
|
||||
throw new ArgumentException("Username can't be empty", nameof(newName));
|
||||
}
|
||||
|
||||
Name = newName;
|
||||
|
||||
return RefreshMetadata(
|
||||
new MetadataRefreshOptions(new DirectoryService(FileSystem))
|
||||
{
|
||||
ReplaceAllMetadata = true,
|
||||
ImageRefreshMode = MetadataRefreshMode.FullRefresh,
|
||||
MetadataRefreshMode = MetadataRefreshMode.FullRefresh,
|
||||
ForceSave = true
|
||||
|
||||
},
|
||||
CancellationToken.None);
|
||||
}
|
||||
|
||||
public override void UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken)
|
||||
{
|
||||
UserManager.UpdateUser(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the user's configuration directory
|
||||
/// </summary>
|
||||
/// <value>The configuration directory path.</value>
|
||||
[JsonIgnore]
|
||||
public string ConfigurationDirectoryPath => GetConfigurationDirectoryPath(Name);
|
||||
|
||||
public override double GetDefaultPrimaryImageAspectRatio()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the configuration directory path.
|
||||
/// </summary>
|
||||
/// <param name="username">The username.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
private string GetConfigurationDirectoryPath(string username)
|
||||
{
|
||||
var parentPath = ConfigurationManager.ApplicationPaths.UserConfigurationDirectoryPath;
|
||||
|
||||
// TODO: Remove idPath and just use usernamePath for future releases
|
||||
var usernamePath = System.IO.Path.Combine(parentPath, username);
|
||||
var idPath = System.IO.Path.Combine(parentPath, Id.ToString("N", CultureInfo.InvariantCulture));
|
||||
if (!Directory.Exists(usernamePath) && Directory.Exists(idPath))
|
||||
{
|
||||
Directory.Move(idPath, usernamePath);
|
||||
}
|
||||
|
||||
return usernamePath;
|
||||
}
|
||||
|
||||
public bool IsParentalScheduleAllowed()
|
||||
{
|
||||
return IsParentalScheduleAllowed(DateTime.UtcNow);
|
||||
}
|
||||
|
||||
public bool IsParentalScheduleAllowed(DateTime date)
|
||||
{
|
||||
var schedules = Policy.AccessSchedules;
|
||||
|
||||
if (schedules.Length == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (var i in schedules)
|
||||
{
|
||||
if (IsParentalScheduleAllowed(i, date))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool IsParentalScheduleAllowed(AccessSchedule schedule, DateTime date)
|
||||
{
|
||||
if (date.Kind != DateTimeKind.Utc)
|
||||
{
|
||||
throw new ArgumentException("Utc date expected");
|
||||
}
|
||||
|
||||
var localTime = date.ToLocalTime();
|
||||
|
||||
return DayOfWeekHelper.GetDaysOfWeek(schedule.DayOfWeek).Contains(localTime.DayOfWeek) &&
|
||||
IsWithinTime(schedule, localTime);
|
||||
}
|
||||
|
||||
private bool IsWithinTime(AccessSchedule schedule, DateTime localTime)
|
||||
{
|
||||
var hour = localTime.TimeOfDay.TotalHours;
|
||||
|
||||
return hour >= schedule.StartHour && hour <= schedule.EndHour;
|
||||
}
|
||||
|
||||
public bool IsFolderGrouped(Guid id)
|
||||
{
|
||||
foreach (var i in Configuration.GroupedFolders)
|
||||
{
|
||||
if (new Guid(i) == id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public override bool SupportsPeople => false;
|
||||
|
||||
public long InternalId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Library;
|
||||
using MediaBrowser.Model.Querying;
|
||||
|
||||
@@ -3,8 +3,10 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Controller.TV;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
@@ -66,7 +68,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
parent = LibraryManager.GetItemById(ParentId) as Folder ?? parent;
|
||||
}
|
||||
|
||||
return new UserViewBuilder(UserViewManager, LibraryManager, Logger, UserDataManager, TVSeriesManager, ConfigurationManager)
|
||||
return new UserViewBuilder(UserViewManager, LibraryManager, LoggerFactory.CreateLogger<UserViewBuilder>(), UserDataManager, TVSeriesManager, ConfigurationManager)
|
||||
.GetUserItems(parent, this, CollectionType, query);
|
||||
}
|
||||
|
||||
@@ -110,7 +112,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
private static string[] UserSpecificViewTypes = new string[]
|
||||
{
|
||||
MediaBrowser.Model.Entities.CollectionType.Playlists
|
||||
Model.Entities.CollectionType.Playlists
|
||||
};
|
||||
|
||||
public static bool IsUserSpecific(Folder folder)
|
||||
@@ -139,8 +141,8 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
private static string[] ViewTypesEligibleForGrouping = new string[]
|
||||
{
|
||||
MediaBrowser.Model.Entities.CollectionType.Movies,
|
||||
MediaBrowser.Model.Entities.CollectionType.TvShows,
|
||||
Model.Entities.CollectionType.Movies,
|
||||
Model.Entities.CollectionType.TvShows,
|
||||
string.Empty
|
||||
};
|
||||
|
||||
@@ -151,12 +153,12 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
private static string[] OriginalFolderViewTypes = new string[]
|
||||
{
|
||||
MediaBrowser.Model.Entities.CollectionType.Books,
|
||||
MediaBrowser.Model.Entities.CollectionType.MusicVideos,
|
||||
MediaBrowser.Model.Entities.CollectionType.HomeVideos,
|
||||
MediaBrowser.Model.Entities.CollectionType.Photos,
|
||||
MediaBrowser.Model.Entities.CollectionType.Music,
|
||||
MediaBrowser.Model.Entities.CollectionType.BoxSets
|
||||
Model.Entities.CollectionType.Books,
|
||||
Model.Entities.CollectionType.MusicVideos,
|
||||
Model.Entities.CollectionType.HomeVideos,
|
||||
Model.Entities.CollectionType.Photos,
|
||||
Model.Entities.CollectionType.Music,
|
||||
Model.Entities.CollectionType.BoxSets
|
||||
};
|
||||
|
||||
public static bool EnableOriginalFolder(string viewType)
|
||||
|
||||
@@ -2,14 +2,19 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.TV;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
|
||||
using MetadataProvider = MediaBrowser.Model.Entities.MetadataProvider;
|
||||
using Movie = MediaBrowser.Controller.Entities.Movies.Movie;
|
||||
using Season = MediaBrowser.Controller.Entities.TV.Season;
|
||||
using Series = MediaBrowser.Controller.Entities.TV.Series;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
@@ -17,7 +22,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
private readonly IUserViewManager _userViewManager;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<UserViewBuilder> _logger;
|
||||
private readonly IUserDataManager _userDataManager;
|
||||
private readonly ITVSeriesManager _tvSeriesManager;
|
||||
private readonly IServerConfigurationManager _config;
|
||||
@@ -25,7 +30,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
public UserViewBuilder(
|
||||
IUserViewManager userViewManager,
|
||||
ILibraryManager libraryManager,
|
||||
ILogger logger,
|
||||
ILogger<UserViewBuilder> logger,
|
||||
IUserDataManager userDataManager,
|
||||
ITVSeriesManager tvSeriesManager,
|
||||
IServerConfigurationManager config)
|
||||
@@ -42,7 +47,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var user = query.User;
|
||||
|
||||
//if (query.IncludeItemTypes != null &&
|
||||
// if (query.IncludeItemTypes != null &&
|
||||
// query.IncludeItemTypes.Length == 1 &&
|
||||
// string.Equals(query.IncludeItemTypes[0], "Playlist", StringComparison.OrdinalIgnoreCase))
|
||||
//{
|
||||
@@ -140,14 +145,15 @@ namespace MediaBrowser.Controller.Entities
|
||||
return parent.QueryRecursive(query);
|
||||
}
|
||||
|
||||
var list = new List<BaseItem>();
|
||||
|
||||
list.Add(GetUserView(SpecialFolder.MovieResume, "HeaderContinueWatching", "0", parent));
|
||||
list.Add(GetUserView(SpecialFolder.MovieLatest, "Latest", "1", parent));
|
||||
list.Add(GetUserView(SpecialFolder.MovieMovies, "Movies", "2", parent));
|
||||
list.Add(GetUserView(SpecialFolder.MovieCollections, "Collections", "3", parent));
|
||||
list.Add(GetUserView(SpecialFolder.MovieFavorites, "Favorites", "4", parent));
|
||||
list.Add(GetUserView(SpecialFolder.MovieGenres, "Genres", "5", parent));
|
||||
var list = new List<BaseItem>
|
||||
{
|
||||
GetUserView(SpecialFolder.MovieResume, "HeaderContinueWatching", "0", parent),
|
||||
GetUserView(SpecialFolder.MovieLatest, "Latest", "1", parent),
|
||||
GetUserView(SpecialFolder.MovieMovies, "Movies", "2", parent),
|
||||
GetUserView(SpecialFolder.MovieCollections, "Collections", "3", parent),
|
||||
GetUserView(SpecialFolder.MovieFavorites, "Favorites", "4", parent),
|
||||
GetUserView(SpecialFolder.MovieGenres, "Genres", "5", parent)
|
||||
};
|
||||
|
||||
return GetResult(list, parent, query);
|
||||
}
|
||||
@@ -264,7 +270,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
_logger.LogError(ex, "Error getting genre");
|
||||
return null;
|
||||
}
|
||||
|
||||
})
|
||||
.Where(i => i != null)
|
||||
.Select(i => GetUserViewWithName(i.Name, SpecialFolder.MovieGenre, i.SortName, parent));
|
||||
@@ -293,21 +298,27 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
if (query.IncludeItemTypes.Length == 0)
|
||||
{
|
||||
query.IncludeItemTypes = new[] { typeof(Series).Name, typeof(Season).Name, typeof(Episode).Name };
|
||||
query.IncludeItemTypes = new[]
|
||||
{
|
||||
nameof(Series),
|
||||
nameof(Season),
|
||||
nameof(Episode)
|
||||
};
|
||||
}
|
||||
|
||||
return parent.QueryRecursive(query);
|
||||
}
|
||||
|
||||
var list = new List<BaseItem>();
|
||||
|
||||
list.Add(GetUserView(SpecialFolder.TvResume, "HeaderContinueWatching", "0", parent));
|
||||
list.Add(GetUserView(SpecialFolder.TvNextUp, "HeaderNextUp", "1", parent));
|
||||
list.Add(GetUserView(SpecialFolder.TvLatest, "Latest", "2", parent));
|
||||
list.Add(GetUserView(SpecialFolder.TvShowSeries, "Shows", "3", parent));
|
||||
list.Add(GetUserView(SpecialFolder.TvFavoriteSeries, "HeaderFavoriteShows", "4", parent));
|
||||
list.Add(GetUserView(SpecialFolder.TvFavoriteEpisodes, "HeaderFavoriteEpisodes", "5", parent));
|
||||
list.Add(GetUserView(SpecialFolder.TvGenres, "Genres", "6", parent));
|
||||
var list = new List<BaseItem>
|
||||
{
|
||||
GetUserView(SpecialFolder.TvResume, "HeaderContinueWatching", "0", parent),
|
||||
GetUserView(SpecialFolder.TvNextUp, "HeaderNextUp", "1", parent),
|
||||
GetUserView(SpecialFolder.TvLatest, "Latest", "2", parent),
|
||||
GetUserView(SpecialFolder.TvShowSeries, "Shows", "3", parent),
|
||||
GetUserView(SpecialFolder.TvFavoriteSeries, "HeaderFavoriteShows", "4", parent),
|
||||
GetUserView(SpecialFolder.TvFavoriteEpisodes, "HeaderFavoriteEpisodes", "5", parent),
|
||||
GetUserView(SpecialFolder.TvGenres, "Genres", "6", parent)
|
||||
};
|
||||
|
||||
return GetResult(list, parent, query);
|
||||
}
|
||||
@@ -335,7 +346,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
Limit = query.Limit,
|
||||
StartIndex = query.StartIndex,
|
||||
UserId = query.User.Id
|
||||
|
||||
}, parentFolders, query.DtoOptions);
|
||||
|
||||
return result;
|
||||
@@ -372,7 +382,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
IncludeItemTypes = new[] { typeof(Series).Name },
|
||||
Recursive = true,
|
||||
EnableTotalRecordCount = false
|
||||
|
||||
}).Items
|
||||
.SelectMany(i => i.Genres)
|
||||
.DistinctNames()
|
||||
@@ -387,7 +396,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
_logger.LogError(ex, "Error getting genre");
|
||||
return null;
|
||||
}
|
||||
|
||||
})
|
||||
.Where(i => i != null)
|
||||
.Select(i => GetUserViewWithName(i.Name, SpecialFolder.TvGenre, i.SortName, parent));
|
||||
@@ -412,12 +420,13 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
return new QueryResult<BaseItem>
|
||||
{
|
||||
Items = result.Items, //TODO Fix The co-variant conversion between T[] and BaseItem[], this can generate runtime issues if T is not BaseItem.
|
||||
Items = result.Items, // TODO Fix The co-variant conversion between T[] and BaseItem[], this can generate runtime issues if T is not BaseItem.
|
||||
TotalRecordCount = result.TotalRecordCount
|
||||
};
|
||||
}
|
||||
|
||||
private QueryResult<BaseItem> GetResult<T>(IEnumerable<T> items,
|
||||
private QueryResult<BaseItem> GetResult<T>(
|
||||
IEnumerable<T> items,
|
||||
BaseItem queryParent,
|
||||
InternalItemsQuery query)
|
||||
where T : BaseItem
|
||||
@@ -611,7 +620,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var filterValue = query.HasImdbId.Value;
|
||||
|
||||
var hasValue = !string.IsNullOrEmpty(item.GetProviderId(MetadataProviders.Imdb));
|
||||
var hasValue = !string.IsNullOrEmpty(item.GetProviderId(MetadataProvider.Imdb));
|
||||
|
||||
if (hasValue != filterValue)
|
||||
{
|
||||
@@ -623,7 +632,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var filterValue = query.HasTmdbId.Value;
|
||||
|
||||
var hasValue = !string.IsNullOrEmpty(item.GetProviderId(MetadataProviders.Tmdb));
|
||||
var hasValue = !string.IsNullOrEmpty(item.GetProviderId(MetadataProvider.Tmdb));
|
||||
|
||||
if (hasValue != filterValue)
|
||||
{
|
||||
@@ -635,7 +644,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var filterValue = query.HasTvdbId.Value;
|
||||
|
||||
var hasValue = !string.IsNullOrEmpty(item.GetProviderId(MetadataProviders.Tvdb));
|
||||
var hasValue = !string.IsNullOrEmpty(item.GetProviderId(MetadataProvider.Tvdb));
|
||||
|
||||
if (hasValue != filterValue)
|
||||
{
|
||||
|
||||
@@ -272,13 +272,13 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
if (ExtraType.HasValue)
|
||||
{
|
||||
var key = this.GetProviderId(MetadataProviders.Tmdb);
|
||||
var key = this.GetProviderId(MetadataProvider.Tmdb);
|
||||
if (!string.IsNullOrEmpty(key))
|
||||
{
|
||||
list.Insert(0, GetUserDataKey(key));
|
||||
}
|
||||
|
||||
key = this.GetProviderId(MetadataProviders.Imdb);
|
||||
key = this.GetProviderId(MetadataProvider.Imdb);
|
||||
if (!string.IsNullOrEmpty(key))
|
||||
{
|
||||
list.Insert(0, GetUserDataKey(key));
|
||||
@@ -286,13 +286,13 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
else
|
||||
{
|
||||
var key = this.GetProviderId(MetadataProviders.Imdb);
|
||||
var key = this.GetProviderId(MetadataProvider.Imdb);
|
||||
if (!string.IsNullOrEmpty(key))
|
||||
{
|
||||
list.Insert(0, key);
|
||||
}
|
||||
|
||||
key = this.GetProviderId(MetadataProviders.Tmdb);
|
||||
key = this.GetProviderId(MetadataProvider.Tmdb);
|
||||
if (!string.IsNullOrEmpty(key))
|
||||
{
|
||||
list.Insert(0, key);
|
||||
@@ -535,7 +535,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
ItemId = Id,
|
||||
Index = DefaultVideoStreamIndex.Value
|
||||
|
||||
}).FirstOrDefault();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ namespace MediaBrowser.Controller.IO
|
||||
/// <param name="resolveShortcuts">if set to <c>true</c> [resolve shortcuts].</param>
|
||||
/// <returns>Dictionary{System.StringFileSystemInfo}.</returns>
|
||||
/// <exception cref="ArgumentNullException">path</exception>
|
||||
public static FileSystemMetadata[] GetFilteredFileSystemEntries(IDirectoryService directoryService,
|
||||
public static FileSystemMetadata[] GetFilteredFileSystemEntries(
|
||||
IDirectoryService directoryService,
|
||||
string path,
|
||||
IFileSystem fileSystem,
|
||||
IServerApplicationHost appHost,
|
||||
@@ -76,7 +77,7 @@ namespace MediaBrowser.Controller.IO
|
||||
|
||||
if (string.IsNullOrEmpty(newPath))
|
||||
{
|
||||
//invalid shortcut - could be old or target could just be unavailable
|
||||
// invalid shortcut - could be old or target could just be unavailable
|
||||
logger.LogWarning("Encountered invalid shortcut: " + fullName);
|
||||
continue;
|
||||
}
|
||||
@@ -117,7 +118,6 @@ namespace MediaBrowser.Controller.IO
|
||||
}
|
||||
return returnResult;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <returns>IEnumerable{System.String}.</returns>
|
||||
Task<IEnumerable<IntroInfo>> GetIntros(BaseItem item, User user);
|
||||
Task<IEnumerable<IntroInfo>> GetIntros(BaseItem item, Jellyfin.Data.Entities.User user);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all intro files.
|
||||
|
||||
@@ -2,10 +2,10 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Controller.Resolvers;
|
||||
using MediaBrowser.Controller.Sorting;
|
||||
@@ -14,6 +14,9 @@ using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
|
||||
using Genre = MediaBrowser.Controller.Entities.Genre;
|
||||
using Person = MediaBrowser.Controller.Entities.Person;
|
||||
|
||||
namespace MediaBrowser.Controller.Library
|
||||
{
|
||||
@@ -27,14 +30,18 @@ namespace MediaBrowser.Controller.Library
|
||||
/// </summary>
|
||||
/// <param name="fileInfo">The file information.</param>
|
||||
/// <param name="parent">The parent.</param>
|
||||
/// <param name="allowIgnorePath">Allow the path to be ignored.</param>
|
||||
/// <returns>BaseItem.</returns>
|
||||
BaseItem ResolvePath(FileSystemMetadata fileInfo,
|
||||
Folder parent = null);
|
||||
BaseItem ResolvePath(
|
||||
FileSystemMetadata fileInfo,
|
||||
Folder parent = null,
|
||||
bool allowIgnorePath = true);
|
||||
|
||||
/// <summary>
|
||||
/// Resolves a set of files into a list of BaseItem
|
||||
/// </summary>
|
||||
IEnumerable<BaseItem> ResolvePaths(IEnumerable<FileSystemMetadata> files,
|
||||
IEnumerable<BaseItem> ResolvePaths(
|
||||
IEnumerable<FileSystemMetadata> files,
|
||||
IDirectoryService directoryService,
|
||||
Folder parent,
|
||||
LibraryOptions libraryOptions,
|
||||
@@ -285,7 +292,8 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <param name="parentId">The parent identifier.</param>
|
||||
/// <param name="viewType">Type of the view.</param>
|
||||
/// <param name="sortName">Name of the sort.</param>
|
||||
UserView GetNamedView(User user,
|
||||
UserView GetNamedView(
|
||||
User user,
|
||||
string name,
|
||||
Guid parentId,
|
||||
string viewType,
|
||||
@@ -298,7 +306,8 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <param name="name">The name.</param>
|
||||
/// <param name="viewType">Type of the view.</param>
|
||||
/// <param name="sortName">Name of the sort.</param>
|
||||
UserView GetNamedView(User user,
|
||||
UserView GetNamedView(
|
||||
User user,
|
||||
string name,
|
||||
string viewType,
|
||||
string sortName);
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Model.Dto;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Dto;
|
||||
@@ -27,7 +28,7 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <param name="reason">The reason.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
void SaveUserData(Guid userId, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
|
||||
void SaveUserData(User userId, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
|
||||
void SaveUserData(User user, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
|
||||
|
||||
UserItemData GetUserData(User user, BaseItem item);
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Controller.Authentication;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Events;
|
||||
@@ -16,6 +15,31 @@ namespace MediaBrowser.Controller.Library
|
||||
/// </summary>
|
||||
public interface IUserManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Occurs when a user is updated.
|
||||
/// </summary>
|
||||
event EventHandler<GenericEventArgs<User>> OnUserUpdated;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a user is created.
|
||||
/// </summary>
|
||||
event EventHandler<GenericEventArgs<User>> OnUserCreated;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a user is deleted.
|
||||
/// </summary>
|
||||
event EventHandler<GenericEventArgs<User>> OnUserDeleted;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a user's password is changed.
|
||||
/// </summary>
|
||||
event EventHandler<GenericEventArgs<User>> OnUserPasswordChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a user is locked out.
|
||||
/// </summary>
|
||||
event EventHandler<GenericEventArgs<User>> OnUserLockedOut;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the users.
|
||||
/// </summary>
|
||||
@@ -29,24 +53,9 @@ namespace MediaBrowser.Controller.Library
|
||||
IEnumerable<Guid> UsersIds { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when [user updated].
|
||||
/// Initializes the user manager and ensures that a user exists.
|
||||
/// </summary>
|
||||
event EventHandler<GenericEventArgs<User>> UserUpdated;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when [user deleted].
|
||||
/// </summary>
|
||||
event EventHandler<GenericEventArgs<User>> UserDeleted;
|
||||
|
||||
event EventHandler<GenericEventArgs<User>> UserCreated;
|
||||
|
||||
event EventHandler<GenericEventArgs<User>> UserPolicyUpdated;
|
||||
|
||||
event EventHandler<GenericEventArgs<User>> UserConfigurationUpdated;
|
||||
|
||||
event EventHandler<GenericEventArgs<User>> UserPasswordChanged;
|
||||
|
||||
event EventHandler<GenericEventArgs<User>> UserLockedOut;
|
||||
void Initialize();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a user by Id.
|
||||
@@ -63,13 +72,6 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <returns>User.</returns>
|
||||
User GetUserByName(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes metadata for each user
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task RefreshUsersMetadata(CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Renames the user.
|
||||
/// </summary>
|
||||
@@ -89,19 +91,27 @@ namespace MediaBrowser.Controller.Library
|
||||
void UpdateUser(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Creates the user.
|
||||
/// Updates the user.
|
||||
/// </summary>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <returns>User.</returns>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <exception cref="ArgumentNullException">If user is <c>null</c>.</exception>
|
||||
/// <exception cref="ArgumentException">If the provided user doesn't exist.</exception>
|
||||
/// <returns>A task representing the update of the user.</returns>
|
||||
Task UpdateUserAsync(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a user with the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the new user.</param>
|
||||
/// <returns>The created user.</returns>
|
||||
/// <exception cref="ArgumentNullException">name</exception>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
User CreateUser(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the user.
|
||||
/// Deletes the specified user.
|
||||
/// </summary>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <param name="user">The user to be deleted.</param>
|
||||
void DeleteUser(User user);
|
||||
|
||||
/// <summary>
|
||||
@@ -111,13 +121,6 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <returns>Task.</returns>
|
||||
Task ResetPassword(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the offline user dto.
|
||||
/// </summary>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <returns>UserDto.</returns>
|
||||
UserDto GetOfflineUserDto(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Resets the easy password.
|
||||
/// </summary>
|
||||
@@ -163,47 +166,34 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
Task<PinRedeemResult> RedeemPasswordResetPin(string pin);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user policy.
|
||||
/// </summary>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <returns>UserPolicy.</returns>
|
||||
UserPolicy GetUserPolicy(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user configuration.
|
||||
/// </summary>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <returns>UserConfiguration.</returns>
|
||||
UserConfiguration GetUserConfiguration(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the configuration.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user identifier.</param>
|
||||
/// <param name="newConfiguration">The new configuration.</param>
|
||||
/// <returns>Task.</returns>
|
||||
void UpdateConfiguration(Guid userId, UserConfiguration newConfiguration);
|
||||
|
||||
void UpdateConfiguration(User user, UserConfiguration newConfiguration);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the user policy.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user identifier.</param>
|
||||
/// <param name="userPolicy">The user policy.</param>
|
||||
void UpdateUserPolicy(Guid userId, UserPolicy userPolicy);
|
||||
|
||||
/// <summary>
|
||||
/// Makes the valid username.
|
||||
/// </summary>
|
||||
/// <param name="username">The username.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
string MakeValidUsername(string username);
|
||||
|
||||
void AddParts(IEnumerable<IAuthenticationProvider> authenticationProviders, IEnumerable<IPasswordResetProvider> passwordResetProviders);
|
||||
|
||||
NameIdPair[] GetAuthenticationProviders();
|
||||
|
||||
NameIdPair[] GetPasswordResetProviders();
|
||||
|
||||
/// <summary>
|
||||
/// This method updates the user's configuration.
|
||||
/// This is only included as a stopgap until the new API, using this internally is not recommended.
|
||||
/// Instead, modify the user object directly, then call <see cref="UpdateUser"/>.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Id.</param>
|
||||
/// <param name="config">The request containing the new user configuration.</param>
|
||||
void UpdateConfiguration(Guid userId, UserConfiguration config);
|
||||
|
||||
/// <summary>
|
||||
/// This method updates the user's policy.
|
||||
/// This is only included as a stopgap until the new API, using this internally is not recommended.
|
||||
/// Instead, modify the user object directly, then call <see cref="UpdateUser"/>.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Id.</param>
|
||||
/// <param name="policy">The request containing the new user policy.</param>
|
||||
void UpdatePolicy(Guid userId, UserPolicy policy);
|
||||
|
||||
/// <summary>
|
||||
/// Clears the user's profile image.
|
||||
/// </summary>
|
||||
/// <param name="user">The user.</param>
|
||||
void ClearProfileImage(User user);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,6 @@ namespace MediaBrowser.Controller.Library
|
||||
|
||||
return parentDir.Length > _appPaths.RootFolderPath.Length
|
||||
&& parentDir.StartsWith(_appPaths.RootFolderPath, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +128,6 @@ namespace MediaBrowser.Controller.Library
|
||||
}
|
||||
|
||||
return item != null;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Model.Dto;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <summary>
|
||||
/// The _logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<Profiler> _logger;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Profiler" /> class.
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
|
||||
@@ -3,8 +3,8 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.LiveTv;
|
||||
|
||||
@@ -9,12 +9,10 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
{
|
||||
public LiveTvConflictException()
|
||||
{
|
||||
|
||||
}
|
||||
public LiveTvConflictException(string message)
|
||||
: base(message)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.LiveTv;
|
||||
using MediaBrowser.Model.Providers;
|
||||
@@ -26,13 +26,13 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
|
||||
if (!IsSeries)
|
||||
{
|
||||
var key = this.GetProviderId(MetadataProviders.Imdb);
|
||||
var key = this.GetProviderId(MetadataProvider.Imdb);
|
||||
if (!string.IsNullOrEmpty(key))
|
||||
{
|
||||
list.Insert(0, key);
|
||||
}
|
||||
|
||||
key = this.GetProviderId(MetadataProviders.Tmdb);
|
||||
key = this.GetProviderId(MetadataProvider.Tmdb);
|
||||
if (!string.IsNullOrEmpty(key))
|
||||
{
|
||||
list.Insert(0, key);
|
||||
@@ -147,7 +147,7 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
public override string ContainingFolderPath => Path;
|
||||
|
||||
//[JsonIgnore]
|
||||
//public override string MediaType
|
||||
// public override string MediaType
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
@@ -253,7 +253,7 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
{
|
||||
var list = base.GetRelatedUrls();
|
||||
|
||||
var imdbId = this.GetProviderId(MetadataProviders.Imdb);
|
||||
var imdbId = this.GetProviderId(MetadataProvider.Imdb);
|
||||
if (!string.IsNullOrEmpty(imdbId))
|
||||
{
|
||||
if (IsMovie)
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Extensions;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
@@ -772,7 +773,6 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
}
|
||||
|
||||
param += " -look_ahead 0";
|
||||
|
||||
}
|
||||
else if (string.Equals(videoEncoder, "h264_nvenc", StringComparison.OrdinalIgnoreCase) // h264 (h264_nvenc)
|
||||
|| string.Equals(videoEncoder, "hevc_nvenc", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -781,7 +781,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
case "veryslow":
|
||||
|
||||
param += "-preset slow"; //lossless is only supported on maxwell and newer(2014+)
|
||||
param += "-preset slow"; // lossless is only supported on maxwell and newer(2014+)
|
||||
break;
|
||||
|
||||
case "slow":
|
||||
@@ -1012,7 +1012,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
if (string.IsNullOrEmpty(videoStream.Profile))
|
||||
{
|
||||
//return false;
|
||||
// return false;
|
||||
}
|
||||
|
||||
var requestedProfile = requestedProfiles[0];
|
||||
@@ -1085,7 +1085,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
if (!videoStream.Level.HasValue)
|
||||
{
|
||||
//return false;
|
||||
// return false;
|
||||
}
|
||||
|
||||
if (videoStream.Level.HasValue && videoStream.Level.Value > requestLevel)
|
||||
@@ -1340,7 +1340,6 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
// wmav2 currently only supports two channel output
|
||||
transcoderChannelLimit = 2;
|
||||
}
|
||||
|
||||
else if (codec.IndexOf("mp3", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
// libmp3lame currently only supports two channel output
|
||||
@@ -1475,7 +1474,6 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
" -map 0:{0}",
|
||||
state.AudioStream.Index);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
args += " -map -0:a";
|
||||
@@ -1946,11 +1944,11 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
break;
|
||||
case Video3DFormat.FullSideBySide:
|
||||
filter = "crop=iw/2:ih:0:0,setdar=dar=a,crop=min(iw\\,ih*dar):min(ih\\,iw/dar):(iw-min(iw\\,iw*sar))/2:(ih - min (ih\\,ih/sar))/2,setsar=sar=1,scale={0}:trunc({0}/dar/2)*2";
|
||||
//fsbs crop width in half,set the display aspect,crop out any black bars we may have made the scale width to requestedWidth.
|
||||
// fsbs crop width in half,set the display aspect,crop out any black bars we may have made the scale width to requestedWidth.
|
||||
break;
|
||||
case Video3DFormat.HalfTopAndBottom:
|
||||
filter = "crop=iw:ih/2:0:0,scale=(iw*2):ih),setdar=dar=a,crop=min(iw\\,ih*dar):min(ih\\,iw/dar):(iw-min(iw\\,iw*sar))/2:(ih - min (ih\\,ih/sar))/2,setsar=sar=1,scale={0}:trunc({0}/dar/2)*2";
|
||||
//htab crop height in half,scale to correct size, set the display aspect,crop out any black bars we may have made the scale width to requestedWidth
|
||||
// htab crop height in half,scale to correct size, set the display aspect,crop out any black bars we may have made the scale width to requestedWidth
|
||||
break;
|
||||
case Video3DFormat.FullTopAndBottom:
|
||||
filter = "crop=iw:ih/2:0:0,setdar=dar=a,crop=min(iw\\,ih*dar):min(ih\\,iw/dar):(iw-min(iw\\,iw*sar))/2:(ih - min (ih\\,ih/sar))/2,setsar=sar=1,scale={0}:trunc({0}/dar/2)*2";
|
||||
@@ -2162,7 +2160,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
var user = state.User;
|
||||
|
||||
// If the user doesn't have access to transcoding, then force stream copy, regardless of whether it will be compatible or not
|
||||
if (user != null && !user.Policy.EnableVideoPlaybackTranscoding)
|
||||
if (user != null && !user.HasPermission(PermissionKind.EnableVideoPlaybackTranscoding))
|
||||
{
|
||||
state.OutputVideoCodec = "copy";
|
||||
}
|
||||
@@ -2178,7 +2176,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
var user = state.User;
|
||||
|
||||
// If the user doesn't have access to transcoding, then force stream copy, regardless of whether it will be compatible or not
|
||||
if (user != null && !user.Policy.EnableAudioPlaybackTranscoding)
|
||||
if (user != null && !user.HasPermission(PermissionKind.EnableAudioPlaybackTranscoding))
|
||||
{
|
||||
state.OutputAudioCodec = "copy";
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Drawing;
|
||||
using MediaBrowser.Model.Dto;
|
||||
@@ -18,22 +18,37 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
public class EncodingJobInfo
|
||||
{
|
||||
public MediaStream VideoStream { get; set; }
|
||||
|
||||
public VideoType VideoType { get; set; }
|
||||
|
||||
public Dictionary<string, string> RemoteHttpHeaders { get; set; }
|
||||
|
||||
public string OutputVideoCodec { get; set; }
|
||||
|
||||
public MediaProtocol InputProtocol { get; set; }
|
||||
|
||||
public string MediaPath { get; set; }
|
||||
|
||||
public bool IsInputVideo { get; set; }
|
||||
|
||||
public IIsoMount IsoMount { get; set; }
|
||||
|
||||
public string[] PlayableStreamFileNames { get; set; }
|
||||
|
||||
public string OutputAudioCodec { get; set; }
|
||||
|
||||
public int? OutputVideoBitrate { get; set; }
|
||||
|
||||
public MediaStream SubtitleStream { get; set; }
|
||||
|
||||
public SubtitleDeliveryMethod SubtitleDeliveryMethod { get; set; }
|
||||
|
||||
public string[] SupportedSubtitleCodecs { get; set; }
|
||||
|
||||
public int InternalSubtitleStreamOffset { get; set; }
|
||||
|
||||
public MediaSourceInfo MediaSource { get; set; }
|
||||
|
||||
public User User { get; set; }
|
||||
|
||||
public long? RunTimeTicks { get; set; }
|
||||
|
||||
@@ -1,36 +1,40 @@
|
||||
using System;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using Jellyfin.Data.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Net
|
||||
{
|
||||
public class AuthorizationInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the user identifier.
|
||||
/// Gets the user identifier.
|
||||
/// </summary>
|
||||
/// <value>The user identifier.</value>
|
||||
public Guid UserId => User == null ? Guid.Empty : User.Id;
|
||||
public Guid UserId => User?.Id ?? Guid.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the device identifier.
|
||||
/// </summary>
|
||||
/// <value>The device identifier.</value>
|
||||
public string DeviceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the device.
|
||||
/// </summary>
|
||||
/// <value>The device.</value>
|
||||
public string Device { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the client.
|
||||
/// </summary>
|
||||
/// <value>The client.</value>
|
||||
public string Client { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the version.
|
||||
/// </summary>
|
||||
/// <value>The version.</value>
|
||||
public string Version { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the token.
|
||||
/// </summary>
|
||||
|
||||
@@ -40,9 +40,9 @@ namespace MediaBrowser.Controller.Net
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
protected ILogger Logger;
|
||||
protected ILogger<BasePeriodicWebSocketListener<TReturnDataType, TStateType>> Logger;
|
||||
|
||||
protected BasePeriodicWebSocketListener(ILogger logger)
|
||||
protected BasePeriodicWebSocketListener(ILogger<BasePeriodicWebSocketListener<TReturnDataType, TStateType>> logger)
|
||||
{
|
||||
if (logger == null)
|
||||
{
|
||||
@@ -156,6 +156,7 @@ namespace MediaBrowser.Controller.Net
|
||||
await connection.SendAsync(
|
||||
new WebSocketMessage<TReturnDataType>
|
||||
{
|
||||
MessageId = Guid.NewGuid(),
|
||||
MessageType = Name,
|
||||
Data = data
|
||||
},
|
||||
@@ -213,7 +214,7 @@ namespace MediaBrowser.Controller.Net
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
//TODO Investigate and properly fix.
|
||||
// TODO Investigate and properly fix.
|
||||
}
|
||||
|
||||
lock (_activeConnections)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#nullable enable
|
||||
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Model.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace MediaBrowser.Controller.Net
|
||||
public interface IAuthService
|
||||
{
|
||||
void Authenticate(IRequest request, IAuthenticationAttributes authAttribtues);
|
||||
|
||||
User? Authenticate(HttpRequest request, IAuthenticationAttributes authAttribtues);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Model.Services;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using Jellyfin.Data.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Notifications
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Model.Notifications;
|
||||
|
||||
namespace MediaBrowser.Controller.Notifications
|
||||
|
||||
@@ -44,6 +44,5 @@ namespace MediaBrowser.Controller.Persistence
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
void SaveAllUserData(long userId, UserItemData[] userData, CancellationToken cancellationToken);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Persistence
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides an interface to implement a User repository
|
||||
/// </summary>
|
||||
public interface IUserRepository : IRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Deletes the user.
|
||||
/// </summary>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <returns>Task.</returns>
|
||||
void DeleteUser(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all users.
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{User}.</returns>
|
||||
List<User> RetrieveAllUsers();
|
||||
|
||||
void CreateUser(User user);
|
||||
void UpdateUser(User user);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
@@ -241,15 +242,7 @@ namespace MediaBrowser.Controller.Playlists
|
||||
}
|
||||
|
||||
var userId = user.Id.ToString("N", CultureInfo.InvariantCulture);
|
||||
foreach (var share in shares)
|
||||
{
|
||||
if (string.Equals(share.UserId, userId, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return shares.Any(share => string.Equals(share.UserId, userId, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
public override bool IsVisibleStandalone(User user)
|
||||
|
||||
@@ -22,6 +22,5 @@ namespace MediaBrowser.Controller.Plugins
|
||||
/// </summary>
|
||||
public interface IRunBeforeStartup
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
@@ -70,6 +71,8 @@ namespace MediaBrowser.Controller.Providers
|
||||
/// <returns>Task.</returns>
|
||||
Task SaveImage(BaseItem item, string source, string mimeType, ImageType type, int? imageIndex, bool? saveLocallyWithMedia, CancellationToken cancellationToken);
|
||||
|
||||
Task SaveImage(User user, Stream source, string mimeType, string path);
|
||||
|
||||
/// <summary>
|
||||
/// Adds the metadata providers.
|
||||
/// </summary>
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Authentication;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Security;
|
||||
using MediaBrowser.Model.Dto;
|
||||
@@ -75,7 +74,7 @@ namespace MediaBrowser.Controller.Session
|
||||
/// <param name="deviceName">Name of the device.</param>
|
||||
/// <param name="remoteEndPoint">The remote end point.</param>
|
||||
/// <param name="user">The user.</param>
|
||||
SessionInfo LogSessionActivity(string appName, string appVersion, string deviceId, string deviceName, string remoteEndPoint, User user);
|
||||
SessionInfo LogSessionActivity(string appName, string appVersion, string deviceId, string deviceName, string remoteEndPoint, Jellyfin.Data.Entities.User user);
|
||||
|
||||
void UpdateDeviceName(string sessionId, string reportedDeviceName);
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
|
||||
namespace MediaBrowser.Controller.Sorting
|
||||
@@ -12,7 +11,7 @@ namespace MediaBrowser.Controller.Sorting
|
||||
/// Gets or sets the user.
|
||||
/// </summary>
|
||||
/// <value>The user.</value>
|
||||
User User { get; set; }
|
||||
Jellyfin.Data.Entities.User User { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the user manager.
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
public class GroupInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Default ping value used for sessions.
|
||||
/// Gets the default ping value used for sessions.
|
||||
/// </summary>
|
||||
public long DefaulPing { get; } = 500;
|
||||
|
||||
@@ -31,13 +31,13 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
public BaseItem PlayingItem { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether playback is paused.
|
||||
/// Gets or sets a value indicating whether playback is paused.
|
||||
/// </summary>
|
||||
/// <value>Playback is paused.</value>
|
||||
public bool IsPaused { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the position ticks.
|
||||
/// Gets or sets a value indicating whether there are position ticks.
|
||||
/// </summary>
|
||||
/// <value>The position ticks.</value>
|
||||
public long PositionTicks { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user