Seperate changes from #1023
The unrelated changes from #1023 (and more)
This commit is contained in:
parent
5024c52c60
commit
6566c91360
|
@ -3,12 +3,10 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Common.Updates;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Authentication;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Devices;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
|
@ -29,31 +27,39 @@ namespace Emby.Server.Implementations.Activity
|
|||
{
|
||||
public class ActivityLogEntryPoint : IServerEntryPoint
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IInstallationManager _installationManager;
|
||||
private readonly ISessionManager _sessionManager;
|
||||
private readonly ITaskManager _taskManager;
|
||||
private readonly IActivityManager _activityManager;
|
||||
private readonly ILocalizationManager _localization;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly ISubtitleManager _subManager;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IServerApplicationHost _appHost;
|
||||
private readonly IDeviceManager _deviceManager;
|
||||
|
||||
public ActivityLogEntryPoint(ISessionManager sessionManager, IDeviceManager deviceManager, ITaskManager taskManager, IActivityManager activityManager, ILocalizationManager localization, IInstallationManager installationManager, ILibraryManager libraryManager, ISubtitleManager subManager, IUserManager userManager, IServerConfigurationManager config, IServerApplicationHost appHost)
|
||||
public ActivityLogEntryPoint(
|
||||
ILogger<ActivityLogEntryPoint> logger,
|
||||
ISessionManager sessionManager,
|
||||
IDeviceManager deviceManager,
|
||||
ITaskManager taskManager,
|
||||
IActivityManager activityManager,
|
||||
ILocalizationManager localization,
|
||||
IInstallationManager installationManager,
|
||||
ISubtitleManager subManager,
|
||||
IUserManager userManager,
|
||||
IServerApplicationHost appHost)
|
||||
{
|
||||
_logger = logger;
|
||||
_sessionManager = sessionManager;
|
||||
_deviceManager = deviceManager;
|
||||
_taskManager = taskManager;
|
||||
_activityManager = activityManager;
|
||||
_localization = localization;
|
||||
_installationManager = installationManager;
|
||||
_libraryManager = libraryManager;
|
||||
_subManager = subManager;
|
||||
_userManager = userManager;
|
||||
_config = config;
|
||||
_appHost = appHost;
|
||||
_deviceManager = deviceManager;
|
||||
}
|
||||
|
||||
public Task RunAsync()
|
||||
|
@ -124,7 +130,7 @@ namespace Emby.Server.Implementations.Activity
|
|||
|
||||
if (item == null)
|
||||
{
|
||||
//_logger.LogWarning("PlaybackStopped reported with null media info.");
|
||||
_logger.LogWarning("PlaybackStopped reported with null media info.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -155,7 +161,7 @@ namespace Emby.Server.Implementations.Activity
|
|||
|
||||
if (item == null)
|
||||
{
|
||||
//_logger.LogWarning("PlaybackStart reported with null media info.");
|
||||
_logger.LogWarning("PlaybackStart reported with null media info.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -203,6 +209,7 @@ namespace Emby.Server.Implementations.Activity
|
|||
{
|
||||
return NotificationType.AudioPlayback.ToString();
|
||||
}
|
||||
|
||||
if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return NotificationType.VideoPlayback.ToString();
|
||||
|
@ -217,6 +224,7 @@ namespace Emby.Server.Implementations.Activity
|
|||
{
|
||||
return NotificationType.AudioPlaybackStopped.ToString();
|
||||
}
|
||||
|
||||
if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return NotificationType.VideoPlaybackStopped.ToString();
|
||||
|
@ -415,6 +423,7 @@ namespace Emby.Server.Implementations.Activity
|
|||
{
|
||||
vals.Add(e.Result.ErrorMessage);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(e.Result.LongErrorMessage))
|
||||
{
|
||||
vals.Add(e.Result.LongErrorMessage);
|
||||
|
@ -424,7 +433,7 @@ namespace Emby.Server.Implementations.Activity
|
|||
{
|
||||
Name = string.Format(_localization.GetLocalizedString("ScheduledTaskFailedWithName"), task.Name),
|
||||
Type = NotificationType.TaskFailed.ToString(),
|
||||
Overview = string.Join(Environment.NewLine, vals.ToArray()),
|
||||
Overview = string.Join(Environment.NewLine, vals),
|
||||
ShortOverview = runningTime,
|
||||
Severity = LogLevel.Error
|
||||
});
|
||||
|
@ -503,6 +512,7 @@ namespace Emby.Server.Implementations.Activity
|
|||
{
|
||||
values.Add(CreateValueString(span.Hours, "hour"));
|
||||
}
|
||||
|
||||
// Number of minutes
|
||||
if (span.Minutes >= 1)
|
||||
{
|
||||
|
@ -526,6 +536,7 @@ namespace Emby.Server.Implementations.Activity
|
|||
|
||||
builder.Append(values[i]);
|
||||
}
|
||||
|
||||
// Return result
|
||||
return builder.ToString();
|
||||
}
|
||||
|
|
|
@ -831,10 +831,10 @@ namespace Emby.Server.Implementations
|
|||
DtoService = new DtoService(LoggerFactory, LibraryManager, UserDataManager, ItemRepository, ImageProcessor, ProviderManager, this, () => MediaSourceManager, () => LiveTvManager);
|
||||
serviceCollection.AddSingleton(DtoService);
|
||||
|
||||
ChannelManager = new ChannelManager(UserManager, DtoService, LibraryManager, LoggerFactory, ServerConfigurationManager, FileSystemManager, UserDataManager, JsonSerializer, LocalizationManager, HttpClient, ProviderManager);
|
||||
ChannelManager = new ChannelManager(UserManager, DtoService, LibraryManager, LoggerFactory, ServerConfigurationManager, FileSystemManager, UserDataManager, JsonSerializer, ProviderManager);
|
||||
serviceCollection.AddSingleton(ChannelManager);
|
||||
|
||||
SessionManager = new SessionManager(UserDataManager, LoggerFactory, LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, JsonSerializer, this, HttpClient, AuthenticationRepository, DeviceManager, MediaSourceManager);
|
||||
SessionManager = new SessionManager(UserDataManager, LoggerFactory, LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, this, AuthenticationRepository, DeviceManager, MediaSourceManager);
|
||||
serviceCollection.AddSingleton(SessionManager);
|
||||
|
||||
serviceCollection.AddSingleton<IDlnaManager>(
|
||||
|
@ -1035,7 +1035,6 @@ namespace Emby.Server.Implementations
|
|||
Video.LiveTvManager = LiveTvManager;
|
||||
Folder.UserViewManager = UserViewManager;
|
||||
UserView.TVSeriesManager = TVSeriesManager;
|
||||
UserView.PlaylistManager = PlaylistManager;
|
||||
UserView.CollectionManager = CollectionManager;
|
||||
BaseItem.MediaSourceManager = MediaSourceManager;
|
||||
CollectionFolder.XmlSerializer = XmlSerializer;
|
||||
|
|
|
@ -6,7 +6,6 @@ using System.Linq;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Common.Progress;
|
||||
using MediaBrowser.Controller.Channels;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
|
@ -20,7 +19,6 @@ using MediaBrowser.Controller.Providers;
|
|||
using MediaBrowser.Model.Channels;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
@ -40,11 +38,8 @@ namespace Emby.Server.Implementations.Channels
|
|||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IProviderManager _providerManager;
|
||||
|
||||
private readonly ILocalizationManager _localization;
|
||||
|
||||
public ChannelManager(
|
||||
IUserManager userManager,
|
||||
IDtoService dtoService,
|
||||
|
@ -54,8 +49,6 @@ namespace Emby.Server.Implementations.Channels
|
|||
IFileSystem fileSystem,
|
||||
IUserDataManager userDataManager,
|
||||
IJsonSerializer jsonSerializer,
|
||||
ILocalizationManager localization,
|
||||
IHttpClient httpClient,
|
||||
IProviderManager providerManager)
|
||||
{
|
||||
_userManager = userManager;
|
||||
|
@ -66,8 +59,6 @@ namespace Emby.Server.Implementations.Channels
|
|||
_fileSystem = fileSystem;
|
||||
_userDataManager = userDataManager;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_localization = localization;
|
||||
_httpClient = httpClient;
|
||||
_providerManager = providerManager;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,14 +89,11 @@ namespace Emby.Server.Implementations.Dto
|
|||
var channelTuples = new List<Tuple<BaseItemDto, LiveTvChannel>>();
|
||||
|
||||
var index = 0;
|
||||
var allCollectionFolders = _libraryManager.GetUserRootFolder().Children.OfType<Folder>().ToList();
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
var dto = GetBaseItemDtoInternal(item, options, allCollectionFolders, user, owner);
|
||||
var dto = GetBaseItemDtoInternal(item, options, user, owner);
|
||||
|
||||
var tvChannel = item as LiveTvChannel;
|
||||
if (tvChannel != null)
|
||||
if (item is LiveTvChannel tvChannel)
|
||||
{
|
||||
channelTuples.Add(new Tuple<BaseItemDto, LiveTvChannel>(dto, tvChannel));
|
||||
}
|
||||
|
@ -105,9 +102,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
programTuples.Add(new Tuple<BaseItem, BaseItemDto>(item, dto));
|
||||
}
|
||||
|
||||
var byName = item as IItemByName;
|
||||
|
||||
if (byName != null)
|
||||
if (item is IItemByName byName)
|
||||
{
|
||||
if (options.ContainsField(ItemFields.ItemCounts))
|
||||
{
|
||||
|
@ -130,8 +125,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
|
||||
if (programTuples.Count > 0)
|
||||
{
|
||||
var task = _livetvManager().AddInfoToProgramDto(programTuples, options.Fields, user);
|
||||
Task.WaitAll(task);
|
||||
_livetvManager().AddInfoToProgramDto(programTuples, options.Fields, user).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
if (channelTuples.Count > 0)
|
||||
|
@ -144,8 +138,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
|
||||
public BaseItemDto GetBaseItemDto(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null)
|
||||
{
|
||||
var allCollectionFolders = _libraryManager.GetUserRootFolder().Children.OfType<Folder>().ToList();
|
||||
var dto = GetBaseItemDtoInternal(item, options, allCollectionFolders, user, owner);
|
||||
var dto = GetBaseItemDtoInternal(item, options, user, owner);
|
||||
var tvChannel = item as LiveTvChannel;
|
||||
if (tvChannel != null)
|
||||
{
|
||||
|
@ -188,7 +181,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
});
|
||||
}
|
||||
|
||||
private BaseItemDto GetBaseItemDtoInternal(BaseItem item, DtoOptions options, List<Folder> allCollectionFolders, User user = null, BaseItem owner = null)
|
||||
private BaseItemDto GetBaseItemDtoInternal(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null)
|
||||
{
|
||||
var dto = new BaseItemDto
|
||||
{
|
||||
|
@ -312,6 +305,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
{
|
||||
path = path.TrimStart('.');
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(path) && containers.Contains(path, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
fileExtensionContainer = path;
|
||||
|
@ -325,8 +319,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
|
||||
public BaseItemDto GetItemByNameDto(BaseItem item, DtoOptions options, List<BaseItem> taggedItems, User user = null)
|
||||
{
|
||||
var allCollectionFolders = _libraryManager.GetUserRootFolder().Children.OfType<Folder>().ToList();
|
||||
var dto = GetBaseItemDtoInternal(item, options, allCollectionFolders, user);
|
||||
var dto = GetBaseItemDtoInternal(item, options, user);
|
||||
|
||||
if (taggedItems != null && options.ContainsField(ItemFields.ItemCounts))
|
||||
{
|
||||
|
@ -1051,14 +1044,15 @@ namespace Emby.Server.Implementations.Dto
|
|||
}
|
||||
else
|
||||
{
|
||||
mediaStreams = dto.MediaSources.Where(i => string.Equals(i.Id, item.Id.ToString("N"), StringComparison.OrdinalIgnoreCase))
|
||||
string id = item.Id.ToString("N");
|
||||
mediaStreams = dto.MediaSources.Where(i => string.Equals(i.Id, id, StringComparison.OrdinalIgnoreCase))
|
||||
.SelectMany(i => i.MediaStreams)
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mediaStreams = _mediaSourceManager().GetStaticMediaSources(item, true).First().MediaStreams.ToArray();
|
||||
mediaStreams = _mediaSourceManager().GetStaticMediaSources(item, true)[0].MediaStreams.ToArray();
|
||||
}
|
||||
|
||||
dto.MediaStreams = mediaStreams;
|
||||
|
|
|
@ -15,13 +15,9 @@ namespace Emby.Server.Implementations.Security
|
|||
{
|
||||
public class AuthenticationRepository : BaseSqliteRepository, IAuthenticationRepository
|
||||
{
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||
|
||||
public AuthenticationRepository(ILoggerFactory loggerFactory, IServerConfigurationManager config)
|
||||
: base(loggerFactory.CreateLogger(nameof(AuthenticationRepository)))
|
||||
{
|
||||
_config = config;
|
||||
DbFilePath = Path.Combine(config.ApplicationPaths.DataPath, "authentication.db");
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.Services
|
|||
|
||||
foreach (var propertyInfo in RestPath.GetSerializableProperties(type))
|
||||
{
|
||||
var propertySetFn = TypeAccessor.GetSetPropertyMethod(type, propertyInfo);
|
||||
var propertySetFn = TypeAccessor.GetSetPropertyMethod(propertyInfo);
|
||||
var propertyType = propertyInfo.PropertyType;
|
||||
var propertyParseStringFn = GetParseFn(propertyType);
|
||||
var propertySerializer = new PropertySerializerEntry(propertySetFn, propertyParseStringFn, propertyType);
|
||||
|
@ -110,9 +110,9 @@ namespace Emby.Server.Implementations.Services
|
|||
}
|
||||
}
|
||||
|
||||
internal class TypeAccessor
|
||||
internal static class TypeAccessor
|
||||
{
|
||||
public static Action<object, object> GetSetPropertyMethod(Type type, PropertyInfo propertyInfo)
|
||||
public static Action<object, object> GetSetPropertyMethod(PropertyInfo propertyInfo)
|
||||
{
|
||||
if (!propertyInfo.CanWrite || propertyInfo.GetIndexParameters().Length > 0)
|
||||
{
|
||||
|
|
|
@ -7,7 +7,6 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Authentication;
|
||||
using MediaBrowser.Controller.Devices;
|
||||
|
@ -25,7 +24,6 @@ using MediaBrowser.Model.Entities;
|
|||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Library;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Session;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
|
@ -53,8 +51,6 @@ namespace Emby.Server.Implementations.Session
|
|||
private readonly IImageProcessor _imageProcessor;
|
||||
private readonly IMediaSourceManager _mediaSourceManager;
|
||||
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IServerApplicationHost _appHost;
|
||||
|
||||
private readonly IAuthenticationRepository _authRepo;
|
||||
|
@ -96,9 +92,7 @@ namespace Emby.Server.Implementations.Session
|
|||
IMusicManager musicManager,
|
||||
IDtoService dtoService,
|
||||
IImageProcessor imageProcessor,
|
||||
IJsonSerializer jsonSerializer,
|
||||
IServerApplicationHost appHost,
|
||||
IHttpClient httpClient,
|
||||
IAuthenticationRepository authRepo,
|
||||
IDeviceManager deviceManager,
|
||||
IMediaSourceManager mediaSourceManager)
|
||||
|
@ -110,9 +104,7 @@ namespace Emby.Server.Implementations.Session
|
|||
_musicManager = musicManager;
|
||||
_dtoService = dtoService;
|
||||
_imageProcessor = imageProcessor;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_appHost = appHost;
|
||||
_httpClient = httpClient;
|
||||
_authRepo = authRepo;
|
||||
_deviceManager = deviceManager;
|
||||
_mediaSourceManager = mediaSourceManager;
|
||||
|
@ -347,8 +339,7 @@ namespace Emby.Server.Implementations.Session
|
|||
var runtimeTicks = libraryItem.RunTimeTicks;
|
||||
|
||||
MediaSourceInfo mediaSource = null;
|
||||
var hasMediaSources = libraryItem as IHasMediaSources;
|
||||
if (hasMediaSources != null)
|
||||
if (libraryItem is IHasMediaSources hasMediaSources)
|
||||
{
|
||||
mediaSource = await GetMediaSource(libraryItem, info.MediaSourceId, info.LiveStreamId).ConfigureAwait(false);
|
||||
|
||||
|
@ -1841,64 +1832,49 @@ namespace Emby.Server.Implementations.Session
|
|||
|
||||
var data = dataFn();
|
||||
|
||||
var tasks = sessions.Select(session => Task.Run(async () =>
|
||||
IEnumerable<Task> GetTasks()
|
||||
{
|
||||
try
|
||||
foreach (var session in sessions)
|
||||
{
|
||||
await SendMessageToSession(session, name, data, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Error sending message", ex);
|
||||
yield return SendMessageToSession(session, name, data, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
}, cancellationToken)).ToArray();
|
||||
|
||||
return Task.WhenAll(tasks);
|
||||
return Task.WhenAll(GetTasks());
|
||||
}
|
||||
|
||||
public Task SendMessageToUserSessions<T>(List<Guid> userIds, string name, T data, CancellationToken cancellationToken)
|
||||
{
|
||||
CheckDisposed();
|
||||
|
||||
var sessions = Sessions.Where(i => userIds.Any(i.ContainsUser)).ToList();
|
||||
var sessions = Sessions.Where(i => userIds.Any(i.ContainsUser));
|
||||
|
||||
var tasks = sessions.Select(session => Task.Run(async () =>
|
||||
IEnumerable<Task> GetTasks()
|
||||
{
|
||||
try
|
||||
foreach (var session in sessions)
|
||||
{
|
||||
await SendMessageToSession(session, name, data, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Error sending message", ex);
|
||||
yield return SendMessageToSession(session, name, data, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
}, cancellationToken)).ToArray();
|
||||
|
||||
return Task.WhenAll(tasks);
|
||||
return Task.WhenAll(GetTasks());
|
||||
}
|
||||
|
||||
public Task SendMessageToUserDeviceSessions<T>(string deviceId, string name, T data, CancellationToken cancellationToken)
|
||||
{
|
||||
CheckDisposed();
|
||||
|
||||
var sessions = Sessions.Where(i => string.Equals(i.DeviceId, deviceId, StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
var sessions = Sessions.Where(i => string.Equals(i.DeviceId, deviceId, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
var tasks = sessions.Select(session => Task.Run(async () =>
|
||||
IEnumerable<Task> GetTasks()
|
||||
{
|
||||
try
|
||||
foreach (var session in sessions)
|
||||
{
|
||||
await SendMessageToSession(session, name, data, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Error sending message", ex);
|
||||
yield return SendMessageToSession(session, name, data, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
}, cancellationToken)).ToArray();
|
||||
|
||||
return Task.WhenAll(tasks);
|
||||
return Task.WhenAll(GetTasks());
|
||||
}
|
||||
|
||||
public Task SendMessageToUserDeviceAndAdminSessions<T>(string deviceId, string name, T data, CancellationToken cancellationToken)
|
||||
|
@ -1906,23 +1882,17 @@ namespace Emby.Server.Implementations.Session
|
|||
CheckDisposed();
|
||||
|
||||
var sessions = Sessions
|
||||
.Where(i => string.Equals(i.DeviceId, deviceId, StringComparison.OrdinalIgnoreCase) || IsAdminSession(i))
|
||||
.ToList();
|
||||
.Where(i => string.Equals(i.DeviceId, deviceId, StringComparison.OrdinalIgnoreCase) || IsAdminSession(i));
|
||||
|
||||
var tasks = sessions.Select(session => Task.Run(async () =>
|
||||
IEnumerable<Task> GetTasks()
|
||||
{
|
||||
try
|
||||
foreach (var session in sessions)
|
||||
{
|
||||
await SendMessageToSession(session, name, data, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Error sending message", ex);
|
||||
yield return SendMessageToSession(session, name, data, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
}, cancellationToken)).ToArray();
|
||||
|
||||
return Task.WhenAll(tasks);
|
||||
return Task.WhenAll(GetTasks());
|
||||
}
|
||||
|
||||
private bool IsAdminSession(SessionInfo s)
|
||||
|
|
|
@ -2,7 +2,6 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Playlists;
|
||||
using MediaBrowser.Controller.TV;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
@ -17,7 +16,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
public Guid? UserId { get; set; }
|
||||
|
||||
public static ITVSeriesManager TVSeriesManager;
|
||||
public static IPlaylistManager PlaylistManager;
|
||||
|
||||
[IgnoreDataMember]
|
||||
public string CollectionType => ViewType;
|
||||
|
@ -38,6 +36,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
{
|
||||
list.Add(Id);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -65,7 +64,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
parent = LibraryManager.GetItemById(ParentId) as Folder ?? parent;
|
||||
}
|
||||
|
||||
return new UserViewBuilder(UserViewManager, LibraryManager, Logger, UserDataManager, TVSeriesManager, ConfigurationManager, PlaylistManager)
|
||||
return new UserViewBuilder(UserViewManager, LibraryManager, Logger, UserDataManager, TVSeriesManager, ConfigurationManager)
|
||||
.GetUserItems(parent, this, CollectionType, query);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Controller.Configuration;
|
|||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Playlists;
|
||||
using MediaBrowser.Controller.TV;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Querying;
|
||||
|
@ -21,9 +20,14 @@ namespace MediaBrowser.Controller.Entities
|
|||
private readonly IUserDataManager _userDataManager;
|
||||
private readonly ITVSeriesManager _tvSeriesManager;
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IPlaylistManager _playlistManager;
|
||||
|
||||
public UserViewBuilder(IUserViewManager userViewManager, ILibraryManager libraryManager, ILogger logger, IUserDataManager userDataManager, ITVSeriesManager tvSeriesManager, IServerConfigurationManager config, IPlaylistManager playlistManager)
|
||||
public UserViewBuilder(
|
||||
IUserViewManager userViewManager,
|
||||
ILibraryManager libraryManager,
|
||||
ILogger logger,
|
||||
IUserDataManager userDataManager,
|
||||
ITVSeriesManager tvSeriesManager,
|
||||
IServerConfigurationManager config)
|
||||
{
|
||||
_userViewManager = userViewManager;
|
||||
_libraryManager = libraryManager;
|
||||
|
@ -31,7 +35,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
_userDataManager = userDataManager;
|
||||
_tvSeriesManager = tvSeriesManager;
|
||||
_config = config;
|
||||
_playlistManager = playlistManager;
|
||||
}
|
||||
|
||||
public QueryResult<BaseItem> GetUserItems(Folder queryParent, Folder displayParent, string viewType, InternalItemsQuery query)
|
||||
|
@ -110,6 +113,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
{
|
||||
return GetResult(GetMediaFolders(user).OfType<Folder>().SelectMany(i => i.GetChildren(user, true)), queryParent, query);
|
||||
}
|
||||
|
||||
return queryParent.GetItems(query);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user