mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-09 19:56:18 +00:00
make channel access opt-in rather than opt out
This commit is contained in:
@@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Channels
|
||||
|
||||
public override bool IsVisible(User user)
|
||||
{
|
||||
if (user.Policy.BlockedChannels.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
|
||||
if (!user.Policy.EnableAllChannels && !user.Policy.EnabledChannels.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -379,7 +379,14 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public string GetInternalMetadataPath()
|
||||
{
|
||||
return GetInternalMetadataPath(ConfigurationManager.ApplicationPaths.InternalMetadataPath);
|
||||
var basePath = ConfigurationManager.ApplicationPaths.InternalMetadataPath;
|
||||
|
||||
if (ConfigurationManager.Configuration.EnableLibraryMetadataSubFolder)
|
||||
{
|
||||
basePath = System.IO.Path.Combine(basePath, "library");
|
||||
}
|
||||
|
||||
return GetInternalMetadataPath(basePath);
|
||||
}
|
||||
|
||||
protected virtual string GetInternalMetadataPath(string basePath)
|
||||
@@ -1458,7 +1465,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
currentFile.Attributes &= ~FileAttributes.Hidden;
|
||||
}
|
||||
|
||||
currentFile.Delete();
|
||||
FileSystem.DeleteFile(currentFile.FullName);
|
||||
}
|
||||
|
||||
return UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None);
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
// Exceptions will be thrown if these paths already exist
|
||||
if (Directory.Exists(newConfigDirectory))
|
||||
{
|
||||
Directory.Delete(newConfigDirectory, true);
|
||||
FileSystem.DeleteDirectory(newConfigDirectory, true);
|
||||
}
|
||||
|
||||
if (Directory.Exists(oldConfigurationDirectory))
|
||||
|
||||
@@ -59,12 +59,6 @@ namespace MediaBrowser.Controller
|
||||
/// <value>The game genre path.</value>
|
||||
string GameGenrePath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the artists path.
|
||||
/// </summary>
|
||||
/// <value>The artists path.</value>
|
||||
string ArtistsPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the Studio directory
|
||||
/// </summary>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.Users;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Controller.LiveTv
|
||||
{
|
||||
@@ -83,5 +83,10 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
{
|
||||
return config.BlockUnratedItems.Contains(UnratedItem.LiveTvProgram);
|
||||
}
|
||||
|
||||
protected override string GetInternalMetadataPath(string basePath)
|
||||
{
|
||||
return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,5 +145,10 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
protected override string GetInternalMetadataPath(string basePath)
|
||||
{
|
||||
return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N"), "metadata");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,5 +204,10 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
{
|
||||
return config.BlockUnratedItems.Contains(UnratedItem.LiveTvProgram);
|
||||
}
|
||||
|
||||
protected override string GetInternalMetadataPath(string basePath)
|
||||
{
|
||||
return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,5 +83,10 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
{
|
||||
return config.BlockUnratedItems.Contains(UnratedItem.LiveTvProgram);
|
||||
}
|
||||
|
||||
protected override string GetInternalMetadataPath(string basePath)
|
||||
{
|
||||
return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,8 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
SubtitlePlaybackMode mode,
|
||||
string audioTrackLanguage)
|
||||
{
|
||||
streams = GetSortedStreams(streams, MediaStreamType.Subtitle, preferredLanguages).ToList();
|
||||
streams = GetSortedStreams(streams, MediaStreamType.Subtitle, preferredLanguages)
|
||||
.ToList();
|
||||
|
||||
var full = streams.Where(s => !s.IsForced);
|
||||
|
||||
@@ -81,11 +82,9 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
private static IEnumerable<MediaStream> GetSortedStreams(IEnumerable<MediaStream> streams, MediaStreamType type, List<string> languagePreferences)
|
||||
{
|
||||
var orderStreams = streams
|
||||
.Where(i => i.Type == type);
|
||||
|
||||
// Give some preferance to external text subs for better performance
|
||||
return orderStreams.OrderBy(i =>
|
||||
return streams.Where(i => i.Type == type)
|
||||
.OrderBy(i =>
|
||||
{
|
||||
var index = languagePreferences.FindIndex(l => string.Equals(i.Language, l, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
@@ -94,8 +93,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
.ThenBy(i => i.IsDefault)
|
||||
.ThenBy(i => i.IsTextSubtitleStream)
|
||||
.ThenBy(i => i.IsExternal)
|
||||
.ThenBy(i => i.Index)
|
||||
.ToList();
|
||||
.ThenBy(i => i.Index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,5 +105,15 @@ namespace MediaBrowser.Controller.Session
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task SendServerRestartNotification(CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Sends the message.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <param name="data">The data.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task SendMessage<T>(string name, T data, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,6 +170,17 @@ namespace MediaBrowser.Controller.Session
|
||||
/// <returns>Task.</returns>
|
||||
Task SendPlaystateCommand(string controllingSessionId, string sessionId, PlaystateRequest command, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Sends the message to user sessions.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="userId">The user identifier.</param>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <param name="data">The data.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task SendMessageToUserSessions<T>(string userId, string name, T data, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Sends the restart required message.
|
||||
/// </summary>
|
||||
|
||||
@@ -160,6 +160,11 @@ namespace MediaBrowser.Controller.Session
|
||||
}
|
||||
}
|
||||
|
||||
public bool ContainsUser(string userId)
|
||||
{
|
||||
return ContainsUser(new Guid(userId));
|
||||
}
|
||||
|
||||
public bool ContainsUser(Guid userId)
|
||||
{
|
||||
return (UserId ?? Guid.Empty) == userId || AdditionalUsers.Any(i => userId == new Guid(i.UserId));
|
||||
|
||||
Reference in New Issue
Block a user