diff --git a/.gitmodules b/.gitmodules index 7aeb94dfca..c10f5905c4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "ThirdParty/taglib-sharp"] - path = ThirdParty/taglib-sharp - url = https://github.com/mono/taglib-sharp.git [submodule "MediaBrowser.WebDashboard/jellyfin-web"] path = MediaBrowser.WebDashboard/jellyfin-web url = https://github.com/jellyfin/jellyfin-web.git diff --git a/Emby.Photos/Emby.Photos.csproj b/Emby.Photos/Emby.Photos.csproj index e6b445202f..c9830abc5f 100644 --- a/Emby.Photos/Emby.Photos.csproj +++ b/Emby.Photos/Emby.Photos.csproj @@ -3,13 +3,16 @@ - + + + + netstandard2.0 false diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 492adef6a2..21294f96f3 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -4712,9 +4712,21 @@ namespace Emby.Server.Implementations.Data continue; } - var paramName = "@HasAnyProviderId" + index; + // TODO this seems to be an idea for a better schema where ProviderIds are their own table + // buut this is not implemented //hasProviderIds.Add("(COALESCE((select value from ProviderIds where ItemId=Guid and Name = '" + pair.Key + "'), '') <> " + paramName + ")"); + + // TODO this is a really BAD way to do it since the pair: + // Tmdb, 1234 matches Tmdb=1234 but also Tmdb=1234567 + // and maybe even NotTmdb=1234. + + // this is a placeholder for this specific pair to correlate it in the bigger query + var paramName = "@HasAnyProviderId" + index; + + // this is a search for the placeholder hasProviderIds.Add("ProviderIds like " + paramName + ""); + + // this replaces the placeholder with a value, here: %key=val% if (statement != null) { statement.TryBind(paramName, "%" + pair.Key + "=" + pair.Value + "%"); diff --git a/Emby.Server.Implementations/Diagnostics/CommonProcess.cs b/Emby.Server.Implementations/Diagnostics/CommonProcess.cs index d8a798c460..55539eafcf 100644 --- a/Emby.Server.Implementations/Diagnostics/CommonProcess.cs +++ b/Emby.Server.Implementations/Diagnostics/CommonProcess.cs @@ -105,26 +105,22 @@ namespace Emby.Server.Implementations.Diagnostics { return _process.WaitForExit(timeMs); } - + public Task WaitForExitAsync(int timeMs) { - //if (_process.WaitForExit(100)) - //{ - // return Task.FromResult(true); - //} - - //timeMs -= 100; - timeMs = Math.Max(0, timeMs); - - var tcs = new TaskCompletionSource(); - - var cancellationToken = new CancellationTokenSource(timeMs).Token; + //Note: For this function to work correctly, the option EnableRisingEvents needs to be set to true. if (HasExited) { return Task.FromResult(true); } + timeMs = Math.Max(0, timeMs); + + var tcs = new TaskCompletionSource(); + + var cancellationToken = new CancellationTokenSource(timeMs).Token; + _process.Exited += (sender, args) => tcs.TrySetResult(true); cancellationToken.Register(() => tcs.TrySetResult(HasExited)); diff --git a/Jellyfin.Server/Jellyfin.Server.csproj b/Jellyfin.Server/Jellyfin.Server.csproj index 897d933396..0622d94b8f 100644 --- a/Jellyfin.Server/Jellyfin.Server.csproj +++ b/Jellyfin.Server/Jellyfin.Server.csproj @@ -27,6 +27,11 @@ + + true + ../jellyfin.ruleset + + diff --git a/MediaBrowser.Api/Playback/MediaInfoService.cs b/MediaBrowser.Api/Playback/MediaInfoService.cs index 1c7be52f3e..ab3994a639 100644 --- a/MediaBrowser.Api/Playback/MediaInfoService.cs +++ b/MediaBrowser.Api/Playback/MediaInfoService.cs @@ -74,8 +74,19 @@ namespace MediaBrowser.Api.Playback private readonly IUserManager _userManager; private readonly IJsonSerializer _json; private readonly IAuthorizationContext _authContext; + private readonly ILogger _logger; - public MediaInfoService(IMediaSourceManager mediaSourceManager, IDeviceManager deviceManager, ILibraryManager libraryManager, IServerConfigurationManager config, INetworkManager networkManager, IMediaEncoder mediaEncoder, IUserManager userManager, IJsonSerializer json, IAuthorizationContext authContext) + public MediaInfoService( + IMediaSourceManager mediaSourceManager, + IDeviceManager deviceManager, + ILibraryManager libraryManager, + IServerConfigurationManager config, + INetworkManager networkManager, + IMediaEncoder mediaEncoder, + IUserManager userManager, + IJsonSerializer json, + IAuthorizationContext authContext, + ILoggerFactory loggerFactory) { _mediaSourceManager = mediaSourceManager; _deviceManager = deviceManager; @@ -86,6 +97,7 @@ namespace MediaBrowser.Api.Playback _userManager = userManager; _json = json; _authContext = authContext; + _logger = loggerFactory.CreateLogger(nameof(MediaInfoService)); } public object Get(GetBitrateTestBytes request) @@ -165,7 +177,7 @@ namespace MediaBrowser.Api.Playback var profile = request.DeviceProfile; - //Logger.Info("GetPostedPlaybackInfo profile: {0}", _json.SerializeToString(profile)); + //Logger.LogInformation("GetPostedPlaybackInfo profile: {profile}", _json.SerializeToString(profile)); if (profile == null) { @@ -262,7 +274,7 @@ namespace MediaBrowser.Api.Playback catch (Exception ex) { mediaSources = new List(); - // TODO Log exception + _logger.LogError(ex, "Could not find media sources for item id {id}", id); // TODO PlaybackException ?? //result.ErrorCode = ex.ErrorCode; } diff --git a/MediaBrowser.Api/Playback/UniversalAudioService.cs b/MediaBrowser.Api/Playback/UniversalAudioService.cs index 1faa32ba94..1aa77792ce 100644 --- a/MediaBrowser.Api/Playback/UniversalAudioService.cs +++ b/MediaBrowser.Api/Playback/UniversalAudioService.cs @@ -19,6 +19,7 @@ using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Services; using MediaBrowser.Model.System; +using Microsoft.Extensions.Logging; namespace MediaBrowser.Api.Playback { @@ -75,7 +76,24 @@ namespace MediaBrowser.Api.Playback [Authenticated] public class UniversalAudioService : BaseApiService { - public UniversalAudioService(IServerConfigurationManager serverConfigurationManager, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, IDeviceManager deviceManager, ISubtitleEncoder subtitleEncoder, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, IAuthorizationContext authorizationContext, IImageProcessor imageProcessor, INetworkManager networkManager, IEnvironmentInfo environmentInfo) + public UniversalAudioService( + IServerConfigurationManager serverConfigurationManager, + IUserManager userManager, + ILibraryManager libraryManager, + IIsoManager isoManager, + IMediaEncoder mediaEncoder, + IFileSystem fileSystem, + IDlnaManager dlnaManager, + IDeviceManager deviceManager, + ISubtitleEncoder subtitleEncoder, + IMediaSourceManager mediaSourceManager, + IZipClient zipClient, + IJsonSerializer jsonSerializer, + IAuthorizationContext authorizationContext, + IImageProcessor imageProcessor, + INetworkManager networkManager, + IEnvironmentInfo environmentInfo, + ILoggerFactory loggerFactory) { ServerConfigurationManager = serverConfigurationManager; UserManager = userManager; @@ -93,6 +111,8 @@ namespace MediaBrowser.Api.Playback ImageProcessor = imageProcessor; NetworkManager = networkManager; EnvironmentInfo = environmentInfo; + _loggerFactory = loggerFactory; + _logger = loggerFactory.CreateLogger(nameof(UniversalAudioService)); } protected IServerConfigurationManager ServerConfigurationManager { get; private set; } @@ -111,6 +131,8 @@ namespace MediaBrowser.Api.Playback protected IImageProcessor ImageProcessor { get; private set; } protected INetworkManager NetworkManager { get; private set; } protected IEnvironmentInfo EnvironmentInfo { get; private set; } + private ILoggerFactory _loggerFactory; + private ILogger _logger; public Task Get(GetUniversalAudioStream request) { @@ -221,7 +243,7 @@ namespace MediaBrowser.Api.Playback AuthorizationContext.GetAuthorizationInfo(Request).DeviceId = request.DeviceId; - var mediaInfoService = new MediaInfoService(MediaSourceManager, DeviceManager, LibraryManager, ServerConfigurationManager, NetworkManager, MediaEncoder, UserManager, JsonSerializer, AuthorizationContext) + var mediaInfoService = new MediaInfoService(MediaSourceManager, DeviceManager, LibraryManager, ServerConfigurationManager, NetworkManager, MediaEncoder, UserManager, JsonSerializer, AuthorizationContext, _loggerFactory) { Request = Request }; diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs index a3e05f0d2d..5b2939b759 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -96,7 +96,7 @@ namespace MediaBrowser.Controller.Entities.Audio /// /// The tracks. [IgnoreDataMember] - public IEnumerable Tracks => GetRecursiveChildren(i => i is Audio); + public IEnumerable