mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-19 12:44:19 +01:00
Merge remote-tracking branch 'upstream/master' into HEAD
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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -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()
|
||||
@@ -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
|
||||
@@ -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)
|
||||
@@ -1005,7 +1006,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <returns>PlayAccess.</returns>
|
||||
public PlayAccess GetPlayAccess(User user)
|
||||
{
|
||||
if (!user.Policy.EnableMediaPlayback)
|
||||
if (!user.HasPermission(PermissionKind.EnableMediaPlayback))
|
||||
{
|
||||
return PlayAccess.None;
|
||||
}
|
||||
@@ -1214,11 +1215,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");
|
||||
}
|
||||
@@ -1774,7 +1775,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
var maxAllowedRating = user.Policy.MaxParentalRating;
|
||||
var maxAllowedRating = user.MaxParentalAgeRating;
|
||||
|
||||
if (maxAllowedRating == null)
|
||||
{
|
||||
@@ -1790,7 +1791,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
if (string.IsNullOrEmpty(rating))
|
||||
{
|
||||
return !GetBlockUnratedValue(user.Policy);
|
||||
return !GetBlockUnratedValue(user);
|
||||
}
|
||||
|
||||
var value = LocalizationManager.GetRatingLevel(rating);
|
||||
@@ -1798,7 +1799,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)
|
||||
{
|
||||
@@ -1860,8 +1861,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;
|
||||
}
|
||||
@@ -1887,22 +1887,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>
|
||||
@@ -2132,7 +2128,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)
|
||||
{
|
||||
@@ -2806,14 +2803,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]
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -882,7 +890,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 +960,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)
|
||||
{
|
||||
@@ -1582,7 +1592,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
EnableTotalRecordCount = false
|
||||
};
|
||||
|
||||
if (!user.Configuration.DisplayMissingEpisodes)
|
||||
if (!user.DisplayMissingEpisodes)
|
||||
{
|
||||
query.IsVirtualItem = false;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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,6 +3,7 @@ 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;
|
||||
@@ -111,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)
|
||||
@@ -140,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
|
||||
};
|
||||
|
||||
@@ -152,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
|
||||
{
|
||||
@@ -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);
|
||||
}
|
||||
@@ -293,21 +299,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);
|
||||
}
|
||||
@@ -417,7 +429,8 @@ namespace MediaBrowser.Controller.Entities
|
||||
};
|
||||
}
|
||||
|
||||
private QueryResult<BaseItem> GetResult<T>(IEnumerable<T> items,
|
||||
private QueryResult<BaseItem> GetResult<T>(
|
||||
IEnumerable<T> items,
|
||||
BaseItem queryParent,
|
||||
InternalItemsQuery query)
|
||||
where T : BaseItem
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -289,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,
|
||||
@@ -302,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
@@ -2148,7 +2149,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";
|
||||
}
|
||||
@@ -2164,7 +2165,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>
|
||||
|
||||
@@ -156,6 +156,7 @@ namespace MediaBrowser.Controller.Net
|
||||
await connection.SendAsync(
|
||||
new WebSocketMessage<TReturnDataType>
|
||||
{
|
||||
MessageId = Guid.NewGuid(),
|
||||
MessageType = Name,
|
||||
Data = data
|
||||
},
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user