commit
2d0844b5db
|
@ -11,9 +11,6 @@ pr:
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
batch: true
|
batch: true
|
||||||
branches:
|
|
||||||
include:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
- job: main_build
|
- job: main_build
|
||||||
|
@ -71,28 +68,28 @@ jobs:
|
||||||
|
|
||||||
- task: PublishBuildArtifacts@1
|
- task: PublishBuildArtifacts@1
|
||||||
displayName: 'Publish Artifact Naming'
|
displayName: 'Publish Artifact Naming'
|
||||||
condition: eq(variables['BuildConfiguration'], 'Release')
|
condition: and(eq(variables['BuildConfiguration'], 'Release'), succeeded())
|
||||||
inputs:
|
inputs:
|
||||||
PathtoPublish: '$(build.artifactstagingdirectory)/Jellyfin.Server/Emby.Naming.dll'
|
PathtoPublish: '$(build.artifactstagingdirectory)/Jellyfin.Server/Emby.Naming.dll'
|
||||||
artifactName: 'Jellyfin.Naming'
|
artifactName: 'Jellyfin.Naming'
|
||||||
|
|
||||||
- task: PublishBuildArtifacts@1
|
- task: PublishBuildArtifacts@1
|
||||||
displayName: 'Publish Artifact Controller'
|
displayName: 'Publish Artifact Controller'
|
||||||
condition: eq(variables['BuildConfiguration'], 'Release')
|
condition: and(eq(variables['BuildConfiguration'], 'Release'), succeeded())
|
||||||
inputs:
|
inputs:
|
||||||
PathtoPublish: '$(build.artifactstagingdirectory)/Jellyfin.Server/MediaBrowser.Controller.dll'
|
PathtoPublish: '$(build.artifactstagingdirectory)/Jellyfin.Server/MediaBrowser.Controller.dll'
|
||||||
artifactName: 'Jellyfin.Controller'
|
artifactName: 'Jellyfin.Controller'
|
||||||
|
|
||||||
- task: PublishBuildArtifacts@1
|
- task: PublishBuildArtifacts@1
|
||||||
displayName: 'Publish Artifact Model'
|
displayName: 'Publish Artifact Model'
|
||||||
condition: eq(variables['BuildConfiguration'], 'Release')
|
condition: and(eq(variables['BuildConfiguration'], 'Release'), succeeded())
|
||||||
inputs:
|
inputs:
|
||||||
PathtoPublish: '$(build.artifactstagingdirectory)/Jellyfin.Server/MediaBrowser.Model.dll'
|
PathtoPublish: '$(build.artifactstagingdirectory)/Jellyfin.Server/MediaBrowser.Model.dll'
|
||||||
artifactName: 'Jellyfin.Model'
|
artifactName: 'Jellyfin.Model'
|
||||||
|
|
||||||
- task: PublishBuildArtifacts@1
|
- task: PublishBuildArtifacts@1
|
||||||
displayName: 'Publish Artifact Common'
|
displayName: 'Publish Artifact Common'
|
||||||
condition: eq(variables['BuildConfiguration'], 'Release')
|
condition: and(eq(variables['BuildConfiguration'], 'Release'), succeeded())
|
||||||
inputs:
|
inputs:
|
||||||
PathtoPublish: '$(build.artifactstagingdirectory)/Jellyfin.Server/MediaBrowser.Common.dll'
|
PathtoPublish: '$(build.artifactstagingdirectory)/Jellyfin.Server/MediaBrowser.Common.dll'
|
||||||
artifactName: 'Jellyfin.Common'
|
artifactName: 'Jellyfin.Common'
|
||||||
|
@ -102,7 +99,7 @@ jobs:
|
||||||
pool:
|
pool:
|
||||||
vmImage: ubuntu-16.04
|
vmImage: ubuntu-16.04
|
||||||
dependsOn: main_build
|
dependsOn: main_build
|
||||||
condition: succeeded()
|
condition: and(succeeded(), variables['System.PullRequest.PullRequestNumber']) # Only execute if the pullrequest numer is defined. (So not for normal CI builds)
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
Naming:
|
Naming:
|
||||||
|
@ -121,16 +118,28 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- checkout: none
|
- checkout: none
|
||||||
|
|
||||||
- task: NuGetCommand@2
|
- task: DownloadBuildArtifacts@0
|
||||||
displayName: 'Download $(NugetPackageName)'
|
displayName: Download the Reference Assembly Build Artifact
|
||||||
inputs:
|
inputs:
|
||||||
command: custom
|
buildType: 'specific' # Options: current, specific
|
||||||
arguments: 'install $(NugetPackageName) -OutputDirectory $(System.ArtifactsDirectory)/packages -ExcludeVersion -DirectDownload'
|
project: $(System.TeamProjectId) # Required when buildType == Specific
|
||||||
|
pipeline: $(System.DefinitionId) # Required when buildType == Specific, not sure if this will take a name too
|
||||||
|
#specificBuildWithTriggering: false # Optional
|
||||||
|
buildVersionToDownload: 'latestFromBranch' # Required when buildType == Specific# Options: latest, latestFromBranch, specific
|
||||||
|
allowPartiallySucceededBuilds: false # Optional
|
||||||
|
branchName: '$(System.PullRequest.TargetBranch)' # Required when buildType == Specific && BuildVersionToDownload == LatestFromBranch
|
||||||
|
#buildId: # Required when buildType == Specific && BuildVersionToDownload == Specific
|
||||||
|
#tags: # Optional
|
||||||
|
downloadType: 'single' # Options: single, specific
|
||||||
|
artifactName: '$(NugetPackageName)'# Required when downloadType == Single
|
||||||
|
#itemPattern: '**' # Optional
|
||||||
|
downloadPath: '$(System.ArtifactsDirectory)/current-artifacts'
|
||||||
|
#parallelizationLimit: '8' # Optional
|
||||||
|
|
||||||
- task: CopyFiles@2
|
- task: CopyFiles@2
|
||||||
displayName: Copy Nuget Assembly to current-release folder
|
displayName: Copy Nuget Assembly to current-release folder
|
||||||
inputs:
|
inputs:
|
||||||
sourceFolder: $(System.ArtifactsDirectory)/packages/$(NugetPackageName) # Optional
|
sourceFolder: $(System.ArtifactsDirectory)/current-artifacts # Optional
|
||||||
contents: '**/*.dll'
|
contents: '**/*.dll'
|
||||||
targetFolder: $(System.ArtifactsDirectory)/current-release
|
targetFolder: $(System.ArtifactsDirectory)/current-release
|
||||||
cleanTargetFolder: true # Optional
|
cleanTargetFolder: true # Optional
|
||||||
|
@ -138,7 +147,7 @@ jobs:
|
||||||
flattenFolders: true # Optional
|
flattenFolders: true # Optional
|
||||||
|
|
||||||
- task: DownloadBuildArtifacts@0
|
- task: DownloadBuildArtifacts@0
|
||||||
displayName: Download the Assembly Build Artifact
|
displayName: Download the New Assembly Build Artifact
|
||||||
inputs:
|
inputs:
|
||||||
buildType: 'current' # Options: current, specific
|
buildType: 'current' # Options: current, specific
|
||||||
allowPartiallySucceededBuilds: false # Optional
|
allowPartiallySucceededBuilds: false # Optional
|
||||||
|
|
81
.drone.yml
81
.drone.yml
|
@ -28,84 +28,3 @@ steps:
|
||||||
commands:
|
commands:
|
||||||
- dotnet publish "Jellyfin.Server" --configuration Release --output "../ci/ci-release"
|
- dotnet publish "Jellyfin.Server" --configuration Release --output "../ci/ci-release"
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
kind: pipeline
|
|
||||||
name: check-abi
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: submodules
|
|
||||||
image: docker:git
|
|
||||||
commands:
|
|
||||||
- git submodule update --init --recursive
|
|
||||||
|
|
||||||
- name: build
|
|
||||||
image: microsoft/dotnet:2-sdk
|
|
||||||
commands:
|
|
||||||
- dotnet publish "Jellyfin.Server" --configuration Release --output "../ci/ci-release"
|
|
||||||
|
|
||||||
- name: clone-dotnet-compat
|
|
||||||
image: docker:git
|
|
||||||
commands:
|
|
||||||
- git clone --depth 1 https://github.com/EraYaN/dotnet-compatibility ci/dotnet-compatibility
|
|
||||||
|
|
||||||
- name: build-dotnet-compat
|
|
||||||
image: microsoft/dotnet:2-sdk
|
|
||||||
commands:
|
|
||||||
- dotnet publish "ci/dotnet-compatibility/CompatibilityCheckerCoreCLI" --configuration Release --output "../../ci-tools"
|
|
||||||
|
|
||||||
- name: download-last-nuget-release-common
|
|
||||||
image: plugins/download
|
|
||||||
settings:
|
|
||||||
source: https://www.nuget.org/api/v2/package/Jellyfin.Common
|
|
||||||
destination: ci/Jellyfin.Common.nupkg
|
|
||||||
|
|
||||||
- name: download-last-nuget-release-model
|
|
||||||
image: plugins/download
|
|
||||||
settings:
|
|
||||||
source: https://www.nuget.org/api/v2/package/Jellyfin.Model
|
|
||||||
destination: ci/Jellyfin.Model.nupkg
|
|
||||||
|
|
||||||
- name: download-last-nuget-release-controller
|
|
||||||
image: plugins/download
|
|
||||||
settings:
|
|
||||||
source: https://www.nuget.org/api/v2/package/Jellyfin.Controller
|
|
||||||
destination: ci/Jellyfin.Controller.nupkg
|
|
||||||
|
|
||||||
- name: download-last-nuget-release-naming
|
|
||||||
image: plugins/download
|
|
||||||
settings:
|
|
||||||
source: https://www.nuget.org/api/v2/package/Jellyfin.Naming
|
|
||||||
destination: ci/Jellyfin.Naming.nupkg
|
|
||||||
|
|
||||||
- name: extract-downloaded-nuget-packages
|
|
||||||
image: garthk/unzip
|
|
||||||
commands:
|
|
||||||
- unzip -j ci/Jellyfin.Common.nupkg "*.dll" -d ci/nuget-packages
|
|
||||||
- unzip -j ci/Jellyfin.Model.nupkg "*.dll" -d ci/nuget-packages
|
|
||||||
- unzip -j ci/Jellyfin.Controller.nupkg "*.dll" -d ci/nuget-packages
|
|
||||||
- unzip -j ci/Jellyfin.Naming.nupkg "*.dll" -d ci/nuget-packages
|
|
||||||
|
|
||||||
- name: run-dotnet-compat-common
|
|
||||||
image: microsoft/dotnet:2-runtime
|
|
||||||
err_ignore: true
|
|
||||||
commands:
|
|
||||||
- dotnet ci/ci-tools/CompatibilityCheckerCoreCLI.dll ci/nuget-packages/MediaBrowser.Common.dll ci/ci-release/MediaBrowser.Common.dll
|
|
||||||
|
|
||||||
- name: run-dotnet-compat-model
|
|
||||||
image: microsoft/dotnet:2-runtime
|
|
||||||
err_ignore: true
|
|
||||||
commands:
|
|
||||||
- dotnet ci/ci-tools/CompatibilityCheckerCoreCLI.dll ci/nuget-packages/MediaBrowser.Model.dll ci/ci-release/MediaBrowser.Model.dll
|
|
||||||
|
|
||||||
- name: run-dotnet-compat-controller
|
|
||||||
image: microsoft/dotnet:2-runtime
|
|
||||||
err_ignore: true
|
|
||||||
commands:
|
|
||||||
- dotnet ci/ci-tools/CompatibilityCheckerCoreCLI.dll ci/nuget-packages/MediaBrowser.Controller.dll ci/ci-release/MediaBrowser.Controller.dll
|
|
||||||
|
|
||||||
- name: run-dotnet-compat-naming
|
|
||||||
image: microsoft/dotnet:2-runtime
|
|
||||||
err_ignore: true
|
|
||||||
commands:
|
|
||||||
- dotnet ci/ci-tools/CompatibilityCheckerCoreCLI.dll ci/nuget-packages/Emby.Naming.dll ci/ci-release/Emby.Naming.dll
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Jellyfin Project")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
[assembly: AssemblyProduct("Jellyfin Server")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2016 CinemaSquid. Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
[assembly: AssemblyCopyright("Copyright © 2016 CinemaSquid. Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
|
@ -15,7 +15,7 @@ RUN apt-get update \
|
||||||
libfontconfig1 \
|
libfontconfig1 \
|
||||||
&& apt-get clean autoclean \
|
&& apt-get clean autoclean \
|
||||||
&& apt-get autoremove \
|
&& apt-get autoremove \
|
||||||
&& rm -rf /var/lib/{apt,dpkg,cache,log} \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& mkdir -p /cache /config /media \
|
&& mkdir -p /cache /config /media \
|
||||||
&& chmod 777 /cache /config /media
|
&& chmod 777 /cache /config /media
|
||||||
COPY --from=ffmpeg / /
|
COPY --from=ffmpeg / /
|
||||||
|
@ -31,5 +31,4 @@ VOLUME /cache /config /media
|
||||||
ENTRYPOINT dotnet /jellyfin/jellyfin.dll \
|
ENTRYPOINT dotnet /jellyfin/jellyfin.dll \
|
||||||
--datadir /config \
|
--datadir /config \
|
||||||
--cachedir /cache \
|
--cachedir /cache \
|
||||||
--ffmpeg /usr/local/bin/ffmpeg \
|
--ffmpeg /usr/local/bin/ffmpeg
|
||||||
--ffprobe /usr/local/bin/ffprobe
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ FROM microsoft/dotnet:${DOTNET_VERSION}-runtime-stretch-slim-arm32v7
|
||||||
COPY --from=qemu_extract qemu-arm-static /usr/bin
|
COPY --from=qemu_extract qemu-arm-static /usr/bin
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install --no-install-recommends --no-install-suggests -y ffmpeg \
|
&& apt-get install --no-install-recommends --no-install-suggests -y ffmpeg \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& mkdir -p /cache /config /media \
|
&& mkdir -p /cache /config /media \
|
||||||
&& chmod 777 /cache /config /media
|
&& chmod 777 /cache /config /media
|
||||||
COPY --from=builder /jellyfin /jellyfin
|
COPY --from=builder /jellyfin /jellyfin
|
||||||
|
@ -39,5 +40,4 @@ VOLUME /cache /config /media
|
||||||
ENTRYPOINT dotnet /jellyfin/jellyfin.dll \
|
ENTRYPOINT dotnet /jellyfin/jellyfin.dll \
|
||||||
--datadir /config \
|
--datadir /config \
|
||||||
--cachedir /cache \
|
--cachedir /cache \
|
||||||
--ffmpeg /usr/bin/ffmpeg \
|
--ffmpeg /usr/bin/ffmpeg
|
||||||
--ffprobe /usr/bin/ffprobe
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ FROM microsoft/dotnet:${DOTNET_VERSION}-runtime-stretch-slim-arm64v8
|
||||||
COPY --from=qemu_extract qemu-aarch64-static /usr/bin
|
COPY --from=qemu_extract qemu-aarch64-static /usr/bin
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install --no-install-recommends --no-install-suggests -y ffmpeg \
|
&& apt-get install --no-install-recommends --no-install-suggests -y ffmpeg \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& mkdir -p /cache /config /media \
|
&& mkdir -p /cache /config /media \
|
||||||
&& chmod 777 /cache /config /media
|
&& chmod 777 /cache /config /media
|
||||||
COPY --from=builder /jellyfin /jellyfin
|
COPY --from=builder /jellyfin /jellyfin
|
||||||
|
@ -40,5 +41,4 @@ VOLUME /cache /config /media
|
||||||
ENTRYPOINT dotnet /jellyfin/jellyfin.dll \
|
ENTRYPOINT dotnet /jellyfin/jellyfin.dll \
|
||||||
--datadir /config \
|
--datadir /config \
|
||||||
--cachedir /cache \
|
--cachedir /cache \
|
||||||
--ffmpeg /usr/bin/ffmpeg \
|
--ffmpeg /usr/bin/ffmpeg
|
||||||
--ffprobe /usr/bin/ffprobe
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Jellyfin Project")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
[assembly: AssemblyProduct("Jellyfin Server")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
|
@ -2,7 +2,6 @@ using Emby.Dlna.Service;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Dlna;
|
using MediaBrowser.Controller.Dlna;
|
||||||
using MediaBrowser.Model.Xml;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Dlna.ConnectionManager
|
namespace Emby.Dlna.ConnectionManager
|
||||||
|
@ -12,15 +11,13 @@ namespace Emby.Dlna.ConnectionManager
|
||||||
private readonly IDlnaManager _dlna;
|
private readonly IDlnaManager _dlna;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
protected readonly IXmlReaderSettingsFactory XmlReaderSettingsFactory;
|
|
||||||
|
|
||||||
public ConnectionManager(IDlnaManager dlna, IServerConfigurationManager config, ILogger logger, IHttpClient httpClient, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
|
public ConnectionManager(IDlnaManager dlna, IServerConfigurationManager config, ILogger logger, IHttpClient httpClient)
|
||||||
: base(logger, httpClient)
|
: base(logger, httpClient)
|
||||||
{
|
{
|
||||||
_dlna = dlna;
|
_dlna = dlna;
|
||||||
_config = config;
|
_config = config;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetServiceXml()
|
public string GetServiceXml()
|
||||||
|
@ -33,7 +30,7 @@ namespace Emby.Dlna.ConnectionManager
|
||||||
var profile = _dlna.GetProfile(request.Headers) ??
|
var profile = _dlna.GetProfile(request.Headers) ??
|
||||||
_dlna.GetDefaultProfile();
|
_dlna.GetDefaultProfile();
|
||||||
|
|
||||||
return new ControlHandler(_config, _logger, XmlReaderSettingsFactory, profile).ProcessControlRequest(request);
|
return new ControlHandler(_config, _logger, profile).ProcessControlRequest(request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ using Emby.Dlna.Service;
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Model.Dlna;
|
using MediaBrowser.Model.Dlna;
|
||||||
using MediaBrowser.Model.Xml;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Dlna.ConnectionManager
|
namespace Emby.Dlna.ConnectionManager
|
||||||
|
@ -32,7 +31,8 @@ namespace Emby.Dlna.ConnectionManager
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlHandler(IServerConfigurationManager config, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory, DeviceProfile profile) : base(config, logger, xmlReaderSettingsFactory)
|
public ControlHandler(IServerConfigurationManager config, ILogger logger, DeviceProfile profile)
|
||||||
|
: base(config, logger)
|
||||||
{
|
{
|
||||||
_profile = profile;
|
_profile = profile;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ using MediaBrowser.Controller.MediaEncoding;
|
||||||
using MediaBrowser.Controller.TV;
|
using MediaBrowser.Controller.TV;
|
||||||
using MediaBrowser.Model.Dlna;
|
using MediaBrowser.Model.Dlna;
|
||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
using MediaBrowser.Model.Xml;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Dlna.ContentDirectory
|
namespace Emby.Dlna.ContentDirectory
|
||||||
|
@ -28,7 +27,6 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
private readonly IMediaSourceManager _mediaSourceManager;
|
private readonly IMediaSourceManager _mediaSourceManager;
|
||||||
private readonly IUserViewManager _userViewManager;
|
private readonly IUserViewManager _userViewManager;
|
||||||
private readonly IMediaEncoder _mediaEncoder;
|
private readonly IMediaEncoder _mediaEncoder;
|
||||||
protected readonly IXmlReaderSettingsFactory XmlReaderSettingsFactory;
|
|
||||||
private readonly ITVSeriesManager _tvSeriesManager;
|
private readonly ITVSeriesManager _tvSeriesManager;
|
||||||
|
|
||||||
public ContentDirectory(IDlnaManager dlna,
|
public ContentDirectory(IDlnaManager dlna,
|
||||||
|
@ -38,7 +36,12 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
IServerConfigurationManager config,
|
IServerConfigurationManager config,
|
||||||
IUserManager userManager,
|
IUserManager userManager,
|
||||||
ILogger logger,
|
ILogger logger,
|
||||||
IHttpClient httpClient, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, IUserViewManager userViewManager, IMediaEncoder mediaEncoder, IXmlReaderSettingsFactory xmlReaderSettingsFactory, ITVSeriesManager tvSeriesManager)
|
IHttpClient httpClient,
|
||||||
|
ILocalizationManager localization,
|
||||||
|
IMediaSourceManager mediaSourceManager,
|
||||||
|
IUserViewManager userViewManager,
|
||||||
|
IMediaEncoder mediaEncoder,
|
||||||
|
ITVSeriesManager tvSeriesManager)
|
||||||
: base(logger, httpClient)
|
: base(logger, httpClient)
|
||||||
{
|
{
|
||||||
_dlna = dlna;
|
_dlna = dlna;
|
||||||
|
@ -51,7 +54,6 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
_mediaSourceManager = mediaSourceManager;
|
_mediaSourceManager = mediaSourceManager;
|
||||||
_userViewManager = userViewManager;
|
_userViewManager = userViewManager;
|
||||||
_mediaEncoder = mediaEncoder;
|
_mediaEncoder = mediaEncoder;
|
||||||
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
|
|
||||||
_tvSeriesManager = tvSeriesManager;
|
_tvSeriesManager = tvSeriesManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +96,6 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
_mediaSourceManager,
|
_mediaSourceManager,
|
||||||
_userViewManager,
|
_userViewManager,
|
||||||
_mediaEncoder,
|
_mediaEncoder,
|
||||||
XmlReaderSettingsFactory,
|
|
||||||
_tvSeriesManager)
|
_tvSeriesManager)
|
||||||
.ProcessControlRequest(request);
|
.ProcessControlRequest(request);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ using MediaBrowser.Model.Dlna;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
using MediaBrowser.Model.Xml;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Dlna.ContentDirectory
|
namespace Emby.Dlna.ContentDirectory
|
||||||
|
@ -51,8 +50,22 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
|
|
||||||
private readonly DeviceProfile _profile;
|
private readonly DeviceProfile _profile;
|
||||||
|
|
||||||
public ControlHandler(ILogger logger, ILibraryManager libraryManager, DeviceProfile profile, string serverAddress, string accessToken, IImageProcessor imageProcessor, IUserDataManager userDataManager, User user, int systemUpdateId, IServerConfigurationManager config, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, IUserViewManager userViewManager, IMediaEncoder mediaEncoder, IXmlReaderSettingsFactory xmlReaderSettingsFactory, ITVSeriesManager tvSeriesManager)
|
public ControlHandler(
|
||||||
: base(config, logger, xmlReaderSettingsFactory)
|
ILogger logger,
|
||||||
|
ILibraryManager libraryManager,
|
||||||
|
DeviceProfile profile,
|
||||||
|
string serverAddress,
|
||||||
|
string accessToken,
|
||||||
|
IImageProcessor imageProcessor,
|
||||||
|
IUserDataManager userDataManager,
|
||||||
|
User user, int systemUpdateId,
|
||||||
|
IServerConfigurationManager config,
|
||||||
|
ILocalizationManager localization,
|
||||||
|
IMediaSourceManager mediaSourceManager,
|
||||||
|
IUserViewManager userViewManager,
|
||||||
|
IMediaEncoder mediaEncoder,
|
||||||
|
ITVSeriesManager tvSeriesManager)
|
||||||
|
: base(config, logger)
|
||||||
{
|
{
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
_userDataManager = userDataManager;
|
_userDataManager = userDataManager;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Emby.Dlna.PlayTo;
|
using Emby.Dlna.PlayTo;
|
||||||
|
@ -20,10 +19,10 @@ using MediaBrowser.Model.Dlna;
|
||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
using MediaBrowser.Model.Xml;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Rssdp;
|
using Rssdp;
|
||||||
using Rssdp.Infrastructure;
|
using Rssdp.Infrastructure;
|
||||||
|
using OperatingSystem = MediaBrowser.Common.System.OperatingSystem;
|
||||||
|
|
||||||
namespace Emby.Dlna.Main
|
namespace Emby.Dlna.Main
|
||||||
{
|
{
|
||||||
|
@ -50,7 +49,6 @@ namespace Emby.Dlna.Main
|
||||||
private SsdpDevicePublisher _Publisher;
|
private SsdpDevicePublisher _Publisher;
|
||||||
|
|
||||||
private readonly ISocketFactory _socketFactory;
|
private readonly ISocketFactory _socketFactory;
|
||||||
private readonly IEnvironmentInfo _environmentInfo;
|
|
||||||
private readonly INetworkManager _networkManager;
|
private readonly INetworkManager _networkManager;
|
||||||
|
|
||||||
private ISsdpCommunicationsServer _communicationsServer;
|
private ISsdpCommunicationsServer _communicationsServer;
|
||||||
|
@ -76,10 +74,8 @@ namespace Emby.Dlna.Main
|
||||||
IDeviceDiscovery deviceDiscovery,
|
IDeviceDiscovery deviceDiscovery,
|
||||||
IMediaEncoder mediaEncoder,
|
IMediaEncoder mediaEncoder,
|
||||||
ISocketFactory socketFactory,
|
ISocketFactory socketFactory,
|
||||||
IEnvironmentInfo environmentInfo,
|
|
||||||
INetworkManager networkManager,
|
INetworkManager networkManager,
|
||||||
IUserViewManager userViewManager,
|
IUserViewManager userViewManager,
|
||||||
IXmlReaderSettingsFactory xmlReaderSettingsFactory,
|
|
||||||
ITVSeriesManager tvSeriesManager)
|
ITVSeriesManager tvSeriesManager)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
|
@ -96,11 +92,11 @@ namespace Emby.Dlna.Main
|
||||||
_deviceDiscovery = deviceDiscovery;
|
_deviceDiscovery = deviceDiscovery;
|
||||||
_mediaEncoder = mediaEncoder;
|
_mediaEncoder = mediaEncoder;
|
||||||
_socketFactory = socketFactory;
|
_socketFactory = socketFactory;
|
||||||
_environmentInfo = environmentInfo;
|
|
||||||
_networkManager = networkManager;
|
_networkManager = networkManager;
|
||||||
_logger = loggerFactory.CreateLogger("Dlna");
|
_logger = loggerFactory.CreateLogger("Dlna");
|
||||||
|
|
||||||
ContentDirectory = new ContentDirectory.ContentDirectory(dlnaManager,
|
ContentDirectory = new ContentDirectory.ContentDirectory(
|
||||||
|
dlnaManager,
|
||||||
userDataManager,
|
userDataManager,
|
||||||
imageProcessor,
|
imageProcessor,
|
||||||
libraryManager,
|
libraryManager,
|
||||||
|
@ -112,12 +108,11 @@ namespace Emby.Dlna.Main
|
||||||
mediaSourceManager,
|
mediaSourceManager,
|
||||||
userViewManager,
|
userViewManager,
|
||||||
mediaEncoder,
|
mediaEncoder,
|
||||||
xmlReaderSettingsFactory,
|
|
||||||
tvSeriesManager);
|
tvSeriesManager);
|
||||||
|
|
||||||
ConnectionManager = new ConnectionManager.ConnectionManager(dlnaManager, config, _logger, httpClient, xmlReaderSettingsFactory);
|
ConnectionManager = new ConnectionManager.ConnectionManager(dlnaManager, config, _logger, httpClient);
|
||||||
|
|
||||||
MediaReceiverRegistrar = new MediaReceiverRegistrar.MediaReceiverRegistrar(_logger, httpClient, config, xmlReaderSettingsFactory);
|
MediaReceiverRegistrar = new MediaReceiverRegistrar.MediaReceiverRegistrar(_logger, httpClient, config);
|
||||||
Current = this;
|
Current = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,8 +164,8 @@ namespace Emby.Dlna.Main
|
||||||
{
|
{
|
||||||
if (_communicationsServer == null)
|
if (_communicationsServer == null)
|
||||||
{
|
{
|
||||||
var enableMultiSocketBinding = _environmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows ||
|
var enableMultiSocketBinding = OperatingSystem.Id == OperatingSystemId.Windows ||
|
||||||
_environmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Linux;
|
OperatingSystem.Id == OperatingSystemId.Linux;
|
||||||
|
|
||||||
_communicationsServer = new SsdpCommunicationsServer(_config, _socketFactory, _networkManager, _logger, enableMultiSocketBinding)
|
_communicationsServer = new SsdpCommunicationsServer(_config, _socketFactory, _networkManager, _logger, enableMultiSocketBinding)
|
||||||
{
|
{
|
||||||
|
@ -230,7 +225,7 @@ namespace Emby.Dlna.Main
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_Publisher = new SsdpDevicePublisher(_communicationsServer, _networkManager, _environmentInfo.OperatingSystemName, _environmentInfo.OperatingSystemVersion, _config.GetDlnaConfiguration().SendOnlyMatchedHost);
|
_Publisher = new SsdpDevicePublisher(_communicationsServer, _networkManager, OperatingSystem.Name, Environment.OSVersion.VersionString, _config.GetDlnaConfiguration().SendOnlyMatchedHost);
|
||||||
_Publisher.LogFunction = LogMessage;
|
_Publisher.LogFunction = LogMessage;
|
||||||
_Publisher.SupportPnpRootDevice = false;
|
_Publisher.SupportPnpRootDevice = false;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||||
using Emby.Dlna.Service;
|
using Emby.Dlna.Service;
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Model.Xml;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Dlna.MediaReceiverRegistrar
|
namespace Emby.Dlna.MediaReceiverRegistrar
|
||||||
|
@ -36,8 +35,8 @@ namespace Emby.Dlna.MediaReceiverRegistrar
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlHandler(IServerConfigurationManager config, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
|
public ControlHandler(IServerConfigurationManager config, ILogger logger)
|
||||||
: base(config, logger, xmlReaderSettingsFactory)
|
: base(config, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using Emby.Dlna.Service;
|
using Emby.Dlna.Service;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Model.Xml;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Dlna.MediaReceiverRegistrar
|
namespace Emby.Dlna.MediaReceiverRegistrar
|
||||||
|
@ -9,13 +8,11 @@ namespace Emby.Dlna.MediaReceiverRegistrar
|
||||||
public class MediaReceiverRegistrar : BaseService, IMediaReceiverRegistrar
|
public class MediaReceiverRegistrar : BaseService, IMediaReceiverRegistrar
|
||||||
{
|
{
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
protected readonly IXmlReaderSettingsFactory XmlReaderSettingsFactory;
|
|
||||||
|
|
||||||
public MediaReceiverRegistrar(ILogger logger, IHttpClient httpClient, IServerConfigurationManager config, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
|
public MediaReceiverRegistrar(ILogger logger, IHttpClient httpClient, IServerConfigurationManager config)
|
||||||
: base(logger, httpClient)
|
: base(logger, httpClient)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetServiceXml()
|
public string GetServiceXml()
|
||||||
|
@ -27,7 +24,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
|
||||||
{
|
{
|
||||||
return new ControlHandler(
|
return new ControlHandler(
|
||||||
_config,
|
_config,
|
||||||
Logger, XmlReaderSettingsFactory)
|
Logger)
|
||||||
.ProcessControlRequest(request);
|
.ProcessControlRequest(request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,8 @@ using System.Resources;
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Jellyfin Project")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
[assembly: AssemblyProduct("Jellyfin Server")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
|
@ -7,7 +7,6 @@ using System.Xml;
|
||||||
using Emby.Dlna.Didl;
|
using Emby.Dlna.Didl;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Extensions;
|
using MediaBrowser.Controller.Extensions;
|
||||||
using MediaBrowser.Model.Xml;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Dlna.Service
|
namespace Emby.Dlna.Service
|
||||||
|
@ -18,13 +17,11 @@ namespace Emby.Dlna.Service
|
||||||
|
|
||||||
protected readonly IServerConfigurationManager Config;
|
protected readonly IServerConfigurationManager Config;
|
||||||
protected readonly ILogger _logger;
|
protected readonly ILogger _logger;
|
||||||
protected readonly IXmlReaderSettingsFactory XmlReaderSettingsFactory;
|
|
||||||
|
|
||||||
protected BaseControlHandler(IServerConfigurationManager config, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
|
protected BaseControlHandler(IServerConfigurationManager config, ILogger logger)
|
||||||
{
|
{
|
||||||
Config = config;
|
Config = config;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlResponse ProcessControlRequest(ControlRequest request)
|
public ControlResponse ProcessControlRequest(ControlRequest request)
|
||||||
|
@ -61,11 +58,13 @@ namespace Emby.Dlna.Service
|
||||||
|
|
||||||
using (var streamReader = new StreamReader(request.InputXml))
|
using (var streamReader = new StreamReader(request.InputXml))
|
||||||
{
|
{
|
||||||
var readerSettings = XmlReaderSettingsFactory.Create(false);
|
var readerSettings = new XmlReaderSettings()
|
||||||
|
{
|
||||||
readerSettings.CheckCharacters = false;
|
ValidationType = ValidationType.None,
|
||||||
readerSettings.IgnoreProcessingInstructions = true;
|
CheckCharacters = false,
|
||||||
readerSettings.IgnoreComments = true;
|
IgnoreProcessingInstructions = true,
|
||||||
|
IgnoreComments = true
|
||||||
|
};
|
||||||
|
|
||||||
using (var reader = XmlReader.Create(streamReader, readerSettings))
|
using (var reader = XmlReader.Create(streamReader, readerSettings))
|
||||||
{
|
{
|
||||||
|
|
|
@ -180,6 +180,12 @@ namespace Emby.Drawing
|
||||||
|
|
||||||
var supportedImageInfo = await GetSupportedImage(originalImagePath, dateModified).ConfigureAwait(false);
|
var supportedImageInfo = await GetSupportedImage(originalImagePath, dateModified).ConfigureAwait(false);
|
||||||
originalImagePath = supportedImageInfo.path;
|
originalImagePath = supportedImageInfo.path;
|
||||||
|
|
||||||
|
if (!File.Exists(originalImagePath))
|
||||||
|
{
|
||||||
|
return (originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified);
|
||||||
|
}
|
||||||
|
|
||||||
dateModified = supportedImageInfo.dateModified;
|
dateModified = supportedImageInfo.dateModified;
|
||||||
bool requiresTransparency = TransparentImageTypes.Contains(Path.GetExtension(originalImagePath));
|
bool requiresTransparency = TransparentImageTypes.Contains(Path.GetExtension(originalImagePath));
|
||||||
|
|
||||||
|
@ -265,8 +271,6 @@ namespace Emby.Drawing
|
||||||
{
|
{
|
||||||
// If it fails for whatever reason, return the original image
|
// If it fails for whatever reason, return the original image
|
||||||
_logger.LogError(ex, "Error encoding image");
|
_logger.LogError(ex, "Error encoding image");
|
||||||
|
|
||||||
// Just spit out the original file if all the options are default
|
|
||||||
return (originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified);
|
return (originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Jellyfin Project")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
[assembly: AssemblyProduct("Jellyfin Server")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ using MediaBrowser.Model.Diagnostics;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using OperatingSystem = MediaBrowser.Common.System.OperatingSystem;
|
||||||
|
|
||||||
namespace IsoMounter
|
namespace IsoMounter
|
||||||
{
|
{
|
||||||
|
@ -17,7 +18,6 @@ namespace IsoMounter
|
||||||
|
|
||||||
#region Private Fields
|
#region Private Fields
|
||||||
|
|
||||||
private readonly IEnvironmentInfo EnvironmentInfo;
|
|
||||||
private readonly bool ExecutablesAvailable;
|
private readonly bool ExecutablesAvailable;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly string MountCommand;
|
private readonly string MountCommand;
|
||||||
|
@ -30,10 +30,8 @@ namespace IsoMounter
|
||||||
|
|
||||||
#region Constructor(s)
|
#region Constructor(s)
|
||||||
|
|
||||||
public LinuxIsoManager(ILogger logger, IEnvironmentInfo environment, IProcessFactory processFactory)
|
public LinuxIsoManager(ILogger logger, IProcessFactory processFactory)
|
||||||
{
|
{
|
||||||
|
|
||||||
EnvironmentInfo = environment;
|
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
ProcessFactory = processFactory;
|
ProcessFactory = processFactory;
|
||||||
|
|
||||||
|
@ -109,7 +107,7 @@ namespace IsoMounter
|
||||||
public bool CanMount(string path)
|
public bool CanMount(string path)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Linux)
|
if (OperatingSystem.Id != OperatingSystemId.Linux)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +116,7 @@ namespace IsoMounter
|
||||||
Name,
|
Name,
|
||||||
path,
|
path,
|
||||||
Path.GetExtension(path),
|
Path.GetExtension(path),
|
||||||
EnvironmentInfo.OperatingSystem,
|
OperatingSystem.Name,
|
||||||
ExecutablesAvailable
|
ExecutablesAvailable
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Jellyfin Project")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
[assembly: AssemblyProduct("Jellyfin Server")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
|
@ -9,8 +9,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Jellyfin Project")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
[assembly: AssemblyProduct("Jellyfin Server")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
|
@ -9,8 +9,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Jellyfin Project")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
[assembly: AssemblyProduct("Jellyfin Server")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
|
@ -9,8 +9,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Jellyfin Project")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
[assembly: AssemblyProduct("Jellyfin Server")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
|
@ -30,13 +30,10 @@ namespace Emby.Server.Implementations.Activity
|
||||||
public class ActivityLogEntryPoint : IServerEntryPoint
|
public class ActivityLogEntryPoint : IServerEntryPoint
|
||||||
{
|
{
|
||||||
private readonly IInstallationManager _installationManager;
|
private readonly IInstallationManager _installationManager;
|
||||||
|
|
||||||
//private readonly ILogger _logger;
|
|
||||||
private readonly ISessionManager _sessionManager;
|
private readonly ISessionManager _sessionManager;
|
||||||
private readonly ITaskManager _taskManager;
|
private readonly ITaskManager _taskManager;
|
||||||
private readonly IActivityManager _activityManager;
|
private readonly IActivityManager _activityManager;
|
||||||
private readonly ILocalizationManager _localization;
|
private readonly ILocalizationManager _localization;
|
||||||
|
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
private readonly ISubtitleManager _subManager;
|
private readonly ISubtitleManager _subManager;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
|
@ -61,41 +58,37 @@ namespace Emby.Server.Implementations.Activity
|
||||||
|
|
||||||
public Task RunAsync()
|
public Task RunAsync()
|
||||||
{
|
{
|
||||||
_taskManager.TaskCompleted += _taskManager_TaskCompleted;
|
_taskManager.TaskCompleted += OnTaskCompleted;
|
||||||
|
|
||||||
_installationManager.PluginInstalled += _installationManager_PluginInstalled;
|
_installationManager.PluginInstalled += OnPluginInstalled;
|
||||||
_installationManager.PluginUninstalled += _installationManager_PluginUninstalled;
|
_installationManager.PluginUninstalled += OnPluginUninstalled;
|
||||||
_installationManager.PluginUpdated += _installationManager_PluginUpdated;
|
_installationManager.PluginUpdated += OnPluginUpdated;
|
||||||
_installationManager.PackageInstallationFailed += _installationManager_PackageInstallationFailed;
|
_installationManager.PackageInstallationFailed += OnPackageInstallationFailed;
|
||||||
|
|
||||||
_sessionManager.SessionStarted += _sessionManager_SessionStarted;
|
_sessionManager.SessionStarted += OnSessionStarted;
|
||||||
_sessionManager.AuthenticationFailed += _sessionManager_AuthenticationFailed;
|
_sessionManager.AuthenticationFailed += OnAuthenticationFailed;
|
||||||
_sessionManager.AuthenticationSucceeded += _sessionManager_AuthenticationSucceeded;
|
_sessionManager.AuthenticationSucceeded += OnAuthenticationSucceeded;
|
||||||
_sessionManager.SessionEnded += _sessionManager_SessionEnded;
|
_sessionManager.SessionEnded += OnSessionEnded;
|
||||||
|
|
||||||
_sessionManager.PlaybackStart += _sessionManager_PlaybackStart;
|
_sessionManager.PlaybackStart += OnPlaybackStart;
|
||||||
_sessionManager.PlaybackStopped += _sessionManager_PlaybackStopped;
|
_sessionManager.PlaybackStopped += OnPlaybackStopped;
|
||||||
|
|
||||||
//_subManager.SubtitlesDownloaded += _subManager_SubtitlesDownloaded;
|
_subManager.SubtitleDownloadFailure += OnSubtitleDownloadFailure;
|
||||||
_subManager.SubtitleDownloadFailure += _subManager_SubtitleDownloadFailure;
|
|
||||||
|
|
||||||
_userManager.UserCreated += _userManager_UserCreated;
|
_userManager.UserCreated += OnUserCreated;
|
||||||
_userManager.UserPasswordChanged += _userManager_UserPasswordChanged;
|
_userManager.UserPasswordChanged += OnUserPasswordChanged;
|
||||||
_userManager.UserDeleted += _userManager_UserDeleted;
|
_userManager.UserDeleted += OnUserDeleted;
|
||||||
_userManager.UserPolicyUpdated += _userManager_UserPolicyUpdated;
|
_userManager.UserPolicyUpdated += OnUserPolicyUpdated;
|
||||||
_userManager.UserLockedOut += _userManager_UserLockedOut;
|
_userManager.UserLockedOut += OnUserLockedOut;
|
||||||
|
|
||||||
//_config.ConfigurationUpdated += _config_ConfigurationUpdated;
|
_deviceManager.CameraImageUploaded += OnCameraImageUploaded;
|
||||||
//_config.NamedConfigurationUpdated += _config_NamedConfigurationUpdated;
|
|
||||||
|
|
||||||
_deviceManager.CameraImageUploaded += _deviceManager_CameraImageUploaded;
|
_appHost.ApplicationUpdated += OnApplicationUpdated;
|
||||||
|
|
||||||
_appHost.ApplicationUpdated += _appHost_ApplicationUpdated;
|
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _deviceManager_CameraImageUploaded(object sender, GenericEventArgs<CameraImageUploadInfo> e)
|
private void OnCameraImageUploaded(object sender, GenericEventArgs<CameraImageUploadInfo> e)
|
||||||
{
|
{
|
||||||
CreateLogEntry(new ActivityLogEntry
|
CreateLogEntry(new ActivityLogEntry
|
||||||
{
|
{
|
||||||
|
@ -104,7 +97,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _userManager_UserLockedOut(object sender, GenericEventArgs<User> e)
|
private void OnUserLockedOut(object sender, GenericEventArgs<User> e)
|
||||||
{
|
{
|
||||||
CreateLogEntry(new ActivityLogEntry
|
CreateLogEntry(new ActivityLogEntry
|
||||||
{
|
{
|
||||||
|
@ -114,7 +107,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _subManager_SubtitleDownloadFailure(object sender, SubtitleDownloadFailureEventArgs e)
|
private void OnSubtitleDownloadFailure(object sender, SubtitleDownloadFailureEventArgs e)
|
||||||
{
|
{
|
||||||
CreateLogEntry(new ActivityLogEntry
|
CreateLogEntry(new ActivityLogEntry
|
||||||
{
|
{
|
||||||
|
@ -125,7 +118,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _sessionManager_PlaybackStopped(object sender, PlaybackStopEventArgs e)
|
private void OnPlaybackStopped(object sender, PlaybackStopEventArgs e)
|
||||||
{
|
{
|
||||||
var item = e.MediaInfo;
|
var item = e.MediaInfo;
|
||||||
|
|
||||||
|
@ -146,7 +139,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var user = e.Users.First();
|
var user = e.Users[0];
|
||||||
|
|
||||||
CreateLogEntry(new ActivityLogEntry
|
CreateLogEntry(new ActivityLogEntry
|
||||||
{
|
{
|
||||||
|
@ -156,7 +149,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _sessionManager_PlaybackStart(object sender, PlaybackProgressEventArgs e)
|
private void OnPlaybackStart(object sender, PlaybackProgressEventArgs e)
|
||||||
{
|
{
|
||||||
var item = e.MediaInfo;
|
var item = e.MediaInfo;
|
||||||
|
|
||||||
|
@ -232,7 +225,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _sessionManager_SessionEnded(object sender, SessionEventArgs e)
|
private void OnSessionEnded(object sender, SessionEventArgs e)
|
||||||
{
|
{
|
||||||
string name;
|
string name;
|
||||||
var session = e.SessionInfo;
|
var session = e.SessionInfo;
|
||||||
|
@ -258,7 +251,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _sessionManager_AuthenticationSucceeded(object sender, GenericEventArgs<AuthenticationResult> e)
|
private void OnAuthenticationSucceeded(object sender, GenericEventArgs<AuthenticationResult> e)
|
||||||
{
|
{
|
||||||
var user = e.Argument.User;
|
var user = e.Argument.User;
|
||||||
|
|
||||||
|
@ -271,7 +264,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _sessionManager_AuthenticationFailed(object sender, GenericEventArgs<AuthenticationRequest> e)
|
private void OnAuthenticationFailed(object sender, GenericEventArgs<AuthenticationRequest> e)
|
||||||
{
|
{
|
||||||
CreateLogEntry(new ActivityLogEntry
|
CreateLogEntry(new ActivityLogEntry
|
||||||
{
|
{
|
||||||
|
@ -282,7 +275,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _appHost_ApplicationUpdated(object sender, GenericEventArgs<PackageVersionInfo> e)
|
private void OnApplicationUpdated(object sender, GenericEventArgs<PackageVersionInfo> e)
|
||||||
{
|
{
|
||||||
CreateLogEntry(new ActivityLogEntry
|
CreateLogEntry(new ActivityLogEntry
|
||||||
{
|
{
|
||||||
|
@ -292,25 +285,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _config_NamedConfigurationUpdated(object sender, ConfigurationUpdateEventArgs e)
|
private void OnUserPolicyUpdated(object sender, GenericEventArgs<User> e)
|
||||||
{
|
|
||||||
CreateLogEntry(new ActivityLogEntry
|
|
||||||
{
|
|
||||||
Name = string.Format(_localization.GetLocalizedString("MessageNamedServerConfigurationUpdatedWithValue"), e.Key),
|
|
||||||
Type = "NamedConfigurationUpdated"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void _config_ConfigurationUpdated(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
CreateLogEntry(new ActivityLogEntry
|
|
||||||
{
|
|
||||||
Name = _localization.GetLocalizedString("MessageServerConfigurationUpdated"),
|
|
||||||
Type = "ServerConfigurationUpdated"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void _userManager_UserPolicyUpdated(object sender, GenericEventArgs<User> e)
|
|
||||||
{
|
{
|
||||||
CreateLogEntry(new ActivityLogEntry
|
CreateLogEntry(new ActivityLogEntry
|
||||||
{
|
{
|
||||||
|
@ -320,7 +295,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _userManager_UserDeleted(object sender, GenericEventArgs<User> e)
|
private void OnUserDeleted(object sender, GenericEventArgs<User> e)
|
||||||
{
|
{
|
||||||
CreateLogEntry(new ActivityLogEntry
|
CreateLogEntry(new ActivityLogEntry
|
||||||
{
|
{
|
||||||
|
@ -329,7 +304,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _userManager_UserPasswordChanged(object sender, GenericEventArgs<User> e)
|
private void OnUserPasswordChanged(object sender, GenericEventArgs<User> e)
|
||||||
{
|
{
|
||||||
CreateLogEntry(new ActivityLogEntry
|
CreateLogEntry(new ActivityLogEntry
|
||||||
{
|
{
|
||||||
|
@ -339,7 +314,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _userManager_UserCreated(object sender, GenericEventArgs<User> e)
|
private void OnUserCreated(object sender, GenericEventArgs<User> e)
|
||||||
{
|
{
|
||||||
CreateLogEntry(new ActivityLogEntry
|
CreateLogEntry(new ActivityLogEntry
|
||||||
{
|
{
|
||||||
|
@ -349,18 +324,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _subManager_SubtitlesDownloaded(object sender, SubtitleDownloadEventArgs e)
|
private void OnSessionStarted(object sender, SessionEventArgs e)
|
||||||
{
|
|
||||||
CreateLogEntry(new ActivityLogEntry
|
|
||||||
{
|
|
||||||
Name = string.Format(_localization.GetLocalizedString("SubtitlesDownloadedForItem"), Notifications.Notifications.GetItemName(e.Item)),
|
|
||||||
Type = "SubtitlesDownloaded",
|
|
||||||
ItemId = e.Item.Id.ToString("N"),
|
|
||||||
ShortOverview = string.Format(_localization.GetLocalizedString("ProviderValue"), e.Provider)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void _sessionManager_SessionStarted(object sender, SessionEventArgs e)
|
|
||||||
{
|
{
|
||||||
string name;
|
string name;
|
||||||
var session = e.SessionInfo;
|
var session = e.SessionInfo;
|
||||||
|
@ -386,7 +350,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _installationManager_PluginUpdated(object sender, GenericEventArgs<Tuple<IPlugin, PackageVersionInfo>> e)
|
private void OnPluginUpdated(object sender, GenericEventArgs<Tuple<IPlugin, PackageVersionInfo>> e)
|
||||||
{
|
{
|
||||||
CreateLogEntry(new ActivityLogEntry
|
CreateLogEntry(new ActivityLogEntry
|
||||||
{
|
{
|
||||||
|
@ -397,7 +361,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _installationManager_PluginUninstalled(object sender, GenericEventArgs<IPlugin> e)
|
private void OnPluginUninstalled(object sender, GenericEventArgs<IPlugin> e)
|
||||||
{
|
{
|
||||||
CreateLogEntry(new ActivityLogEntry
|
CreateLogEntry(new ActivityLogEntry
|
||||||
{
|
{
|
||||||
|
@ -406,7 +370,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _installationManager_PluginInstalled(object sender, GenericEventArgs<PackageVersionInfo> e)
|
private void OnPluginInstalled(object sender, GenericEventArgs<PackageVersionInfo> e)
|
||||||
{
|
{
|
||||||
CreateLogEntry(new ActivityLogEntry
|
CreateLogEntry(new ActivityLogEntry
|
||||||
{
|
{
|
||||||
|
@ -416,7 +380,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _installationManager_PackageInstallationFailed(object sender, InstallationFailedEventArgs e)
|
private void OnPackageInstallationFailed(object sender, InstallationFailedEventArgs e)
|
||||||
{
|
{
|
||||||
var installationInfo = e.InstallationInfo;
|
var installationInfo = e.InstallationInfo;
|
||||||
|
|
||||||
|
@ -429,7 +393,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _taskManager_TaskCompleted(object sender, TaskCompletionEventArgs e)
|
private void OnTaskCompleted(object sender, TaskCompletionEventArgs e)
|
||||||
{
|
{
|
||||||
var result = e.Result;
|
var result = e.Result;
|
||||||
var task = e.Task;
|
var task = e.Task;
|
||||||
|
@ -468,48 +432,36 @@ namespace Emby.Server.Implementations.Activity
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateLogEntry(ActivityLogEntry entry)
|
private void CreateLogEntry(ActivityLogEntry entry)
|
||||||
{
|
=> _activityManager.Create(entry);
|
||||||
try
|
|
||||||
{
|
|
||||||
_activityManager.Create(entry);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// Logged at lower levels
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_taskManager.TaskCompleted -= _taskManager_TaskCompleted;
|
_taskManager.TaskCompleted -= OnTaskCompleted;
|
||||||
|
|
||||||
_installationManager.PluginInstalled -= _installationManager_PluginInstalled;
|
_installationManager.PluginInstalled -= OnPluginInstalled;
|
||||||
_installationManager.PluginUninstalled -= _installationManager_PluginUninstalled;
|
_installationManager.PluginUninstalled -= OnPluginUninstalled;
|
||||||
_installationManager.PluginUpdated -= _installationManager_PluginUpdated;
|
_installationManager.PluginUpdated -= OnPluginUpdated;
|
||||||
_installationManager.PackageInstallationFailed -= _installationManager_PackageInstallationFailed;
|
_installationManager.PackageInstallationFailed -= OnPackageInstallationFailed;
|
||||||
|
|
||||||
_sessionManager.SessionStarted -= _sessionManager_SessionStarted;
|
_sessionManager.SessionStarted -= OnSessionStarted;
|
||||||
_sessionManager.AuthenticationFailed -= _sessionManager_AuthenticationFailed;
|
_sessionManager.AuthenticationFailed -= OnAuthenticationFailed;
|
||||||
_sessionManager.AuthenticationSucceeded -= _sessionManager_AuthenticationSucceeded;
|
_sessionManager.AuthenticationSucceeded -= OnAuthenticationSucceeded;
|
||||||
_sessionManager.SessionEnded -= _sessionManager_SessionEnded;
|
_sessionManager.SessionEnded -= OnSessionEnded;
|
||||||
|
|
||||||
_sessionManager.PlaybackStart -= _sessionManager_PlaybackStart;
|
_sessionManager.PlaybackStart -= OnPlaybackStart;
|
||||||
_sessionManager.PlaybackStopped -= _sessionManager_PlaybackStopped;
|
_sessionManager.PlaybackStopped -= OnPlaybackStopped;
|
||||||
|
|
||||||
_subManager.SubtitleDownloadFailure -= _subManager_SubtitleDownloadFailure;
|
_subManager.SubtitleDownloadFailure -= OnSubtitleDownloadFailure;
|
||||||
|
|
||||||
_userManager.UserCreated -= _userManager_UserCreated;
|
_userManager.UserCreated -= OnUserCreated;
|
||||||
_userManager.UserPasswordChanged -= _userManager_UserPasswordChanged;
|
_userManager.UserPasswordChanged -= OnUserPasswordChanged;
|
||||||
_userManager.UserDeleted -= _userManager_UserDeleted;
|
_userManager.UserDeleted -= OnUserDeleted;
|
||||||
_userManager.UserPolicyUpdated -= _userManager_UserPolicyUpdated;
|
_userManager.UserPolicyUpdated -= OnUserPolicyUpdated;
|
||||||
_userManager.UserLockedOut -= _userManager_UserLockedOut;
|
_userManager.UserLockedOut -= OnUserLockedOut;
|
||||||
|
|
||||||
_config.ConfigurationUpdated -= _config_ConfigurationUpdated;
|
_deviceManager.CameraImageUploaded -= OnCameraImageUploaded;
|
||||||
_config.NamedConfigurationUpdated -= _config_NamedConfigurationUpdated;
|
|
||||||
|
|
||||||
_deviceManager.CameraImageUploaded -= _deviceManager_CameraImageUploaded;
|
_appHost.ApplicationUpdated -= OnApplicationUpdated;
|
||||||
|
|
||||||
_appHost.ApplicationUpdated -= _appHost_ApplicationUpdated;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -531,6 +483,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
values.Add(CreateValueString(years, "year"));
|
values.Add(CreateValueString(years, "year"));
|
||||||
days = days % DaysInYear;
|
days = days % DaysInYear;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of months
|
// Number of months
|
||||||
if (days >= DaysInMonth)
|
if (days >= DaysInMonth)
|
||||||
{
|
{
|
||||||
|
@ -538,25 +491,39 @@ namespace Emby.Server.Implementations.Activity
|
||||||
values.Add(CreateValueString(months, "month"));
|
values.Add(CreateValueString(months, "month"));
|
||||||
days = days % DaysInMonth;
|
days = days % DaysInMonth;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of days
|
// Number of days
|
||||||
if (days >= 1)
|
if (days >= 1)
|
||||||
|
{
|
||||||
values.Add(CreateValueString(days, "day"));
|
values.Add(CreateValueString(days, "day"));
|
||||||
|
}
|
||||||
|
|
||||||
// Number of hours
|
// Number of hours
|
||||||
if (span.Hours >= 1)
|
if (span.Hours >= 1)
|
||||||
|
{
|
||||||
values.Add(CreateValueString(span.Hours, "hour"));
|
values.Add(CreateValueString(span.Hours, "hour"));
|
||||||
|
}
|
||||||
// Number of minutes
|
// Number of minutes
|
||||||
if (span.Minutes >= 1)
|
if (span.Minutes >= 1)
|
||||||
|
{
|
||||||
values.Add(CreateValueString(span.Minutes, "minute"));
|
values.Add(CreateValueString(span.Minutes, "minute"));
|
||||||
|
}
|
||||||
|
|
||||||
// Number of seconds (include when 0 if no other components included)
|
// Number of seconds (include when 0 if no other components included)
|
||||||
if (span.Seconds >= 1 || values.Count == 0)
|
if (span.Seconds >= 1 || values.Count == 0)
|
||||||
|
{
|
||||||
values.Add(CreateValueString(span.Seconds, "second"));
|
values.Add(CreateValueString(span.Seconds, "second"));
|
||||||
|
}
|
||||||
|
|
||||||
// Combine values into string
|
// Combine values into string
|
||||||
var builder = new StringBuilder();
|
var builder = new StringBuilder();
|
||||||
for (int i = 0; i < values.Count; i++)
|
for (int i = 0; i < values.Count; i++)
|
||||||
{
|
{
|
||||||
if (builder.Length > 0)
|
if (builder.Length > 0)
|
||||||
|
{
|
||||||
builder.Append(i == values.Count - 1 ? " and " : ", ");
|
builder.Append(i == values.Count - 1 ? " and " : ", ");
|
||||||
|
}
|
||||||
|
|
||||||
builder.Append(values[i]);
|
builder.Append(values[i]);
|
||||||
}
|
}
|
||||||
// Return result
|
// Return result
|
||||||
|
|
|
@ -17,12 +17,14 @@ namespace Emby.Server.Implementations.AppBase
|
||||||
string programDataPath,
|
string programDataPath,
|
||||||
string logDirectoryPath,
|
string logDirectoryPath,
|
||||||
string configurationDirectoryPath,
|
string configurationDirectoryPath,
|
||||||
string cacheDirectoryPath)
|
string cacheDirectoryPath,
|
||||||
|
string webDirectoryPath)
|
||||||
{
|
{
|
||||||
ProgramDataPath = programDataPath;
|
ProgramDataPath = programDataPath;
|
||||||
LogDirectoryPath = logDirectoryPath;
|
LogDirectoryPath = logDirectoryPath;
|
||||||
ConfigurationDirectoryPath = configurationDirectoryPath;
|
ConfigurationDirectoryPath = configurationDirectoryPath;
|
||||||
CachePath = cacheDirectoryPath;
|
CachePath = cacheDirectoryPath;
|
||||||
|
WebPath = webDirectoryPath;
|
||||||
|
|
||||||
DataPath = Path.Combine(ProgramDataPath, "data");
|
DataPath = Path.Combine(ProgramDataPath, "data");
|
||||||
}
|
}
|
||||||
|
@ -33,6 +35,12 @@ namespace Emby.Server.Implementations.AppBase
|
||||||
/// <value>The program data path.</value>
|
/// <value>The program data path.</value>
|
||||||
public string ProgramDataPath { get; private set; }
|
public string ProgramDataPath { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the path to the web UI resources folder
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The web UI resources path.</value>
|
||||||
|
public string WebPath { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path to the system folder
|
/// Gets the path to the system folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -34,10 +34,8 @@ using Emby.Server.Implementations.IO;
|
||||||
using Emby.Server.Implementations.Library;
|
using Emby.Server.Implementations.Library;
|
||||||
using Emby.Server.Implementations.LiveTv;
|
using Emby.Server.Implementations.LiveTv;
|
||||||
using Emby.Server.Implementations.Localization;
|
using Emby.Server.Implementations.Localization;
|
||||||
using Emby.Server.Implementations.Middleware;
|
|
||||||
using Emby.Server.Implementations.Net;
|
using Emby.Server.Implementations.Net;
|
||||||
using Emby.Server.Implementations.Playlists;
|
using Emby.Server.Implementations.Playlists;
|
||||||
using Emby.Server.Implementations.Reflection;
|
|
||||||
using Emby.Server.Implementations.ScheduledTasks;
|
using Emby.Server.Implementations.ScheduledTasks;
|
||||||
using Emby.Server.Implementations.Security;
|
using Emby.Server.Implementations.Security;
|
||||||
using Emby.Server.Implementations.Serialization;
|
using Emby.Server.Implementations.Serialization;
|
||||||
|
@ -45,7 +43,6 @@ using Emby.Server.Implementations.Session;
|
||||||
using Emby.Server.Implementations.SocketSharp;
|
using Emby.Server.Implementations.SocketSharp;
|
||||||
using Emby.Server.Implementations.TV;
|
using Emby.Server.Implementations.TV;
|
||||||
using Emby.Server.Implementations.Updates;
|
using Emby.Server.Implementations.Updates;
|
||||||
using Emby.Server.Implementations.Xml;
|
|
||||||
using MediaBrowser.Api;
|
using MediaBrowser.Api;
|
||||||
using MediaBrowser.Common;
|
using MediaBrowser.Common;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
|
@ -93,13 +90,11 @@ using MediaBrowser.Model.Globalization;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
using MediaBrowser.Model.Reflection;
|
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using MediaBrowser.Model.Services;
|
using MediaBrowser.Model.Services;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using MediaBrowser.Model.Updates;
|
using MediaBrowser.Model.Updates;
|
||||||
using MediaBrowser.Model.Xml;
|
|
||||||
using MediaBrowser.Providers.Chapters;
|
using MediaBrowser.Providers.Chapters;
|
||||||
using MediaBrowser.Providers.Manager;
|
using MediaBrowser.Providers.Manager;
|
||||||
using MediaBrowser.Providers.Subtitles;
|
using MediaBrowser.Providers.Subtitles;
|
||||||
|
@ -115,6 +110,7 @@ using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
using ServiceStack;
|
using ServiceStack;
|
||||||
|
using OperatingSystem = MediaBrowser.Common.System.OperatingSystem;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations
|
namespace Emby.Server.Implementations
|
||||||
{
|
{
|
||||||
|
@ -143,12 +139,8 @@ namespace Emby.Server.Implementations
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows)
|
if (OperatingSystem.Id == OperatingSystemId.Windows
|
||||||
{
|
|| OperatingSystem.Id == OperatingSystemId.Darwin)
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.OSX)
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -168,7 +160,7 @@ namespace Emby.Server.Implementations
|
||||||
public event EventHandler<GenericEventArgs<PackageVersionInfo>> ApplicationUpdated;
|
public event EventHandler<GenericEventArgs<PackageVersionInfo>> ApplicationUpdated;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether this instance has changes that require the entire application to restart.
|
/// Gets a value indicating whether this instance has changes that require the entire application to restart.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if this instance has pending application restart; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this instance has pending application restart; otherwise, <c>false</c>.</value>
|
||||||
public bool HasPendingRestart { get; private set; }
|
public bool HasPendingRestart { get; private set; }
|
||||||
|
@ -182,7 +174,7 @@ namespace Emby.Server.Implementations
|
||||||
protected ILogger Logger { get; set; }
|
protected ILogger Logger { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the plugins.
|
/// Gets the plugins.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The plugins.</value>
|
/// <value>The plugins.</value>
|
||||||
public IPlugin[] Plugins { get; protected set; }
|
public IPlugin[] Plugins { get; protected set; }
|
||||||
|
@ -194,13 +186,13 @@ namespace Emby.Server.Implementations
|
||||||
public ILoggerFactory LoggerFactory { get; protected set; }
|
public ILoggerFactory LoggerFactory { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the application paths.
|
/// Gets or sets the application paths.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The application paths.</value>
|
/// <value>The application paths.</value>
|
||||||
protected ServerApplicationPaths ApplicationPaths { get; set; }
|
protected ServerApplicationPaths ApplicationPaths { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all concrete types.
|
/// Gets or sets all concrete types.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>All concrete types.</value>
|
/// <value>All concrete types.</value>
|
||||||
public Type[] AllConcreteTypes { get; protected set; }
|
public Type[] AllConcreteTypes { get; protected set; }
|
||||||
|
@ -208,7 +200,7 @@ namespace Emby.Server.Implementations
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The disposable parts
|
/// The disposable parts
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly List<IDisposable> DisposableParts = new List<IDisposable>();
|
protected readonly List<IDisposable> _disposableParts = new List<IDisposable>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the configuration manager.
|
/// Gets the configuration manager.
|
||||||
|
@ -218,8 +210,6 @@ namespace Emby.Server.Implementations
|
||||||
|
|
||||||
public IFileSystem FileSystemManager { get; set; }
|
public IFileSystem FileSystemManager { get; set; }
|
||||||
|
|
||||||
protected IEnvironmentInfo EnvironmentInfo { get; set; }
|
|
||||||
|
|
||||||
public PackageVersionClass SystemUpdateLevel
|
public PackageVersionClass SystemUpdateLevel
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -239,15 +229,6 @@ namespace Emby.Server.Implementations
|
||||||
/// <value>The server configuration manager.</value>
|
/// <value>The server configuration manager.</value>
|
||||||
public IServerConfigurationManager ServerConfigurationManager => (IServerConfigurationManager)ConfigurationManager;
|
public IServerConfigurationManager ServerConfigurationManager => (IServerConfigurationManager)ConfigurationManager;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the configuration manager.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>IConfigurationManager.</returns>
|
|
||||||
protected IConfigurationManager GetConfigurationManager()
|
|
||||||
{
|
|
||||||
return new ServerConfigurationManager(ApplicationPaths, LoggerFactory, XmlSerializer, FileSystemManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual IResourceFileManager CreateResourceFileManager()
|
protected virtual IResourceFileManager CreateResourceFileManager()
|
||||||
{
|
{
|
||||||
return new ResourceFileManager(HttpResultFactory, LoggerFactory, FileSystemManager);
|
return new ResourceFileManager(HttpResultFactory, LoggerFactory, FileSystemManager);
|
||||||
|
@ -258,27 +239,33 @@ namespace Emby.Server.Implementations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user manager.</value>
|
/// <value>The user manager.</value>
|
||||||
public IUserManager UserManager { get; set; }
|
public IUserManager UserManager { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the library manager.
|
/// Gets or sets the library manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The library manager.</value>
|
/// <value>The library manager.</value>
|
||||||
internal ILibraryManager LibraryManager { get; set; }
|
internal ILibraryManager LibraryManager { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the directory watchers.
|
/// Gets or sets the directory watchers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The directory watchers.</value>
|
/// <value>The directory watchers.</value>
|
||||||
private ILibraryMonitor LibraryMonitor { get; set; }
|
private ILibraryMonitor LibraryMonitor { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the provider manager.
|
/// Gets or sets the provider manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The provider manager.</value>
|
/// <value>The provider manager.</value>
|
||||||
private IProviderManager ProviderManager { get; set; }
|
private IProviderManager ProviderManager { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the HTTP server.
|
/// Gets or sets the HTTP server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The HTTP server.</value>
|
/// <value>The HTTP server.</value>
|
||||||
private IHttpServer HttpServer { get; set; }
|
private IHttpServer HttpServer { get; set; }
|
||||||
|
|
||||||
private IDtoService DtoService { get; set; }
|
private IDtoService DtoService { get; set; }
|
||||||
|
|
||||||
public IImageProcessor ImageProcessor { get; set; }
|
public IImageProcessor ImageProcessor { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -286,6 +273,7 @@ namespace Emby.Server.Implementations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The media encoder.</value>
|
/// <value>The media encoder.</value>
|
||||||
private IMediaEncoder MediaEncoder { get; set; }
|
private IMediaEncoder MediaEncoder { get; set; }
|
||||||
|
|
||||||
private ISubtitleEncoder SubtitleEncoder { get; set; }
|
private ISubtitleEncoder SubtitleEncoder { get; set; }
|
||||||
|
|
||||||
private ISessionManager SessionManager { get; set; }
|
private ISessionManager SessionManager { get; set; }
|
||||||
|
@ -295,6 +283,7 @@ namespace Emby.Server.Implementations
|
||||||
public LocalizationManager LocalizationManager { get; set; }
|
public LocalizationManager LocalizationManager { get; set; }
|
||||||
|
|
||||||
private IEncodingManager EncodingManager { get; set; }
|
private IEncodingManager EncodingManager { get; set; }
|
||||||
|
|
||||||
private IChannelManager ChannelManager { get; set; }
|
private IChannelManager ChannelManager { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -302,20 +291,29 @@ namespace Emby.Server.Implementations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user data repository.</value>
|
/// <value>The user data repository.</value>
|
||||||
private IUserDataManager UserDataManager { get; set; }
|
private IUserDataManager UserDataManager { get; set; }
|
||||||
|
|
||||||
private IUserRepository UserRepository { get; set; }
|
private IUserRepository UserRepository { get; set; }
|
||||||
|
|
||||||
internal SqliteItemRepository ItemRepository { get; set; }
|
internal SqliteItemRepository ItemRepository { get; set; }
|
||||||
|
|
||||||
private INotificationManager NotificationManager { get; set; }
|
private INotificationManager NotificationManager { get; set; }
|
||||||
|
|
||||||
private ISubtitleManager SubtitleManager { get; set; }
|
private ISubtitleManager SubtitleManager { get; set; }
|
||||||
|
|
||||||
private IChapterManager ChapterManager { get; set; }
|
private IChapterManager ChapterManager { get; set; }
|
||||||
|
|
||||||
private IDeviceManager DeviceManager { get; set; }
|
private IDeviceManager DeviceManager { get; set; }
|
||||||
|
|
||||||
internal IUserViewManager UserViewManager { get; set; }
|
internal IUserViewManager UserViewManager { get; set; }
|
||||||
|
|
||||||
private IAuthenticationRepository AuthenticationRepository { get; set; }
|
private IAuthenticationRepository AuthenticationRepository { get; set; }
|
||||||
|
|
||||||
private ITVSeriesManager TVSeriesManager { get; set; }
|
private ITVSeriesManager TVSeriesManager { get; set; }
|
||||||
|
|
||||||
private ICollectionManager CollectionManager { get; set; }
|
private ICollectionManager CollectionManager { get; set; }
|
||||||
|
|
||||||
private IMediaSourceManager MediaSourceManager { get; set; }
|
private IMediaSourceManager MediaSourceManager { get; set; }
|
||||||
|
|
||||||
private IPlaylistManager PlaylistManager { get; set; }
|
private IPlaylistManager PlaylistManager { get; set; }
|
||||||
|
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
|
@ -331,32 +329,40 @@ namespace Emby.Server.Implementations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The zip client.</value>
|
/// <value>The zip client.</value>
|
||||||
protected IZipClient ZipClient { get; private set; }
|
protected IZipClient ZipClient { get; private set; }
|
||||||
|
|
||||||
protected IHttpResultFactory HttpResultFactory { get; private set; }
|
protected IHttpResultFactory HttpResultFactory { get; private set; }
|
||||||
|
|
||||||
protected IAuthService AuthService { get; private set; }
|
protected IAuthService AuthService { get; private set; }
|
||||||
|
|
||||||
public IStartupOptions StartupOptions { get; private set; }
|
public IStartupOptions StartupOptions { get; }
|
||||||
|
|
||||||
internal IImageEncoder ImageEncoder { get; private set; }
|
internal IImageEncoder ImageEncoder { get; private set; }
|
||||||
|
|
||||||
protected IProcessFactory ProcessFactory { get; private set; }
|
protected IProcessFactory ProcessFactory { get; private set; }
|
||||||
|
|
||||||
protected ICryptoProvider CryptographyProvider = new CryptographyProvider();
|
protected ICryptoProvider CryptographyProvider = new CryptographyProvider();
|
||||||
protected readonly IXmlSerializer XmlSerializer;
|
protected readonly IXmlSerializer XmlSerializer;
|
||||||
|
|
||||||
protected ISocketFactory SocketFactory { get; private set; }
|
protected ISocketFactory SocketFactory { get; private set; }
|
||||||
|
|
||||||
protected ITaskManager TaskManager { get; private set; }
|
protected ITaskManager TaskManager { get; private set; }
|
||||||
|
|
||||||
public IHttpClient HttpClient { get; private set; }
|
public IHttpClient HttpClient { get; private set; }
|
||||||
|
|
||||||
protected INetworkManager NetworkManager { get; set; }
|
protected INetworkManager NetworkManager { get; set; }
|
||||||
|
|
||||||
public IJsonSerializer JsonSerializer { get; private set; }
|
public IJsonSerializer JsonSerializer { get; private set; }
|
||||||
|
|
||||||
protected IIsoManager IsoManager { get; private set; }
|
protected IIsoManager IsoManager { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ApplicationHost" /> class.
|
/// Initializes a new instance of the <see cref="ApplicationHost" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ApplicationHost(ServerApplicationPaths applicationPaths,
|
public ApplicationHost(
|
||||||
|
ServerApplicationPaths applicationPaths,
|
||||||
ILoggerFactory loggerFactory,
|
ILoggerFactory loggerFactory,
|
||||||
IStartupOptions options,
|
IStartupOptions options,
|
||||||
IFileSystem fileSystem,
|
IFileSystem fileSystem,
|
||||||
IEnvironmentInfo environmentInfo,
|
|
||||||
IImageEncoder imageEncoder,
|
IImageEncoder imageEncoder,
|
||||||
INetworkManager networkManager,
|
INetworkManager networkManager,
|
||||||
IConfiguration configuration)
|
IConfiguration configuration)
|
||||||
|
@ -370,13 +376,12 @@ namespace Emby.Server.Implementations
|
||||||
|
|
||||||
NetworkManager = networkManager;
|
NetworkManager = networkManager;
|
||||||
networkManager.LocalSubnetsFn = GetConfiguredLocalSubnets;
|
networkManager.LocalSubnetsFn = GetConfiguredLocalSubnets;
|
||||||
EnvironmentInfo = environmentInfo;
|
|
||||||
|
|
||||||
ApplicationPaths = applicationPaths;
|
ApplicationPaths = applicationPaths;
|
||||||
LoggerFactory = loggerFactory;
|
LoggerFactory = loggerFactory;
|
||||||
FileSystemManager = fileSystem;
|
FileSystemManager = fileSystem;
|
||||||
|
|
||||||
ConfigurationManager = GetConfigurationManager();
|
ConfigurationManager = new ServerConfigurationManager(ApplicationPaths, LoggerFactory, XmlSerializer, FileSystemManager);
|
||||||
|
|
||||||
Logger = LoggerFactory.CreateLogger("App");
|
Logger = LoggerFactory.CreateLogger("App");
|
||||||
|
|
||||||
|
@ -415,7 +420,7 @@ namespace Emby.Server.Implementations
|
||||||
_validAddressResults.Clear();
|
_validAddressResults.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ApplicationVersion => typeof(ApplicationHost).Assembly.GetName().Version.ToString(3);
|
public string ApplicationVersion { get; } = typeof(ApplicationHost).Assembly.GetName().Version.ToString(3);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the current application user agent
|
/// Gets the current application user agent
|
||||||
|
@ -423,14 +428,23 @@ namespace Emby.Server.Implementations
|
||||||
/// <value>The application user agent.</value>
|
/// <value>The application user agent.</value>
|
||||||
public string ApplicationUserAgent => Name.Replace(' ','-') + "/" + ApplicationVersion;
|
public string ApplicationUserAgent => Name.Replace(' ','-') + "/" + ApplicationVersion;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the email address for use within a comment section of a user agent field.
|
||||||
|
/// Presently used to provide contact information to MusicBrainz service.
|
||||||
|
/// </summary>
|
||||||
|
public string ApplicationUserAgentAddress { get; } = "team@jellyfin.org";
|
||||||
|
|
||||||
private string _productName;
|
private string _productName;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the current application name
|
/// Gets the current application name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The application name.</value>
|
/// <value>The application name.</value>
|
||||||
public string ApplicationProductName => _productName ?? (_productName = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).ProductName);
|
public string ApplicationProductName
|
||||||
|
=> _productName ?? (_productName = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).ProductName);
|
||||||
|
|
||||||
private DeviceId _deviceId;
|
private DeviceId _deviceId;
|
||||||
|
|
||||||
public string SystemId
|
public string SystemId
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -461,15 +475,15 @@ namespace Emby.Server.Implementations
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an instance of type and resolves all constructor dependencies
|
/// Creates an instance of type and resolves all constructor dependencies
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type">The type.</param>
|
/// /// <typeparam name="T">The type</typeparam>
|
||||||
/// <returns>System.Object.</returns>
|
/// <returns>T</returns>
|
||||||
public T CreateInstance<T>()
|
public T CreateInstance<T>()
|
||||||
=> ActivatorUtilities.CreateInstance<T>(_serviceProvider);
|
=> ActivatorUtilities.CreateInstance<T>(_serviceProvider);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the instance safe.
|
/// Creates the instance safe.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="typeInfo">The type information.</param>
|
/// <param name="type">The type.</param>
|
||||||
/// <returns>System.Object.</returns>
|
/// <returns>System.Object.</returns>
|
||||||
protected object CreateInstanceSafe(Type type)
|
protected object CreateInstanceSafe(Type type)
|
||||||
{
|
{
|
||||||
|
@ -488,14 +502,14 @@ namespace Emby.Server.Implementations
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resolves this instance.
|
/// Resolves this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T">The type</typeparam>
|
||||||
/// <returns>``0.</returns>
|
/// <returns>``0.</returns>
|
||||||
public T Resolve<T>() => _serviceProvider.GetService<T>();
|
public T Resolve<T>() => _serviceProvider.GetService<T>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the export types.
|
/// Gets the export types.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T">The type</typeparam>
|
||||||
/// <returns>IEnumerable{Type}.</returns>
|
/// <returns>IEnumerable{Type}.</returns>
|
||||||
public IEnumerable<Type> GetExportTypes<T>()
|
public IEnumerable<Type> GetExportTypes<T>()
|
||||||
{
|
{
|
||||||
|
@ -507,22 +521,22 @@ namespace Emby.Server.Implementations
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the exports.
|
/// Gets the exports.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T">The type</typeparam>
|
||||||
/// <param name="manageLifetime">if set to <c>true</c> [manage lifetime].</param>
|
/// <param name="manageLifetime">if set to <c>true</c> [manage lifetime].</param>
|
||||||
/// <returns>IEnumerable{``0}.</returns>
|
/// <returns>IEnumerable{``0}.</returns>
|
||||||
public IEnumerable<T> GetExports<T>(bool manageLifetime = true)
|
public IEnumerable<T> GetExports<T>(bool manageLifetime = true)
|
||||||
{
|
{
|
||||||
var parts = GetExportTypes<T>()
|
var parts = GetExportTypes<T>()
|
||||||
.Select(x => CreateInstanceSafe(x))
|
.Select(CreateInstanceSafe)
|
||||||
.Where(i => i != null)
|
.Where(i => i != null)
|
||||||
.Cast<T>()
|
.Cast<T>()
|
||||||
.ToList(); // Convert to list so this isn't executed for each iteration
|
.ToList(); // Convert to list so this isn't executed for each iteration
|
||||||
|
|
||||||
if (manageLifetime)
|
if (manageLifetime)
|
||||||
{
|
{
|
||||||
lock (DisposableParts)
|
lock (_disposableParts)
|
||||||
{
|
{
|
||||||
DisposableParts.AddRange(parts.OfType<IDisposable>());
|
_disposableParts.AddRange(parts.OfType<IDisposable>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -532,7 +546,7 @@ namespace Emby.Server.Implementations
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Runs the startup tasks.
|
/// Runs the startup tasks.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task RunStartupTasks()
|
public async Task RunStartupTasksAsync()
|
||||||
{
|
{
|
||||||
Logger.LogInformation("Running startup tasks");
|
Logger.LogInformation("Running startup tasks");
|
||||||
|
|
||||||
|
@ -542,29 +556,20 @@ namespace Emby.Server.Implementations
|
||||||
|
|
||||||
MediaEncoder.SetFFmpegPath();
|
MediaEncoder.SetFFmpegPath();
|
||||||
|
|
||||||
//if (string.IsNullOrWhiteSpace(MediaEncoder.EncoderPath))
|
|
||||||
//{
|
|
||||||
// if (ServerConfigurationManager.Configuration.IsStartupWizardCompleted)
|
|
||||||
// {
|
|
||||||
// ServerConfigurationManager.Configuration.IsStartupWizardCompleted = false;
|
|
||||||
// ServerConfigurationManager.SaveConfiguration();
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
Logger.LogInformation("ServerId: {0}", SystemId);
|
Logger.LogInformation("ServerId: {0}", SystemId);
|
||||||
|
|
||||||
var entryPoints = GetExports<IServerEntryPoint>();
|
var entryPoints = GetExports<IServerEntryPoint>().ToList();
|
||||||
|
|
||||||
var stopWatch = new Stopwatch();
|
var stopWatch = new Stopwatch();
|
||||||
stopWatch.Start();
|
stopWatch.Start();
|
||||||
await Task.WhenAll(StartEntryPoints(entryPoints, true));
|
await Task.WhenAll(StartEntryPoints(entryPoints, true)).ConfigureAwait(false);
|
||||||
Logger.LogInformation("Executed all pre-startup entry points in {Elapsed:g}", stopWatch.Elapsed);
|
Logger.LogInformation("Executed all pre-startup entry points in {Elapsed:g}", stopWatch.Elapsed);
|
||||||
|
|
||||||
Logger.LogInformation("Core startup complete");
|
Logger.LogInformation("Core startup complete");
|
||||||
HttpServer.GlobalResponse = null;
|
HttpServer.GlobalResponse = null;
|
||||||
|
|
||||||
stopWatch.Restart();
|
stopWatch.Restart();
|
||||||
await Task.WhenAll(StartEntryPoints(entryPoints, false));
|
await Task.WhenAll(StartEntryPoints(entryPoints, false)).ConfigureAwait(false);
|
||||||
Logger.LogInformation("Executed all post-startup entry points in {Elapsed:g}", stopWatch.Elapsed);
|
Logger.LogInformation("Executed all post-startup entry points in {Elapsed:g}", stopWatch.Elapsed);
|
||||||
stopWatch.Stop();
|
stopWatch.Stop();
|
||||||
}
|
}
|
||||||
|
@ -584,7 +589,7 @@ namespace Emby.Server.Implementations
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Init(IServiceCollection serviceCollection)
|
public async Task InitAsync(IServiceCollection serviceCollection)
|
||||||
{
|
{
|
||||||
HttpPort = ServerConfigurationManager.Configuration.HttpServerPortNumber;
|
HttpPort = ServerConfigurationManager.Configuration.HttpServerPortNumber;
|
||||||
HttpsPort = ServerConfigurationManager.Configuration.HttpsPortNumber;
|
HttpsPort = ServerConfigurationManager.Configuration.HttpsPortNumber;
|
||||||
|
@ -614,14 +619,14 @@ namespace Emby.Server.Implementations
|
||||||
|
|
||||||
SetHttpLimit();
|
SetHttpLimit();
|
||||||
|
|
||||||
await RegisterResources(serviceCollection);
|
await RegisterResources(serviceCollection).ConfigureAwait(false);
|
||||||
|
|
||||||
FindParts();
|
FindParts();
|
||||||
|
|
||||||
string contentRoot = ServerConfigurationManager.Configuration.DashboardSourcePath;
|
string contentRoot = ServerConfigurationManager.Configuration.DashboardSourcePath;
|
||||||
if (string.IsNullOrEmpty(contentRoot))
|
if (string.IsNullOrEmpty(contentRoot))
|
||||||
{
|
{
|
||||||
contentRoot = Path.Combine(ServerConfigurationManager.ApplicationPaths.ApplicationResourcesPath, "jellyfin-web", "src");
|
contentRoot = ServerConfigurationManager.ApplicationPaths.WebPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
var host = new WebHostBuilder()
|
var host = new WebHostBuilder()
|
||||||
|
@ -629,7 +634,7 @@ namespace Emby.Server.Implementations
|
||||||
{
|
{
|
||||||
options.ListenAnyIP(HttpPort);
|
options.ListenAnyIP(HttpPort);
|
||||||
|
|
||||||
if (EnableHttps)
|
if (EnableHttps && Certificate != null)
|
||||||
{
|
{
|
||||||
options.ListenAnyIP(HttpsPort, listenOptions => { listenOptions.UseHttps(Certificate); });
|
options.ListenAnyIP(HttpsPort, listenOptions => { listenOptions.UseHttps(Certificate); });
|
||||||
}
|
}
|
||||||
|
@ -651,7 +656,7 @@ namespace Emby.Server.Implementations
|
||||||
})
|
})
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
await host.StartAsync();
|
await host.StartAsync().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ExecuteWebsocketHandlerAsync(HttpContext context, Func<Task> next)
|
private async Task ExecuteWebsocketHandlerAsync(HttpContext context, Func<Task> next)
|
||||||
|
@ -700,14 +705,14 @@ namespace Emby.Server.Implementations
|
||||||
|
|
||||||
serviceCollection.AddSingleton<IApplicationPaths>(ApplicationPaths);
|
serviceCollection.AddSingleton<IApplicationPaths>(ApplicationPaths);
|
||||||
|
|
||||||
|
serviceCollection.AddSingleton<IConfiguration>(_configuration);
|
||||||
|
|
||||||
serviceCollection.AddSingleton(JsonSerializer);
|
serviceCollection.AddSingleton(JsonSerializer);
|
||||||
|
|
||||||
serviceCollection.AddSingleton(LoggerFactory);
|
serviceCollection.AddSingleton(LoggerFactory);
|
||||||
serviceCollection.AddLogging();
|
serviceCollection.AddLogging();
|
||||||
serviceCollection.AddSingleton(Logger);
|
serviceCollection.AddSingleton(Logger);
|
||||||
|
|
||||||
serviceCollection.AddSingleton(EnvironmentInfo);
|
|
||||||
|
|
||||||
serviceCollection.AddSingleton(FileSystemManager);
|
serviceCollection.AddSingleton(FileSystemManager);
|
||||||
serviceCollection.AddSingleton<TvDbClientManager>();
|
serviceCollection.AddSingleton<TvDbClientManager>();
|
||||||
|
|
||||||
|
@ -749,17 +754,12 @@ namespace Emby.Server.Implementations
|
||||||
|
|
||||||
serviceCollection.AddSingleton(ServerConfigurationManager);
|
serviceCollection.AddSingleton(ServerConfigurationManager);
|
||||||
|
|
||||||
var assemblyInfo = new AssemblyInfo();
|
LocalizationManager = new LocalizationManager(ServerConfigurationManager, JsonSerializer, LoggerFactory);
|
||||||
serviceCollection.AddSingleton<IAssemblyInfo>(assemblyInfo);
|
await LocalizationManager.LoadAll().ConfigureAwait(false);
|
||||||
|
|
||||||
LocalizationManager = new LocalizationManager(ServerConfigurationManager, FileSystemManager, JsonSerializer, LoggerFactory);
|
|
||||||
await LocalizationManager.LoadAll();
|
|
||||||
serviceCollection.AddSingleton<ILocalizationManager>(LocalizationManager);
|
serviceCollection.AddSingleton<ILocalizationManager>(LocalizationManager);
|
||||||
|
|
||||||
serviceCollection.AddSingleton<IBlurayExaminer>(new BdInfoExaminer(FileSystemManager));
|
serviceCollection.AddSingleton<IBlurayExaminer>(new BdInfoExaminer(FileSystemManager));
|
||||||
|
|
||||||
serviceCollection.AddSingleton<IXmlReaderSettingsFactory>(new XmlReaderSettingsFactory());
|
|
||||||
|
|
||||||
UserDataManager = new UserDataManager(LoggerFactory, ServerConfigurationManager, () => UserManager);
|
UserDataManager = new UserDataManager(LoggerFactory, ServerConfigurationManager, () => UserManager);
|
||||||
serviceCollection.AddSingleton(UserDataManager);
|
serviceCollection.AddSingleton(UserDataManager);
|
||||||
|
|
||||||
|
@ -770,7 +770,7 @@ namespace Emby.Server.Implementations
|
||||||
var displayPreferencesRepo = new SqliteDisplayPreferencesRepository(LoggerFactory, JsonSerializer, ApplicationPaths, FileSystemManager);
|
var displayPreferencesRepo = new SqliteDisplayPreferencesRepository(LoggerFactory, JsonSerializer, ApplicationPaths, FileSystemManager);
|
||||||
serviceCollection.AddSingleton<IDisplayPreferencesRepository>(displayPreferencesRepo);
|
serviceCollection.AddSingleton<IDisplayPreferencesRepository>(displayPreferencesRepo);
|
||||||
|
|
||||||
ItemRepository = new SqliteItemRepository(ServerConfigurationManager, this, JsonSerializer, LoggerFactory, assemblyInfo);
|
ItemRepository = new SqliteItemRepository(ServerConfigurationManager, this, JsonSerializer, LoggerFactory);
|
||||||
serviceCollection.AddSingleton<IItemRepository>(ItemRepository);
|
serviceCollection.AddSingleton<IItemRepository>(ItemRepository);
|
||||||
|
|
||||||
AuthenticationRepository = GetAuthenticationRepository();
|
AuthenticationRepository = GetAuthenticationRepository();
|
||||||
|
@ -786,7 +786,7 @@ namespace Emby.Server.Implementations
|
||||||
var musicManager = new MusicManager(LibraryManager);
|
var musicManager = new MusicManager(LibraryManager);
|
||||||
serviceCollection.AddSingleton<IMusicManager>(new MusicManager(LibraryManager));
|
serviceCollection.AddSingleton<IMusicManager>(new MusicManager(LibraryManager));
|
||||||
|
|
||||||
LibraryMonitor = new LibraryMonitor(LoggerFactory, LibraryManager, ServerConfigurationManager, FileSystemManager, EnvironmentInfo);
|
LibraryMonitor = new LibraryMonitor(LoggerFactory, LibraryManager, ServerConfigurationManager, FileSystemManager);
|
||||||
serviceCollection.AddSingleton(LibraryMonitor);
|
serviceCollection.AddSingleton(LibraryMonitor);
|
||||||
|
|
||||||
serviceCollection.AddSingleton<ISearchEngine>(new SearchEngine(LoggerFactory, LibraryManager, UserManager));
|
serviceCollection.AddSingleton<ISearchEngine>(new SearchEngine(LoggerFactory, LibraryManager, UserManager));
|
||||||
|
@ -794,16 +794,19 @@ namespace Emby.Server.Implementations
|
||||||
CertificateInfo = GetCertificateInfo(true);
|
CertificateInfo = GetCertificateInfo(true);
|
||||||
Certificate = GetCertificate(CertificateInfo);
|
Certificate = GetCertificate(CertificateInfo);
|
||||||
|
|
||||||
HttpServer = new HttpListenerHost(this,
|
HttpServer = new HttpListenerHost(
|
||||||
|
this,
|
||||||
LoggerFactory,
|
LoggerFactory,
|
||||||
ServerConfigurationManager,
|
ServerConfigurationManager,
|
||||||
_configuration,
|
_configuration,
|
||||||
NetworkManager,
|
NetworkManager,
|
||||||
JsonSerializer,
|
JsonSerializer,
|
||||||
XmlSerializer,
|
XmlSerializer,
|
||||||
CreateHttpListener());
|
CreateHttpListener())
|
||||||
|
{
|
||||||
|
GlobalResponse = LocalizationManager.GetLocalizedString("StartupEmbyServerIsLoading")
|
||||||
|
};
|
||||||
|
|
||||||
HttpServer.GlobalResponse = LocalizationManager.GetLocalizedString("StartupEmbyServerIsLoading");
|
|
||||||
serviceCollection.AddSingleton(HttpServer);
|
serviceCollection.AddSingleton(HttpServer);
|
||||||
|
|
||||||
ImageProcessor = GetImageProcessor();
|
ImageProcessor = GetImageProcessor();
|
||||||
|
@ -862,7 +865,6 @@ namespace Emby.Server.Implementations
|
||||||
LoggerFactory,
|
LoggerFactory,
|
||||||
JsonSerializer,
|
JsonSerializer,
|
||||||
StartupOptions.FFmpegPath,
|
StartupOptions.FFmpegPath,
|
||||||
StartupOptions.FFprobePath,
|
|
||||||
ServerConfigurationManager,
|
ServerConfigurationManager,
|
||||||
FileSystemManager,
|
FileSystemManager,
|
||||||
() => SubtitleEncoder,
|
() => SubtitleEncoder,
|
||||||
|
@ -907,7 +909,7 @@ namespace Emby.Server.Implementations
|
||||||
|
|
||||||
public virtual string PackageRuntime => "netcore";
|
public virtual string PackageRuntime => "netcore";
|
||||||
|
|
||||||
public static void LogEnvironmentInfo(ILogger logger, IApplicationPaths appPaths, EnvironmentInfo.EnvironmentInfo environmentInfo)
|
public static void LogEnvironmentInfo(ILogger logger, IApplicationPaths appPaths)
|
||||||
{
|
{
|
||||||
// Distinct these to prevent users from reporting problems that aren't actually problems
|
// Distinct these to prevent users from reporting problems that aren't actually problems
|
||||||
var commandLineArgs = Environment
|
var commandLineArgs = Environment
|
||||||
|
@ -915,12 +917,14 @@ namespace Emby.Server.Implementations
|
||||||
.Distinct();
|
.Distinct();
|
||||||
|
|
||||||
logger.LogInformation("Arguments: {Args}", commandLineArgs);
|
logger.LogInformation("Arguments: {Args}", commandLineArgs);
|
||||||
logger.LogInformation("Operating system: {OS} {OSVersion}", environmentInfo.OperatingSystemName, environmentInfo.OperatingSystemVersion);
|
// FIXME: @bond this logs the kernel version, not the OS version
|
||||||
logger.LogInformation("Architecture: {Architecture}", environmentInfo.SystemArchitecture);
|
logger.LogInformation("Operating system: {OS} {OSVersion}", OperatingSystem.Name, Environment.OSVersion.Version);
|
||||||
|
logger.LogInformation("Architecture: {Architecture}", RuntimeInformation.OSArchitecture);
|
||||||
logger.LogInformation("64-Bit Process: {Is64Bit}", Environment.Is64BitProcess);
|
logger.LogInformation("64-Bit Process: {Is64Bit}", Environment.Is64BitProcess);
|
||||||
logger.LogInformation("User Interactive: {IsUserInteractive}", Environment.UserInteractive);
|
logger.LogInformation("User Interactive: {IsUserInteractive}", Environment.UserInteractive);
|
||||||
logger.LogInformation("Processor count: {ProcessorCount}", Environment.ProcessorCount);
|
logger.LogInformation("Processor count: {ProcessorCount}", Environment.ProcessorCount);
|
||||||
logger.LogInformation("Program data path: {ProgramDataPath}", appPaths.ProgramDataPath);
|
logger.LogInformation("Program data path: {ProgramDataPath}", appPaths.ProgramDataPath);
|
||||||
|
logger.LogInformation("Web resources path: {WebPath}", appPaths.WebPath);
|
||||||
logger.LogInformation("Application directory: {ApplicationPath}", appPaths.ProgramSystemPath);
|
logger.LogInformation("Application directory: {ApplicationPath}", appPaths.ProgramSystemPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -957,7 +961,7 @@ namespace Emby.Server.Implementations
|
||||||
var password = string.IsNullOrWhiteSpace(info.Password) ? null : info.Password;
|
var password = string.IsNullOrWhiteSpace(info.Password) ? null : info.Password;
|
||||||
|
|
||||||
var localCert = new X509Certificate2(certificateLocation, password);
|
var localCert = new X509Certificate2(certificateLocation, password);
|
||||||
//localCert.PrivateKey = PrivateKey.CreateFromFile(pvk_file).RSA;
|
// localCert.PrivateKey = PrivateKey.CreateFromFile(pvk_file).RSA;
|
||||||
if (!localCert.HasPrivateKey)
|
if (!localCert.HasPrivateKey)
|
||||||
{
|
{
|
||||||
Logger.LogError("No private key included in SSL cert {CertificateLocation}.", certificateLocation);
|
Logger.LogError("No private key included in SSL cert {CertificateLocation}.", certificateLocation);
|
||||||
|
@ -1058,13 +1062,15 @@ namespace Emby.Server.Implementations
|
||||||
|
|
||||||
HttpServer.Init(GetExports<IService>(false), GetExports<IWebSocketListener>(), GetUrlPrefixes());
|
HttpServer.Init(GetExports<IService>(false), GetExports<IWebSocketListener>(), GetUrlPrefixes());
|
||||||
|
|
||||||
LibraryManager.AddParts(GetExports<IResolverIgnoreRule>(),
|
LibraryManager.AddParts(
|
||||||
|
GetExports<IResolverIgnoreRule>(),
|
||||||
GetExports<IItemResolver>(),
|
GetExports<IItemResolver>(),
|
||||||
GetExports<IIntroProvider>(),
|
GetExports<IIntroProvider>(),
|
||||||
GetExports<IBaseItemComparer>(),
|
GetExports<IBaseItemComparer>(),
|
||||||
GetExports<ILibraryPostScanTask>());
|
GetExports<ILibraryPostScanTask>());
|
||||||
|
|
||||||
ProviderManager.AddParts(GetExports<IImageProvider>(),
|
ProviderManager.AddParts(
|
||||||
|
GetExports<IImageProvider>(),
|
||||||
GetExports<IMetadataService>(),
|
GetExports<IMetadataService>(),
|
||||||
GetExports<IMetadataProvider>(),
|
GetExports<IMetadataProvider>(),
|
||||||
GetExports<IMetadataSaver>(),
|
GetExports<IMetadataSaver>(),
|
||||||
|
@ -1145,6 +1151,7 @@ namespace Emby.Server.Implementations
|
||||||
}
|
}
|
||||||
|
|
||||||
private CertificateInfo CertificateInfo { get; set; }
|
private CertificateInfo CertificateInfo { get; set; }
|
||||||
|
|
||||||
protected X509Certificate2 Certificate { get; private set; }
|
protected X509Certificate2 Certificate { get; private set; }
|
||||||
|
|
||||||
private IEnumerable<string> GetUrlPrefixes()
|
private IEnumerable<string> GetUrlPrefixes()
|
||||||
|
@ -1155,7 +1162,7 @@ namespace Emby.Server.Implementations
|
||||||
{
|
{
|
||||||
var prefixes = new List<string>
|
var prefixes = new List<string>
|
||||||
{
|
{
|
||||||
"http://"+i+":" + HttpPort + "/"
|
"http://" + i + ":" + HttpPort + "/"
|
||||||
};
|
};
|
||||||
|
|
||||||
if (CertificateInfo != null)
|
if (CertificateInfo != null)
|
||||||
|
@ -1184,30 +1191,12 @@ namespace Emby.Server.Implementations
|
||||||
// Generate self-signed cert
|
// Generate self-signed cert
|
||||||
var certHost = GetHostnameFromExternalDns(ServerConfigurationManager.Configuration.WanDdns);
|
var certHost = GetHostnameFromExternalDns(ServerConfigurationManager.Configuration.WanDdns);
|
||||||
var certPath = Path.Combine(ServerConfigurationManager.ApplicationPaths.ProgramDataPath, "ssl", "cert_" + (certHost + "2").GetMD5().ToString("N") + ".pfx");
|
var certPath = Path.Combine(ServerConfigurationManager.ApplicationPaths.ProgramDataPath, "ssl", "cert_" + (certHost + "2").GetMD5().ToString("N") + ".pfx");
|
||||||
var password = "embycert";
|
const string Password = "embycert";
|
||||||
|
|
||||||
//if (generateCertificate)
|
|
||||||
//{
|
|
||||||
// if (!File.Exists(certPath))
|
|
||||||
// {
|
|
||||||
// FileSystemManager.CreateDirectory(FileSystemManager.GetDirectoryName(certPath));
|
|
||||||
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// CertificateGenerator.CreateSelfSignCertificatePfx(certPath, certHost, password, Logger);
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// Logger.LogError(ex, "Error creating ssl cert");
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
return new CertificateInfo
|
return new CertificateInfo
|
||||||
{
|
{
|
||||||
Path = certPath,
|
Path = certPath,
|
||||||
Password = password
|
Password = Password
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1242,9 +1231,9 @@ namespace Emby.Server.Implementations
|
||||||
requiresRestart = true;
|
requiresRestart = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentCertPath = CertificateInfo == null ? null : CertificateInfo.Path;
|
var currentCertPath = CertificateInfo?.Path;
|
||||||
var newCertInfo = GetCertificateInfo(false);
|
var newCertInfo = GetCertificateInfo(false);
|
||||||
var newCertPath = newCertInfo == null ? null : newCertInfo.Path;
|
var newCertPath = newCertInfo?.Path;
|
||||||
|
|
||||||
if (!string.Equals(currentCertPath, newCertPath, StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(currentCertPath, newCertPath, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
@ -1377,6 +1366,7 @@ namespace Emby.Server.Implementations
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the system status.
|
/// Gets the system status.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="cancellationToken">The cancellation token</param>
|
||||||
/// <returns>SystemInfo.</returns>
|
/// <returns>SystemInfo.</returns>
|
||||||
public async Task<SystemInfo> GetSystemInfo(CancellationToken cancellationToken)
|
public async Task<SystemInfo> GetSystemInfo(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
@ -1393,6 +1383,7 @@ namespace Emby.Server.Implementations
|
||||||
CompletedInstallations = InstallationManager.CompletedInstallations.ToArray(),
|
CompletedInstallations = InstallationManager.CompletedInstallations.ToArray(),
|
||||||
Id = SystemId,
|
Id = SystemId,
|
||||||
ProgramDataPath = ApplicationPaths.ProgramDataPath,
|
ProgramDataPath = ApplicationPaths.ProgramDataPath,
|
||||||
|
WebPath = ApplicationPaths.WebPath,
|
||||||
LogPath = ApplicationPaths.LogDirectoryPath,
|
LogPath = ApplicationPaths.LogDirectoryPath,
|
||||||
ItemsByNamePath = ApplicationPaths.InternalMetadataPath,
|
ItemsByNamePath = ApplicationPaths.InternalMetadataPath,
|
||||||
InternalMetadataPath = ApplicationPaths.InternalMetadataPath,
|
InternalMetadataPath = ApplicationPaths.InternalMetadataPath,
|
||||||
|
@ -1400,8 +1391,8 @@ namespace Emby.Server.Implementations
|
||||||
HttpServerPortNumber = HttpPort,
|
HttpServerPortNumber = HttpPort,
|
||||||
SupportsHttps = SupportsHttps,
|
SupportsHttps = SupportsHttps,
|
||||||
HttpsPortNumber = HttpsPort,
|
HttpsPortNumber = HttpsPort,
|
||||||
OperatingSystem = EnvironmentInfo.OperatingSystem.ToString(),
|
OperatingSystem = OperatingSystem.Id.ToString(),
|
||||||
OperatingSystemDisplayName = EnvironmentInfo.OperatingSystemName,
|
OperatingSystemDisplayName = OperatingSystem.Name,
|
||||||
CanSelfRestart = CanSelfRestart,
|
CanSelfRestart = CanSelfRestart,
|
||||||
CanLaunchWebBrowser = CanLaunchWebBrowser,
|
CanLaunchWebBrowser = CanLaunchWebBrowser,
|
||||||
WanAddress = wanAddress,
|
WanAddress = wanAddress,
|
||||||
|
@ -1411,7 +1402,7 @@ namespace Emby.Server.Implementations
|
||||||
LocalAddress = localAddress,
|
LocalAddress = localAddress,
|
||||||
SupportsLibraryMonitor = true,
|
SupportsLibraryMonitor = true,
|
||||||
EncoderLocation = MediaEncoder.EncoderLocation,
|
EncoderLocation = MediaEncoder.EncoderLocation,
|
||||||
SystemArchitecture = EnvironmentInfo.SystemArchitecture,
|
SystemArchitecture = RuntimeInformation.OSArchitecture,
|
||||||
SystemUpdateLevel = SystemUpdateLevel,
|
SystemUpdateLevel = SystemUpdateLevel,
|
||||||
PackageName = StartupOptions.PackageName
|
PackageName = StartupOptions.PackageName
|
||||||
};
|
};
|
||||||
|
@ -1435,7 +1426,7 @@ namespace Emby.Server.Implementations
|
||||||
{
|
{
|
||||||
Version = ApplicationVersion,
|
Version = ApplicationVersion,
|
||||||
Id = SystemId,
|
Id = SystemId,
|
||||||
OperatingSystem = EnvironmentInfo.OperatingSystem.ToString(),
|
OperatingSystem = OperatingSystem.Id.ToString(),
|
||||||
WanAddress = wanAddress,
|
WanAddress = wanAddress,
|
||||||
ServerName = FriendlyName,
|
ServerName = FriendlyName,
|
||||||
LocalAddress = localAddress
|
LocalAddress = localAddress
|
||||||
|
@ -1470,19 +1461,19 @@ namespace Emby.Server.Implementations
|
||||||
|
|
||||||
public async Task<string> GetWanApiUrl(CancellationToken cancellationToken)
|
public async Task<string> GetWanApiUrl(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
const string url = "http://ipv4.icanhazip.com";
|
const string Url = "http://ipv4.icanhazip.com";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var response = await HttpClient.Get(new HttpRequestOptions
|
using (var response = await HttpClient.Get(new HttpRequestOptions
|
||||||
{
|
{
|
||||||
Url = url,
|
Url = Url,
|
||||||
LogErrorResponseBody = false,
|
LogErrorResponseBody = false,
|
||||||
LogErrors = false,
|
LogErrors = false,
|
||||||
LogRequest = false,
|
LogRequest = false,
|
||||||
TimeoutMs = 10000,
|
TimeoutMs = 10000,
|
||||||
BufferContent = false,
|
BufferContent = false,
|
||||||
CancellationToken = cancellationToken
|
CancellationToken = cancellationToken
|
||||||
}))
|
}).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return GetLocalApiUrl(response.ReadToEnd().Trim());
|
return GetLocalApiUrl(response.ReadToEnd().Trim());
|
||||||
}
|
}
|
||||||
|
@ -1570,10 +1561,12 @@ namespace Emby.Server.Implementations
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly ConcurrentDictionary<string, bool> _validAddressResults = new ConcurrentDictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
|
private readonly ConcurrentDictionary<string, bool> _validAddressResults = new ConcurrentDictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
private async Task<bool> IsIpAddressValidAsync(IpAddressInfo address, CancellationToken cancellationToken)
|
private async Task<bool> IsIpAddressValidAsync(IpAddressInfo address, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (address.Equals(IpAddressInfo.Loopback) ||
|
if (address.Equals(IpAddressInfo.Loopback) ||
|
||||||
|
@ -1590,25 +1583,25 @@ namespace Emby.Server.Implementations
|
||||||
return cachedResult;
|
return cachedResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
var logPing = false;
|
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
logPing = true;
|
const bool LogPing = true;
|
||||||
|
#else
|
||||||
|
const bool LogPing = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var response = await HttpClient.SendAsync(new HttpRequestOptions
|
using (var response = await HttpClient.SendAsync(
|
||||||
|
new HttpRequestOptions
|
||||||
{
|
{
|
||||||
Url = apiUrl,
|
Url = apiUrl,
|
||||||
LogErrorResponseBody = false,
|
LogErrorResponseBody = false,
|
||||||
LogErrors = logPing,
|
LogErrors = LogPing,
|
||||||
LogRequest = logPing,
|
LogRequest = LogPing,
|
||||||
TimeoutMs = 5000,
|
TimeoutMs = 5000,
|
||||||
BufferContent = false,
|
BufferContent = false,
|
||||||
|
|
||||||
CancellationToken = cancellationToken
|
CancellationToken = cancellationToken
|
||||||
|
|
||||||
}, "POST").ConfigureAwait(false))
|
}, "POST").ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
using (var reader = new StreamReader(response.Content))
|
using (var reader = new StreamReader(response.Content))
|
||||||
|
@ -1674,6 +1667,7 @@ namespace Emby.Server.Implementations
|
||||||
public event EventHandler HasUpdateAvailableChanged;
|
public event EventHandler HasUpdateAvailableChanged;
|
||||||
|
|
||||||
private bool _hasUpdateAvailable;
|
private bool _hasUpdateAvailable;
|
||||||
|
|
||||||
public bool HasUpdateAvailable
|
public bool HasUpdateAvailable
|
||||||
{
|
{
|
||||||
get => _hasUpdateAvailable;
|
get => _hasUpdateAvailable;
|
||||||
|
@ -1734,7 +1728,7 @@ namespace Emby.Server.Implementations
|
||||||
var process = ProcessFactory.Create(new ProcessOptions
|
var process = ProcessFactory.Create(new ProcessOptions
|
||||||
{
|
{
|
||||||
FileName = url,
|
FileName = url,
|
||||||
//EnableRaisingEvents = true,
|
EnableRaisingEvents = true,
|
||||||
UseShellExecute = true,
|
UseShellExecute = true,
|
||||||
ErrorDialog = false
|
ErrorDialog = false
|
||||||
});
|
});
|
||||||
|
@ -1769,7 +1763,9 @@ namespace Emby.Server.Implementations
|
||||||
{
|
{
|
||||||
Logger.LogInformation("Application has been updated to version {0}", package.versionStr);
|
Logger.LogInformation("Application has been updated to version {0}", package.versionStr);
|
||||||
|
|
||||||
ApplicationUpdated?.Invoke(this, new GenericEventArgs<PackageVersionInfo>
|
ApplicationUpdated?.Invoke(
|
||||||
|
this,
|
||||||
|
new GenericEventArgs<PackageVersionInfo>()
|
||||||
{
|
{
|
||||||
Argument = package
|
Argument = package
|
||||||
});
|
});
|
||||||
|
@ -1777,18 +1773,15 @@ namespace Emby.Server.Implementations
|
||||||
NotifyPendingRestart();
|
NotifyPendingRestart();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _disposed;
|
private bool _disposed = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (!_disposed)
|
|
||||||
{
|
|
||||||
_disposed = true;
|
|
||||||
|
|
||||||
Dispose(true);
|
Dispose(true);
|
||||||
}
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1797,14 +1790,19 @@ namespace Emby.Server.Implementations
|
||||||
/// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
|
/// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
|
||||||
protected virtual void Dispose(bool dispose)
|
protected virtual void Dispose(bool dispose)
|
||||||
{
|
{
|
||||||
|
if (_disposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (dispose)
|
if (dispose)
|
||||||
{
|
{
|
||||||
var type = GetType();
|
var type = GetType();
|
||||||
|
|
||||||
Logger.LogInformation("Disposing {Type}", type.Name);
|
Logger.LogInformation("Disposing {Type}", type.Name);
|
||||||
|
|
||||||
var parts = DisposableParts.Distinct().Where(i => i.GetType() != type).ToList();
|
var parts = _disposableParts.Distinct().Where(i => i.GetType() != type).ToList();
|
||||||
DisposableParts.Clear();
|
_disposableParts.Clear();
|
||||||
|
|
||||||
foreach (var part in parts)
|
foreach (var part in parts)
|
||||||
{
|
{
|
||||||
|
@ -1820,6 +1818,8 @@ namespace Emby.Server.Implementations
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_disposed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@ namespace Emby.Server.Implementations
|
||||||
{
|
{
|
||||||
public static readonly Dictionary<string, string> Configuration = new Dictionary<string, string>
|
public static readonly Dictionary<string, string> Configuration = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{"HttpListenerHost:DefaultRedirectPath", "web/index.html"}
|
{"HttpListenerHost:DefaultRedirectPath", "web/index.html"},
|
||||||
|
{"MusicBrainz:BaseUrl", "https://www.musicbrainz.org"}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.LiveTv;
|
using MediaBrowser.Model.LiveTv;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
using MediaBrowser.Model.Reflection;
|
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using SQLitePCL.pretty;
|
using SQLitePCL.pretty;
|
||||||
|
@ -65,8 +64,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
IServerConfigurationManager config,
|
IServerConfigurationManager config,
|
||||||
IServerApplicationHost appHost,
|
IServerApplicationHost appHost,
|
||||||
IJsonSerializer jsonSerializer,
|
IJsonSerializer jsonSerializer,
|
||||||
ILoggerFactory loggerFactory,
|
ILoggerFactory loggerFactory)
|
||||||
IAssemblyInfo assemblyInfo)
|
|
||||||
: base(loggerFactory.CreateLogger(nameof(SqliteItemRepository)))
|
: base(loggerFactory.CreateLogger(nameof(SqliteItemRepository)))
|
||||||
{
|
{
|
||||||
if (config == null)
|
if (config == null)
|
||||||
|
@ -82,7 +80,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
_appHost = appHost;
|
_appHost = appHost;
|
||||||
_config = config;
|
_config = config;
|
||||||
_jsonSerializer = jsonSerializer;
|
_jsonSerializer = jsonSerializer;
|
||||||
_typeMapper = new TypeMapper(assemblyInfo);
|
_typeMapper = new TypeMapper();
|
||||||
|
|
||||||
DbFilePath = Path.Combine(_config.ApplicationPaths.DataPath, "library.db");
|
DbFilePath = Path.Combine(_config.ApplicationPaths.DataPath, "library.db");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using MediaBrowser.Model.Reflection;
|
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Data
|
namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
|
@ -10,16 +9,13 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TypeMapper
|
public class TypeMapper
|
||||||
{
|
{
|
||||||
private readonly IAssemblyInfo _assemblyInfo;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This holds all the types in the running assemblies so that we can de-serialize properly when we don't have strong types
|
/// This holds all the types in the running assemblies so that we can de-serialize properly when we don't have strong types
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly ConcurrentDictionary<string, Type> _typeMap = new ConcurrentDictionary<string, Type>();
|
private readonly ConcurrentDictionary<string, Type> _typeMap = new ConcurrentDictionary<string, Type>();
|
||||||
|
|
||||||
public TypeMapper(IAssemblyInfo assemblyInfo)
|
public TypeMapper()
|
||||||
{
|
{
|
||||||
_assemblyInfo = assemblyInfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -45,8 +41,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// <returns>Type.</returns>
|
/// <returns>Type.</returns>
|
||||||
private Type LookupType(string typeName)
|
private Type LookupType(string typeName)
|
||||||
{
|
{
|
||||||
return _assemblyInfo
|
return AppDomain.CurrentDomain.GetAssemblies()
|
||||||
.GetCurrentAssemblies()
|
|
||||||
.Select(a => a.GetType(typeName))
|
.Select(a => a.GetType(typeName))
|
||||||
.FirstOrDefault(t => t != null);
|
.FirstOrDefault(t => t != null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,14 +9,14 @@ namespace Emby.Server.Implementations.Diagnostics
|
||||||
{
|
{
|
||||||
public class CommonProcess : IProcess
|
public class CommonProcess : IProcess
|
||||||
{
|
{
|
||||||
public event EventHandler Exited;
|
|
||||||
|
|
||||||
private readonly ProcessOptions _options;
|
|
||||||
private readonly Process _process;
|
private readonly Process _process;
|
||||||
|
|
||||||
|
private bool _disposed = false;
|
||||||
|
private bool _hasExited;
|
||||||
|
|
||||||
public CommonProcess(ProcessOptions options)
|
public CommonProcess(ProcessOptions options)
|
||||||
{
|
{
|
||||||
_options = options;
|
StartInfo = options;
|
||||||
|
|
||||||
var startInfo = new ProcessStartInfo
|
var startInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
|
@ -27,10 +27,10 @@ namespace Emby.Server.Implementations.Diagnostics
|
||||||
CreateNoWindow = options.CreateNoWindow,
|
CreateNoWindow = options.CreateNoWindow,
|
||||||
RedirectStandardError = options.RedirectStandardError,
|
RedirectStandardError = options.RedirectStandardError,
|
||||||
RedirectStandardInput = options.RedirectStandardInput,
|
RedirectStandardInput = options.RedirectStandardInput,
|
||||||
RedirectStandardOutput = options.RedirectStandardOutput
|
RedirectStandardOutput = options.RedirectStandardOutput,
|
||||||
|
ErrorDialog = options.ErrorDialog
|
||||||
};
|
};
|
||||||
|
|
||||||
startInfo.ErrorDialog = options.ErrorDialog;
|
|
||||||
|
|
||||||
if (options.IsHidden)
|
if (options.IsHidden)
|
||||||
{
|
{
|
||||||
|
@ -45,11 +45,22 @@ namespace Emby.Server.Implementations.Diagnostics
|
||||||
if (options.EnableRaisingEvents)
|
if (options.EnableRaisingEvents)
|
||||||
{
|
{
|
||||||
_process.EnableRaisingEvents = true;
|
_process.EnableRaisingEvents = true;
|
||||||
_process.Exited += _process_Exited;
|
_process.Exited += OnProcessExited;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _hasExited;
|
public event EventHandler Exited;
|
||||||
|
|
||||||
|
public ProcessOptions StartInfo { get; }
|
||||||
|
|
||||||
|
public StreamWriter StandardInput => _process.StandardInput;
|
||||||
|
|
||||||
|
public StreamReader StandardError => _process.StandardError;
|
||||||
|
|
||||||
|
public StreamReader StandardOutput => _process.StandardOutput;
|
||||||
|
|
||||||
|
public int ExitCode => _process.ExitCode;
|
||||||
|
|
||||||
private bool HasExited
|
private bool HasExited
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -72,25 +83,6 @@ namespace Emby.Server.Implementations.Diagnostics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _process_Exited(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
_hasExited = true;
|
|
||||||
if (Exited != null)
|
|
||||||
{
|
|
||||||
Exited(this, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProcessOptions StartInfo => _options;
|
|
||||||
|
|
||||||
public StreamWriter StandardInput => _process.StandardInput;
|
|
||||||
|
|
||||||
public StreamReader StandardError => _process.StandardError;
|
|
||||||
|
|
||||||
public StreamReader StandardOutput => _process.StandardOutput;
|
|
||||||
|
|
||||||
public int ExitCode => _process.ExitCode;
|
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
_process.Start();
|
_process.Start();
|
||||||
|
@ -108,7 +100,7 @@ namespace Emby.Server.Implementations.Diagnostics
|
||||||
|
|
||||||
public Task<bool> WaitForExitAsync(int timeMs)
|
public Task<bool> WaitForExitAsync(int timeMs)
|
||||||
{
|
{
|
||||||
//Note: For this function to work correctly, the option EnableRisingEvents needs to be set to true.
|
// Note: For this function to work correctly, the option EnableRisingEvents needs to be set to true.
|
||||||
|
|
||||||
if (HasExited)
|
if (HasExited)
|
||||||
{
|
{
|
||||||
|
@ -129,8 +121,30 @@ namespace Emby.Server.Implementations.Diagnostics
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Dispose(true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (_disposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (disposing)
|
||||||
{
|
{
|
||||||
_process?.Dispose();
|
_process?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_disposed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnProcessExited(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_hasExited = true;
|
||||||
|
Exited?.Invoke(this, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
<ProjectReference Include="..\Mono.Nat\Mono.Nat.csproj" />
|
<ProjectReference Include="..\Mono.Nat\Mono.Nat.csproj" />
|
||||||
<ProjectReference Include="..\MediaBrowser.Api\MediaBrowser.Api.csproj" />
|
<ProjectReference Include="..\MediaBrowser.Api\MediaBrowser.Api.csproj" />
|
||||||
<ProjectReference Include="..\MediaBrowser.LocalMetadata\MediaBrowser.LocalMetadata.csproj" />
|
<ProjectReference Include="..\MediaBrowser.LocalMetadata\MediaBrowser.LocalMetadata.csproj" />
|
||||||
<ProjectReference Include="..\OpenSubtitlesHandler\OpenSubtitlesHandler.csproj" />
|
|
||||||
<ProjectReference Include="..\Emby.Photos\Emby.Photos.csproj" />
|
<ProjectReference Include="..\Emby.Photos\Emby.Photos.csproj" />
|
||||||
<ProjectReference Include="..\Emby.Drawing\Emby.Drawing.csproj" />
|
<ProjectReference Include="..\Emby.Drawing\Emby.Drawing.csproj" />
|
||||||
<ProjectReference Include="..\Emby.XmlTv\Emby.XmlTv\Emby.XmlTv.csproj" />
|
<ProjectReference Include="..\Emby.XmlTv\Emby.XmlTv\Emby.XmlTv.csproj" />
|
||||||
|
@ -47,6 +46,21 @@
|
||||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||||
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Code analysers-->
|
||||||
|
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
|
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.3" />
|
||||||
|
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2" />
|
||||||
|
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
|
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Localization\iso6392.txt" />
|
<EmbeddedResource Include="Localization\iso6392.txt" />
|
||||||
<EmbeddedResource Include="Localization\countries.json" />
|
<EmbeddedResource Include="Localization\countries.json" />
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using MediaBrowser.Model.System;
|
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.EnvironmentInfo
|
|
||||||
{
|
|
||||||
public class EnvironmentInfo : IEnvironmentInfo
|
|
||||||
{
|
|
||||||
public EnvironmentInfo(MediaBrowser.Model.System.OperatingSystem operatingSystem)
|
|
||||||
{
|
|
||||||
OperatingSystem = operatingSystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MediaBrowser.Model.System.OperatingSystem OperatingSystem { get; private set; }
|
|
||||||
|
|
||||||
public string OperatingSystemName
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
switch (OperatingSystem)
|
|
||||||
{
|
|
||||||
case MediaBrowser.Model.System.OperatingSystem.Android: return "Android";
|
|
||||||
case MediaBrowser.Model.System.OperatingSystem.BSD: return "BSD";
|
|
||||||
case MediaBrowser.Model.System.OperatingSystem.Linux: return "Linux";
|
|
||||||
case MediaBrowser.Model.System.OperatingSystem.OSX: return "macOS";
|
|
||||||
case MediaBrowser.Model.System.OperatingSystem.Windows: return "Windows";
|
|
||||||
default: throw new Exception($"Unknown OS {OperatingSystem}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string OperatingSystemVersion => Environment.OSVersion.Version.ToString() + " " + Environment.OSVersion.ServicePack.ToString();
|
|
||||||
|
|
||||||
public Architecture SystemArchitecture => RuntimeInformation.OSArchitecture;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -5,7 +5,6 @@ using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Model.Services;
|
using MediaBrowser.Model.Services;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Microsoft.Net.Http.Headers;
|
using Microsoft.Net.Http.Headers;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.HttpServer
|
namespace Emby.Server.Implementations.HttpServer
|
||||||
|
|
|
@ -10,8 +10,8 @@ using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Plugins;
|
using MediaBrowser.Controller.Plugins;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
using MediaBrowser.Model.Tasks;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using OperatingSystem = MediaBrowser.Common.System.OperatingSystem;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.IO
|
namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
|
@ -127,7 +127,6 @@ namespace Emby.Server.Implementations.IO
|
||||||
private IServerConfigurationManager ConfigurationManager { get; set; }
|
private IServerConfigurationManager ConfigurationManager { get; set; }
|
||||||
|
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
private readonly IEnvironmentInfo _environmentInfo;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="LibraryMonitor" /> class.
|
/// Initializes a new instance of the <see cref="LibraryMonitor" /> class.
|
||||||
|
@ -136,14 +135,12 @@ namespace Emby.Server.Implementations.IO
|
||||||
ILoggerFactory loggerFactory,
|
ILoggerFactory loggerFactory,
|
||||||
ILibraryManager libraryManager,
|
ILibraryManager libraryManager,
|
||||||
IServerConfigurationManager configurationManager,
|
IServerConfigurationManager configurationManager,
|
||||||
IFileSystem fileSystem,
|
IFileSystem fileSystem)
|
||||||
IEnvironmentInfo environmentInfo)
|
|
||||||
{
|
{
|
||||||
LibraryManager = libraryManager;
|
LibraryManager = libraryManager;
|
||||||
Logger = loggerFactory.CreateLogger(GetType().Name);
|
Logger = loggerFactory.CreateLogger(GetType().Name);
|
||||||
ConfigurationManager = configurationManager;
|
ConfigurationManager = configurationManager;
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_environmentInfo = environmentInfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsLibraryMonitorEnabled(BaseItem item)
|
private bool IsLibraryMonitorEnabled(BaseItem item)
|
||||||
|
@ -267,7 +264,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_environmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Windows)
|
if (OperatingSystem.Id != OperatingSystemId.Windows)
|
||||||
{
|
{
|
||||||
if (path.StartsWith("\\\\", StringComparison.OrdinalIgnoreCase) || path.StartsWith("smb://", StringComparison.OrdinalIgnoreCase))
|
if (path.StartsWith("\\\\", StringComparison.OrdinalIgnoreCase) || path.StartsWith("smb://", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
@ -276,12 +273,6 @@ namespace Emby.Server.Implementations.IO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_environmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Android)
|
|
||||||
{
|
|
||||||
// causing crashing
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Already being watched
|
// Already being watched
|
||||||
if (_fileSystemWatchers.ContainsKey(path))
|
if (_fileSystemWatchers.ContainsKey(path))
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,7 @@ using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using OperatingSystem = MediaBrowser.Common.System.OperatingSystem;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.IO
|
namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
|
@ -24,22 +25,19 @@ namespace Emby.Server.Implementations.IO
|
||||||
|
|
||||||
private readonly string _tempPath;
|
private readonly string _tempPath;
|
||||||
|
|
||||||
private readonly IEnvironmentInfo _environmentInfo;
|
|
||||||
private readonly bool _isEnvironmentCaseInsensitive;
|
private readonly bool _isEnvironmentCaseInsensitive;
|
||||||
|
|
||||||
public ManagedFileSystem(
|
public ManagedFileSystem(
|
||||||
ILoggerFactory loggerFactory,
|
ILoggerFactory loggerFactory,
|
||||||
IEnvironmentInfo environmentInfo,
|
|
||||||
IApplicationPaths applicationPaths)
|
IApplicationPaths applicationPaths)
|
||||||
{
|
{
|
||||||
Logger = loggerFactory.CreateLogger("FileSystem");
|
Logger = loggerFactory.CreateLogger("FileSystem");
|
||||||
_supportsAsyncFileStreams = true;
|
_supportsAsyncFileStreams = true;
|
||||||
_tempPath = applicationPaths.TempDirectory;
|
_tempPath = applicationPaths.TempDirectory;
|
||||||
_environmentInfo = environmentInfo;
|
|
||||||
|
|
||||||
SetInvalidFileNameChars(environmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows);
|
SetInvalidFileNameChars(OperatingSystem.Id == OperatingSystemId.Windows);
|
||||||
|
|
||||||
_isEnvironmentCaseInsensitive = environmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows;
|
_isEnvironmentCaseInsensitive = OperatingSystem.Id == OperatingSystemId.Windows;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void AddShortcutHandler(IShortcutHandler handler)
|
public virtual void AddShortcutHandler(IShortcutHandler handler)
|
||||||
|
@ -468,7 +466,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
|
|
||||||
public virtual void SetHidden(string path, bool isHidden)
|
public virtual void SetHidden(string path, bool isHidden)
|
||||||
{
|
{
|
||||||
if (_environmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Windows)
|
if (OperatingSystem.Id != MediaBrowser.Model.System.OperatingSystemId.Windows)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -492,7 +490,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
|
|
||||||
public virtual void SetReadOnly(string path, bool isReadOnly)
|
public virtual void SetReadOnly(string path, bool isReadOnly)
|
||||||
{
|
{
|
||||||
if (_environmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Windows)
|
if (OperatingSystem.Id != MediaBrowser.Model.System.OperatingSystemId.Windows)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -516,7 +514,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
|
|
||||||
public virtual void SetAttributes(string path, bool isHidden, bool isReadOnly)
|
public virtual void SetAttributes(string path, bool isHidden, bool isReadOnly)
|
||||||
{
|
{
|
||||||
if (_environmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Windows)
|
if (OperatingSystem.Id != MediaBrowser.Model.System.OperatingSystemId.Windows)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -801,7 +799,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
|
|
||||||
public virtual void SetExecutable(string path)
|
public virtual void SetExecutable(string path)
|
||||||
{
|
{
|
||||||
if (_environmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.OSX)
|
if (OperatingSystem.Id == MediaBrowser.Model.System.OperatingSystemId.Darwin)
|
||||||
{
|
{
|
||||||
RunProcess("chmod", "+x \"" + path + "\"", Path.GetDirectoryName(path));
|
RunProcess("chmod", "+x \"" + path + "\"", Path.GetDirectoryName(path));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Buffers;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -8,11 +9,15 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
public class StreamHelper : IStreamHelper
|
public class StreamHelper : IStreamHelper
|
||||||
{
|
{
|
||||||
|
private const int StreamCopyToBufferSize = 81920;
|
||||||
|
|
||||||
public async Task CopyToAsync(Stream source, Stream destination, int bufferSize, Action onStarted, CancellationToken cancellationToken)
|
public async Task CopyToAsync(Stream source, Stream destination, int bufferSize, Action onStarted, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
byte[] buffer = new byte[bufferSize];
|
byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferSize);
|
||||||
|
try
|
||||||
|
{
|
||||||
int read;
|
int read;
|
||||||
while ((read = source.Read(buffer, 0, buffer.Length)) != 0)
|
while ((read = await source.ReadAsync(buffer, 0, buffer.Length).ConfigureAwait(false)) != 0)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
@ -25,15 +30,21 @@ namespace Emby.Server.Implementations.IO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ArrayPool<byte>.Shared.Return(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task CopyToAsync(Stream source, Stream destination, int bufferSize, int emptyReadLimit, CancellationToken cancellationToken)
|
public async Task CopyToAsync(Stream source, Stream destination, int bufferSize, int emptyReadLimit, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
byte[] buffer = new byte[bufferSize];
|
byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferSize);
|
||||||
|
try
|
||||||
|
{
|
||||||
if (emptyReadLimit <= 0)
|
if (emptyReadLimit <= 0)
|
||||||
{
|
{
|
||||||
int read;
|
int read;
|
||||||
while ((read = source.Read(buffer, 0, buffer.Length)) != 0)
|
while ((read = await source.ReadAsync(buffer, 0, buffer.Length).ConfigureAwait(false)) != 0)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
@ -49,7 +60,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
var bytesRead = source.Read(buffer, 0, buffer.Length);
|
var bytesRead = await source.ReadAsync(buffer, 0, buffer.Length).ConfigureAwait(false);
|
||||||
|
|
||||||
if (bytesRead == 0)
|
if (bytesRead == 0)
|
||||||
{
|
{
|
||||||
|
@ -64,21 +75,27 @@ namespace Emby.Server.Implementations.IO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ArrayPool<byte>.Shared.Return(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const int StreamCopyToBufferSize = 81920;
|
|
||||||
public async Task<int> CopyToAsync(Stream source, Stream destination, CancellationToken cancellationToken)
|
public async Task<int> CopyToAsync(Stream source, Stream destination, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var array = new byte[StreamCopyToBufferSize];
|
byte[] buffer = ArrayPool<byte>.Shared.Rent(StreamCopyToBufferSize);
|
||||||
int bytesRead;
|
try
|
||||||
|
{
|
||||||
int totalBytesRead = 0;
|
int totalBytesRead = 0;
|
||||||
|
|
||||||
while ((bytesRead = await source.ReadAsync(array, 0, array.Length, cancellationToken).ConfigureAwait(false)) != 0)
|
int bytesRead;
|
||||||
|
while ((bytesRead = await source.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false)) != 0)
|
||||||
{
|
{
|
||||||
var bytesToWrite = bytesRead;
|
var bytesToWrite = bytesRead;
|
||||||
|
|
||||||
if (bytesToWrite > 0)
|
if (bytesToWrite > 0)
|
||||||
{
|
{
|
||||||
await destination.WriteAsync(array, 0, Convert.ToInt32(bytesToWrite), cancellationToken).ConfigureAwait(false);
|
await destination.WriteAsync(buffer, 0, Convert.ToInt32(bytesToWrite), cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
totalBytesRead += bytesRead;
|
totalBytesRead += bytesRead;
|
||||||
}
|
}
|
||||||
|
@ -86,20 +103,27 @@ namespace Emby.Server.Implementations.IO
|
||||||
|
|
||||||
return totalBytesRead;
|
return totalBytesRead;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ArrayPool<byte>.Shared.Return(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<int> CopyToAsyncWithSyncRead(Stream source, Stream destination, CancellationToken cancellationToken)
|
public async Task<int> CopyToAsyncWithSyncRead(Stream source, Stream destination, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var array = new byte[StreamCopyToBufferSize];
|
byte[] buffer = ArrayPool<byte>.Shared.Rent(StreamCopyToBufferSize);
|
||||||
|
try
|
||||||
|
{
|
||||||
int bytesRead;
|
int bytesRead;
|
||||||
int totalBytesRead = 0;
|
int totalBytesRead = 0;
|
||||||
|
|
||||||
while ((bytesRead = source.Read(array, 0, array.Length)) != 0)
|
while ((bytesRead = source.Read(buffer, 0, buffer.Length)) != 0)
|
||||||
{
|
{
|
||||||
var bytesToWrite = bytesRead;
|
var bytesToWrite = bytesRead;
|
||||||
|
|
||||||
if (bytesToWrite > 0)
|
if (bytesToWrite > 0)
|
||||||
{
|
{
|
||||||
await destination.WriteAsync(array, 0, Convert.ToInt32(bytesToWrite), cancellationToken).ConfigureAwait(false);
|
await destination.WriteAsync(buffer, 0, Convert.ToInt32(bytesToWrite), cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
totalBytesRead += bytesRead;
|
totalBytesRead += bytesRead;
|
||||||
}
|
}
|
||||||
|
@ -107,19 +131,26 @@ namespace Emby.Server.Implementations.IO
|
||||||
|
|
||||||
return totalBytesRead;
|
return totalBytesRead;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ArrayPool<byte>.Shared.Return(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task CopyToAsyncWithSyncRead(Stream source, Stream destination, long copyLength, CancellationToken cancellationToken)
|
public async Task CopyToAsyncWithSyncRead(Stream source, Stream destination, long copyLength, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var array = new byte[StreamCopyToBufferSize];
|
byte[] buffer = ArrayPool<byte>.Shared.Rent(StreamCopyToBufferSize);
|
||||||
|
try
|
||||||
|
{
|
||||||
int bytesRead;
|
int bytesRead;
|
||||||
|
|
||||||
while ((bytesRead = source.Read(array, 0, array.Length)) != 0)
|
while ((bytesRead = source.Read(buffer, 0, buffer.Length)) != 0)
|
||||||
{
|
{
|
||||||
var bytesToWrite = Math.Min(bytesRead, copyLength);
|
var bytesToWrite = Math.Min(bytesRead, copyLength);
|
||||||
|
|
||||||
if (bytesToWrite > 0)
|
if (bytesToWrite > 0)
|
||||||
{
|
{
|
||||||
await destination.WriteAsync(array, 0, Convert.ToInt32(bytesToWrite), cancellationToken).ConfigureAwait(false);
|
await destination.WriteAsync(buffer, 0, Convert.ToInt32(bytesToWrite), cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
copyLength -= bytesToWrite;
|
copyLength -= bytesToWrite;
|
||||||
|
@ -130,19 +161,26 @@ namespace Emby.Server.Implementations.IO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ArrayPool<byte>.Shared.Return(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task CopyToAsync(Stream source, Stream destination, long copyLength, CancellationToken cancellationToken)
|
public async Task CopyToAsync(Stream source, Stream destination, long copyLength, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var array = new byte[StreamCopyToBufferSize];
|
byte[] buffer = ArrayPool<byte>.Shared.Rent(StreamCopyToBufferSize);
|
||||||
|
try
|
||||||
|
{
|
||||||
int bytesRead;
|
int bytesRead;
|
||||||
|
|
||||||
while ((bytesRead = await source.ReadAsync(array, 0, array.Length, cancellationToken).ConfigureAwait(false)) != 0)
|
while ((bytesRead = await source.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false)) != 0)
|
||||||
{
|
{
|
||||||
var bytesToWrite = Math.Min(bytesRead, copyLength);
|
var bytesToWrite = Math.Min(bytesRead, copyLength);
|
||||||
|
|
||||||
if (bytesToWrite > 0)
|
if (bytesToWrite > 0)
|
||||||
{
|
{
|
||||||
await destination.WriteAsync(array, 0, Convert.ToInt32(bytesToWrite), cancellationToken).ConfigureAwait(false);
|
await destination.WriteAsync(buffer, 0, Convert.ToInt32(bytesToWrite), cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
copyLength -= bytesToWrite;
|
copyLength -= bytesToWrite;
|
||||||
|
@ -153,24 +191,32 @@ namespace Emby.Server.Implementations.IO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ArrayPool<byte>.Shared.Return(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task CopyUntilCancelled(Stream source, Stream target, int bufferSize, CancellationToken cancellationToken)
|
public async Task CopyUntilCancelled(Stream source, Stream target, int bufferSize, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
byte[] buffer = new byte[bufferSize];
|
byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferSize);
|
||||||
|
try
|
||||||
|
{
|
||||||
while (!cancellationToken.IsCancellationRequested)
|
while (!cancellationToken.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
var bytesRead = await CopyToAsyncInternal(source, target, buffer, cancellationToken).ConfigureAwait(false);
|
var bytesRead = await CopyToAsyncInternal(source, target, buffer, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
//var position = fs.Position;
|
|
||||||
//_logger.LogDebug("Streamed {0} bytes to position {1} from file {2}", bytesRead, position, path);
|
|
||||||
|
|
||||||
if (bytesRead == 0)
|
if (bytesRead == 0)
|
||||||
{
|
{
|
||||||
await Task.Delay(100).ConfigureAwait(false);
|
await Task.Delay(100).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ArrayPool<byte>.Shared.Return(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static async Task<int> CopyToAsyncInternal(Stream source, Stream destination, byte[] buffer, CancellationToken cancellationToken)
|
private static async Task<int> CopyToAsyncInternal(Stream source, Stream destination, byte[] buffer, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,11 +7,6 @@ namespace Emby.Server.Implementations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string FFmpegPath { get; }
|
string FFmpegPath { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// --ffprobe
|
|
||||||
/// </summary>
|
|
||||||
string FFprobePath { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// --service
|
/// --service
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -58,22 +58,23 @@ namespace Emby.Server.Implementations.Library
|
||||||
private ILibraryPostScanTask[] PostscanTasks { get; set; }
|
private ILibraryPostScanTask[] PostscanTasks { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the intro providers.
|
/// Gets or sets the intro providers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The intro providers.</value>
|
/// <value>The intro providers.</value>
|
||||||
private IIntroProvider[] IntroProviders { get; set; }
|
private IIntroProvider[] IntroProviders { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the list of entity resolution ignore rules
|
/// Gets or sets the list of entity resolution ignore rules
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The entity resolution ignore rules.</value>
|
/// <value>The entity resolution ignore rules.</value>
|
||||||
private IResolverIgnoreRule[] EntityResolutionIgnoreRules { get; set; }
|
private IResolverIgnoreRule[] EntityResolutionIgnoreRules { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the list of currently registered entity resolvers
|
/// Gets or sets the list of currently registered entity resolvers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The entity resolvers enumerable.</value>
|
/// <value>The entity resolvers enumerable.</value>
|
||||||
private IItemResolver[] EntityResolvers { get; set; }
|
private IItemResolver[] EntityResolvers { get; set; }
|
||||||
|
|
||||||
private IMultiItemResolver[] MultiItemResolvers { get; set; }
|
private IMultiItemResolver[] MultiItemResolvers { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -83,7 +84,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
private IBaseItemComparer[] Comparers { get; set; }
|
private IBaseItemComparer[] Comparers { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the active item repository
|
/// Gets or sets the active item repository
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The item repository.</value>
|
/// <value>The item repository.</value>
|
||||||
public IItemRepository ItemRepository { get; set; }
|
public IItemRepository ItemRepository { get; set; }
|
||||||
|
@ -133,12 +134,14 @@ namespace Emby.Server.Implementations.Library
|
||||||
private readonly Func<IProviderManager> _providerManagerFactory;
|
private readonly Func<IProviderManager> _providerManagerFactory;
|
||||||
private readonly Func<IUserViewManager> _userviewManager;
|
private readonly Func<IUserViewManager> _userviewManager;
|
||||||
public bool IsScanRunning { get; private set; }
|
public bool IsScanRunning { get; private set; }
|
||||||
|
|
||||||
private IServerApplicationHost _appHost;
|
private IServerApplicationHost _appHost;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _library items cache
|
/// The _library items cache
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly ConcurrentDictionary<Guid, BaseItem> _libraryItemsCache;
|
private readonly ConcurrentDictionary<Guid, BaseItem> _libraryItemsCache;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the library items cache.
|
/// Gets the library items cache.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -150,7 +153,8 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="LibraryManager" /> class.
|
/// Initializes a new instance of the <see cref="LibraryManager" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="appHost">The application host</param>
|
||||||
|
/// <param name="loggerFactory">The logger factory.</param>
|
||||||
/// <param name="taskManager">The task manager.</param>
|
/// <param name="taskManager">The task manager.</param>
|
||||||
/// <param name="userManager">The user manager.</param>
|
/// <param name="userManager">The user manager.</param>
|
||||||
/// <param name="configurationManager">The configuration manager.</param>
|
/// <param name="configurationManager">The configuration manager.</param>
|
||||||
|
@ -167,6 +171,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
Func<IProviderManager> providerManagerFactory,
|
Func<IProviderManager> providerManagerFactory,
|
||||||
Func<IUserViewManager> userviewManager)
|
Func<IUserViewManager> userviewManager)
|
||||||
{
|
{
|
||||||
|
_appHost = appHost;
|
||||||
_logger = loggerFactory.CreateLogger(nameof(LibraryManager));
|
_logger = loggerFactory.CreateLogger(nameof(LibraryManager));
|
||||||
_taskManager = taskManager;
|
_taskManager = taskManager;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
|
@ -176,7 +181,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_providerManagerFactory = providerManagerFactory;
|
_providerManagerFactory = providerManagerFactory;
|
||||||
_userviewManager = userviewManager;
|
_userviewManager = userviewManager;
|
||||||
_appHost = appHost;
|
|
||||||
_libraryItemsCache = new ConcurrentDictionary<Guid, BaseItem>();
|
_libraryItemsCache = new ConcurrentDictionary<Guid, BaseItem>();
|
||||||
|
|
||||||
ConfigurationManager.ConfigurationUpdated += ConfigurationUpdated;
|
ConfigurationManager.ConfigurationUpdated += ConfigurationUpdated;
|
||||||
|
@ -191,8 +196,9 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// <param name="resolvers">The resolvers.</param>
|
/// <param name="resolvers">The resolvers.</param>
|
||||||
/// <param name="introProviders">The intro providers.</param>
|
/// <param name="introProviders">The intro providers.</param>
|
||||||
/// <param name="itemComparers">The item comparers.</param>
|
/// <param name="itemComparers">The item comparers.</param>
|
||||||
/// <param name="postscanTasks">The postscan tasks.</param>
|
/// <param name="postscanTasks">The post scan tasks.</param>
|
||||||
public void AddParts(IEnumerable<IResolverIgnoreRule> rules,
|
public void AddParts(
|
||||||
|
IEnumerable<IResolverIgnoreRule> rules,
|
||||||
IEnumerable<IItemResolver> resolvers,
|
IEnumerable<IItemResolver> resolvers,
|
||||||
IEnumerable<IIntroProvider> introProviders,
|
IEnumerable<IIntroProvider> introProviders,
|
||||||
IEnumerable<IBaseItemComparer> itemComparers,
|
IEnumerable<IBaseItemComparer> itemComparers,
|
||||||
|
@ -203,24 +209,19 @@ namespace Emby.Server.Implementations.Library
|
||||||
MultiItemResolvers = EntityResolvers.OfType<IMultiItemResolver>().ToArray();
|
MultiItemResolvers = EntityResolvers.OfType<IMultiItemResolver>().ToArray();
|
||||||
IntroProviders = introProviders.ToArray();
|
IntroProviders = introProviders.ToArray();
|
||||||
Comparers = itemComparers.ToArray();
|
Comparers = itemComparers.ToArray();
|
||||||
|
PostscanTasks = postscanTasks.ToArray();
|
||||||
PostscanTasks = postscanTasks.OrderBy(i =>
|
|
||||||
{
|
|
||||||
var hasOrder = i as IHasOrder;
|
|
||||||
|
|
||||||
return hasOrder == null ? 0 : hasOrder.Order;
|
|
||||||
|
|
||||||
}).ToArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _root folder
|
/// The _root folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private volatile AggregateFolder _rootFolder;
|
private volatile AggregateFolder _rootFolder;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _root folder sync lock
|
/// The _root folder sync lock
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly object _rootFolderSyncLock = new object();
|
private readonly object _rootFolderSyncLock = new object();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the root folder.
|
/// Gets the root folder.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -239,11 +240,13 @@ namespace Emby.Server.Implementations.Library
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return _rootFolder;
|
return _rootFolder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _wizardCompleted;
|
private bool _wizardCompleted;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Records the configuration values.
|
/// Records the configuration values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -258,7 +261,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender">The sender.</param>
|
/// <param name="sender">The sender.</param>
|
||||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||||
void ConfigurationUpdated(object sender, EventArgs e)
|
private void ConfigurationUpdated(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var config = ConfigurationManager.Configuration;
|
var config = ConfigurationManager.Configuration;
|
||||||
|
|
||||||
|
@ -335,12 +338,14 @@ namespace Emby.Server.Implementations.Library
|
||||||
// channel no longer installed
|
// channel no longer installed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
options.DeleteFileLocation = false;
|
options.DeleteFileLocation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item is LiveTvProgram)
|
if (item is LiveTvProgram)
|
||||||
{
|
{
|
||||||
_logger.LogDebug("Deleting item, Type: {0}, Name: {1}, Path: {2}, Id: {3}",
|
_logger.LogDebug(
|
||||||
|
"Deleting item, Type: {0}, Name: {1}, Path: {2}, Id: {3}",
|
||||||
item.GetType().Name,
|
item.GetType().Name,
|
||||||
item.Name ?? "Unknown name",
|
item.Name ?? "Unknown name",
|
||||||
item.Path ?? string.Empty,
|
item.Path ?? string.Empty,
|
||||||
|
@ -348,7 +353,8 @@ namespace Emby.Server.Implementations.Library
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Deleting item, Type: {0}, Name: {1}, Path: {2}, Id: {3}",
|
_logger.LogInformation(
|
||||||
|
"Deleting item, Type: {0}, Name: {1}, Path: {2}, Id: {3}",
|
||||||
item.GetType().Name,
|
item.GetType().Name,
|
||||||
item.Name ?? "Unknown name",
|
item.Name ?? "Unknown name",
|
||||||
item.Path ?? string.Empty,
|
item.Path ?? string.Empty,
|
||||||
|
@ -488,12 +494,13 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(key));
|
throw new ArgumentNullException(nameof(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == null)
|
if (type == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(type));
|
throw new ArgumentNullException(nameof(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key.StartsWith(ConfigurationManager.ApplicationPaths.ProgramDataPath))
|
if (key.StartsWith(ConfigurationManager.ApplicationPaths.ProgramDataPath, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
// Try to normalize paths located underneath program-data in an attempt to make them more portable
|
// Try to normalize paths located underneath program-data in an attempt to make them more portable
|
||||||
key = key.Substring(ConfigurationManager.ApplicationPaths.ProgramDataPath.Length)
|
key = key.Substring(ConfigurationManager.ApplicationPaths.ProgramDataPath.Length)
|
||||||
|
@ -511,13 +518,11 @@ namespace Emby.Server.Implementations.Library
|
||||||
return key.GetMD5();
|
return key.GetMD5();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseItem ResolvePath(FileSystemMetadata fileInfo,
|
public BaseItem ResolvePath(FileSystemMetadata fileInfo, Folder parent = null)
|
||||||
Folder parent = null)
|
=> ResolvePath(fileInfo, new DirectoryService(_logger, _fileSystem), null, parent);
|
||||||
{
|
|
||||||
return ResolvePath(fileInfo, new DirectoryService(_logger, _fileSystem), null, parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private BaseItem ResolvePath(FileSystemMetadata fileInfo,
|
private BaseItem ResolvePath(
|
||||||
|
FileSystemMetadata fileInfo,
|
||||||
IDirectoryService directoryService,
|
IDirectoryService directoryService,
|
||||||
IItemResolver[] resolvers,
|
IItemResolver[] resolvers,
|
||||||
Folder parent = null,
|
Folder parent = null,
|
||||||
|
@ -572,7 +577,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Error in GetFilteredFileSystemEntries isPhysicalRoot: {0} IsVf: {1}", isPhysicalRoot, isVf);
|
_logger.LogError(ex, "Error in GetFilteredFileSystemEntries isPhysicalRoot: {0} IsVf: {1}", isPhysicalRoot, isVf);
|
||||||
|
|
||||||
files = new FileSystemMetadata[] { };
|
files = Array.Empty<FileSystemMetadata>();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -600,13 +605,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IgnoreFile(FileSystemMetadata file, BaseItem parent)
|
public bool IgnoreFile(FileSystemMetadata file, BaseItem parent)
|
||||||
{
|
=> EntityResolutionIgnoreRules.Any(r => r.ShouldIgnore(file, parent));
|
||||||
if (EntityResolutionIgnoreRules.Any(r => r.ShouldIgnore(file, parent)))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<FileSystemMetadata> NormalizeRootPathList(IEnumerable<FileSystemMetadata> paths)
|
public List<FileSystemMetadata> NormalizeRootPathList(IEnumerable<FileSystemMetadata> paths)
|
||||||
{
|
{
|
||||||
|
@ -646,7 +645,8 @@ namespace Emby.Server.Implementations.Library
|
||||||
return ResolvePaths(files, directoryService, parent, libraryOptions, collectionType, EntityResolvers);
|
return ResolvePaths(files, directoryService, parent, libraryOptions, collectionType, EntityResolvers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<BaseItem> ResolvePaths(IEnumerable<FileSystemMetadata> files,
|
public IEnumerable<BaseItem> ResolvePaths(
|
||||||
|
IEnumerable<FileSystemMetadata> files,
|
||||||
IDirectoryService directoryService,
|
IDirectoryService directoryService,
|
||||||
Folder parent,
|
Folder parent,
|
||||||
LibraryOptions libraryOptions,
|
LibraryOptions libraryOptions,
|
||||||
|
@ -672,6 +672,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
ResolverHelper.SetInitialItemValues(item, parent, _fileSystem, this, directoryService);
|
ResolverHelper.SetInitialItemValues(item, parent, _fileSystem, this, directoryService);
|
||||||
}
|
}
|
||||||
|
|
||||||
items.AddRange(ResolveFileList(result.ExtraFiles, directoryService, parent, collectionType, resolvers, libraryOptions));
|
items.AddRange(ResolveFileList(result.ExtraFiles, directoryService, parent, collectionType, resolvers, libraryOptions));
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
@ -681,7 +682,8 @@ namespace Emby.Server.Implementations.Library
|
||||||
return ResolveFileList(fileList, directoryService, parent, collectionType, resolvers, libraryOptions);
|
return ResolveFileList(fileList, directoryService, parent, collectionType, resolvers, libraryOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<BaseItem> ResolveFileList(IEnumerable<FileSystemMetadata> fileList,
|
private IEnumerable<BaseItem> ResolveFileList(
|
||||||
|
IEnumerable<FileSystemMetadata> fileList,
|
||||||
IDirectoryService directoryService,
|
IDirectoryService directoryService,
|
||||||
Folder parent,
|
Folder parent,
|
||||||
string collectionType,
|
string collectionType,
|
||||||
|
@ -766,6 +768,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
private volatile UserRootFolder _userRootFolder;
|
private volatile UserRootFolder _userRootFolder;
|
||||||
private readonly object _syncLock = new object();
|
private readonly object _syncLock = new object();
|
||||||
|
|
||||||
public Folder GetUserRootFolder()
|
public Folder GetUserRootFolder()
|
||||||
{
|
{
|
||||||
if (_userRootFolder == null)
|
if (_userRootFolder == null)
|
||||||
|
@ -810,8 +813,6 @@ namespace Emby.Server.Implementations.Library
|
||||||
throw new ArgumentNullException(nameof(path));
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
//_logger.LogInformation("FindByPath {0}", path);
|
|
||||||
|
|
||||||
var query = new InternalItemsQuery
|
var query = new InternalItemsQuery
|
||||||
{
|
{
|
||||||
Path = path,
|
Path = path,
|
||||||
|
@ -885,7 +886,6 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">The value.</param>
|
/// <param name="value">The value.</param>
|
||||||
/// <returns>Task{Year}.</returns>
|
/// <returns>Task{Year}.</returns>
|
||||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
|
||||||
public Year GetYear(int value)
|
public Year GetYear(int value)
|
||||||
{
|
{
|
||||||
if (value <= 0)
|
if (value <= 0)
|
||||||
|
@ -1027,20 +1027,25 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
private async Task ValidateTopLibraryFolders(CancellationToken cancellationToken)
|
private async Task ValidateTopLibraryFolders(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var rootChildren = RootFolder.Children.ToList();
|
|
||||||
rootChildren = GetUserRootFolder().Children.ToList();
|
|
||||||
|
|
||||||
await RootFolder.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
await RootFolder.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
// Start by just validating the children of the root, but go no further
|
// Start by just validating the children of the root, but go no further
|
||||||
await RootFolder.ValidateChildren(new SimpleProgress<double>(), cancellationToken, new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem)), recursive: false);
|
await RootFolder.ValidateChildren(
|
||||||
|
new SimpleProgress<double>(),
|
||||||
|
cancellationToken,
|
||||||
|
new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem)),
|
||||||
|
recursive: false).ConfigureAwait(false);
|
||||||
|
|
||||||
await GetUserRootFolder().RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
await GetUserRootFolder().RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
await GetUserRootFolder().ValidateChildren(new SimpleProgress<double>(), cancellationToken, new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem)), recursive: false).ConfigureAwait(false);
|
await GetUserRootFolder().ValidateChildren(
|
||||||
|
new SimpleProgress<double>(),
|
||||||
|
cancellationToken,
|
||||||
|
new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem)),
|
||||||
|
recursive: false).ConfigureAwait(false);
|
||||||
|
|
||||||
// Quickly scan CollectionFolders for changes
|
// Quickly scan CollectionFolders for changes
|
||||||
foreach (var folder in GetUserRootFolder().Children.OfType<Folder>().ToList())
|
foreach (var folder in GetUserRootFolder().Children.OfType<Folder>())
|
||||||
{
|
{
|
||||||
await folder.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
await folder.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
@ -1204,7 +1209,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
private string GetCollectionType(string path)
|
private string GetCollectionType(string path)
|
||||||
{
|
{
|
||||||
return _fileSystem.GetFilePaths(path, new[] { ".collection" }, true, false)
|
return _fileSystem.GetFilePaths(path, new[] { ".collection" }, true, false)
|
||||||
.Select(i => Path.GetFileNameWithoutExtension(i))
|
.Select(Path.GetFileNameWithoutExtension)
|
||||||
.FirstOrDefault(i => !string.IsNullOrEmpty(i));
|
.FirstOrDefault(i => !string.IsNullOrEmpty(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1218,7 +1223,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (id == Guid.Empty)
|
if (id == Guid.Empty)
|
||||||
{
|
{
|
||||||
throw new ArgumentException(nameof(id), "Guid can't be empty");
|
throw new ArgumentException("Guid can't be empty", nameof(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LibraryItemsCache.TryGetValue(id, out BaseItem item))
|
if (LibraryItemsCache.TryGetValue(id, out BaseItem item))
|
||||||
|
@ -1386,17 +1391,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
var parents = query.AncestorIds.Select(i => GetItemById(i)).ToList();
|
var parents = query.AncestorIds.Select(i => GetItemById(i)).ToList();
|
||||||
|
|
||||||
if (parents.All(i =>
|
if (parents.All(i => i is ICollectionFolder || i is UserView))
|
||||||
{
|
|
||||||
if (i is ICollectionFolder || i is UserView)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//_logger.LogDebug("Query requires ancestor query due to type: " + i.GetType().Name);
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}))
|
|
||||||
{
|
{
|
||||||
// Optimize by querying against top level views
|
// Optimize by querying against top level views
|
||||||
query.TopParentIds = parents.SelectMany(i => GetTopParentIdsForQuery(i, query.User)).ToArray();
|
query.TopParentIds = parents.SelectMany(i => GetTopParentIdsForQuery(i, query.User)).ToArray();
|
||||||
|
@ -1452,17 +1447,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
private void SetTopParentIdsOrAncestors(InternalItemsQuery query, List<BaseItem> parents)
|
private void SetTopParentIdsOrAncestors(InternalItemsQuery query, List<BaseItem> parents)
|
||||||
{
|
{
|
||||||
if (parents.All(i =>
|
if (parents.All(i => i is ICollectionFolder || i is UserView))
|
||||||
{
|
|
||||||
if (i is ICollectionFolder || i is UserView)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//_logger.LogDebug("Query requires ancestor query due to type: " + i.GetType().Name);
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}))
|
|
||||||
{
|
{
|
||||||
// Optimize by querying against top level views
|
// Optimize by querying against top level views
|
||||||
query.TopParentIds = parents.SelectMany(i => GetTopParentIdsForQuery(i, query.User)).ToArray();
|
query.TopParentIds = parents.SelectMany(i => GetTopParentIdsForQuery(i, query.User)).ToArray();
|
||||||
|
@ -1511,11 +1496,9 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
private IEnumerable<Guid> GetTopParentIdsForQuery(BaseItem item, User user)
|
private IEnumerable<Guid> GetTopParentIdsForQuery(BaseItem item, User user)
|
||||||
{
|
{
|
||||||
var view = item as UserView;
|
if (item is UserView view)
|
||||||
|
|
||||||
if (view != null)
|
|
||||||
{
|
{
|
||||||
if (string.Equals(view.ViewType, CollectionType.LiveTv))
|
if (string.Equals(view.ViewType, CollectionType.LiveTv, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
return new[] { view.Id };
|
return new[] { view.Id };
|
||||||
}
|
}
|
||||||
|
@ -1528,8 +1511,10 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
return GetTopParentIdsForQuery(displayParent, user);
|
return GetTopParentIdsForQuery(displayParent, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Array.Empty<Guid>();
|
return Array.Empty<Guid>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!view.ParentId.Equals(Guid.Empty))
|
if (!view.ParentId.Equals(Guid.Empty))
|
||||||
{
|
{
|
||||||
var displayParent = GetItemById(view.ParentId);
|
var displayParent = GetItemById(view.ParentId);
|
||||||
|
@ -1537,6 +1522,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
return GetTopParentIdsForQuery(displayParent, user);
|
return GetTopParentIdsForQuery(displayParent, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Array.Empty<Guid>();
|
return Array.Empty<Guid>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1550,11 +1536,11 @@ namespace Emby.Server.Implementations.Library
|
||||||
.Where(i => user.IsFolderGrouped(i.Id))
|
.Where(i => user.IsFolderGrouped(i.Id))
|
||||||
.SelectMany(i => GetTopParentIdsForQuery(i, user));
|
.SelectMany(i => GetTopParentIdsForQuery(i, user));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Array.Empty<Guid>();
|
return Array.Empty<Guid>();
|
||||||
}
|
}
|
||||||
|
|
||||||
var collectionFolder = item as CollectionFolder;
|
if (item is CollectionFolder collectionFolder)
|
||||||
if (collectionFolder != null)
|
|
||||||
{
|
{
|
||||||
return collectionFolder.PhysicalFolderIds;
|
return collectionFolder.PhysicalFolderIds;
|
||||||
}
|
}
|
||||||
|
@ -1564,6 +1550,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
return new[] { topParent.Id };
|
return new[] { topParent.Id };
|
||||||
}
|
}
|
||||||
|
|
||||||
return Array.Empty<Guid>();
|
return Array.Empty<Guid>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1760,8 +1747,6 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
var comparer = Comparers.FirstOrDefault(c => string.Equals(name, c.Name, StringComparison.OrdinalIgnoreCase));
|
var comparer = Comparers.FirstOrDefault(c => string.Equals(name, c.Name, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (comparer != null)
|
|
||||||
{
|
|
||||||
// If it requires a user, create a new one, and assign the user
|
// If it requires a user, create a new one, and assign the user
|
||||||
if (comparer is IUserBaseItemComparer)
|
if (comparer is IUserBaseItemComparer)
|
||||||
{
|
{
|
||||||
|
@ -1773,7 +1758,6 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
return userComparer;
|
return userComparer;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return comparer;
|
return comparer;
|
||||||
}
|
}
|
||||||
|
@ -1783,7 +1767,6 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
/// <param name="parent">The parent item.</param>
|
/// <param name="parent">The parent item.</param>
|
||||||
/// <returns>Task.</returns>
|
|
||||||
public void CreateItem(BaseItem item, BaseItem parent)
|
public void CreateItem(BaseItem item, BaseItem parent)
|
||||||
{
|
{
|
||||||
CreateItems(new[] { item }, parent, CancellationToken.None);
|
CreateItems(new[] { item }, parent, CancellationToken.None);
|
||||||
|
@ -1793,20 +1776,23 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// Creates the items.
|
/// Creates the items.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="items">The items.</param>
|
/// <param name="items">The items.</param>
|
||||||
|
/// <param name="parent">The parent item</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
|
||||||
public void CreateItems(IEnumerable<BaseItem> items, BaseItem parent, CancellationToken cancellationToken)
|
public void CreateItems(IEnumerable<BaseItem> items, BaseItem parent, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
ItemRepository.SaveItems(items, cancellationToken);
|
// Don't iterate multiple times
|
||||||
|
var itemsList = items.ToList();
|
||||||
|
|
||||||
foreach (var item in items)
|
ItemRepository.SaveItems(itemsList, cancellationToken);
|
||||||
|
|
||||||
|
foreach (var item in itemsList)
|
||||||
{
|
{
|
||||||
RegisterItem(item);
|
RegisterItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ItemAdded != null)
|
if (ItemAdded != null)
|
||||||
{
|
{
|
||||||
foreach (var item in items)
|
foreach (var item in itemsList)
|
||||||
{
|
{
|
||||||
// With the live tv guide this just creates too much noise
|
// With the live tv guide this just creates too much noise
|
||||||
if (item.SourceType != SourceType.Library)
|
if (item.SourceType != SourceType.Library)
|
||||||
|
@ -1816,7 +1802,9 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemAdded(this, new ItemChangeEventArgs
|
ItemAdded(
|
||||||
|
this,
|
||||||
|
new ItemChangeEventArgs
|
||||||
{
|
{
|
||||||
Item = item,
|
Item = item,
|
||||||
Parent = parent ?? item.GetParent()
|
Parent = parent ?? item.GetParent()
|
||||||
|
@ -1842,7 +1830,10 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdateItems(IEnumerable<BaseItem> items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)
|
public void UpdateItems(IEnumerable<BaseItem> items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
foreach (var item in items)
|
// Don't iterate multiple times
|
||||||
|
var itemsList = items.ToList();
|
||||||
|
|
||||||
|
foreach (var item in itemsList)
|
||||||
{
|
{
|
||||||
if (item.IsFileProtocol)
|
if (item.IsFileProtocol)
|
||||||
{
|
{
|
||||||
|
@ -1854,14 +1845,11 @@ namespace Emby.Server.Implementations.Library
|
||||||
RegisterItem(item);
|
RegisterItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
//var logName = item.LocationType == LocationType.Remote ? item.Name ?? item.Path : item.Path ?? item.Name;
|
ItemRepository.SaveItems(itemsList, cancellationToken);
|
||||||
//_logger.LogDebug("Saving {0} to database.", logName);
|
|
||||||
|
|
||||||
ItemRepository.SaveItems(items, cancellationToken);
|
|
||||||
|
|
||||||
if (ItemUpdated != null)
|
if (ItemUpdated != null)
|
||||||
{
|
{
|
||||||
foreach (var item in items)
|
foreach (var item in itemsList)
|
||||||
{
|
{
|
||||||
// With the live tv guide this just creates too much noise
|
// With the live tv guide this just creates too much noise
|
||||||
if (item.SourceType != SourceType.Library)
|
if (item.SourceType != SourceType.Library)
|
||||||
|
@ -1871,7 +1859,9 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemUpdated(this, new ItemChangeEventArgs
|
ItemUpdated(
|
||||||
|
this,
|
||||||
|
new ItemChangeEventArgs
|
||||||
{
|
{
|
||||||
Item = item,
|
Item = item,
|
||||||
Parent = parent,
|
Parent = parent,
|
||||||
|
@ -1890,9 +1880,9 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// Updates the item.
|
/// Updates the item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
|
/// <param name="parent">The parent item.</param>
|
||||||
/// <param name="updateReason">The update reason.</param>
|
/// <param name="updateReason">The update reason.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
|
||||||
public void UpdateItem(BaseItem item, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)
|
public void UpdateItem(BaseItem item, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
UpdateItems(new [] { item }, parent, updateReason, cancellationToken);
|
UpdateItems(new [] { item }, parent, updateReason, cancellationToken);
|
||||||
|
@ -1902,13 +1892,16 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// Reports the item removed.
|
/// Reports the item removed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
|
/// <param name="parent">The parent item.</param>
|
||||||
public void ReportItemRemoved(BaseItem item, BaseItem parent)
|
public void ReportItemRemoved(BaseItem item, BaseItem parent)
|
||||||
{
|
{
|
||||||
if (ItemRemoved != null)
|
if (ItemRemoved != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemRemoved(this, new ItemChangeEventArgs
|
ItemRemoved(
|
||||||
|
this,
|
||||||
|
new ItemChangeEventArgs
|
||||||
{
|
{
|
||||||
Item = item,
|
Item = item,
|
||||||
Parent = parent
|
Parent = parent
|
||||||
|
@ -2038,8 +2031,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
public string GetConfiguredContentType(BaseItem item, bool inheritConfiguredPath)
|
public string GetConfiguredContentType(BaseItem item, bool inheritConfiguredPath)
|
||||||
{
|
{
|
||||||
var collectionFolder = item as ICollectionFolder;
|
if (item is ICollectionFolder collectionFolder)
|
||||||
if (collectionFolder != null)
|
|
||||||
{
|
{
|
||||||
return collectionFolder.CollectionType;
|
return collectionFolder.CollectionType;
|
||||||
}
|
}
|
||||||
|
@ -2049,13 +2041,11 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
private string GetContentTypeOverride(string path, bool inherit)
|
private string GetContentTypeOverride(string path, bool inherit)
|
||||||
{
|
{
|
||||||
var nameValuePair = ConfigurationManager.Configuration.ContentTypes.FirstOrDefault(i => _fileSystem.AreEqual(i.Name, path) || (inherit && !string.IsNullOrEmpty(i.Name) && _fileSystem.ContainsSubPath(i.Name, path)));
|
var nameValuePair = ConfigurationManager.Configuration.ContentTypes
|
||||||
if (nameValuePair != null)
|
.FirstOrDefault(i => _fileSystem.AreEqual(i.Name, path)
|
||||||
{
|
|| (inherit && !string.IsNullOrEmpty(i.Name)
|
||||||
return nameValuePair.Value;
|
&& _fileSystem.ContainsSubPath(i.Name, path)));
|
||||||
}
|
return nameValuePair?.Value;
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetTopFolderContentType(BaseItem item)
|
private string GetTopFolderContentType(BaseItem item)
|
||||||
|
@ -2072,6 +2062,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
item = parent;
|
item = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2083,9 +2074,9 @@ namespace Emby.Server.Implementations.Library
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly TimeSpan _viewRefreshInterval = TimeSpan.FromHours(24);
|
private readonly TimeSpan _viewRefreshInterval = TimeSpan.FromHours(24);
|
||||||
//private readonly TimeSpan _viewRefreshInterval = TimeSpan.FromMinutes(1);
|
|
||||||
|
|
||||||
public UserView GetNamedView(User user,
|
public UserView GetNamedView(
|
||||||
|
User user,
|
||||||
string name,
|
string name,
|
||||||
string viewType,
|
string viewType,
|
||||||
string sortName)
|
string sortName)
|
||||||
|
@ -2093,11 +2084,13 @@ namespace Emby.Server.Implementations.Library
|
||||||
return GetNamedView(user, name, Guid.Empty, viewType, sortName);
|
return GetNamedView(user, name, Guid.Empty, viewType, sortName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserView GetNamedView(string name,
|
public UserView GetNamedView(
|
||||||
|
string name,
|
||||||
string viewType,
|
string viewType,
|
||||||
string sortName)
|
string sortName)
|
||||||
{
|
{
|
||||||
var path = Path.Combine(ConfigurationManager.ApplicationPaths.InternalMetadataPath,
|
var path = Path.Combine(
|
||||||
|
ConfigurationManager.ApplicationPaths.InternalMetadataPath,
|
||||||
"views",
|
"views",
|
||||||
_fileSystem.GetValidFilename(viewType));
|
_fileSystem.GetValidFilename(viewType));
|
||||||
|
|
||||||
|
@ -2135,7 +2128,8 @@ namespace Emby.Server.Implementations.Library
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserView GetNamedView(User user,
|
public UserView GetNamedView(
|
||||||
|
User user,
|
||||||
string name,
|
string name,
|
||||||
Guid parentId,
|
Guid parentId,
|
||||||
string viewType,
|
string viewType,
|
||||||
|
@ -2164,10 +2158,10 @@ namespace Emby.Server.Implementations.Library
|
||||||
Name = name,
|
Name = name,
|
||||||
ViewType = viewType,
|
ViewType = viewType,
|
||||||
ForcedSortName = sortName,
|
ForcedSortName = sortName,
|
||||||
UserId = user.Id
|
UserId = user.Id,
|
||||||
|
DisplayParentId = parentId
|
||||||
};
|
};
|
||||||
|
|
||||||
item.DisplayParentId = parentId;
|
|
||||||
|
|
||||||
CreateItem(item, null);
|
CreateItem(item, null);
|
||||||
|
|
||||||
|
@ -2184,18 +2178,22 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
if (refresh)
|
if (refresh)
|
||||||
{
|
{
|
||||||
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem))
|
_providerManagerFactory().QueueRefresh(
|
||||||
|
item.Id,
|
||||||
|
new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem))
|
||||||
{
|
{
|
||||||
// Need to force save to increment DateLastSaved
|
// Need to force save to increment DateLastSaved
|
||||||
ForceSave = true
|
ForceSave = true
|
||||||
|
|
||||||
}, RefreshPriority.Normal);
|
},
|
||||||
|
RefreshPriority.Normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserView GetShadowView(BaseItem parent,
|
public UserView GetShadowView(
|
||||||
|
BaseItem parent,
|
||||||
string viewType,
|
string viewType,
|
||||||
string sortName)
|
string sortName)
|
||||||
{
|
{
|
||||||
|
@ -2248,18 +2246,21 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
if (refresh)
|
if (refresh)
|
||||||
{
|
{
|
||||||
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem))
|
_providerManagerFactory().QueueRefresh(
|
||||||
|
item.Id,
|
||||||
|
new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem))
|
||||||
{
|
{
|
||||||
// Need to force save to increment DateLastSaved
|
// Need to force save to increment DateLastSaved
|
||||||
ForceSave = true
|
ForceSave = true
|
||||||
|
},
|
||||||
}, RefreshPriority.Normal);
|
RefreshPriority.Normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserView GetNamedView(string name,
|
public UserView GetNamedView(
|
||||||
|
string name,
|
||||||
Guid parentId,
|
Guid parentId,
|
||||||
string viewType,
|
string viewType,
|
||||||
string sortName,
|
string sortName,
|
||||||
|
@ -2322,17 +2323,21 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
if (refresh)
|
if (refresh)
|
||||||
{
|
{
|
||||||
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem))
|
_providerManagerFactory().QueueRefresh(
|
||||||
|
item.Id,
|
||||||
|
new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem))
|
||||||
{
|
{
|
||||||
// Need to force save to increment DateLastSaved
|
// Need to force save to increment DateLastSaved
|
||||||
ForceSave = true
|
ForceSave = true
|
||||||
}, RefreshPriority.Normal);
|
},
|
||||||
|
RefreshPriority.Normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddExternalSubtitleStreams(List<MediaStream> streams,
|
public void AddExternalSubtitleStreams(
|
||||||
|
List<MediaStream> streams,
|
||||||
string videoPath,
|
string videoPath,
|
||||||
string[] files)
|
string[] files)
|
||||||
{
|
{
|
||||||
|
@ -2436,6 +2441,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
episode.IndexNumber = episodeInfo.EpisodeNumber;
|
episode.IndexNumber = episodeInfo.EpisodeNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2445,6 +2451,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
episode.IndexNumberEnd = episodeInfo.EndingEpsiodeNumber;
|
episode.IndexNumberEnd = episodeInfo.EndingEpsiodeNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2454,6 +2461,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
episode.ParentIndexNumber = episodeInfo.SeasonNumber;
|
episode.ParentIndexNumber = episodeInfo.SeasonNumber;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2483,6 +2491,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
private NamingOptions _namingOptions;
|
private NamingOptions _namingOptions;
|
||||||
private string[] _videoFileExtensions;
|
private string[] _videoFileExtensions;
|
||||||
|
|
||||||
private NamingOptions GetNamingOptionsInternal()
|
private NamingOptions GetNamingOptionsInternal()
|
||||||
{
|
{
|
||||||
if (_namingOptions == null)
|
if (_namingOptions == null)
|
||||||
|
@ -2679,7 +2688,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
var newPath = path.Replace(from, to, StringComparison.OrdinalIgnoreCase);
|
var newPath = path.Replace(from, to, StringComparison.OrdinalIgnoreCase);
|
||||||
var changed = false;
|
var changed = false;
|
||||||
|
|
||||||
if (!string.Equals(newPath, path))
|
if (!string.Equals(newPath, path, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
if (to.IndexOf('/') != -1)
|
if (to.IndexOf('/') != -1)
|
||||||
{
|
{
|
||||||
|
@ -2803,6 +2812,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2907,6 +2917,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
}
|
}
|
||||||
|
|
||||||
private const string ShortcutFileExtension = ".mblink";
|
private const string ShortcutFileExtension = ".mblink";
|
||||||
|
|
||||||
public void AddMediaPath(string virtualFolderName, MediaPathInfo pathInfo)
|
public void AddMediaPath(string virtualFolderName, MediaPathInfo pathInfo)
|
||||||
{
|
{
|
||||||
AddMediaPathInternal(virtualFolderName, pathInfo, true);
|
AddMediaPathInternal(virtualFolderName, pathInfo, true);
|
||||||
|
@ -2923,7 +2934,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(path))
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(path));
|
throw new ArgumentException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Directory.Exists(path))
|
if (!Directory.Exists(path))
|
||||||
|
|
|
@ -33,7 +33,6 @@ using MediaBrowser.Model.LiveTv;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using MediaBrowser.Model.Providers;
|
using MediaBrowser.Model.Providers;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
using MediaBrowser.Model.Reflection;
|
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
@ -58,7 +57,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
private readonly IProviderManager _providerManager;
|
private readonly IProviderManager _providerManager;
|
||||||
private readonly IMediaEncoder _mediaEncoder;
|
private readonly IMediaEncoder _mediaEncoder;
|
||||||
private readonly IProcessFactory _processFactory;
|
private readonly IProcessFactory _processFactory;
|
||||||
private readonly IAssemblyInfo _assemblyInfo;
|
|
||||||
private IMediaSourceManager _mediaSourceManager;
|
private IMediaSourceManager _mediaSourceManager;
|
||||||
|
|
||||||
public static EmbyTV Current;
|
public static EmbyTV Current;
|
||||||
|
@ -74,7 +72,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
public EmbyTV(IServerApplicationHost appHost,
|
public EmbyTV(IServerApplicationHost appHost,
|
||||||
IStreamHelper streamHelper,
|
IStreamHelper streamHelper,
|
||||||
IMediaSourceManager mediaSourceManager,
|
IMediaSourceManager mediaSourceManager,
|
||||||
IAssemblyInfo assemblyInfo,
|
|
||||||
ILogger logger,
|
ILogger logger,
|
||||||
IJsonSerializer jsonSerializer,
|
IJsonSerializer jsonSerializer,
|
||||||
IHttpClient httpClient,
|
IHttpClient httpClient,
|
||||||
|
@ -101,7 +98,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
_processFactory = processFactory;
|
_processFactory = processFactory;
|
||||||
_liveTvManager = (LiveTvManager)liveTvManager;
|
_liveTvManager = (LiveTvManager)liveTvManager;
|
||||||
_jsonSerializer = jsonSerializer;
|
_jsonSerializer = jsonSerializer;
|
||||||
_assemblyInfo = assemblyInfo;
|
|
||||||
_mediaSourceManager = mediaSourceManager;
|
_mediaSourceManager = mediaSourceManager;
|
||||||
_streamHelper = streamHelper;
|
_streamHelper = streamHelper;
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int RtpHeaderBytes = 12;
|
private const int RtpHeaderBytes = 12;
|
||||||
|
|
||||||
private async Task CopyTo(MediaBrowser.Model.Net.ISocket udpClient, string file, TaskCompletionSource<bool> openTaskCompletionSource, CancellationToken cancellationToken)
|
private async Task CopyTo(MediaBrowser.Model.Net.ISocket udpClient, string file, TaskCompletionSource<bool> openTaskCompletionSource, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var bufferSize = 81920;
|
var bufferSize = 81920;
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||||
|
|
||||||
public string OriginalStreamId { get; set; }
|
public string OriginalStreamId { get; set; }
|
||||||
public bool EnableStreamSharing { get; set; }
|
public bool EnableStreamSharing { get; set; }
|
||||||
public string UniqueId { get; private set; }
|
public string UniqueId { get; }
|
||||||
|
|
||||||
protected readonly IFileSystem FileSystem;
|
protected readonly IFileSystem FileSystem;
|
||||||
protected readonly IServerApplicationPaths AppPaths;
|
protected readonly IServerApplicationPaths AppPaths;
|
||||||
|
@ -31,12 +31,10 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||||
protected readonly ILogger Logger;
|
protected readonly ILogger Logger;
|
||||||
protected readonly CancellationTokenSource LiveStreamCancellationTokenSource = new CancellationTokenSource();
|
protected readonly CancellationTokenSource LiveStreamCancellationTokenSource = new CancellationTokenSource();
|
||||||
|
|
||||||
public string TunerHostId { get; private set; }
|
public string TunerHostId { get; }
|
||||||
|
|
||||||
public DateTime DateOpened { get; protected set; }
|
public DateTime DateOpened { get; protected set; }
|
||||||
|
|
||||||
public Func<Task> OnClose { get; set; }
|
|
||||||
|
|
||||||
public LiveStream(MediaSourceInfo mediaSource, TunerHostInfo tuner, IFileSystem fileSystem, ILogger logger, IServerApplicationPaths appPaths)
|
public LiveStream(MediaSourceInfo mediaSource, TunerHostInfo tuner, IFileSystem fileSystem, ILogger logger, IServerApplicationPaths appPaths)
|
||||||
{
|
{
|
||||||
OriginalMediaSource = mediaSource;
|
OriginalMediaSource = mediaSource;
|
||||||
|
@ -76,26 +74,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||||
|
|
||||||
LiveStreamCancellationTokenSource.Cancel();
|
LiveStreamCancellationTokenSource.Cancel();
|
||||||
|
|
||||||
if (OnClose != null)
|
|
||||||
{
|
|
||||||
return CloseWithExternalFn();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task CloseWithExternalFn()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await OnClose().ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.LogError(ex, "Error closing live stream");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Stream GetInputStream(string path, bool allowAsyncFileRead)
|
protected Stream GetInputStream(string path, bool allowAsyncFileRead)
|
||||||
{
|
{
|
||||||
var fileOpenOptions = FileOpenOptions.SequentialScan;
|
var fileOpenOptions = FileOpenOptions.SequentialScan;
|
||||||
|
@ -113,27 +94,26 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||||
return DeleteTempFiles(GetStreamFilePaths());
|
return DeleteTempFiles(GetStreamFilePaths());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task DeleteTempFiles(List<string> paths, int retryCount = 0)
|
protected async Task DeleteTempFiles(IEnumerable<string> paths, int retryCount = 0)
|
||||||
{
|
{
|
||||||
if (retryCount == 0)
|
if (retryCount == 0)
|
||||||
{
|
{
|
||||||
Logger.LogInformation("Deleting temp files {0}", string.Join(", ", paths.ToArray()));
|
Logger.LogInformation("Deleting temp files {0}", paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
var failedFiles = new List<string>();
|
var failedFiles = new List<string>();
|
||||||
|
|
||||||
foreach (var path in paths)
|
foreach (var path in paths)
|
||||||
{
|
{
|
||||||
|
if (!File.Exists(path))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FileSystem.DeleteFile(path);
|
FileSystem.DeleteFile(path);
|
||||||
}
|
}
|
||||||
catch (DirectoryNotFoundException)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
catch (FileNotFoundException)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.LogError(ex, "Error deleting file {path}", path);
|
Logger.LogError(ex, "Error deleting file {path}", path);
|
||||||
|
@ -157,8 +137,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||||
{
|
{
|
||||||
cancellationToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, LiveStreamCancellationTokenSource.Token).Token;
|
cancellationToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, LiveStreamCancellationTokenSource.Token).Token;
|
||||||
|
|
||||||
var allowAsync = false;
|
// use non-async filestream on windows along with read due to https://github.com/dotnet/corefx/issues/6039
|
||||||
// use non-async filestream along with read due to https://github.com/dotnet/corefx/issues/6039
|
var allowAsync = Environment.OSVersion.Platform != PlatformID.Win32NT;
|
||||||
|
|
||||||
bool seekFile = (DateTime.UtcNow - DateOpened).TotalSeconds > 10;
|
bool seekFile = (DateTime.UtcNow - DateOpened).TotalSeconds > 10;
|
||||||
|
|
||||||
|
@ -181,28 +161,24 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||||
Logger.LogInformation("Live Stream ended.");
|
Logger.LogInformation("Live Stream ended.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Tuple<string, bool> GetNextFile(string currentFile)
|
private (string file, bool isLastFile) GetNextFile(string currentFile)
|
||||||
{
|
{
|
||||||
var files = GetStreamFilePaths();
|
var files = GetStreamFilePaths();
|
||||||
|
|
||||||
//logger.LogInformation("Live stream files: {0}", string.Join(", ", files.ToArray()));
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(currentFile))
|
if (string.IsNullOrEmpty(currentFile))
|
||||||
{
|
{
|
||||||
return new Tuple<string, bool>(files.Last(), true);
|
return (files.Last(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
var nextIndex = files.FindIndex(i => string.Equals(i, currentFile, StringComparison.OrdinalIgnoreCase)) + 1;
|
var nextIndex = files.FindIndex(i => string.Equals(i, currentFile, StringComparison.OrdinalIgnoreCase)) + 1;
|
||||||
|
|
||||||
var isLastFile = nextIndex == files.Count - 1;
|
var isLastFile = nextIndex == files.Count - 1;
|
||||||
|
|
||||||
return new Tuple<string, bool>(files.ElementAtOrDefault(nextIndex), isLastFile);
|
return (files.ElementAtOrDefault(nextIndex), isLastFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task CopyFile(string path, bool seekFile, int emptyReadLimit, bool allowAsync, Stream stream, CancellationToken cancellationToken)
|
private async Task CopyFile(string path, bool seekFile, int emptyReadLimit, bool allowAsync, Stream stream, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
//logger.LogInformation("Opening live stream file {0}. Empty read limit: {1}", path, emptyReadLimit);
|
|
||||||
|
|
||||||
using (var inputStream = (FileStream)GetInputStream(path, allowAsync))
|
using (var inputStream = (FileStream)GetInputStream(path, allowAsync))
|
||||||
{
|
{
|
||||||
if (seekFile)
|
if (seekFile)
|
||||||
|
@ -218,7 +194,11 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||||
|
|
||||||
private void TrySeek(FileStream stream, long offset)
|
private void TrySeek(FileStream stream, long offset)
|
||||||
{
|
{
|
||||||
//logger.LogInformation("TrySeek live stream");
|
if (!stream.CanSeek)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream.Seek(offset, SeekOrigin.End);
|
stream.Seek(offset, SeekOrigin.End);
|
||||||
|
|
|
@ -1,97 +1,97 @@
|
||||||
{
|
{
|
||||||
"Albums": "Albums",
|
"Albums": "Álbumes",
|
||||||
"AppDeviceValues": "App: {0}, Device: {1}",
|
"AppDeviceValues": "Aplicación: {0}, Dispositivo: {1}",
|
||||||
"Application": "Application",
|
"Application": "Aplicación",
|
||||||
"Artists": "Artists",
|
"Artists": "Artistas",
|
||||||
"AuthenticationSucceededWithUserName": "{0} successfully authenticated",
|
"AuthenticationSucceededWithUserName": "{0} autenticado correctamente",
|
||||||
"Books": "Books",
|
"Books": "Libros",
|
||||||
"CameraImageUploadedFrom": "A new camera image has been uploaded from {0}",
|
"CameraImageUploadedFrom": "Se ha subido una nueva imagen de cámara desde {0}",
|
||||||
"Channels": "Channels",
|
"Channels": "Canales",
|
||||||
"ChapterNameValue": "Chapter {0}",
|
"ChapterNameValue": "Capítulo {0}",
|
||||||
"Collections": "Collections",
|
"Collections": "Colecciones",
|
||||||
"DeviceOfflineWithName": "{0} has disconnected",
|
"DeviceOfflineWithName": "{0} se ha desconectado",
|
||||||
"DeviceOnlineWithName": "{0} is connected",
|
"DeviceOnlineWithName": "{0} está conectado",
|
||||||
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
|
"FailedLoginAttemptWithUserName": "Error al intentar iniciar sesión desde {0}",
|
||||||
"Favorites": "Favorites",
|
"Favorites": "Favoritos",
|
||||||
"Folders": "Folders",
|
"Folders": "Carpetas",
|
||||||
"Genres": "Genres",
|
"Genres": "Géneros",
|
||||||
"HeaderAlbumArtists": "Album Artists",
|
"HeaderAlbumArtists": "Artistas de álbumes",
|
||||||
"HeaderCameraUploads": "Camera Uploads",
|
"HeaderCameraUploads": "Subidas de cámara",
|
||||||
"HeaderContinueWatching": "Continue Watching",
|
"HeaderContinueWatching": "Continuar viendo",
|
||||||
"HeaderFavoriteAlbums": "Favorite Albums",
|
"HeaderFavoriteAlbums": "Álbumes favoritos",
|
||||||
"HeaderFavoriteArtists": "Favorite Artists",
|
"HeaderFavoriteArtists": "Artistas favoritos",
|
||||||
"HeaderFavoriteEpisodes": "Favorite Episodes",
|
"HeaderFavoriteEpisodes": "Episodios favoritos",
|
||||||
"HeaderFavoriteShows": "Favorite Shows",
|
"HeaderFavoriteShows": "Programas favoritos",
|
||||||
"HeaderFavoriteSongs": "Favorite Songs",
|
"HeaderFavoriteSongs": "Canciones favoritas",
|
||||||
"HeaderLiveTV": "Live TV",
|
"HeaderLiveTV": "TV en vivo",
|
||||||
"HeaderNextUp": "Next Up",
|
"HeaderNextUp": "Continuar Viendo",
|
||||||
"HeaderRecordingGroups": "Recording Groups",
|
"HeaderRecordingGroups": "Grupos de grabación",
|
||||||
"HomeVideos": "Home videos",
|
"HomeVideos": "Videos caseros",
|
||||||
"Inherit": "Inherit",
|
"Inherit": "Heredar",
|
||||||
"ItemAddedWithName": "{0} was added to the library",
|
"ItemAddedWithName": "{0} se ha añadido a la biblioteca",
|
||||||
"ItemRemovedWithName": "{0} was removed from the library",
|
"ItemRemovedWithName": "{0} ha sido eliminado de la biblioteca",
|
||||||
"LabelIpAddressValue": "Ip address: {0}",
|
"LabelIpAddressValue": "Dirección IP: {0}",
|
||||||
"LabelRunningTimeValue": "Running time: {0}",
|
"LabelRunningTimeValue": "Tiempo de funcionamiento: {0}",
|
||||||
"Latest": "Latest",
|
"Latest": "Últimos",
|
||||||
"MessageApplicationUpdated": "Jellyfin Server has been updated",
|
"MessageApplicationUpdated": "El servidor Jellyfin fue actualizado",
|
||||||
"MessageApplicationUpdatedTo": "Jellyfin Server has been updated to {0}",
|
"MessageApplicationUpdatedTo": "Se ha actualizado el servidor Jellyfin a la versión {0}",
|
||||||
"MessageNamedServerConfigurationUpdatedWithValue": "Server configuration section {0} has been updated",
|
"MessageNamedServerConfigurationUpdatedWithValue": "Fue actualizada la sección {0} de la configuración del servidor",
|
||||||
"MessageServerConfigurationUpdated": "Server configuration has been updated",
|
"MessageServerConfigurationUpdated": "Fue actualizada la configuración del servidor",
|
||||||
"MixedContent": "Mixed content",
|
"MixedContent": "Contenido mixto",
|
||||||
"Movies": "Movies",
|
"Movies": "Películas",
|
||||||
"Music": "Music",
|
"Music": "Música",
|
||||||
"MusicVideos": "Music videos",
|
"MusicVideos": "Videos musicales",
|
||||||
"NameInstallFailed": "{0} installation failed",
|
"NameInstallFailed": "{0} error de instalación",
|
||||||
"NameSeasonNumber": "Season {0}",
|
"NameSeasonNumber": "Temporada {0}",
|
||||||
"NameSeasonUnknown": "Season Unknown",
|
"NameSeasonUnknown": "Temporada desconocida",
|
||||||
"NewVersionIsAvailable": "A new version of Jellyfin Server is available for download.",
|
"NewVersionIsAvailable": "Disponible una nueva versión de Jellyfin para descargar.",
|
||||||
"NotificationOptionApplicationUpdateAvailable": "Application update available",
|
"NotificationOptionApplicationUpdateAvailable": "Actualización de la aplicación disponible",
|
||||||
"NotificationOptionApplicationUpdateInstalled": "Application update installed",
|
"NotificationOptionApplicationUpdateInstalled": "Actualización de la aplicación instalada",
|
||||||
"NotificationOptionAudioPlayback": "Audio playback started",
|
"NotificationOptionAudioPlayback": "Se inició la reproducción de audio",
|
||||||
"NotificationOptionAudioPlaybackStopped": "Audio playback stopped",
|
"NotificationOptionAudioPlaybackStopped": "Se detuvo la reproducción de audio",
|
||||||
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
|
"NotificationOptionCameraImageUploaded": "Imagen de la cámara cargada",
|
||||||
"NotificationOptionInstallationFailed": "Installation failure",
|
"NotificationOptionInstallationFailed": "Error de instalación",
|
||||||
"NotificationOptionNewLibraryContent": "New content added",
|
"NotificationOptionNewLibraryContent": "Nuevo contenido añadido",
|
||||||
"NotificationOptionPluginError": "Plugin failure",
|
"NotificationOptionPluginError": "Error en plugin",
|
||||||
"NotificationOptionPluginInstalled": "Plugin installed",
|
"NotificationOptionPluginInstalled": "Plugin instalado",
|
||||||
"NotificationOptionPluginUninstalled": "Plugin uninstalled",
|
"NotificationOptionPluginUninstalled": "Plugin desinstalado",
|
||||||
"NotificationOptionPluginUpdateInstalled": "Plugin update installed",
|
"NotificationOptionPluginUpdateInstalled": "Actualización del complemento instalada",
|
||||||
"NotificationOptionServerRestartRequired": "Server restart required",
|
"NotificationOptionServerRestartRequired": "Se requiere reinicio del servidor",
|
||||||
"NotificationOptionTaskFailed": "Scheduled task failure",
|
"NotificationOptionTaskFailed": "Error de tarea programada",
|
||||||
"NotificationOptionUserLockedOut": "User locked out",
|
"NotificationOptionUserLockedOut": "Usuario bloqueado",
|
||||||
"NotificationOptionVideoPlayback": "Video playback started",
|
"NotificationOptionVideoPlayback": "Se inició la reproducción de video",
|
||||||
"NotificationOptionVideoPlaybackStopped": "Video playback stopped",
|
"NotificationOptionVideoPlaybackStopped": "Reproducción de video detenida",
|
||||||
"Photos": "Photos",
|
"Photos": "Fotos",
|
||||||
"Playlists": "Playlists",
|
"Playlists": "Listas de reproducción",
|
||||||
"Plugin": "Plugin",
|
"Plugin": "Plugin",
|
||||||
"PluginInstalledWithName": "{0} was installed",
|
"PluginInstalledWithName": "{0} fue instalado",
|
||||||
"PluginUninstalledWithName": "{0} was uninstalled",
|
"PluginUninstalledWithName": "{0} fue desinstalado",
|
||||||
"PluginUpdatedWithName": "{0} was updated",
|
"PluginUpdatedWithName": "{0} fue actualizado",
|
||||||
"ProviderValue": "Provider: {0}",
|
"ProviderValue": "Proveedor: {0}",
|
||||||
"ScheduledTaskFailedWithName": "{0} failed",
|
"ScheduledTaskFailedWithName": "{0} falló",
|
||||||
"ScheduledTaskStartedWithName": "{0} started",
|
"ScheduledTaskStartedWithName": "{0} iniciada",
|
||||||
"ServerNameNeedsToBeRestarted": "{0} needs to be restarted",
|
"ServerNameNeedsToBeRestarted": "{0} necesita ser reiniciado",
|
||||||
"Shows": "Series",
|
"Shows": "Series",
|
||||||
"Songs": "Songs",
|
"Songs": "Canciones",
|
||||||
"StartupEmbyServerIsLoading": "Jellyfin Server is loading. Please try again shortly.",
|
"StartupEmbyServerIsLoading": "Jellyfin Server se está cargando. Vuelve a intentarlo en breve.",
|
||||||
"SubtitleDownloadFailureForItem": "Subtitles failed to download for {0}",
|
"SubtitleDownloadFailureForItem": "Subtitles failed to download for {0}",
|
||||||
"SubtitleDownloadFailureFromForItem": "Subtitles failed to download from {0} for {1}",
|
"SubtitleDownloadFailureFromForItem": "Fallo de descarga de subtítulos desde {0} para {1}",
|
||||||
"SubtitlesDownloadedForItem": "Subtitles downloaded for {0}",
|
"SubtitlesDownloadedForItem": "Descargar subtítulos para {0}",
|
||||||
"Sync": "Sync",
|
"Sync": "Sincronizar",
|
||||||
"System": "System",
|
"System": "Sistema",
|
||||||
"TvShows": "TV Shows",
|
"TvShows": "Series de TV",
|
||||||
"User": "User",
|
"User": "Usuario",
|
||||||
"UserCreatedWithName": "User {0} has been created",
|
"UserCreatedWithName": "El usuario {0} ha sido creado",
|
||||||
"UserDeletedWithName": "User {0} has been deleted",
|
"UserDeletedWithName": "El usuario {0} ha sido borrado",
|
||||||
"UserDownloadingItemWithValues": "{0} is downloading {1}",
|
"UserDownloadingItemWithValues": "{0} está descargando {1}",
|
||||||
"UserLockedOutWithName": "User {0} has been locked out",
|
"UserLockedOutWithName": "El usuario {0} ha sido bloqueado",
|
||||||
"UserOfflineFromDevice": "{0} has disconnected from {1}",
|
"UserOfflineFromDevice": "{0} se ha desconectado de {1}",
|
||||||
"UserOnlineFromDevice": "{0} is online from {1}",
|
"UserOnlineFromDevice": "{0} está en línea desde {1}",
|
||||||
"UserPasswordChangedWithName": "Password has been changed for user {0}",
|
"UserPasswordChangedWithName": "Se ha cambiado la contraseña para el usuario {0}",
|
||||||
"UserPolicyUpdatedWithName": "User policy has been updated for {0}",
|
"UserPolicyUpdatedWithName": "Actualizada política de usuario para {0}",
|
||||||
"UserStartedPlayingItemWithValues": "{0} is playing {1} on {2}",
|
"UserStartedPlayingItemWithValues": "{0} está reproduciendo {1} en {2}",
|
||||||
"UserStoppedPlayingItemWithValues": "{0} has finished playing {1} on {2}",
|
"UserStoppedPlayingItemWithValues": "{0} ha terminado de reproducir {1} en {2}",
|
||||||
"ValueHasBeenAddedToLibrary": "{0} has been added to your media library",
|
"ValueHasBeenAddedToLibrary": "{0} ha sido añadido a tu biblioteca multimedia",
|
||||||
"ValueSpecialEpisodeName": "Special - {0}",
|
"ValueSpecialEpisodeName": "Especial - {0}",
|
||||||
"VersionNumber": "Version {0}"
|
"VersionNumber": "Versión {0}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,97 +1,97 @@
|
||||||
{
|
{
|
||||||
"Albums": "Albums",
|
"Albums": "Albums",
|
||||||
"AppDeviceValues": "App: {0}, Device: {1}",
|
"AppDeviceValues": "Application : {0}, Appareil : {1}",
|
||||||
"Application": "Application",
|
"Application": "Application",
|
||||||
"Artists": "Artists",
|
"Artists": "Artistes",
|
||||||
"AuthenticationSucceededWithUserName": "{0} successfully authenticated",
|
"AuthenticationSucceededWithUserName": "{0} s'est authentifié avec succès",
|
||||||
"Books": "Books",
|
"Books": "Livres",
|
||||||
"CameraImageUploadedFrom": "A new camera image has been uploaded from {0}",
|
"CameraImageUploadedFrom": "Une nouvelle image de caméra a été téléchargée depuis {0}",
|
||||||
"Channels": "Channels",
|
"Channels": "Chaînes",
|
||||||
"ChapterNameValue": "Chapter {0}",
|
"ChapterNameValue": "Chapitre {0}",
|
||||||
"Collections": "Collections",
|
"Collections": "Collections",
|
||||||
"DeviceOfflineWithName": "{0} has disconnected",
|
"DeviceOfflineWithName": "{0} s'est déconnecté",
|
||||||
"DeviceOnlineWithName": "{0} is connected",
|
"DeviceOnlineWithName": "{0} est connecté",
|
||||||
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
|
"FailedLoginAttemptWithUserName": "Échec d'une tentative de connexion de {0}",
|
||||||
"Favorites": "Favorites",
|
"Favorites": "Favoris",
|
||||||
"Folders": "Folders",
|
"Folders": "Dossiers",
|
||||||
"Genres": "Genres",
|
"Genres": "Genres",
|
||||||
"HeaderAlbumArtists": "Album Artists",
|
"HeaderAlbumArtists": "Artistes de l'album",
|
||||||
"HeaderCameraUploads": "Camera Uploads",
|
"HeaderCameraUploads": "Photos transférées",
|
||||||
"HeaderContinueWatching": "Continuer à regarder",
|
"HeaderContinueWatching": "Continuer à regarder",
|
||||||
"HeaderFavoriteAlbums": "Favorite Albums",
|
"HeaderFavoriteAlbums": "Albums favoris",
|
||||||
"HeaderFavoriteArtists": "Favorite Artists",
|
"HeaderFavoriteArtists": "Artistes favoris",
|
||||||
"HeaderFavoriteEpisodes": "Favorite Episodes",
|
"HeaderFavoriteEpisodes": "Épisodes favoris",
|
||||||
"HeaderFavoriteShows": "Favorite Shows",
|
"HeaderFavoriteShows": "Séries favorites",
|
||||||
"HeaderFavoriteSongs": "Favorite Songs",
|
"HeaderFavoriteSongs": "Chansons favorites",
|
||||||
"HeaderLiveTV": "Live TV",
|
"HeaderLiveTV": "TV en direct",
|
||||||
"HeaderNextUp": "À Suivre",
|
"HeaderNextUp": "À Suivre",
|
||||||
"HeaderRecordingGroups": "Recording Groups",
|
"HeaderRecordingGroups": "Groupes d'enregistrements",
|
||||||
"HomeVideos": "Home videos",
|
"HomeVideos": "Vidéos personnelles",
|
||||||
"Inherit": "Inherit",
|
"Inherit": "Hériter",
|
||||||
"ItemAddedWithName": "{0} was added to the library",
|
"ItemAddedWithName": "{0} a été ajouté à la médiathèque",
|
||||||
"ItemRemovedWithName": "{0} was removed from the library",
|
"ItemRemovedWithName": "{0} a été supprimé de la médiathèque",
|
||||||
"LabelIpAddressValue": "Ip address: {0}",
|
"LabelIpAddressValue": "Adresse IP : {0}",
|
||||||
"LabelRunningTimeValue": "Running time: {0}",
|
"LabelRunningTimeValue": "Durée : {0}",
|
||||||
"Latest": "Latest",
|
"Latest": "Derniers",
|
||||||
"MessageApplicationUpdated": "Jellyfin Server has been updated",
|
"MessageApplicationUpdated": "Le serveur Jellyfin a été mis à jour",
|
||||||
"MessageApplicationUpdatedTo": "Jellyfin Server has been updated to {0}",
|
"MessageApplicationUpdatedTo": "Le serveur Jellyfin a été mis à jour vers la version {0}",
|
||||||
"MessageNamedServerConfigurationUpdatedWithValue": "Server configuration section {0} has been updated",
|
"MessageNamedServerConfigurationUpdatedWithValue": "La configuration de la section {0} du serveur a été mise à jour",
|
||||||
"MessageServerConfigurationUpdated": "Server configuration has been updated",
|
"MessageServerConfigurationUpdated": "La configuration du serveur a été mise à jour",
|
||||||
"MixedContent": "Mixed content",
|
"MixedContent": "Contenu mixte",
|
||||||
"Movies": "Movies",
|
"Movies": "Films",
|
||||||
"Music": "Music",
|
"Music": "Musique",
|
||||||
"MusicVideos": "Music videos",
|
"MusicVideos": "Vidéos musicales",
|
||||||
"NameInstallFailed": "{0} installation failed",
|
"NameInstallFailed": "{0} échec d'installation",
|
||||||
"NameSeasonNumber": "Season {0}",
|
"NameSeasonNumber": "Saison {0}",
|
||||||
"NameSeasonUnknown": "Season Unknown",
|
"NameSeasonUnknown": "Saison Inconnue",
|
||||||
"NewVersionIsAvailable": "A new version of Jellyfin Server is available for download.",
|
"NewVersionIsAvailable": "Une nouvelle version du serveur Jellyfin est disponible au téléchargement.",
|
||||||
"NotificationOptionApplicationUpdateAvailable": "Application update available",
|
"NotificationOptionApplicationUpdateAvailable": "Mise à jour de l'application disponible",
|
||||||
"NotificationOptionApplicationUpdateInstalled": "Application update installed",
|
"NotificationOptionApplicationUpdateInstalled": "Mise à jour de l'application installée",
|
||||||
"NotificationOptionAudioPlayback": "Audio playback started",
|
"NotificationOptionAudioPlayback": "Lecture audio démarrée",
|
||||||
"NotificationOptionAudioPlaybackStopped": "Audio playback stopped",
|
"NotificationOptionAudioPlaybackStopped": "Lecture audio arrêtée",
|
||||||
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
|
"NotificationOptionCameraImageUploaded": "L'image de l'appareil photo a été transférée",
|
||||||
"NotificationOptionInstallationFailed": "Installation failure",
|
"NotificationOptionInstallationFailed": "Échec d'installation",
|
||||||
"NotificationOptionNewLibraryContent": "New content added",
|
"NotificationOptionNewLibraryContent": "Nouveau contenu ajouté",
|
||||||
"NotificationOptionPluginError": "Plugin failure",
|
"NotificationOptionPluginError": "Erreur d'extension",
|
||||||
"NotificationOptionPluginInstalled": "Plugin installed",
|
"NotificationOptionPluginInstalled": "Extension installée",
|
||||||
"NotificationOptionPluginUninstalled": "Plugin uninstalled",
|
"NotificationOptionPluginUninstalled": "Extension désinstallée",
|
||||||
"NotificationOptionPluginUpdateInstalled": "Plugin update installed",
|
"NotificationOptionPluginUpdateInstalled": "Mise à jour d'extension installée",
|
||||||
"NotificationOptionServerRestartRequired": "Server restart required",
|
"NotificationOptionServerRestartRequired": "Un redémarrage du serveur est requis",
|
||||||
"NotificationOptionTaskFailed": "Scheduled task failure",
|
"NotificationOptionTaskFailed": "Échec de tâche planifiée",
|
||||||
"NotificationOptionUserLockedOut": "User locked out",
|
"NotificationOptionUserLockedOut": "Utilisateur verrouillé",
|
||||||
"NotificationOptionVideoPlayback": "Video playback started",
|
"NotificationOptionVideoPlayback": "Lecture vidéo démarrée",
|
||||||
"NotificationOptionVideoPlaybackStopped": "Video playback stopped",
|
"NotificationOptionVideoPlaybackStopped": "Lecture vidéo arrêtée",
|
||||||
"Photos": "Photos",
|
"Photos": "Photos",
|
||||||
"Playlists": "Playlists",
|
"Playlists": "Listes de lecture",
|
||||||
"Plugin": "Plugin",
|
"Plugin": "Extension",
|
||||||
"PluginInstalledWithName": "{0} was installed",
|
"PluginInstalledWithName": "{0} a été installé",
|
||||||
"PluginUninstalledWithName": "{0} was uninstalled",
|
"PluginUninstalledWithName": "{0} a été désinstallé",
|
||||||
"PluginUpdatedWithName": "{0} was updated",
|
"PluginUpdatedWithName": "{0} a été mis à jour",
|
||||||
"ProviderValue": "Provider: {0}",
|
"ProviderValue": "Fournisseur : {0}",
|
||||||
"ScheduledTaskFailedWithName": "{0} failed",
|
"ScheduledTaskFailedWithName": "{0} a échoué",
|
||||||
"ScheduledTaskStartedWithName": "{0} started",
|
"ScheduledTaskStartedWithName": "{0} a commencé",
|
||||||
"ServerNameNeedsToBeRestarted": "{0} needs to be restarted",
|
"ServerNameNeedsToBeRestarted": "{0} doit être redémarré",
|
||||||
"Shows": "Series",
|
"Shows": "Émissions",
|
||||||
"Songs": "Songs",
|
"Songs": "Chansons",
|
||||||
"StartupEmbyServerIsLoading": "Jellyfin Server is loading. Please try again shortly.",
|
"StartupEmbyServerIsLoading": "Le serveur Jellyfin est en cours de chargement. Veuillez réessayer dans quelques instants.",
|
||||||
"SubtitleDownloadFailureForItem": "Subtitles failed to download for {0}",
|
"SubtitleDownloadFailureForItem": "Subtitles failed to download for {0}",
|
||||||
"SubtitleDownloadFailureFromForItem": "Subtitles failed to download from {0} for {1}",
|
"SubtitleDownloadFailureFromForItem": "Échec du téléchargement des sous-titres depuis {0} pour {1}",
|
||||||
"SubtitlesDownloadedForItem": "Subtitles downloaded for {0}",
|
"SubtitlesDownloadedForItem": "Les sous-titres de {0} ont été téléchargés",
|
||||||
"Sync": "Sync",
|
"Sync": "Synchroniser",
|
||||||
"System": "System",
|
"System": "Système",
|
||||||
"TvShows": "TV Shows",
|
"TvShows": "Séries Télé",
|
||||||
"User": "User",
|
"User": "Utilisateur",
|
||||||
"UserCreatedWithName": "User {0} has been created",
|
"UserCreatedWithName": "L'utilisateur {0} a été créé",
|
||||||
"UserDeletedWithName": "User {0} has been deleted",
|
"UserDeletedWithName": "L'utilisateur {0} a été supprimé",
|
||||||
"UserDownloadingItemWithValues": "{0} is downloading {1}",
|
"UserDownloadingItemWithValues": "{0} est en train de télécharger {1}",
|
||||||
"UserLockedOutWithName": "User {0} has been locked out",
|
"UserLockedOutWithName": "L'utilisateur {0} a été verrouillé",
|
||||||
"UserOfflineFromDevice": "{0} has disconnected from {1}",
|
"UserOfflineFromDevice": "{0} s'est déconnecté depuis {1}",
|
||||||
"UserOnlineFromDevice": "{0} is online from {1}",
|
"UserOnlineFromDevice": "{0} s'est connecté depuis {1}",
|
||||||
"UserPasswordChangedWithName": "Password has been changed for user {0}",
|
"UserPasswordChangedWithName": "Le mot de passe pour l'utilisateur {0} a été modifié",
|
||||||
"UserPolicyUpdatedWithName": "User policy has been updated for {0}",
|
"UserPolicyUpdatedWithName": "La politique de l'utilisateur a été mise à jour pour {0}",
|
||||||
"UserStartedPlayingItemWithValues": "{0} is playing {1} on {2}",
|
"UserStartedPlayingItemWithValues": "{0} est en train de lire {1} sur {2}",
|
||||||
"UserStoppedPlayingItemWithValues": "{0} has finished playing {1} on {2}",
|
"UserStoppedPlayingItemWithValues": "{0} vient d'arrêter la lecture de {1} sur {2}",
|
||||||
"ValueHasBeenAddedToLibrary": "{0} has been added to your media library",
|
"ValueHasBeenAddedToLibrary": "{0} a été ajouté à votre médiathèque",
|
||||||
"ValueSpecialEpisodeName": "Spécial - {0}",
|
"ValueSpecialEpisodeName": "Spécial - {0}",
|
||||||
"VersionNumber": "Version {0}"
|
"VersionNumber": "Version {0}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
"NameInstallFailed": "{0} échec d'installation",
|
"NameInstallFailed": "{0} échec d'installation",
|
||||||
"NameSeasonNumber": "Saison {0}",
|
"NameSeasonNumber": "Saison {0}",
|
||||||
"NameSeasonUnknown": "Saison Inconnue",
|
"NameSeasonUnknown": "Saison Inconnue",
|
||||||
"NewVersionIsAvailable": "Une nouvelle version d'Jellyfin Serveur est disponible au téléchargement.",
|
"NewVersionIsAvailable": "Une nouvelle version de Jellyfin Serveur est disponible au téléchargement.",
|
||||||
"NotificationOptionApplicationUpdateAvailable": "Mise à jour de l'application disponible",
|
"NotificationOptionApplicationUpdateAvailable": "Mise à jour de l'application disponible",
|
||||||
"NotificationOptionApplicationUpdateInstalled": "Mise à jour de l'application installée",
|
"NotificationOptionApplicationUpdateInstalled": "Mise à jour de l'application installée",
|
||||||
"NotificationOptionAudioPlayback": "Lecture audio démarrée",
|
"NotificationOptionAudioPlayback": "Lecture audio démarrée",
|
||||||
|
@ -89,7 +89,7 @@
|
||||||
"UserOnlineFromDevice": "{0} s'est connecté depuis {1}",
|
"UserOnlineFromDevice": "{0} s'est connecté depuis {1}",
|
||||||
"UserPasswordChangedWithName": "Le mot de passe pour l'utilisateur {0} a été modifié",
|
"UserPasswordChangedWithName": "Le mot de passe pour l'utilisateur {0} a été modifié",
|
||||||
"UserPolicyUpdatedWithName": "La politique de l'utilisateur a été mise à jour pour {0}",
|
"UserPolicyUpdatedWithName": "La politique de l'utilisateur a été mise à jour pour {0}",
|
||||||
"UserStartedPlayingItemWithValues": "{0} est entrain de lire {1} sur {2}",
|
"UserStartedPlayingItemWithValues": "{0} est en train de lire {1} sur {2}",
|
||||||
"UserStoppedPlayingItemWithValues": "{0} vient d'arrêter la lecture de {1} sur {2}",
|
"UserStoppedPlayingItemWithValues": "{0} vient d'arrêter la lecture de {1} sur {2}",
|
||||||
"ValueHasBeenAddedToLibrary": "{0} a été ajouté à votre librairie",
|
"ValueHasBeenAddedToLibrary": "{0} a été ajouté à votre librairie",
|
||||||
"ValueSpecialEpisodeName": "Spécial - {0}",
|
"ValueSpecialEpisodeName": "Spécial - {0}",
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"Albums": "Albums",
|
"Albums": "אלבומים",
|
||||||
"AppDeviceValues": "App: {0}, Device: {1}",
|
"AppDeviceValues": "App: {0}, Device: {1}",
|
||||||
"Application": "Application",
|
"Application": "אפליקציה",
|
||||||
"Artists": "Artists",
|
"Artists": "אמנים",
|
||||||
"AuthenticationSucceededWithUserName": "{0} successfully authenticated",
|
"AuthenticationSucceededWithUserName": "{0} successfully authenticated",
|
||||||
"Books": "ספרים",
|
"Books": "ספרים",
|
||||||
"CameraImageUploadedFrom": "A new camera image has been uploaded from {0}",
|
"CameraImageUploadedFrom": "A new camera image has been uploaded from {0}",
|
||||||
|
|
|
@ -34,17 +34,17 @@
|
||||||
"LabelRunningTimeValue": "Durata: {0}",
|
"LabelRunningTimeValue": "Durata: {0}",
|
||||||
"Latest": "Più recenti",
|
"Latest": "Più recenti",
|
||||||
"MessageApplicationUpdated": "Il Server Jellyfin è stato aggiornato",
|
"MessageApplicationUpdated": "Il Server Jellyfin è stato aggiornato",
|
||||||
"MessageApplicationUpdatedTo": "Jellyfin Server has been updated to {0}",
|
"MessageApplicationUpdatedTo": "Jellyfin Server è stato aggiornato a {0}",
|
||||||
"MessageNamedServerConfigurationUpdatedWithValue": "La sezione {0} della configurazione server è stata aggiornata",
|
"MessageNamedServerConfigurationUpdatedWithValue": "La sezione {0} della configurazione server è stata aggiornata",
|
||||||
"MessageServerConfigurationUpdated": "La configurazione del server è stata aggiornata",
|
"MessageServerConfigurationUpdated": "La configurazione del server è stata aggiornata",
|
||||||
"MixedContent": "Contenuto misto",
|
"MixedContent": "Contenuto misto",
|
||||||
"Movies": "Film",
|
"Movies": "Film",
|
||||||
"Music": "Musica",
|
"Music": "Musica",
|
||||||
"MusicVideos": "Video musicali",
|
"MusicVideos": "Video musicali",
|
||||||
"NameInstallFailed": "{0} installation failed",
|
"NameInstallFailed": "{0} installazione fallita",
|
||||||
"NameSeasonNumber": "Stagione {0}",
|
"NameSeasonNumber": "Stagione {0}",
|
||||||
"NameSeasonUnknown": "Stagione sconosciuto",
|
"NameSeasonUnknown": "Stagione sconosciuto",
|
||||||
"NewVersionIsAvailable": "A new version of Jellyfin Server is available for download.",
|
"NewVersionIsAvailable": "Una nuova versione di Jellyfin Server è disponibile per il download.",
|
||||||
"NotificationOptionApplicationUpdateAvailable": "Aggiornamento dell'applicazione disponibile",
|
"NotificationOptionApplicationUpdateAvailable": "Aggiornamento dell'applicazione disponibile",
|
||||||
"NotificationOptionApplicationUpdateInstalled": "Aggiornamento dell'applicazione installato",
|
"NotificationOptionApplicationUpdateInstalled": "Aggiornamento dell'applicazione installato",
|
||||||
"NotificationOptionAudioPlayback": "La riproduzione audio è iniziata",
|
"NotificationOptionAudioPlayback": "La riproduzione audio è iniziata",
|
||||||
|
@ -70,12 +70,12 @@
|
||||||
"ProviderValue": "Provider: {0}",
|
"ProviderValue": "Provider: {0}",
|
||||||
"ScheduledTaskFailedWithName": "{0} fallito",
|
"ScheduledTaskFailedWithName": "{0} fallito",
|
||||||
"ScheduledTaskStartedWithName": "{0} avviati",
|
"ScheduledTaskStartedWithName": "{0} avviati",
|
||||||
"ServerNameNeedsToBeRestarted": "{0} needs to be restarted",
|
"ServerNameNeedsToBeRestarted": "{0} deve essere riavviato",
|
||||||
"Shows": "Programmi",
|
"Shows": "Programmi",
|
||||||
"Songs": "Canzoni",
|
"Songs": "Canzoni",
|
||||||
"StartupEmbyServerIsLoading": "Jellyfin server si sta avviando. Per favore riprova più tardi.",
|
"StartupEmbyServerIsLoading": "Jellyfin server si sta avviando. Per favore riprova più tardi.",
|
||||||
"SubtitleDownloadFailureForItem": "Impossibile scaricare i sottotitoli per {0}",
|
"SubtitleDownloadFailureForItem": "Impossibile scaricare i sottotitoli per {0}",
|
||||||
"SubtitleDownloadFailureFromForItem": "Subtitles failed to download from {0} for {1}",
|
"SubtitleDownloadFailureFromForItem": "Impossibile scaricare i sottotitoli da {0} per {1}",
|
||||||
"SubtitlesDownloadedForItem": "Sottotitoli scaricati per {0}",
|
"SubtitlesDownloadedForItem": "Sottotitoli scaricati per {0}",
|
||||||
"Sync": "Sincronizza",
|
"Sync": "Sincronizza",
|
||||||
"System": "Sistema",
|
"System": "Sistema",
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
"UserPolicyUpdatedWithName": "La politica dell'utente è stata aggiornata per {0}",
|
"UserPolicyUpdatedWithName": "La politica dell'utente è stata aggiornata per {0}",
|
||||||
"UserStartedPlayingItemWithValues": "{0} ha avviato la riproduzione di {1}",
|
"UserStartedPlayingItemWithValues": "{0} ha avviato la riproduzione di {1}",
|
||||||
"UserStoppedPlayingItemWithValues": "{0} ha interrotto la riproduzione di {1}",
|
"UserStoppedPlayingItemWithValues": "{0} ha interrotto la riproduzione di {1}",
|
||||||
"ValueHasBeenAddedToLibrary": "{0} has been added to your media library",
|
"ValueHasBeenAddedToLibrary": "{0} è stato aggiunto alla tua libreria multimediale",
|
||||||
"ValueSpecialEpisodeName": "Speciale - {0}",
|
"ValueSpecialEpisodeName": "Speciale - {0}",
|
||||||
"VersionNumber": "Versione {0}"
|
"VersionNumber": "Versione {0}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
"AppDeviceValues": "Qoldanba: {0}, Qurylǵy: {1}",
|
"AppDeviceValues": "Qoldanba: {0}, Qurylǵy: {1}",
|
||||||
"Application": "Qoldanba",
|
"Application": "Qoldanba",
|
||||||
"Artists": "Oryndaýshylar",
|
"Artists": "Oryndaýshylar",
|
||||||
"AuthenticationSucceededWithUserName": "{0} túpnusqalyǵyn rastalýy sátti",
|
"AuthenticationSucceededWithUserName": "{0} túpnusqalyq rastalýy sátti aıaqtaldy",
|
||||||
"Books": "Kitaptar",
|
"Books": "Kitaptar",
|
||||||
"CameraImageUploadedFrom": "Jańa sýret {0} kamerasynan júktep alyndy",
|
"CameraImageUploadedFrom": "{0} kamerasynan jańa sýret júktep alyndy",
|
||||||
"Channels": "Arnalar",
|
"Channels": "Arnalar",
|
||||||
"ChapterNameValue": "{0}-sahna",
|
"ChapterNameValue": "{0}-sahna",
|
||||||
"Collections": "Jıyntyqtar",
|
"Collections": "Jıyntyqtar",
|
||||||
"DeviceOfflineWithName": "{0} ajyratylǵan",
|
"DeviceOfflineWithName": "{0} ajyratylǵan",
|
||||||
"DeviceOnlineWithName": "{0} qosylǵan",
|
"DeviceOnlineWithName": "{0} qosylǵan",
|
||||||
"FailedLoginAttemptWithUserName": "{0} tarapynan kirý áreketi sátsiz",
|
"FailedLoginAttemptWithUserName": "{0} tarapynan kirý áreketi sátsiz aıaqtaldy",
|
||||||
"Favorites": "Tańdaýlylar",
|
"Favorites": "Tańdaýlylar",
|
||||||
"Folders": "Qaltalar",
|
"Folders": "Qaltalar",
|
||||||
"Genres": "Janrlar",
|
"Genres": "Janrlar",
|
||||||
|
@ -28,13 +28,13 @@
|
||||||
"HeaderRecordingGroups": "Jazba toptary",
|
"HeaderRecordingGroups": "Jazba toptary",
|
||||||
"HomeVideos": "Úılik beıneler",
|
"HomeVideos": "Úılik beıneler",
|
||||||
"Inherit": "Muraǵa ıelený",
|
"Inherit": "Muraǵa ıelený",
|
||||||
"ItemAddedWithName": "{0} tasyǵyshhanaǵa ústelindi",
|
"ItemAddedWithName": "{0} tasyǵyshhanaǵa ústeldi",
|
||||||
"ItemRemovedWithName": "{0} tasyǵyshhanadan alastaldy",
|
"ItemRemovedWithName": "{0} tasyǵyshhanadan alastaldy",
|
||||||
"LabelIpAddressValue": "IP-mekenjaıy: {0}",
|
"LabelIpAddressValue": "IP-mekenjaıy: {0}",
|
||||||
"LabelRunningTimeValue": "Oınatý ýaqyty: {0}",
|
"LabelRunningTimeValue": "Oınatý ýaqyty: {0}",
|
||||||
"Latest": "Eń keıingi",
|
"Latest": "Eń keıingi",
|
||||||
"MessageApplicationUpdated": "Jellyfin Serveri jańartyldy",
|
"MessageApplicationUpdated": "Jellyfin Serveri jańartyldy",
|
||||||
"MessageApplicationUpdatedTo": "Jellyfin Serveri {0} deńgeıge jańartyldy",
|
"MessageApplicationUpdatedTo": "Jellyfin Serveri {0} nusqasyna jańartyldy",
|
||||||
"MessageNamedServerConfigurationUpdatedWithValue": "Server teńsheliminiń {0} bólimi jańartyldy",
|
"MessageNamedServerConfigurationUpdatedWithValue": "Server teńsheliminiń {0} bólimi jańartyldy",
|
||||||
"MessageServerConfigurationUpdated": "Server teńshelimi jańartyldy",
|
"MessageServerConfigurationUpdated": "Server teńshelimi jańartyldy",
|
||||||
"MixedContent": "Aralas mazmun",
|
"MixedContent": "Aralas mazmun",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"Artists": "Artistas",
|
"Artists": "Artistas",
|
||||||
"AuthenticationSucceededWithUserName": "{0} autenticado com sucesso",
|
"AuthenticationSucceededWithUserName": "{0} autenticado com sucesso",
|
||||||
"Books": "Livros",
|
"Books": "Livros",
|
||||||
"CameraImageUploadedFrom": "A new camera image has been uploaded from {0}",
|
"CameraImageUploadedFrom": "Uma nova imagem da câmera foi submetida de {0}",
|
||||||
"Channels": "Canais",
|
"Channels": "Canais",
|
||||||
"ChapterNameValue": "Capítulo {0}",
|
"ChapterNameValue": "Capítulo {0}",
|
||||||
"Collections": "Coletâneas",
|
"Collections": "Coletâneas",
|
||||||
|
@ -30,21 +30,21 @@
|
||||||
"Inherit": "Herdar",
|
"Inherit": "Herdar",
|
||||||
"ItemAddedWithName": "{0} foi adicionado à biblioteca",
|
"ItemAddedWithName": "{0} foi adicionado à biblioteca",
|
||||||
"ItemRemovedWithName": "{0} foi removido da biblioteca",
|
"ItemRemovedWithName": "{0} foi removido da biblioteca",
|
||||||
"LabelIpAddressValue": "Endereço ip: {0}",
|
"LabelIpAddressValue": "Endereço IP: {0}",
|
||||||
"LabelRunningTimeValue": "Tempo de execução: {0}",
|
"LabelRunningTimeValue": "Tempo de execução: {0}",
|
||||||
"Latest": "Recente",
|
"Latest": "Recente",
|
||||||
"MessageApplicationUpdated": "O servidor Jellyfin foi atualizado",
|
"MessageApplicationUpdated": "O servidor Jellyfin foi atualizado",
|
||||||
"MessageApplicationUpdatedTo": "Jellyfin Server has been updated to {0}",
|
"MessageApplicationUpdatedTo": "O Servidor Jellyfin foi atualizado para {0}",
|
||||||
"MessageNamedServerConfigurationUpdatedWithValue": "A seção {0} da configuração do servidor foi atualizada",
|
"MessageNamedServerConfigurationUpdatedWithValue": "A seção {0} da configuração do servidor foi atualizada",
|
||||||
"MessageServerConfigurationUpdated": "A configuração do servidor foi atualizada",
|
"MessageServerConfigurationUpdated": "A configuração do servidor foi atualizada",
|
||||||
"MixedContent": "Conteúdo misto",
|
"MixedContent": "Conteúdo misto",
|
||||||
"Movies": "Filmes",
|
"Movies": "Filmes",
|
||||||
"Music": "Música",
|
"Music": "Música",
|
||||||
"MusicVideos": "Vídeos musicais",
|
"MusicVideos": "Vídeos musicais",
|
||||||
"NameInstallFailed": "{0} installation failed",
|
"NameInstallFailed": "A instalação de {0} falhou",
|
||||||
"NameSeasonNumber": "Temporada {0}",
|
"NameSeasonNumber": "Temporada {0}",
|
||||||
"NameSeasonUnknown": "Temporada Desconhecida",
|
"NameSeasonUnknown": "Temporada Desconhecida",
|
||||||
"NewVersionIsAvailable": "A new version of Jellyfin Server is available for download.",
|
"NewVersionIsAvailable": "Uma nova versão do servidor Jellyfin está disponível para download.",
|
||||||
"NotificationOptionApplicationUpdateAvailable": "Atualização de aplicativo disponível",
|
"NotificationOptionApplicationUpdateAvailable": "Atualização de aplicativo disponível",
|
||||||
"NotificationOptionApplicationUpdateInstalled": "Atualização de aplicativo instalada",
|
"NotificationOptionApplicationUpdateInstalled": "Atualização de aplicativo instalada",
|
||||||
"NotificationOptionAudioPlayback": "Reprodução de áudio iniciada",
|
"NotificationOptionAudioPlayback": "Reprodução de áudio iniciada",
|
||||||
|
@ -70,12 +70,12 @@
|
||||||
"ProviderValue": "Provedor: {0}",
|
"ProviderValue": "Provedor: {0}",
|
||||||
"ScheduledTaskFailedWithName": "{0} falhou",
|
"ScheduledTaskFailedWithName": "{0} falhou",
|
||||||
"ScheduledTaskStartedWithName": "{0} iniciada",
|
"ScheduledTaskStartedWithName": "{0} iniciada",
|
||||||
"ServerNameNeedsToBeRestarted": "{0} needs to be restarted",
|
"ServerNameNeedsToBeRestarted": "O servidor {0} precisa ser reiniciado",
|
||||||
"Shows": "Séries",
|
"Shows": "Séries",
|
||||||
"Songs": "Músicas",
|
"Songs": "Músicas",
|
||||||
"StartupEmbyServerIsLoading": "O Servidor Jellyfin está carregando. Por favor tente novamente em breve.",
|
"StartupEmbyServerIsLoading": "O Servidor Jellyfin está carregando. Por favor tente novamente em breve.",
|
||||||
"SubtitleDownloadFailureForItem": "Download de legendas falhou para {0}",
|
"SubtitleDownloadFailureForItem": "Download de legendas falhou para {0}",
|
||||||
"SubtitleDownloadFailureFromForItem": "Subtitles failed to download from {0} for {1}",
|
"SubtitleDownloadFailureFromForItem": "Houve um problema ao baixar as legendas de {0} para {1}",
|
||||||
"SubtitlesDownloadedForItem": "Legendas baixadas para {0}",
|
"SubtitlesDownloadedForItem": "Legendas baixadas para {0}",
|
||||||
"Sync": "Sincronizar",
|
"Sync": "Sincronizar",
|
||||||
"System": "Sistema",
|
"System": "Sistema",
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
"UserPolicyUpdatedWithName": "A política de usuário foi atualizada para {0}",
|
"UserPolicyUpdatedWithName": "A política de usuário foi atualizada para {0}",
|
||||||
"UserStartedPlayingItemWithValues": "{0} iniciou a reprodução de {1}",
|
"UserStartedPlayingItemWithValues": "{0} iniciou a reprodução de {1}",
|
||||||
"UserStoppedPlayingItemWithValues": "{0} parou de reproduzir {1}",
|
"UserStoppedPlayingItemWithValues": "{0} parou de reproduzir {1}",
|
||||||
"ValueHasBeenAddedToLibrary": "{0} has been added to your media library",
|
"ValueHasBeenAddedToLibrary": "{0} foi adicionado a sua biblioteca",
|
||||||
"ValueSpecialEpisodeName": "Especial - {0}",
|
"ValueSpecialEpisodeName": "Especial - {0}",
|
||||||
"VersionNumber": "Versão {0}"
|
"VersionNumber": "Versão {0}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,62 +1,62 @@
|
||||||
{
|
{
|
||||||
"Albums": "Albums",
|
"Albums": "Albumi",
|
||||||
"AppDeviceValues": "App: {0}, Device: {1}",
|
"AppDeviceValues": "Aplikacija: {0}, Naprava: {1}",
|
||||||
"Application": "Application",
|
"Application": "Aplikacija",
|
||||||
"Artists": "Artists",
|
"Artists": "Izvajalci",
|
||||||
"AuthenticationSucceededWithUserName": "{0} successfully authenticated",
|
"AuthenticationSucceededWithUserName": "{0} preverjanje uspešno",
|
||||||
"Books": "Books",
|
"Books": "Knjige",
|
||||||
"CameraImageUploadedFrom": "A new camera image has been uploaded from {0}",
|
"CameraImageUploadedFrom": "Nova fotografija je bila naložena z {0}",
|
||||||
"Channels": "Channels",
|
"Channels": "Kanali",
|
||||||
"ChapterNameValue": "Chapter {0}",
|
"ChapterNameValue": "Poglavje {0}",
|
||||||
"Collections": "Collections",
|
"Collections": "Zbirke",
|
||||||
"DeviceOfflineWithName": "{0} has disconnected",
|
"DeviceOfflineWithName": "{0} has disconnected",
|
||||||
"DeviceOnlineWithName": "{0} is connected",
|
"DeviceOnlineWithName": "{0} je povezan",
|
||||||
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
|
"FailedLoginAttemptWithUserName": "Neuspešen poskus prijave z {0}",
|
||||||
"Favorites": "Favorites",
|
"Favorites": "Priljubljeni",
|
||||||
"Folders": "Folders",
|
"Folders": "Mape",
|
||||||
"Genres": "Genres",
|
"Genres": "Zvrsti",
|
||||||
"HeaderAlbumArtists": "Album Artists",
|
"HeaderAlbumArtists": "Izvajalci albuma",
|
||||||
"HeaderCameraUploads": "Camera Uploads",
|
"HeaderCameraUploads": "Posnetki kamere",
|
||||||
"HeaderContinueWatching": "Continue Watching",
|
"HeaderContinueWatching": "Nadaljuj gledanje",
|
||||||
"HeaderFavoriteAlbums": "Favorite Albums",
|
"HeaderFavoriteAlbums": "Priljubljeni albumi",
|
||||||
"HeaderFavoriteArtists": "Favorite Artists",
|
"HeaderFavoriteArtists": "Priljubljeni izvajalci",
|
||||||
"HeaderFavoriteEpisodes": "Favorite Episodes",
|
"HeaderFavoriteEpisodes": "Priljubljene epizode",
|
||||||
"HeaderFavoriteShows": "Favorite Shows",
|
"HeaderFavoriteShows": "Priljubljene serije",
|
||||||
"HeaderFavoriteSongs": "Favorite Songs",
|
"HeaderFavoriteSongs": "Priljubljene pesmi",
|
||||||
"HeaderLiveTV": "Live TV",
|
"HeaderLiveTV": "TV v živo",
|
||||||
"HeaderNextUp": "Next Up",
|
"HeaderNextUp": "Sledi",
|
||||||
"HeaderRecordingGroups": "Recording Groups",
|
"HeaderRecordingGroups": "Zbirke posnetkov",
|
||||||
"HomeVideos": "Home videos",
|
"HomeVideos": "Domači posnetki",
|
||||||
"Inherit": "Inherit",
|
"Inherit": "Podeduj",
|
||||||
"ItemAddedWithName": "{0} was added to the library",
|
"ItemAddedWithName": "{0} je dodan v knjižnico",
|
||||||
"ItemRemovedWithName": "{0} was removed from the library",
|
"ItemRemovedWithName": "{0} je bil odstranjen iz knjižnice",
|
||||||
"LabelIpAddressValue": "Ip address: {0}",
|
"LabelIpAddressValue": "IP naslov: {0}",
|
||||||
"LabelRunningTimeValue": "Running time: {0}",
|
"LabelRunningTimeValue": "Čas trajanja: {0}",
|
||||||
"Latest": "Latest",
|
"Latest": "Najnovejše",
|
||||||
"MessageApplicationUpdated": "Jellyfin Server has been updated",
|
"MessageApplicationUpdated": "Jellyfin strežnik je bil posodobljen",
|
||||||
"MessageApplicationUpdatedTo": "Jellyfin Server has been updated to {0}",
|
"MessageApplicationUpdatedTo": "Jellyfin strežnik je bil posodobljen na {0}",
|
||||||
"MessageNamedServerConfigurationUpdatedWithValue": "Server configuration section {0} has been updated",
|
"MessageNamedServerConfigurationUpdatedWithValue": "Server configuration section {0} has been updated",
|
||||||
"MessageServerConfigurationUpdated": "Server configuration has been updated",
|
"MessageServerConfigurationUpdated": "Nastavitve strežnika so bile posodobljene",
|
||||||
"MixedContent": "Mixed content",
|
"MixedContent": "Razne vsebine",
|
||||||
"Movies": "Movies",
|
"Movies": "Filmi",
|
||||||
"Music": "Music",
|
"Music": "Glasba",
|
||||||
"MusicVideos": "Music videos",
|
"MusicVideos": "Glasbeni posnetki",
|
||||||
"NameInstallFailed": "{0} installation failed",
|
"NameInstallFailed": "{0} namestitev neuspešna",
|
||||||
"NameSeasonNumber": "Season {0}",
|
"NameSeasonNumber": "Sezona {0}",
|
||||||
"NameSeasonUnknown": "Season Unknown",
|
"NameSeasonUnknown": "Season neznana",
|
||||||
"NewVersionIsAvailable": "A new version of Jellyfin Server is available for download.",
|
"NewVersionIsAvailable": "Nova razničica Jellyfin strežnika je na voljo za prenos.",
|
||||||
"NotificationOptionApplicationUpdateAvailable": "Application update available",
|
"NotificationOptionApplicationUpdateAvailable": "Posodobitev aplikacije je na voljo",
|
||||||
"NotificationOptionApplicationUpdateInstalled": "Application update installed",
|
"NotificationOptionApplicationUpdateInstalled": "Posodobitev aplikacije je bila nameščena",
|
||||||
"NotificationOptionAudioPlayback": "Audio playback started",
|
"NotificationOptionAudioPlayback": "Predvajanje zvoka začeto",
|
||||||
"NotificationOptionAudioPlaybackStopped": "Audio playback stopped",
|
"NotificationOptionAudioPlaybackStopped": "Predvajanje zvoka zaustavljeno",
|
||||||
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
|
"NotificationOptionCameraImageUploaded": "Posnetek kamere naložen",
|
||||||
"NotificationOptionInstallationFailed": "Installation failure",
|
"NotificationOptionInstallationFailed": "Napaka pri nameščanju",
|
||||||
"NotificationOptionNewLibraryContent": "New content added",
|
"NotificationOptionNewLibraryContent": "Nove vsebine dodane",
|
||||||
"NotificationOptionPluginError": "Plugin failure",
|
"NotificationOptionPluginError": "Napaka dodatka",
|
||||||
"NotificationOptionPluginInstalled": "Plugin installed",
|
"NotificationOptionPluginInstalled": "Dodatek nameščen",
|
||||||
"NotificationOptionPluginUninstalled": "Plugin uninstalled",
|
"NotificationOptionPluginUninstalled": "Dodatek odstranjen",
|
||||||
"NotificationOptionPluginUpdateInstalled": "Plugin update installed",
|
"NotificationOptionPluginUpdateInstalled": "Posodobitev dodatka nameščena",
|
||||||
"NotificationOptionServerRestartRequired": "Server restart required",
|
"NotificationOptionServerRestartRequired": "Potreben je ponovni zagon strežnika",
|
||||||
"NotificationOptionTaskFailed": "Scheduled task failure",
|
"NotificationOptionTaskFailed": "Scheduled task failure",
|
||||||
"NotificationOptionUserLockedOut": "User locked out",
|
"NotificationOptionUserLockedOut": "User locked out",
|
||||||
"NotificationOptionVideoPlayback": "Video playback started",
|
"NotificationOptionVideoPlayback": "Video playback started",
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"Albums": "Albums",
|
"Albums": "Albümler",
|
||||||
"AppDeviceValues": "App: {0}, Device: {1}",
|
"AppDeviceValues": "Uygulama: {0}, Aygıt: {1}",
|
||||||
"Application": "Application",
|
"Application": "Uygulama",
|
||||||
"Artists": "Artists",
|
"Artists": "Sanatçılar",
|
||||||
"AuthenticationSucceededWithUserName": "{0} successfully authenticated",
|
"AuthenticationSucceededWithUserName": "{0} başarı ile giriş yaptı",
|
||||||
"Books": "Books",
|
"Books": "Kitaplar",
|
||||||
"CameraImageUploadedFrom": "A new camera image has been uploaded from {0}",
|
"CameraImageUploadedFrom": "A new camera image has been uploaded from {0}",
|
||||||
"Channels": "Channels",
|
"Channels": "Kanallar",
|
||||||
"ChapterNameValue": "Chapter {0}",
|
"ChapterNameValue": "Chapter {0}",
|
||||||
"Collections": "Collections",
|
"Collections": "Collections",
|
||||||
"DeviceOfflineWithName": "{0} has disconnected",
|
"DeviceOfflineWithName": "{0} has disconnected",
|
||||||
|
@ -17,8 +17,8 @@
|
||||||
"Genres": "Genres",
|
"Genres": "Genres",
|
||||||
"HeaderAlbumArtists": "Album Artists",
|
"HeaderAlbumArtists": "Album Artists",
|
||||||
"HeaderCameraUploads": "Camera Uploads",
|
"HeaderCameraUploads": "Camera Uploads",
|
||||||
"HeaderContinueWatching": "Continue Watching",
|
"HeaderContinueWatching": "İzlemeye Devam Et",
|
||||||
"HeaderFavoriteAlbums": "Favorite Albums",
|
"HeaderFavoriteAlbums": "Favori Albümler",
|
||||||
"HeaderFavoriteArtists": "Favorite Artists",
|
"HeaderFavoriteArtists": "Favorite Artists",
|
||||||
"HeaderFavoriteEpisodes": "Favorite Episodes",
|
"HeaderFavoriteEpisodes": "Favorite Episodes",
|
||||||
"HeaderFavoriteShows": "Favori Showlar",
|
"HeaderFavoriteShows": "Favori Showlar",
|
||||||
|
@ -30,21 +30,21 @@
|
||||||
"Inherit": "Inherit",
|
"Inherit": "Inherit",
|
||||||
"ItemAddedWithName": "{0} was added to the library",
|
"ItemAddedWithName": "{0} was added to the library",
|
||||||
"ItemRemovedWithName": "{0} was removed from the library",
|
"ItemRemovedWithName": "{0} was removed from the library",
|
||||||
"LabelIpAddressValue": "Ip address: {0}",
|
"LabelIpAddressValue": "Ip adresi: {0}",
|
||||||
"LabelRunningTimeValue": "Running time: {0}",
|
"LabelRunningTimeValue": "Çalışma süresi: {0}",
|
||||||
"Latest": "Latest",
|
"Latest": "Latest",
|
||||||
"MessageApplicationUpdated": "Jellyfin Server has been updated",
|
"MessageApplicationUpdated": "Jellyfin Sunucusu güncellendi",
|
||||||
"MessageApplicationUpdatedTo": "Jellyfin Server has been updated to {0}",
|
"MessageApplicationUpdatedTo": "Jellyfin Server has been updated to {0}",
|
||||||
"MessageNamedServerConfigurationUpdatedWithValue": "Server configuration section {0} has been updated",
|
"MessageNamedServerConfigurationUpdatedWithValue": "Server configuration section {0} has been updated",
|
||||||
"MessageServerConfigurationUpdated": "Server configuration has been updated",
|
"MessageServerConfigurationUpdated": "Server configuration has been updated",
|
||||||
"MixedContent": "Mixed content",
|
"MixedContent": "Mixed content",
|
||||||
"Movies": "Movies",
|
"Movies": "Movies",
|
||||||
"Music": "Music",
|
"Music": "Müzik",
|
||||||
"MusicVideos": "Music videos",
|
"MusicVideos": "Müzik videoları",
|
||||||
"NameInstallFailed": "{0} installation failed",
|
"NameInstallFailed": "{0} kurulum başarısız",
|
||||||
"NameSeasonNumber": "Season {0}",
|
"NameSeasonNumber": "Sezon {0}",
|
||||||
"NameSeasonUnknown": "Season Unknown",
|
"NameSeasonUnknown": "Bilinmeyen Sezon",
|
||||||
"NewVersionIsAvailable": "A new version of Jellyfin Server is available for download.",
|
"NewVersionIsAvailable": "Jellyfin Sunucusunun yeni bir versiyonu indirmek için hazır.",
|
||||||
"NotificationOptionApplicationUpdateAvailable": "Application update available",
|
"NotificationOptionApplicationUpdateAvailable": "Application update available",
|
||||||
"NotificationOptionApplicationUpdateInstalled": "Application update installed",
|
"NotificationOptionApplicationUpdateInstalled": "Application update installed",
|
||||||
"NotificationOptionAudioPlayback": "Audio playback started",
|
"NotificationOptionAudioPlayback": "Audio playback started",
|
||||||
|
|
|
@ -34,14 +34,14 @@
|
||||||
"LabelRunningTimeValue": "运行时间:{0}",
|
"LabelRunningTimeValue": "运行时间:{0}",
|
||||||
"Latest": "最新",
|
"Latest": "最新",
|
||||||
"MessageApplicationUpdated": "Jellyfin 服务器已更新",
|
"MessageApplicationUpdated": "Jellyfin 服务器已更新",
|
||||||
"MessageApplicationUpdatedTo": "Jellyfin Server has been updated to {0}",
|
"MessageApplicationUpdatedTo": "Jellyfin Server 的版本已更新为 {0}",
|
||||||
"MessageNamedServerConfigurationUpdatedWithValue": "服务器配置 {0} 部分已更新",
|
"MessageNamedServerConfigurationUpdatedWithValue": "服务器配置 {0} 部分已更新",
|
||||||
"MessageServerConfigurationUpdated": "服务器配置已更新",
|
"MessageServerConfigurationUpdated": "服务器配置已更新",
|
||||||
"MixedContent": "混合内容",
|
"MixedContent": "混合内容",
|
||||||
"Movies": "电影",
|
"Movies": "电影",
|
||||||
"Music": "音乐",
|
"Music": "音乐",
|
||||||
"MusicVideos": "音乐视频",
|
"MusicVideos": "音乐视频",
|
||||||
"NameInstallFailed": "{0} installation failed",
|
"NameInstallFailed": "{0} 安装失败",
|
||||||
"NameSeasonNumber": "季 {0}",
|
"NameSeasonNumber": "季 {0}",
|
||||||
"NameSeasonUnknown": "未知季",
|
"NameSeasonUnknown": "未知季",
|
||||||
"NewVersionIsAvailable": "A new version of Jellyfin Server is available for download.",
|
"NewVersionIsAvailable": "A new version of Jellyfin Server is available for download.",
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
"ProviderValue": "提供商:{0}",
|
"ProviderValue": "提供商:{0}",
|
||||||
"ScheduledTaskFailedWithName": "{0} 已失败",
|
"ScheduledTaskFailedWithName": "{0} 已失败",
|
||||||
"ScheduledTaskStartedWithName": "{0} 已开始",
|
"ScheduledTaskStartedWithName": "{0} 已开始",
|
||||||
"ServerNameNeedsToBeRestarted": "{0} needs to be restarted",
|
"ServerNameNeedsToBeRestarted": "{0} 需要重新启动",
|
||||||
"Shows": "节目",
|
"Shows": "节目",
|
||||||
"Songs": "歌曲",
|
"Songs": "歌曲",
|
||||||
"StartupEmbyServerIsLoading": "Jellyfin 服务器加载中。请稍后再试。",
|
"StartupEmbyServerIsLoading": "Jellyfin 服务器加载中。请稍后再试。",
|
||||||
|
|
|
@ -11,7 +11,6 @@ using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
using MediaBrowser.Model.IO;
|
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
@ -35,7 +34,6 @@ namespace Emby.Server.Implementations.Localization
|
||||||
private readonly Dictionary<string, Dictionary<string, ParentalRating>> _allParentalRatings =
|
private readonly Dictionary<string, Dictionary<string, ParentalRating>> _allParentalRatings =
|
||||||
new Dictionary<string, Dictionary<string, ParentalRating>>(StringComparer.OrdinalIgnoreCase);
|
new Dictionary<string, Dictionary<string, ParentalRating>>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
private readonly IFileSystem _fileSystem;
|
|
||||||
private readonly IJsonSerializer _jsonSerializer;
|
private readonly IJsonSerializer _jsonSerializer;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private static readonly Assembly _assembly = typeof(LocalizationManager).Assembly;
|
private static readonly Assembly _assembly = typeof(LocalizationManager).Assembly;
|
||||||
|
@ -44,40 +42,38 @@ namespace Emby.Server.Implementations.Localization
|
||||||
/// Initializes a new instance of the <see cref="LocalizationManager" /> class.
|
/// Initializes a new instance of the <see cref="LocalizationManager" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="configurationManager">The configuration manager.</param>
|
/// <param name="configurationManager">The configuration manager.</param>
|
||||||
/// <param name="fileSystem">The file system.</param>
|
|
||||||
/// <param name="jsonSerializer">The json serializer.</param>
|
/// <param name="jsonSerializer">The json serializer.</param>
|
||||||
|
/// <param name="loggerFactory">The logger factory</param>
|
||||||
public LocalizationManager(
|
public LocalizationManager(
|
||||||
IServerConfigurationManager configurationManager,
|
IServerConfigurationManager configurationManager,
|
||||||
IFileSystem fileSystem,
|
|
||||||
IJsonSerializer jsonSerializer,
|
IJsonSerializer jsonSerializer,
|
||||||
ILoggerFactory loggerFactory)
|
ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
_configurationManager = configurationManager;
|
_configurationManager = configurationManager;
|
||||||
_fileSystem = fileSystem;
|
|
||||||
_jsonSerializer = jsonSerializer;
|
_jsonSerializer = jsonSerializer;
|
||||||
_logger = loggerFactory.CreateLogger(nameof(LocalizationManager));
|
_logger = loggerFactory.CreateLogger(nameof(LocalizationManager));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task LoadAll()
|
public async Task LoadAll()
|
||||||
{
|
{
|
||||||
const string ratingsResource = "Emby.Server.Implementations.Localization.Ratings.";
|
const string RatingsResource = "Emby.Server.Implementations.Localization.Ratings.";
|
||||||
|
|
||||||
// Extract from the assembly
|
// Extract from the assembly
|
||||||
foreach (var resource in _assembly.GetManifestResourceNames())
|
foreach (var resource in _assembly.GetManifestResourceNames())
|
||||||
{
|
{
|
||||||
if (!resource.StartsWith(ratingsResource))
|
if (!resource.StartsWith(RatingsResource, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
string countryCode = resource.Substring(ratingsResource.Length, 2);
|
string countryCode = resource.Substring(RatingsResource.Length, 2);
|
||||||
var dict = new Dictionary<string, ParentalRating>(StringComparer.OrdinalIgnoreCase);
|
var dict = new Dictionary<string, ParentalRating>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
using (var str = _assembly.GetManifestResourceStream(resource))
|
using (var str = _assembly.GetManifestResourceStream(resource))
|
||||||
using (var reader = new StreamReader(str))
|
using (var reader = new StreamReader(str))
|
||||||
{
|
{
|
||||||
string line;
|
string line;
|
||||||
while ((line = await reader.ReadLineAsync()) != null)
|
while ((line = await reader.ReadLineAsync().ConfigureAwait(false)) != null)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(line))
|
if (string.IsNullOrWhiteSpace(line))
|
||||||
{
|
{
|
||||||
|
@ -102,7 +98,7 @@ namespace Emby.Server.Implementations.Localization
|
||||||
_allParentalRatings[countryCode] = dict;
|
_allParentalRatings[countryCode] = dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
await LoadCultures();
|
await LoadCultures().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string NormalizeFormKD(string text)
|
public string NormalizeFormKD(string text)
|
||||||
|
@ -121,14 +117,14 @@ namespace Emby.Server.Implementations.Localization
|
||||||
{
|
{
|
||||||
List<CultureDto> list = new List<CultureDto>();
|
List<CultureDto> list = new List<CultureDto>();
|
||||||
|
|
||||||
const string path = "Emby.Server.Implementations.Localization.iso6392.txt";
|
const string ResourcePath = "Emby.Server.Implementations.Localization.iso6392.txt";
|
||||||
|
|
||||||
using (var stream = _assembly.GetManifestResourceStream(path))
|
using (var stream = _assembly.GetManifestResourceStream(ResourcePath))
|
||||||
using (var reader = new StreamReader(stream))
|
using (var reader = new StreamReader(stream))
|
||||||
{
|
{
|
||||||
while (!reader.EndOfStream)
|
while (!reader.EndOfStream)
|
||||||
{
|
{
|
||||||
var line = await reader.ReadLineAsync();
|
var line = await reader.ReadLineAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(line))
|
if (string.IsNullOrWhiteSpace(line))
|
||||||
{
|
{
|
||||||
|
@ -154,11 +150,11 @@ namespace Emby.Server.Implementations.Localization
|
||||||
string[] threeletterNames;
|
string[] threeletterNames;
|
||||||
if (string.IsNullOrWhiteSpace(parts[1]))
|
if (string.IsNullOrWhiteSpace(parts[1]))
|
||||||
{
|
{
|
||||||
threeletterNames = new [] { parts[0] };
|
threeletterNames = new[] { parts[0] };
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
threeletterNames = new [] { parts[0], parts[1] };
|
threeletterNames = new[] { parts[0], parts[1] };
|
||||||
}
|
}
|
||||||
|
|
||||||
list.Add(new CultureDto
|
list.Add(new CultureDto
|
||||||
|
@ -218,6 +214,7 @@ namespace Emby.Server.Implementations.Localization
|
||||||
/// Gets the ratings.
|
/// Gets the ratings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="countryCode">The country code.</param>
|
/// <param name="countryCode">The country code.</param>
|
||||||
|
/// <returns>The ratings</returns>
|
||||||
private Dictionary<string, ParentalRating> GetRatings(string countryCode)
|
private Dictionary<string, ParentalRating> GetRatings(string countryCode)
|
||||||
{
|
{
|
||||||
_allParentalRatings.TryGetValue(countryCode, out var value);
|
_allParentalRatings.TryGetValue(countryCode, out var value);
|
||||||
|
@ -227,9 +224,12 @@ namespace Emby.Server.Implementations.Localization
|
||||||
|
|
||||||
private static readonly string[] _unratedValues = { "n/a", "unrated", "not rated" };
|
private static readonly string[] _unratedValues = { "n/a", "unrated", "not rated" };
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the rating level.
|
/// Gets the rating level.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="rating">Rating field</param>
|
||||||
|
/// <returns>The rating level</returns>>
|
||||||
public int? GetRatingLevel(string rating)
|
public int? GetRatingLevel(string rating)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(rating))
|
if (string.IsNullOrEmpty(rating))
|
||||||
|
@ -301,6 +301,7 @@ namespace Emby.Server.Implementations.Localization
|
||||||
{
|
{
|
||||||
culture = _configurationManager.Configuration.UICulture;
|
culture = _configurationManager.Configuration.UICulture;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(culture))
|
if (string.IsNullOrEmpty(culture))
|
||||||
{
|
{
|
||||||
culture = DefaultCulture;
|
culture = DefaultCulture;
|
||||||
|
@ -346,8 +347,8 @@ namespace Emby.Server.Implementations.Localization
|
||||||
|
|
||||||
var namespaceName = GetType().Namespace + "." + prefix;
|
var namespaceName = GetType().Namespace + "." + prefix;
|
||||||
|
|
||||||
await CopyInto(dictionary, namespaceName + "." + baseFilename);
|
await CopyInto(dictionary, namespaceName + "." + baseFilename).ConfigureAwait(false);
|
||||||
await CopyInto(dictionary, namespaceName + "." + GetResourceFilename(culture));
|
await CopyInto(dictionary, namespaceName + "." + GetResourceFilename(culture)).ConfigureAwait(false);
|
||||||
|
|
||||||
return dictionary;
|
return dictionary;
|
||||||
}
|
}
|
||||||
|
@ -359,7 +360,7 @@ namespace Emby.Server.Implementations.Localization
|
||||||
// If a Culture doesn't have a translation the stream will be null and it defaults to en-us further up the chain
|
// If a Culture doesn't have a translation the stream will be null and it defaults to en-us further up the chain
|
||||||
if (stream != null)
|
if (stream != null)
|
||||||
{
|
{
|
||||||
var dict = await _jsonSerializer.DeserializeFromStreamAsync<Dictionary<string, string>>(stream);
|
var dict = await _jsonSerializer.DeserializeFromStreamAsync<Dictionary<string, string>>(stream).ConfigureAwait(false);
|
||||||
|
|
||||||
foreach (var key in dict.Keys)
|
foreach (var key in dict.Keys)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,66 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Net
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Correclty implements the <see cref="IDisposable"/> interface and pattern for an object containing only managed resources, and adds a few common niceities not on the interface such as an <see cref="IsDisposed"/> property.
|
|
||||||
/// </summary>
|
|
||||||
public abstract class DisposableManagedObjectBase : IDisposable
|
|
||||||
{
|
|
||||||
|
|
||||||
#region Public Methods
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Override this method and dispose any objects you own the lifetime of if disposing is true;
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">True if managed objects should be disposed, if false, only unmanaged resources should be released.</param>
|
|
||||||
protected abstract void Dispose(bool disposing);
|
|
||||||
|
|
||||||
|
|
||||||
//TODO Remove and reimplement using the IsDisposed property directly.
|
|
||||||
/// <summary>
|
|
||||||
/// Throws an <see cref="ObjectDisposedException"/> if the <see cref="IsDisposed"/> property is true.
|
|
||||||
/// </summary>
|
|
||||||
/// <seealso cref="IsDisposed"/>
|
|
||||||
/// <exception cref="ObjectDisposedException">Thrown if the <see cref="IsDisposed"/> property is true.</exception>
|
|
||||||
/// <seealso cref="Dispose()"/>
|
|
||||||
protected virtual void ThrowIfDisposed()
|
|
||||||
{
|
|
||||||
if (IsDisposed) throw new ObjectDisposedException(GetType().Name);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Public Properties
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets or returns a boolean indicating whether or not this instance has been disposed.
|
|
||||||
/// </summary>
|
|
||||||
/// <seealso cref="Dispose()"/>
|
|
||||||
public bool IsDisposed
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
private set;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region IDisposable Members
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Disposes this object instance and all internally managed resources.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// <para>Sets the <see cref="IsDisposed"/> property to true. Does not explicitly throw an exception if called multiple times, but makes no promises about behaviour of derived classes.</para>
|
|
||||||
/// </remarks>
|
|
||||||
/// <seealso cref="IsDisposed"/>
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
IsDisposed = true;
|
|
||||||
|
|
||||||
Dispose(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,7 +4,6 @@ using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using Emby.Server.Implementations.Networking;
|
using Emby.Server.Implementations.Networking;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Net
|
namespace Emby.Server.Implementations.Net
|
||||||
{
|
{
|
||||||
|
@ -19,7 +18,10 @@ namespace Emby.Server.Implementations.Net
|
||||||
|
|
||||||
public ISocket CreateTcpSocket(IpAddressInfo remoteAddress, int remotePort)
|
public ISocket CreateTcpSocket(IpAddressInfo remoteAddress, int remotePort)
|
||||||
{
|
{
|
||||||
if (remotePort < 0) throw new ArgumentException("remotePort cannot be less than zero.", nameof(remotePort));
|
if (remotePort < 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("remotePort cannot be less than zero.", nameof(remotePort));
|
||||||
|
}
|
||||||
|
|
||||||
var addressFamily = remoteAddress.AddressFamily == IpAddressFamily.InterNetwork
|
var addressFamily = remoteAddress.AddressFamily == IpAddressFamily.InterNetwork
|
||||||
? AddressFamily.InterNetwork
|
? AddressFamily.InterNetwork
|
||||||
|
@ -42,8 +44,7 @@ namespace Emby.Server.Implementations.Net
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
if (retVal != null)
|
retVal?.Dispose();
|
||||||
retVal.Dispose();
|
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +56,10 @@ namespace Emby.Server.Implementations.Net
|
||||||
/// <param name="localPort">An integer specifying the local port to bind the acceptSocket to.</param>
|
/// <param name="localPort">An integer specifying the local port to bind the acceptSocket to.</param>
|
||||||
public ISocket CreateUdpSocket(int localPort)
|
public ISocket CreateUdpSocket(int localPort)
|
||||||
{
|
{
|
||||||
if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort));
|
if (localPort < 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort));
|
||||||
|
}
|
||||||
|
|
||||||
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);
|
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);
|
||||||
try
|
try
|
||||||
|
@ -65,8 +69,7 @@ namespace Emby.Server.Implementations.Net
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
if (retVal != null)
|
retVal?.Dispose();
|
||||||
retVal.Dispose();
|
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +77,10 @@ namespace Emby.Server.Implementations.Net
|
||||||
|
|
||||||
public ISocket CreateUdpBroadcastSocket(int localPort)
|
public ISocket CreateUdpBroadcastSocket(int localPort)
|
||||||
{
|
{
|
||||||
if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort));
|
if (localPort < 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort));
|
||||||
|
}
|
||||||
|
|
||||||
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);
|
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);
|
||||||
try
|
try
|
||||||
|
@ -86,8 +92,7 @@ namespace Emby.Server.Implementations.Net
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
if (retVal != null)
|
retVal?.Dispose();
|
||||||
retVal.Dispose();
|
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +104,10 @@ namespace Emby.Server.Implementations.Net
|
||||||
/// <returns>An implementation of the <see cref="ISocket"/> interface used by RSSDP components to perform acceptSocket operations.</returns>
|
/// <returns>An implementation of the <see cref="ISocket"/> interface used by RSSDP components to perform acceptSocket operations.</returns>
|
||||||
public ISocket CreateSsdpUdpSocket(IpAddressInfo localIpAddress, int localPort)
|
public ISocket CreateSsdpUdpSocket(IpAddressInfo localIpAddress, int localPort)
|
||||||
{
|
{
|
||||||
if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort));
|
if (localPort < 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort));
|
||||||
|
}
|
||||||
|
|
||||||
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);
|
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);
|
||||||
try
|
try
|
||||||
|
@ -114,8 +122,7 @@ namespace Emby.Server.Implementations.Net
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
if (retVal != null)
|
retVal?.Dispose();
|
||||||
retVal.Dispose();
|
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
@ -130,10 +137,25 @@ namespace Emby.Server.Implementations.Net
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public ISocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort)
|
public ISocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort)
|
||||||
{
|
{
|
||||||
if (ipAddress == null) throw new ArgumentNullException(nameof(ipAddress));
|
if (ipAddress == null)
|
||||||
if (ipAddress.Length == 0) throw new ArgumentException("ipAddress cannot be an empty string.", nameof(ipAddress));
|
{
|
||||||
if (multicastTimeToLive <= 0) throw new ArgumentException("multicastTimeToLive cannot be zero or less.", nameof(multicastTimeToLive));
|
throw new ArgumentNullException(nameof(ipAddress));
|
||||||
if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort));
|
}
|
||||||
|
|
||||||
|
if (ipAddress.Length == 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("ipAddress cannot be an empty string.", nameof(ipAddress));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (multicastTimeToLive <= 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("multicastTimeToLive cannot be zero or less.", nameof(multicastTimeToLive));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (localPort < 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort));
|
||||||
|
}
|
||||||
|
|
||||||
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);
|
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);
|
||||||
|
|
||||||
|
@ -172,87 +194,13 @@ namespace Emby.Server.Implementations.Net
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
if (retVal != null)
|
retVal?.Dispose();
|
||||||
retVal.Dispose();
|
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stream CreateNetworkStream(ISocket socket, bool ownsSocket)
|
public Stream CreateNetworkStream(ISocket socket, bool ownsSocket)
|
||||||
{
|
=> new NetworkStream(((UdpSocket)socket).Socket, ownsSocket);
|
||||||
var netSocket = (UdpSocket)socket;
|
|
||||||
|
|
||||||
return new SocketStream(netSocket.Socket, ownsSocket);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public class SocketStream : Stream
|
|
||||||
{
|
|
||||||
private readonly Socket _socket;
|
|
||||||
|
|
||||||
public SocketStream(Socket socket, bool ownsSocket)
|
|
||||||
{
|
|
||||||
_socket = socket;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Flush()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanRead => true;
|
|
||||||
|
|
||||||
public override bool CanSeek => false;
|
|
||||||
|
|
||||||
public override bool CanWrite => true;
|
|
||||||
|
|
||||||
public override long Length => throw new NotImplementedException();
|
|
||||||
|
|
||||||
public override long Position
|
|
||||||
{
|
|
||||||
get => throw new NotImplementedException();
|
|
||||||
set => throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Write(byte[] buffer, int offset, int count)
|
|
||||||
{
|
|
||||||
_socket.Send(buffer, offset, count, SocketFlags.None);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
|
|
||||||
{
|
|
||||||
return _socket.BeginSend(buffer, offset, count, SocketFlags.None, callback, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void EndWrite(IAsyncResult asyncResult)
|
|
||||||
{
|
|
||||||
_socket.EndSend(asyncResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void SetLength(long value)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override long Seek(long offset, SeekOrigin origin)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int Read(byte[] buffer, int offset, int count)
|
|
||||||
{
|
|
||||||
return _socket.Receive(buffer, offset, count, SocketFlags.None);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
|
|
||||||
{
|
|
||||||
return _socket.BeginReceive(buffer, offset, count, SocketFlags.None, callback, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int EndRead(IAsyncResult asyncResult)
|
|
||||||
{
|
|
||||||
return _socket.EndReceive(asyncResult);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,12 +11,15 @@ namespace Emby.Server.Implementations.Net
|
||||||
// THIS IS A LINKED FILE - SHARED AMONGST MULTIPLE PLATFORMS
|
// THIS IS A LINKED FILE - SHARED AMONGST MULTIPLE PLATFORMS
|
||||||
// Be careful to check any changes compile and work for all platform projects it is shared in.
|
// Be careful to check any changes compile and work for all platform projects it is shared in.
|
||||||
|
|
||||||
public sealed class UdpSocket : DisposableManagedObjectBase, ISocket
|
public sealed class UdpSocket : ISocket, IDisposable
|
||||||
{
|
{
|
||||||
private Socket _Socket;
|
private Socket _socket;
|
||||||
private int _LocalPort;
|
private int _localPort;
|
||||||
|
private bool _disposed = false;
|
||||||
|
|
||||||
public Socket Socket => _Socket;
|
public Socket Socket => _socket;
|
||||||
|
|
||||||
|
public IpAddressInfo LocalIPAddress { get; }
|
||||||
|
|
||||||
private readonly SocketAsyncEventArgs _receiveSocketAsyncEventArgs = new SocketAsyncEventArgs()
|
private readonly SocketAsyncEventArgs _receiveSocketAsyncEventArgs = new SocketAsyncEventArgs()
|
||||||
{
|
{
|
||||||
|
@ -35,11 +38,11 @@ namespace Emby.Server.Implementations.Net
|
||||||
{
|
{
|
||||||
if (socket == null) throw new ArgumentNullException(nameof(socket));
|
if (socket == null) throw new ArgumentNullException(nameof(socket));
|
||||||
|
|
||||||
_Socket = socket;
|
_socket = socket;
|
||||||
_LocalPort = localPort;
|
_localPort = localPort;
|
||||||
LocalIPAddress = NetworkManager.ToIpAddressInfo(ip);
|
LocalIPAddress = NetworkManager.ToIpAddressInfo(ip);
|
||||||
|
|
||||||
_Socket.Bind(new IPEndPoint(ip, _LocalPort));
|
_socket.Bind(new IPEndPoint(ip, _localPort));
|
||||||
|
|
||||||
InitReceiveSocketAsyncEventArgs();
|
InitReceiveSocketAsyncEventArgs();
|
||||||
}
|
}
|
||||||
|
@ -101,32 +104,26 @@ namespace Emby.Server.Implementations.Net
|
||||||
{
|
{
|
||||||
if (socket == null) throw new ArgumentNullException(nameof(socket));
|
if (socket == null) throw new ArgumentNullException(nameof(socket));
|
||||||
|
|
||||||
_Socket = socket;
|
_socket = socket;
|
||||||
_Socket.Connect(NetworkManager.ToIPEndPoint(endPoint));
|
_socket.Connect(NetworkManager.ToIPEndPoint(endPoint));
|
||||||
|
|
||||||
InitReceiveSocketAsyncEventArgs();
|
InitReceiveSocketAsyncEventArgs();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IpAddressInfo LocalIPAddress
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
private set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IAsyncResult BeginReceive(byte[] buffer, int offset, int count, AsyncCallback callback)
|
public IAsyncResult BeginReceive(byte[] buffer, int offset, int count, AsyncCallback callback)
|
||||||
{
|
{
|
||||||
ThrowIfDisposed();
|
ThrowIfDisposed();
|
||||||
|
|
||||||
EndPoint receivedFromEndPoint = new IPEndPoint(IPAddress.Any, 0);
|
EndPoint receivedFromEndPoint = new IPEndPoint(IPAddress.Any, 0);
|
||||||
|
|
||||||
return _Socket.BeginReceiveFrom(buffer, offset, count, SocketFlags.None, ref receivedFromEndPoint, callback, buffer);
|
return _socket.BeginReceiveFrom(buffer, offset, count, SocketFlags.None, ref receivedFromEndPoint, callback, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Receive(byte[] buffer, int offset, int count)
|
public int Receive(byte[] buffer, int offset, int count)
|
||||||
{
|
{
|
||||||
ThrowIfDisposed();
|
ThrowIfDisposed();
|
||||||
|
|
||||||
return _Socket.Receive(buffer, 0, buffer.Length, SocketFlags.None);
|
return _socket.Receive(buffer, 0, buffer.Length, SocketFlags.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SocketReceiveResult EndReceive(IAsyncResult result)
|
public SocketReceiveResult EndReceive(IAsyncResult result)
|
||||||
|
@ -136,7 +133,7 @@ namespace Emby.Server.Implementations.Net
|
||||||
var sender = new IPEndPoint(IPAddress.Any, 0);
|
var sender = new IPEndPoint(IPAddress.Any, 0);
|
||||||
var remoteEndPoint = (EndPoint)sender;
|
var remoteEndPoint = (EndPoint)sender;
|
||||||
|
|
||||||
var receivedBytes = _Socket.EndReceiveFrom(result, ref remoteEndPoint);
|
var receivedBytes = _socket.EndReceiveFrom(result, ref remoteEndPoint);
|
||||||
|
|
||||||
var buffer = (byte[])result.AsyncState;
|
var buffer = (byte[])result.AsyncState;
|
||||||
|
|
||||||
|
@ -236,35 +233,40 @@ namespace Emby.Server.Implementations.Net
|
||||||
|
|
||||||
var ipEndPoint = NetworkManager.ToIPEndPoint(endPoint);
|
var ipEndPoint = NetworkManager.ToIPEndPoint(endPoint);
|
||||||
|
|
||||||
return _Socket.BeginSendTo(buffer, offset, size, SocketFlags.None, ipEndPoint, callback, state);
|
return _socket.BeginSendTo(buffer, offset, size, SocketFlags.None, ipEndPoint, callback, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int EndSendTo(IAsyncResult result)
|
public int EndSendTo(IAsyncResult result)
|
||||||
{
|
{
|
||||||
ThrowIfDisposed();
|
ThrowIfDisposed();
|
||||||
|
|
||||||
return _Socket.EndSendTo(result);
|
return _socket.EndSendTo(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
private void ThrowIfDisposed()
|
||||||
{
|
{
|
||||||
if (disposing)
|
if (_disposed)
|
||||||
{
|
{
|
||||||
var socket = _Socket;
|
throw new ObjectDisposedException(nameof(UdpSocket));
|
||||||
if (socket != null)
|
}
|
||||||
socket.Dispose();
|
}
|
||||||
|
|
||||||
var tcs = _currentReceiveTaskCompletionSource;
|
public void Dispose()
|
||||||
if (tcs != null)
|
|
||||||
{
|
{
|
||||||
tcs.TrySetCanceled();
|
if (_disposed)
|
||||||
}
|
|
||||||
var sendTcs = _currentSendTaskCompletionSource;
|
|
||||||
if (sendTcs != null)
|
|
||||||
{
|
{
|
||||||
sendTcs.TrySetCanceled();
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_socket?.Dispose();
|
||||||
|
_currentReceiveTaskCompletionSource?.TrySetCanceled();
|
||||||
|
_currentSendTaskCompletionSource?.TrySetCanceled();
|
||||||
|
|
||||||
|
_socket = null;
|
||||||
|
_currentReceiveTaskCompletionSource = null;
|
||||||
|
_currentSendTaskCompletionSource = null;
|
||||||
|
|
||||||
|
_disposed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IpEndPointInfo ToIpEndPointInfo(IPEndPoint endpoint)
|
private static IpEndPointInfo ToIpEndPointInfo(IPEndPoint endpoint)
|
||||||
|
|
|
@ -7,11 +7,11 @@ using System.Net.NetworkInformation;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Model.Extensions;
|
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using OperatingSystem = MediaBrowser.Common.System.OperatingSystem;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Networking
|
namespace Emby.Server.Implementations.Networking
|
||||||
{
|
{
|
||||||
|
@ -22,14 +22,12 @@ namespace Emby.Server.Implementations.Networking
|
||||||
public event EventHandler NetworkChanged;
|
public event EventHandler NetworkChanged;
|
||||||
public Func<string[]> LocalSubnetsFn { get; set; }
|
public Func<string[]> LocalSubnetsFn { get; set; }
|
||||||
|
|
||||||
public NetworkManager(
|
public NetworkManager(ILoggerFactory loggerFactory)
|
||||||
ILoggerFactory loggerFactory,
|
|
||||||
IEnvironmentInfo environment)
|
|
||||||
{
|
{
|
||||||
Logger = loggerFactory.CreateLogger(nameof(NetworkManager));
|
Logger = loggerFactory.CreateLogger(nameof(NetworkManager));
|
||||||
|
|
||||||
// In FreeBSD these events cause a crash
|
// In FreeBSD these events cause a crash
|
||||||
if (environment.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.BSD)
|
if (OperatingSystem.Id != OperatingSystemId.BSD)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Jellyfin Project")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Jellyfin Server")]
|
[assembly: AssemblyProduct("Jellyfin Server")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
|
||||||
using MediaBrowser.Model.Reflection;
|
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Reflection
|
|
||||||
{
|
|
||||||
public class AssemblyInfo : IAssemblyInfo
|
|
||||||
{
|
|
||||||
public Stream GetManifestResourceStream(Type type, string resource)
|
|
||||||
{
|
|
||||||
return type.Assembly.GetManifestResourceStream(resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string[] GetManifestResourceNames(Type type)
|
|
||||||
{
|
|
||||||
return type.Assembly.GetManifestResourceNames();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Assembly[] GetCurrentAssemblies()
|
|
||||||
{
|
|
||||||
return AppDomain.CurrentDomain.GetAssemblies();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -17,11 +17,13 @@ namespace Emby.Server.Implementations
|
||||||
string programDataPath,
|
string programDataPath,
|
||||||
string logDirectoryPath,
|
string logDirectoryPath,
|
||||||
string configurationDirectoryPath,
|
string configurationDirectoryPath,
|
||||||
string cacheDirectoryPath)
|
string cacheDirectoryPath,
|
||||||
|
string webDirectoryPath)
|
||||||
: base(programDataPath,
|
: base(programDataPath,
|
||||||
logDirectoryPath,
|
logDirectoryPath,
|
||||||
configurationDirectoryPath,
|
configurationDirectoryPath,
|
||||||
cacheDirectoryPath)
|
cacheDirectoryPath,
|
||||||
|
webDirectoryPath)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,14 +116,14 @@ namespace Emby.Server.Implementations.Session
|
||||||
_authRepo = authRepo;
|
_authRepo = authRepo;
|
||||||
_deviceManager = deviceManager;
|
_deviceManager = deviceManager;
|
||||||
_mediaSourceManager = mediaSourceManager;
|
_mediaSourceManager = mediaSourceManager;
|
||||||
_deviceManager.DeviceOptionsUpdated += _deviceManager_DeviceOptionsUpdated;
|
_deviceManager.DeviceOptionsUpdated += OnDeviceManagerDeviceOptionsUpdated;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _deviceManager_DeviceOptionsUpdated(object sender, GenericEventArgs<Tuple<string, DeviceOptions>> e)
|
private void OnDeviceManagerDeviceOptionsUpdated(object sender, GenericEventArgs<Tuple<string, DeviceOptions>> e)
|
||||||
{
|
{
|
||||||
foreach (var session in Sessions)
|
foreach (var session in Sessions)
|
||||||
{
|
{
|
||||||
if (string.Equals(session.DeviceId, e.Argument.Item1))
|
if (string.Equals(session.DeviceId, e.Argument.Item1, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(e.Argument.Item2.CustomName))
|
if (!string.IsNullOrWhiteSpace(e.Argument.Item2.CustomName))
|
||||||
{
|
{
|
||||||
|
@ -138,11 +138,29 @@ namespace Emby.Server.Implementations.Session
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _disposed;
|
private bool _disposed = false;
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
Dispose(true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (_disposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (disposing)
|
||||||
|
{
|
||||||
|
// TODO: dispose stuff
|
||||||
|
}
|
||||||
|
|
||||||
|
_deviceManager.DeviceOptionsUpdated -= OnDeviceManagerDeviceOptionsUpdated;
|
||||||
|
|
||||||
_disposed = true;
|
_disposed = true;
|
||||||
_deviceManager.DeviceOptionsUpdated -= _deviceManager_DeviceOptionsUpdated;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CheckDisposed()
|
public void CheckDisposed()
|
||||||
|
@ -157,7 +175,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
/// Gets all connections.
|
/// Gets all connections.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>All connections.</value>
|
/// <value>All connections.</value>
|
||||||
public IEnumerable<SessionInfo> Sessions => _activeConnections.Values.OrderByDescending(c => c.LastActivityDate).ToList();
|
public IEnumerable<SessionInfo> Sessions => _activeConnections.Values.OrderByDescending(c => c.LastActivityDate);
|
||||||
|
|
||||||
private void OnSessionStarted(SessionInfo info)
|
private void OnSessionStarted(SessionInfo info)
|
||||||
{
|
{
|
||||||
|
@ -171,20 +189,27 @@ namespace Emby.Server.Implementations.Session
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EventHelper.QueueEventIfNotNull(SessionStarted, this, new SessionEventArgs
|
EventHelper.QueueEventIfNotNull(
|
||||||
|
SessionStarted,
|
||||||
|
this,
|
||||||
|
new SessionEventArgs
|
||||||
{
|
{
|
||||||
SessionInfo = info
|
SessionInfo = info
|
||||||
|
},
|
||||||
}, _logger);
|
_logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSessionEnded(SessionInfo info)
|
private void OnSessionEnded(SessionInfo info)
|
||||||
{
|
{
|
||||||
EventHelper.QueueEventIfNotNull(SessionEnded, this, new SessionEventArgs
|
EventHelper.QueueEventIfNotNull(
|
||||||
|
SessionEnded,
|
||||||
|
this,
|
||||||
|
new SessionEventArgs
|
||||||
{
|
{
|
||||||
SessionInfo = info
|
SessionInfo = info
|
||||||
|
|
||||||
}, _logger);
|
},
|
||||||
|
_logger);
|
||||||
|
|
||||||
info.Dispose();
|
info.Dispose();
|
||||||
}
|
}
|
||||||
|
@ -192,9 +217,6 @@ namespace Emby.Server.Implementations.Session
|
||||||
public void UpdateDeviceName(string sessionId, string deviceName)
|
public void UpdateDeviceName(string sessionId, string deviceName)
|
||||||
{
|
{
|
||||||
var session = GetSession(sessionId);
|
var session = GetSession(sessionId);
|
||||||
|
|
||||||
var key = GetSessionKey(session.Client, session.DeviceId);
|
|
||||||
|
|
||||||
if (session != null)
|
if (session != null)
|
||||||
{
|
{
|
||||||
session.DeviceName = deviceName;
|
session.DeviceName = deviceName;
|
||||||
|
@ -210,10 +232,10 @@ namespace Emby.Server.Implementations.Session
|
||||||
/// <param name="deviceName">Name of the device.</param>
|
/// <param name="deviceName">Name of the device.</param>
|
||||||
/// <param name="remoteEndPoint">The remote end point.</param>
|
/// <param name="remoteEndPoint">The remote end point.</param>
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>SessionInfo.</returns>
|
||||||
/// <exception cref="ArgumentNullException">user</exception>
|
/// <exception cref="ArgumentNullException">user</exception>
|
||||||
/// <exception cref="UnauthorizedAccessException"></exception>
|
public SessionInfo LogSessionActivity(
|
||||||
public SessionInfo LogSessionActivity(string appName,
|
string appName,
|
||||||
string appVersion,
|
string appVersion,
|
||||||
string deviceId,
|
string deviceId,
|
||||||
string deviceName,
|
string deviceName,
|
||||||
|
@ -226,10 +248,12 @@ namespace Emby.Server.Implementations.Session
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(appName));
|
throw new ArgumentNullException(nameof(appName));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(appVersion))
|
if (string.IsNullOrEmpty(appVersion))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(appVersion));
|
throw new ArgumentNullException(nameof(appVersion));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(deviceId))
|
if (string.IsNullOrEmpty(deviceId))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(deviceId));
|
throw new ArgumentNullException(nameof(deviceId));
|
||||||
|
@ -260,7 +284,9 @@ namespace Emby.Server.Implementations.Session
|
||||||
|
|
||||||
if ((activityDate - lastActivityDate).TotalSeconds > 10)
|
if ((activityDate - lastActivityDate).TotalSeconds > 10)
|
||||||
{
|
{
|
||||||
SessionActivity?.Invoke(this, new SessionEventArgs
|
SessionActivity?.Invoke(
|
||||||
|
this,
|
||||||
|
new SessionEventArgs
|
||||||
{
|
{
|
||||||
SessionInfo = session
|
SessionInfo = session
|
||||||
});
|
});
|
||||||
|
@ -304,6 +330,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the now playing item id.
|
/// Updates the now playing item id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <returns>Task.</returns>
|
||||||
private async Task UpdateNowPlayingItem(SessionInfo session, PlaybackProgressInfo info, BaseItem libraryItem, bool updateLastCheckInTime)
|
private async Task UpdateNowPlayingItem(SessionInfo session, PlaybackProgressInfo info, BaseItem libraryItem, bool updateLastCheckInTime)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(info.MediaSourceId))
|
if (string.IsNullOrEmpty(info.MediaSourceId))
|
||||||
|
@ -418,7 +445,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
});
|
});
|
||||||
|
|
||||||
sessionInfo.UserId = user == null ? Guid.Empty : user.Id;
|
sessionInfo.UserId = user == null ? Guid.Empty : user.Id;
|
||||||
sessionInfo.UserName = user == null ? null : user.Name;
|
sessionInfo.UserName = user?.Name;
|
||||||
sessionInfo.UserPrimaryImageTag = user == null ? null : GetImageCacheTag(user, ImageType.Primary);
|
sessionInfo.UserPrimaryImageTag = user == null ? null : GetImageCacheTag(user, ImageType.Primary);
|
||||||
sessionInfo.RemoteEndPoint = remoteEndPoint;
|
sessionInfo.RemoteEndPoint = remoteEndPoint;
|
||||||
sessionInfo.Client = appName;
|
sessionInfo.Client = appName;
|
||||||
|
@ -432,7 +459,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
|
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
sessionInfo.AdditionalUsers = new SessionUserInfo[] { };
|
sessionInfo.AdditionalUsers = Array.Empty<SessionUserInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return sessionInfo;
|
return sessionInfo;
|
||||||
|
@ -449,9 +476,9 @@ namespace Emby.Server.Implementations.Session
|
||||||
ServerId = _appHost.SystemId
|
ServerId = _appHost.SystemId
|
||||||
};
|
};
|
||||||
|
|
||||||
var username = user == null ? null : user.Name;
|
var username = user?.Name;
|
||||||
|
|
||||||
sessionInfo.UserId = user == null ? Guid.Empty : user.Id;
|
sessionInfo.UserId = user?.Id ?? Guid.Empty;
|
||||||
sessionInfo.UserName = username;
|
sessionInfo.UserName = username;
|
||||||
sessionInfo.UserPrimaryImageTag = user == null ? null : GetImageCacheTag(user, ImageType.Primary);
|
sessionInfo.UserPrimaryImageTag = user == null ? null : GetImageCacheTag(user, ImageType.Primary);
|
||||||
sessionInfo.RemoteEndPoint = remoteEndPoint;
|
sessionInfo.RemoteEndPoint = remoteEndPoint;
|
||||||
|
@ -508,6 +535,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
_idleTimer = new Timer(CheckForIdlePlayback, null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5));
|
_idleTimer = new Timer(CheckForIdlePlayback, null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StopIdleCheckTimer()
|
private void StopIdleCheckTimer()
|
||||||
{
|
{
|
||||||
if (_idleTimer != null)
|
if (_idleTimer != null)
|
||||||
|
@ -539,9 +567,9 @@ namespace Emby.Server.Implementations.Session
|
||||||
Item = session.NowPlayingItem,
|
Item = session.NowPlayingItem,
|
||||||
ItemId = session.NowPlayingItem == null ? Guid.Empty : session.NowPlayingItem.Id,
|
ItemId = session.NowPlayingItem == null ? Guid.Empty : session.NowPlayingItem.Id,
|
||||||
SessionId = session.Id,
|
SessionId = session.Id,
|
||||||
MediaSourceId = session.PlayState == null ? null : session.PlayState.MediaSourceId,
|
MediaSourceId = session.PlayState?.MediaSourceId,
|
||||||
PositionTicks = session.PlayState == null ? null : session.PlayState.PositionTicks
|
PositionTicks = session.PlayState?.PositionTicks
|
||||||
});
|
}).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -616,7 +644,10 @@ namespace Emby.Server.Implementations.Session
|
||||||
|
|
||||||
// Nothing to save here
|
// Nothing to save here
|
||||||
// Fire events to inform plugins
|
// Fire events to inform plugins
|
||||||
EventHelper.QueueEventIfNotNull(PlaybackStart, this, new PlaybackProgressEventArgs
|
EventHelper.QueueEventIfNotNull(
|
||||||
|
PlaybackStart,
|
||||||
|
this,
|
||||||
|
new PlaybackProgressEventArgs
|
||||||
{
|
{
|
||||||
Item = libraryItem,
|
Item = libraryItem,
|
||||||
Users = users,
|
Users = users,
|
||||||
|
@ -627,7 +658,8 @@ namespace Emby.Server.Implementations.Session
|
||||||
DeviceId = session.DeviceId,
|
DeviceId = session.DeviceId,
|
||||||
Session = session
|
Session = session
|
||||||
|
|
||||||
}, _logger);
|
},
|
||||||
|
_logger);
|
||||||
|
|
||||||
StartIdleCheckTimer();
|
StartIdleCheckTimer();
|
||||||
}
|
}
|
||||||
|
@ -667,6 +699,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to report playback progress for an item
|
/// Used to report playback progress for an item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <returns>Task.</returns>
|
||||||
public async Task OnPlaybackProgress(PlaybackProgressInfo info, bool isAutomated)
|
public async Task OnPlaybackProgress(PlaybackProgressInfo info, bool isAutomated)
|
||||||
{
|
{
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -695,7 +728,9 @@ namespace Emby.Server.Implementations.Session
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaybackProgress?.Invoke(this, new PlaybackProgressEventArgs
|
PlaybackProgress?.Invoke(
|
||||||
|
this,
|
||||||
|
new PlaybackProgressEventArgs
|
||||||
{
|
{
|
||||||
Item = libraryItem,
|
Item = libraryItem,
|
||||||
Users = users,
|
Users = users,
|
||||||
|
@ -830,8 +865,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
{
|
{
|
||||||
MediaSourceInfo mediaSource = null;
|
MediaSourceInfo mediaSource = null;
|
||||||
|
|
||||||
var hasMediaSources = libraryItem as IHasMediaSources;
|
if (libraryItem is IHasMediaSources hasMediaSources)
|
||||||
if (hasMediaSources != null)
|
|
||||||
{
|
{
|
||||||
mediaSource = await GetMediaSource(libraryItem, info.MediaSourceId, info.LiveStreamId).ConfigureAwait(false);
|
mediaSource = await GetMediaSource(libraryItem, info.MediaSourceId, info.LiveStreamId).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
@ -848,7 +882,8 @@ namespace Emby.Server.Implementations.Session
|
||||||
{
|
{
|
||||||
var msString = info.PositionTicks.HasValue ? (info.PositionTicks.Value / 10000).ToString(CultureInfo.InvariantCulture) : "unknown";
|
var msString = info.PositionTicks.HasValue ? (info.PositionTicks.Value / 10000).ToString(CultureInfo.InvariantCulture) : "unknown";
|
||||||
|
|
||||||
_logger.LogInformation("Playback stopped reported by app {0} {1} playing {2}. Stopped at {3} ms",
|
_logger.LogInformation(
|
||||||
|
"Playback stopped reported by app {0} {1} playing {2}. Stopped at {3} ms",
|
||||||
session.Client,
|
session.Client,
|
||||||
session.ApplicationVersion,
|
session.ApplicationVersion,
|
||||||
info.Item.Name,
|
info.Item.Name,
|
||||||
|
@ -887,7 +922,10 @@ namespace Emby.Server.Implementations.Session
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EventHelper.QueueEventIfNotNull(PlaybackStopped, this, new PlaybackStopEventArgs
|
EventHelper.QueueEventIfNotNull(
|
||||||
|
PlaybackStopped,
|
||||||
|
this,
|
||||||
|
new PlaybackStopEventArgs
|
||||||
{
|
{
|
||||||
Item = libraryItem,
|
Item = libraryItem,
|
||||||
Users = users,
|
Users = users,
|
||||||
|
@ -900,7 +938,8 @@ namespace Emby.Server.Implementations.Session
|
||||||
DeviceId = session.DeviceId,
|
DeviceId = session.DeviceId,
|
||||||
Session = session
|
Session = session
|
||||||
|
|
||||||
}, _logger);
|
},
|
||||||
|
_logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool OnPlaybackStopped(User user, BaseItem item, long? positionTicks, bool playbackFailed)
|
private bool OnPlaybackStopped(User user, BaseItem item, long? positionTicks, bool playbackFailed)
|
||||||
|
@ -936,11 +975,10 @@ namespace Emby.Server.Implementations.Session
|
||||||
/// <param name="sessionId">The session identifier.</param>
|
/// <param name="sessionId">The session identifier.</param>
|
||||||
/// <param name="throwOnMissing">if set to <c>true</c> [throw on missing].</param>
|
/// <param name="throwOnMissing">if set to <c>true</c> [throw on missing].</param>
|
||||||
/// <returns>SessionInfo.</returns>
|
/// <returns>SessionInfo.</returns>
|
||||||
/// <exception cref="ResourceNotFoundException"></exception>
|
/// <exception cref="ResourceNotFoundException">sessionId</exception>
|
||||||
private SessionInfo GetSession(string sessionId, bool throwOnMissing = true)
|
private SessionInfo GetSession(string sessionId, bool throwOnMissing = true)
|
||||||
{
|
{
|
||||||
var session = Sessions.FirstOrDefault(i => string.Equals(i.Id, sessionId));
|
var session = Sessions.FirstOrDefault(i => string.Equals(i.Id, sessionId, StringComparison.Ordinal));
|
||||||
|
|
||||||
if (session == null && throwOnMissing)
|
if (session == null && throwOnMissing)
|
||||||
{
|
{
|
||||||
throw new ResourceNotFoundException(string.Format("Session {0} not found.", sessionId));
|
throw new ResourceNotFoundException(string.Format("Session {0} not found.", sessionId));
|
||||||
|
@ -952,7 +990,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
private SessionInfo GetSessionToRemoteControl(string sessionId)
|
private SessionInfo GetSessionToRemoteControl(string sessionId)
|
||||||
{
|
{
|
||||||
// Accept either device id or session id
|
// Accept either device id or session id
|
||||||
var session = Sessions.FirstOrDefault(i => string.Equals(i.Id, sessionId));
|
var session = Sessions.FirstOrDefault(i => string.Equals(i.Id, sessionId, StringComparison.Ordinal));
|
||||||
|
|
||||||
if (session == null)
|
if (session == null)
|
||||||
{
|
{
|
||||||
|
@ -1061,7 +1099,9 @@ namespace Emby.Server.Implementations.Session
|
||||||
var series = episode.Series;
|
var series = episode.Series;
|
||||||
if (series != null)
|
if (series != null)
|
||||||
{
|
{
|
||||||
var episodes = series.GetEpisodes(user, new DtoOptions(false)
|
var episodes = series.GetEpisodes(
|
||||||
|
user,
|
||||||
|
new DtoOptions(false)
|
||||||
{
|
{
|
||||||
EnableImages = false
|
EnableImages = false
|
||||||
})
|
})
|
||||||
|
@ -1100,9 +1140,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
return new List<BaseItem>();
|
return new List<BaseItem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
var byName = item as IItemByName;
|
if (item is IItemByName byName)
|
||||||
|
|
||||||
if (byName != null)
|
|
||||||
{
|
{
|
||||||
return byName.GetTaggedItems(new InternalItemsQuery(user)
|
return byName.GetTaggedItems(new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
|
@ -1152,7 +1190,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
_logger.LogError("A non-existant item Id {0} was passed into TranslateItemForInstantMix", id);
|
_logger.LogError("A non-existent item Id {0} was passed into TranslateItemForInstantMix", id);
|
||||||
return new List<BaseItem>();
|
return new List<BaseItem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1163,13 +1201,15 @@ namespace Emby.Server.Implementations.Session
|
||||||
{
|
{
|
||||||
var generalCommand = new GeneralCommand
|
var generalCommand = new GeneralCommand
|
||||||
{
|
{
|
||||||
Name = GeneralCommandType.DisplayContent.ToString()
|
Name = GeneralCommandType.DisplayContent.ToString(),
|
||||||
|
Arguments =
|
||||||
|
{
|
||||||
|
["ItemId"] = command.ItemId,
|
||||||
|
["ItemName"] = command.ItemName,
|
||||||
|
["ItemType"] = command.ItemType
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
generalCommand.Arguments["ItemId"] = command.ItemId;
|
|
||||||
generalCommand.Arguments["ItemName"] = command.ItemName;
|
|
||||||
generalCommand.Arguments["ItemType"] = command.ItemType;
|
|
||||||
|
|
||||||
return SendGeneralCommand(controllingSessionId, sessionId, generalCommand, cancellationToken);
|
return SendGeneralCommand(controllingSessionId, sessionId, generalCommand, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1410,7 +1450,8 @@ namespace Emby.Server.Implementations.Session
|
||||||
|
|
||||||
var token = GetAuthorizationToken(user, request.DeviceId, request.App, request.AppVersion, request.DeviceName);
|
var token = GetAuthorizationToken(user, request.DeviceId, request.App, request.AppVersion, request.DeviceName);
|
||||||
|
|
||||||
var session = LogSessionActivity(request.App,
|
var session = LogSessionActivity(
|
||||||
|
request.App,
|
||||||
request.AppVersion,
|
request.AppVersion,
|
||||||
request.DeviceId,
|
request.DeviceId,
|
||||||
request.DeviceName,
|
request.DeviceName,
|
||||||
|
@ -1454,9 +1495,9 @@ namespace Emby.Server.Implementations.Session
|
||||||
{
|
{
|
||||||
Logout(auth);
|
Logout(auth);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
_logger.LogError(ex, "Error while logging out.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1572,7 +1613,8 @@ namespace Emby.Server.Implementations.Session
|
||||||
ReportCapabilities(session, capabilities, true);
|
ReportCapabilities(session, capabilities, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ReportCapabilities(SessionInfo session,
|
private void ReportCapabilities(
|
||||||
|
SessionInfo session,
|
||||||
ClientCapabilities capabilities,
|
ClientCapabilities capabilities,
|
||||||
bool saveCapabilities)
|
bool saveCapabilities)
|
||||||
{
|
{
|
||||||
|
@ -1580,7 +1622,9 @@ namespace Emby.Server.Implementations.Session
|
||||||
|
|
||||||
if (saveCapabilities)
|
if (saveCapabilities)
|
||||||
{
|
{
|
||||||
CapabilitiesChanged?.Invoke(this, new SessionEventArgs
|
CapabilitiesChanged?.Invoke(
|
||||||
|
this,
|
||||||
|
new SessionEventArgs
|
||||||
{
|
{
|
||||||
SessionInfo = session
|
SessionInfo = session
|
||||||
});
|
});
|
||||||
|
|
|
@ -63,6 +63,28 @@ public sealed class HttpPostedFile : IDisposable
|
||||||
_position = offset;
|
_position = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool CanRead => true;
|
||||||
|
|
||||||
|
public override bool CanSeek => true;
|
||||||
|
|
||||||
|
public override bool CanWrite => false;
|
||||||
|
|
||||||
|
public override long Length => _end - _offset;
|
||||||
|
|
||||||
|
public override long Position
|
||||||
|
{
|
||||||
|
get => _position - _offset;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value > Length)
|
||||||
|
{
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
_position = Seek(value, SeekOrigin.Begin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void Flush()
|
public override void Flush()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -178,27 +200,5 @@ public sealed class HttpPostedFile : IDisposable
|
||||||
{
|
{
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CanRead => true;
|
|
||||||
|
|
||||||
public override bool CanSeek => true;
|
|
||||||
|
|
||||||
public override bool CanWrite => false;
|
|
||||||
|
|
||||||
public override long Length => _end - _offset;
|
|
||||||
|
|
||||||
public override long Position
|
|
||||||
{
|
|
||||||
get => _position - _offset;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value > Length)
|
|
||||||
{
|
|
||||||
throw new ArgumentOutOfRangeException(nameof(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
_position = Seek(value, SeekOrigin.Begin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
{
|
{
|
||||||
var audio = x as IHasAlbumArtist;
|
var audio = x as IHasAlbumArtist;
|
||||||
|
|
||||||
return audio != null ? audio.AlbumArtists.FirstOrDefault() : null;
|
return audio?.AlbumArtists.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -18,17 +18,17 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
return string.Compare(GetValue(x), GetValue(y), StringComparison.CurrentCultureIgnoreCase);
|
return string.Compare(GetValue(x), GetValue(y), StringComparison.CurrentCultureIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetValue(BaseItem item)
|
|
||||||
{
|
|
||||||
var hasSeries = item as IHasSeries;
|
|
||||||
|
|
||||||
return hasSeries != null ? hasSeries.FindSeriesSortName() : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.SeriesSortName;
|
public string Name => ItemSortBy.SeriesSortName;
|
||||||
|
|
||||||
|
private static string GetValue(BaseItem item)
|
||||||
|
{
|
||||||
|
var hasSeries = item as IHasSeries;
|
||||||
|
|
||||||
|
return hasSeries?.FindSeriesSortName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
using System.Xml;
|
|
||||||
using MediaBrowser.Model.Xml;
|
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Xml
|
|
||||||
{
|
|
||||||
public class XmlReaderSettingsFactory : IXmlReaderSettingsFactory
|
|
||||||
{
|
|
||||||
public XmlReaderSettings Create(bool enableValidation)
|
|
||||||
{
|
|
||||||
var settings = new XmlReaderSettings();
|
|
||||||
|
|
||||||
if (!enableValidation)
|
|
||||||
{
|
|
||||||
settings.ValidationType = ValidationType.None;
|
|
||||||
}
|
|
||||||
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -9,8 +9,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Jellyfin Project")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
[assembly: AssemblyProduct("Jellyfin Server")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
|
@ -9,8 +9,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Jellyfin Project")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
[assembly: AssemblyProduct("Jellyfin Server")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
|
@ -77,21 +77,18 @@ namespace Jellyfin.Drawing.Skia
|
||||||
{
|
{
|
||||||
canvas.Clear(SKColors.Black);
|
canvas.Clear(SKColors.Black);
|
||||||
|
|
||||||
|
// number of images used in the thumbnail
|
||||||
|
var iCount = 3;
|
||||||
|
|
||||||
// determine sizes for each image that will composited into the final image
|
// determine sizes for each image that will composited into the final image
|
||||||
var iSlice = Convert.ToInt32(width * 0.23475);
|
var iSlice = Convert.ToInt32(width / iCount);
|
||||||
int iTrans = Convert.ToInt32(height * .25);
|
int iHeight = Convert.ToInt32(height * 1.00);
|
||||||
int iHeight = Convert.ToInt32(height * .70);
|
|
||||||
var horizontalImagePadding = Convert.ToInt32(width * 0.0125);
|
|
||||||
var verticalSpacing = Convert.ToInt32(height * 0.01111111111111111111111111111111);
|
|
||||||
int imageIndex = 0;
|
int imageIndex = 0;
|
||||||
|
for (int i = 0; i < iCount; i++)
|
||||||
for (int i = 0; i < 4; i++)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
using (var currentBitmap = GetNextValidImage(paths, imageIndex, out int newIndex))
|
using (var currentBitmap = GetNextValidImage(paths, imageIndex, out int newIndex))
|
||||||
{
|
{
|
||||||
imageIndex = newIndex;
|
imageIndex = newIndex;
|
||||||
|
|
||||||
if (currentBitmap == null)
|
if (currentBitmap == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -108,44 +105,7 @@ namespace Jellyfin.Drawing.Skia
|
||||||
using (var subset = image.Subset(SKRectI.Create(ix, 0, iSlice, iHeight)))
|
using (var subset = image.Subset(SKRectI.Create(ix, 0, iSlice, iHeight)))
|
||||||
{
|
{
|
||||||
// draw image onto canvas
|
// draw image onto canvas
|
||||||
canvas.DrawImage(subset ?? image, (horizontalImagePadding * (i + 1)) + (iSlice * i), verticalSpacing);
|
canvas.DrawImage(subset ?? image, iSlice * i, 0);
|
||||||
|
|
||||||
if (subset == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// create reflection of image below the drawn image
|
|
||||||
using (var croppedBitmap = SKBitmap.FromImage(subset))
|
|
||||||
using (var reflectionBitmap = new SKBitmap(croppedBitmap.Width, croppedBitmap.Height / 2, croppedBitmap.ColorType, croppedBitmap.AlphaType))
|
|
||||||
{
|
|
||||||
// resize to half height
|
|
||||||
currentBitmap.ScalePixels(reflectionBitmap, SKFilterQuality.High);
|
|
||||||
|
|
||||||
using (var flippedBitmap = new SKBitmap(reflectionBitmap.Width, reflectionBitmap.Height, reflectionBitmap.ColorType, reflectionBitmap.AlphaType))
|
|
||||||
using (var flippedCanvas = new SKCanvas(flippedBitmap))
|
|
||||||
{
|
|
||||||
// flip image vertically
|
|
||||||
var matrix = SKMatrix.MakeScale(1, -1);
|
|
||||||
matrix.SetScaleTranslate(1, -1, 0, flippedBitmap.Height);
|
|
||||||
flippedCanvas.SetMatrix(matrix);
|
|
||||||
flippedCanvas.DrawBitmap(reflectionBitmap, 0, 0);
|
|
||||||
flippedCanvas.ResetMatrix();
|
|
||||||
|
|
||||||
// create gradient to make image appear as a reflection
|
|
||||||
var remainingHeight = height - (iHeight + (2 * verticalSpacing));
|
|
||||||
flippedCanvas.ClipRect(SKRect.Create(reflectionBitmap.Width, remainingHeight));
|
|
||||||
using (var gradient = new SKPaint())
|
|
||||||
{
|
|
||||||
gradient.IsAntialias = true;
|
|
||||||
gradient.BlendMode = SKBlendMode.SrcOver;
|
|
||||||
gradient.Shader = SKShader.CreateLinearGradient(new SKPoint(0, 0), new SKPoint(0, remainingHeight), new[] { new SKColor(0, 0, 0, 128), new SKColor(0, 0, 0, 208), new SKColor(0, 0, 0, 240), new SKColor(0, 0, 0, 255) }, null, SKShaderTileMode.Clamp);
|
|
||||||
flippedCanvas.DrawPaint(gradient);
|
|
||||||
}
|
|
||||||
|
|
||||||
// finally draw reflection onto canvas
|
|
||||||
canvas.DrawBitmap(flippedBitmap, (horizontalImagePadding * (i + 1)) + (iSlice * i), iHeight + (2 * verticalSpacing));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ using System.Reflection;
|
||||||
using Emby.Server.Implementations;
|
using Emby.Server.Implementations;
|
||||||
using Emby.Server.Implementations.HttpServer;
|
using Emby.Server.Implementations.HttpServer;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.System;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
@ -16,7 +15,6 @@ namespace Jellyfin.Server
|
||||||
ILoggerFactory loggerFactory,
|
ILoggerFactory loggerFactory,
|
||||||
StartupOptions options,
|
StartupOptions options,
|
||||||
IFileSystem fileSystem,
|
IFileSystem fileSystem,
|
||||||
IEnvironmentInfo environmentInfo,
|
|
||||||
MediaBrowser.Controller.Drawing.IImageEncoder imageEncoder,
|
MediaBrowser.Controller.Drawing.IImageEncoder imageEncoder,
|
||||||
MediaBrowser.Common.Net.INetworkManager networkManager,
|
MediaBrowser.Common.Net.INetworkManager networkManager,
|
||||||
IConfiguration configuration)
|
IConfiguration configuration)
|
||||||
|
@ -25,7 +23,6 @@ namespace Jellyfin.Server
|
||||||
loggerFactory,
|
loggerFactory,
|
||||||
options,
|
options,
|
||||||
fileSystem,
|
fileSystem,
|
||||||
environmentInfo,
|
|
||||||
imageEncoder,
|
imageEncoder,
|
||||||
networkManager,
|
networkManager,
|
||||||
configuration)
|
configuration)
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
<!-- We need C# 7.1 for async main-->
|
<!-- We need C# 7.1 for async main-->
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<!-- Disable documentation warnings (for now) -->
|
<!-- Disable documentation warnings (for now) -->
|
||||||
<NoWarn>SA1600;CS1591</NoWarn>
|
<NoWarn>SA1600;SA1601;CS1591</NoWarn>
|
||||||
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -23,10 +24,6 @@
|
||||||
<EmbeddedResource Include="Resources/Configuration/*" />
|
<EmbeddedResource Include="Resources/Configuration/*" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<!-- Code analysers-->
|
<!-- Code analysers-->
|
||||||
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
|
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.3" />
|
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.3" />
|
||||||
|
|
|
@ -12,7 +12,6 @@ using System.Threading.Tasks;
|
||||||
using CommandLine;
|
using CommandLine;
|
||||||
using Emby.Drawing;
|
using Emby.Drawing;
|
||||||
using Emby.Server.Implementations;
|
using Emby.Server.Implementations;
|
||||||
using Emby.Server.Implementations.EnvironmentInfo;
|
|
||||||
using Emby.Server.Implementations.IO;
|
using Emby.Server.Implementations.IO;
|
||||||
using Emby.Server.Implementations.Networking;
|
using Emby.Server.Implementations.Networking;
|
||||||
using Jellyfin.Drawing.Skia;
|
using Jellyfin.Drawing.Skia;
|
||||||
|
@ -46,7 +45,6 @@ namespace Jellyfin.Server
|
||||||
const string pattern = @"^(-[^-\s]{2})"; // Match -xx, not -x, not --xx, not xx
|
const string pattern = @"^(-[^-\s]{2})"; // Match -xx, not -x, not --xx, not xx
|
||||||
const string substitution = @"-$1"; // Prepend with additional single-hyphen
|
const string substitution = @"-$1"; // Prepend with additional single-hyphen
|
||||||
var regex = new Regex(pattern);
|
var regex = new Regex(pattern);
|
||||||
|
|
||||||
for (var i = 0; i < args.Length; i++)
|
for (var i = 0; i < args.Length; i++)
|
||||||
{
|
{
|
||||||
args[i] = regex.Replace(args[i], substitution);
|
args[i] = regex.Replace(args[i], substitution);
|
||||||
|
@ -54,9 +52,7 @@ namespace Jellyfin.Server
|
||||||
|
|
||||||
// Parse the command line arguments and either start the app or exit indicating error
|
// Parse the command line arguments and either start the app or exit indicating error
|
||||||
await Parser.Default.ParseArguments<StartupOptions>(args)
|
await Parser.Default.ParseArguments<StartupOptions>(args)
|
||||||
.MapResult(
|
.MapResult(StartApp, _ => Task.CompletedTask).ConfigureAwait(false);
|
||||||
options => StartApp(options),
|
|
||||||
errs => Task.FromResult(0)).ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Shutdown()
|
public static void Shutdown()
|
||||||
|
@ -119,31 +115,29 @@ namespace Jellyfin.Server
|
||||||
|
|
||||||
_logger.LogInformation("Jellyfin version: {Version}", Assembly.GetEntryAssembly().GetName().Version);
|
_logger.LogInformation("Jellyfin version: {Version}", Assembly.GetEntryAssembly().GetName().Version);
|
||||||
|
|
||||||
EnvironmentInfo environmentInfo = new EnvironmentInfo(GetOperatingSystem());
|
ApplicationHost.LogEnvironmentInfo(_logger, appPaths);
|
||||||
ApplicationHost.LogEnvironmentInfo(_logger, appPaths, environmentInfo);
|
|
||||||
|
|
||||||
SQLitePCL.Batteries_V2.Init();
|
SQLitePCL.Batteries_V2.Init();
|
||||||
|
|
||||||
// Allow all https requests
|
// Allow all https requests
|
||||||
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; });
|
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; });
|
||||||
|
|
||||||
var fileSystem = new ManagedFileSystem(_loggerFactory, environmentInfo, appPaths);
|
var fileSystem = new ManagedFileSystem(_loggerFactory, appPaths);
|
||||||
|
|
||||||
using (var appHost = new CoreAppHost(
|
using (var appHost = new CoreAppHost(
|
||||||
appPaths,
|
appPaths,
|
||||||
_loggerFactory,
|
_loggerFactory,
|
||||||
options,
|
options,
|
||||||
fileSystem,
|
fileSystem,
|
||||||
environmentInfo,
|
|
||||||
new NullImageEncoder(),
|
new NullImageEncoder(),
|
||||||
new NetworkManager(_loggerFactory, environmentInfo),
|
new NetworkManager(_loggerFactory),
|
||||||
appConfig))
|
appConfig))
|
||||||
{
|
{
|
||||||
await appHost.Init(new ServiceCollection()).ConfigureAwait(false);
|
await appHost.InitAsync(new ServiceCollection()).ConfigureAwait(false);
|
||||||
|
|
||||||
appHost.ImageProcessor.ImageEncoder = GetImageEncoder(fileSystem, appPaths, appHost.LocalizationManager);
|
appHost.ImageProcessor.ImageEncoder = GetImageEncoder(fileSystem, appPaths, appHost.LocalizationManager);
|
||||||
|
|
||||||
await appHost.RunStartupTasks().ConfigureAwait(false);
|
await appHost.RunStartupTasksAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -174,15 +168,14 @@ namespace Jellyfin.Server
|
||||||
{
|
{
|
||||||
// dataDir
|
// dataDir
|
||||||
// IF --datadir
|
// IF --datadir
|
||||||
// ELSE IF $JELLYFIN_DATA_PATH
|
// ELSE IF $JELLYFIN_DATA_DIR
|
||||||
// ELSE IF windows, use <%APPDATA%>/jellyfin
|
// ELSE IF windows, use <%APPDATA%>/jellyfin
|
||||||
// ELSE IF $XDG_DATA_HOME then use $XDG_DATA_HOME/jellyfin
|
// ELSE IF $XDG_DATA_HOME then use $XDG_DATA_HOME/jellyfin
|
||||||
// ELSE use $HOME/.local/share/jellyfin
|
// ELSE use $HOME/.local/share/jellyfin
|
||||||
var dataDir = options.DataDir;
|
var dataDir = options.DataDir;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(dataDir))
|
if (string.IsNullOrEmpty(dataDir))
|
||||||
{
|
{
|
||||||
dataDir = Environment.GetEnvironmentVariable("JELLYFIN_DATA_PATH");
|
dataDir = Environment.GetEnvironmentVariable("JELLYFIN_DATA_DIR");
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(dataDir))
|
if (string.IsNullOrEmpty(dataDir))
|
||||||
{
|
{
|
||||||
|
@ -191,8 +184,6 @@ namespace Jellyfin.Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Directory.CreateDirectory(dataDir);
|
|
||||||
|
|
||||||
// configDir
|
// configDir
|
||||||
// IF --configdir
|
// IF --configdir
|
||||||
// ELSE IF $JELLYFIN_CONFIG_DIR
|
// ELSE IF $JELLYFIN_CONFIG_DIR
|
||||||
|
@ -236,7 +227,6 @@ namespace Jellyfin.Server
|
||||||
// ELSE IF XDG_CACHE_HOME, use $XDG_CACHE_HOME/jellyfin
|
// ELSE IF XDG_CACHE_HOME, use $XDG_CACHE_HOME/jellyfin
|
||||||
// ELSE HOME/.cache/jellyfin
|
// ELSE HOME/.cache/jellyfin
|
||||||
var cacheDir = options.CacheDir;
|
var cacheDir = options.CacheDir;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(cacheDir))
|
if (string.IsNullOrEmpty(cacheDir))
|
||||||
{
|
{
|
||||||
cacheDir = Environment.GetEnvironmentVariable("JELLYFIN_CACHE_DIR");
|
cacheDir = Environment.GetEnvironmentVariable("JELLYFIN_CACHE_DIR");
|
||||||
|
@ -264,13 +254,29 @@ namespace Jellyfin.Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// webDir
|
||||||
|
// IF --webdir
|
||||||
|
// ELSE IF $JELLYFIN_WEB_DIR
|
||||||
|
// ELSE use <bindir>/jellyfin-web
|
||||||
|
var webDir = options.WebDir;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(webDir))
|
||||||
|
{
|
||||||
|
webDir = Environment.GetEnvironmentVariable("JELLYFIN_WEB_DIR");
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(webDir))
|
||||||
|
{
|
||||||
|
// Use default location under ResourcesPath
|
||||||
|
webDir = Path.Combine(AppContext.BaseDirectory, "jellyfin-web", "src");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// logDir
|
// logDir
|
||||||
// IF --logdir
|
// IF --logdir
|
||||||
// ELSE IF $JELLYFIN_LOG_DIR
|
// ELSE IF $JELLYFIN_LOG_DIR
|
||||||
// ELSE IF --datadir, use <datadir>/log (assume portable run)
|
// ELSE IF --datadir, use <datadir>/log (assume portable run)
|
||||||
// ELSE <datadir>/log
|
// ELSE <datadir>/log
|
||||||
var logDir = options.LogDir;
|
var logDir = options.LogDir;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(logDir))
|
if (string.IsNullOrEmpty(logDir))
|
||||||
{
|
{
|
||||||
logDir = Environment.GetEnvironmentVariable("JELLYFIN_LOG_DIR");
|
logDir = Environment.GetEnvironmentVariable("JELLYFIN_LOG_DIR");
|
||||||
|
@ -285,6 +291,7 @@ namespace Jellyfin.Server
|
||||||
// Ensure the main folders exist before we continue
|
// Ensure the main folders exist before we continue
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Directory.CreateDirectory(dataDir);
|
||||||
Directory.CreateDirectory(logDir);
|
Directory.CreateDirectory(logDir);
|
||||||
Directory.CreateDirectory(configDir);
|
Directory.CreateDirectory(configDir);
|
||||||
Directory.CreateDirectory(cacheDir);
|
Directory.CreateDirectory(cacheDir);
|
||||||
|
@ -296,7 +303,7 @@ namespace Jellyfin.Server
|
||||||
Environment.Exit(1);
|
Environment.Exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ServerApplicationPaths(dataDir, logDir, configDir, cacheDir);
|
return new ServerApplicationPaths(dataDir, logDir, configDir, cacheDir, webDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<IConfiguration> CreateConfiguration(IApplicationPaths appPaths)
|
private static async Task<IConfiguration> CreateConfiguration(IApplicationPaths appPaths)
|
||||||
|
@ -364,36 +371,6 @@ namespace Jellyfin.Server
|
||||||
return new NullImageEncoder();
|
return new NullImageEncoder();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MediaBrowser.Model.System.OperatingSystem GetOperatingSystem()
|
|
||||||
{
|
|
||||||
switch (Environment.OSVersion.Platform)
|
|
||||||
{
|
|
||||||
case PlatformID.MacOSX:
|
|
||||||
return MediaBrowser.Model.System.OperatingSystem.OSX;
|
|
||||||
case PlatformID.Win32NT:
|
|
||||||
return MediaBrowser.Model.System.OperatingSystem.Windows;
|
|
||||||
case PlatformID.Unix:
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
string osDescription = RuntimeInformation.OSDescription;
|
|
||||||
if (osDescription.Contains("linux", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return MediaBrowser.Model.System.OperatingSystem.Linux;
|
|
||||||
}
|
|
||||||
else if (osDescription.Contains("darwin", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return MediaBrowser.Model.System.OperatingSystem.OSX;
|
|
||||||
}
|
|
||||||
else if (osDescription.Contains("bsd", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return MediaBrowser.Model.System.OperatingSystem.BSD;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Exception($"Can't resolve OS with description: '{osDescription}'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void StartNewInstance(StartupOptions options)
|
private static void StartNewInstance(StartupOptions options)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Starting new instance");
|
_logger.LogInformation("Starting new instance");
|
||||||
|
|
|
@ -9,8 +9,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Jellyfin Project")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
[assembly: AssemblyProduct("Jellyfin Server")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
|
@ -11,6 +11,9 @@ namespace Jellyfin.Server
|
||||||
[Option('d', "datadir", Required = false, HelpText = "Path to use for the data folder (database files, etc.).")]
|
[Option('d', "datadir", Required = false, HelpText = "Path to use for the data folder (database files, etc.).")]
|
||||||
public string DataDir { get; set; }
|
public string DataDir { get; set; }
|
||||||
|
|
||||||
|
[Option('w', "webdir", Required = false, HelpText = "Path to the Jellyfin web UI resources.")]
|
||||||
|
public string WebDir { get; set; }
|
||||||
|
|
||||||
[Option('C', "cachedir", Required = false, HelpText = "Path to use for caching.")]
|
[Option('C', "cachedir", Required = false, HelpText = "Path to use for caching.")]
|
||||||
public string CacheDir { get; set; }
|
public string CacheDir { get; set; }
|
||||||
|
|
||||||
|
@ -23,9 +26,6 @@ namespace Jellyfin.Server
|
||||||
[Option("ffmpeg", Required = false, HelpText = "Path to external FFmpeg executable to use in place of default found in PATH.")]
|
[Option("ffmpeg", Required = false, HelpText = "Path to external FFmpeg executable to use in place of default found in PATH.")]
|
||||||
public string FFmpegPath { get; set; }
|
public string FFmpegPath { get; set; }
|
||||||
|
|
||||||
[Option("ffprobe", Required = false, HelpText = "(deprecated) Option has no effect and shall be removed in next release.")]
|
|
||||||
public string FFprobePath { get; set; }
|
|
||||||
|
|
||||||
[Option("service", Required = false, HelpText = "Run as headless service.")]
|
[Option("service", Required = false, HelpText = "Run as headless service.")]
|
||||||
public bool IsService { get; set; }
|
public bool IsService { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,7 @@ namespace MediaBrowser.Api
|
||||||
{
|
{
|
||||||
options.ImageTypeLimit = hasDtoOptions.ImageTypeLimit.Value;
|
options.ImageTypeLimit = hasDtoOptions.ImageTypeLimit.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasDtoOptions.EnableUserData.HasValue)
|
if (hasDtoOptions.EnableUserData.HasValue)
|
||||||
{
|
{
|
||||||
options.EnableUserData = hasDtoOptions.EnableUserData.Value;
|
options.EnableUserData = hasDtoOptions.EnableUserData.Value;
|
||||||
|
@ -307,7 +308,7 @@ namespace MediaBrowser.Api
|
||||||
return pathInfo[index];
|
return pathInfo[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
private string[] Parse(string pathUri)
|
private static string[] Parse(string pathUri)
|
||||||
{
|
{
|
||||||
var actionParts = pathUri.Split(new[] { "://" }, StringSplitOptions.None);
|
var actionParts = pathUri.Split(new[] { "://" }, StringSplitOptions.None);
|
||||||
|
|
||||||
|
@ -329,38 +330,32 @@ namespace MediaBrowser.Api
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected BaseItem GetItemByName(string name, string type, ILibraryManager libraryManager, DtoOptions dtoOptions)
|
protected BaseItem GetItemByName(string name, string type, ILibraryManager libraryManager, DtoOptions dtoOptions)
|
||||||
{
|
{
|
||||||
BaseItem item;
|
if (type.Equals("Person", StringComparison.OrdinalIgnoreCase))
|
||||||
|
|
||||||
if (type.IndexOf("Person", StringComparison.OrdinalIgnoreCase) == 0)
|
|
||||||
{
|
{
|
||||||
item = GetPerson(name, libraryManager, dtoOptions);
|
return GetPerson(name, libraryManager, dtoOptions);
|
||||||
}
|
}
|
||||||
else if (type.IndexOf("Artist", StringComparison.OrdinalIgnoreCase) == 0)
|
else if (type.Equals("Artist", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
item = GetArtist(name, libraryManager, dtoOptions);
|
return GetArtist(name, libraryManager, dtoOptions);
|
||||||
}
|
}
|
||||||
else if (type.IndexOf("Genre", StringComparison.OrdinalIgnoreCase) == 0)
|
else if (type.Equals("Genre", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
item = GetGenre(name, libraryManager, dtoOptions);
|
return GetGenre(name, libraryManager, dtoOptions);
|
||||||
}
|
}
|
||||||
else if (type.IndexOf("MusicGenre", StringComparison.OrdinalIgnoreCase) == 0)
|
else if (type.Equals("MusicGenre", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
item = GetMusicGenre(name, libraryManager, dtoOptions);
|
return GetMusicGenre(name, libraryManager, dtoOptions);
|
||||||
}
|
}
|
||||||
else if (type.IndexOf("Studio", StringComparison.OrdinalIgnoreCase) == 0)
|
else if (type.Equals("Studio", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
item = GetStudio(name, libraryManager, dtoOptions);
|
return GetStudio(name, libraryManager, dtoOptions);
|
||||||
}
|
}
|
||||||
else if (type.IndexOf("Year", StringComparison.OrdinalIgnoreCase) == 0)
|
else if (type.Equals("Year", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
item = libraryManager.GetYear(int.Parse(name));
|
return libraryManager.GetYear(int.Parse(name));
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new ArgumentException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
throw new ArgumentException("Invalid type", nameof(type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.LiveTv;
|
using MediaBrowser.Model.LiveTv;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
using MediaBrowser.Model.Services;
|
using MediaBrowser.Model.Services;
|
||||||
using MediaBrowser.Model.System;
|
|
||||||
using Microsoft.Net.Http.Headers;
|
using Microsoft.Net.Http.Headers;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.LiveTv
|
namespace MediaBrowser.Api.LiveTv
|
||||||
|
@ -695,29 +694,36 @@ namespace MediaBrowser.Api.LiveTv
|
||||||
private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
private readonly IDtoService _dtoService;
|
private readonly IDtoService _dtoService;
|
||||||
private readonly IFileSystem _fileSystem;
|
|
||||||
private readonly IAuthorizationContext _authContext;
|
private readonly IAuthorizationContext _authContext;
|
||||||
private readonly ISessionContext _sessionContext;
|
private readonly ISessionContext _sessionContext;
|
||||||
private readonly IEnvironmentInfo _environment;
|
private readonly ICryptoProvider _cryptographyProvider;
|
||||||
private ICryptoProvider _cryptographyProvider;
|
private readonly IStreamHelper _streamHelper;
|
||||||
private IStreamHelper _streamHelper;
|
private readonly IMediaSourceManager _mediaSourceManager;
|
||||||
private IMediaSourceManager _mediaSourceManager;
|
|
||||||
|
|
||||||
public LiveTvService(ICryptoProvider crypto, IMediaSourceManager mediaSourceManager, IStreamHelper streamHelper, ILiveTvManager liveTvManager, IUserManager userManager, IServerConfigurationManager config, IHttpClient httpClient, ILibraryManager libraryManager, IDtoService dtoService, IFileSystem fileSystem, IAuthorizationContext authContext, ISessionContext sessionContext, IEnvironmentInfo environment)
|
public LiveTvService(
|
||||||
|
ICryptoProvider crypto,
|
||||||
|
IMediaSourceManager mediaSourceManager,
|
||||||
|
IStreamHelper streamHelper,
|
||||||
|
ILiveTvManager liveTvManager,
|
||||||
|
IUserManager userManager,
|
||||||
|
IServerConfigurationManager config,
|
||||||
|
IHttpClient httpClient,
|
||||||
|
ILibraryManager libraryManager,
|
||||||
|
IDtoService dtoService,
|
||||||
|
IAuthorizationContext authContext,
|
||||||
|
ISessionContext sessionContext)
|
||||||
{
|
{
|
||||||
|
_cryptographyProvider = crypto;
|
||||||
|
_mediaSourceManager = mediaSourceManager;
|
||||||
|
_streamHelper = streamHelper;
|
||||||
_liveTvManager = liveTvManager;
|
_liveTvManager = liveTvManager;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_config = config;
|
_config = config;
|
||||||
_httpClient = httpClient;
|
_httpClient = httpClient;
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
_dtoService = dtoService;
|
_dtoService = dtoService;
|
||||||
_fileSystem = fileSystem;
|
|
||||||
_authContext = authContext;
|
_authContext = authContext;
|
||||||
_sessionContext = sessionContext;
|
_sessionContext = sessionContext;
|
||||||
_environment = environment;
|
|
||||||
_cryptographyProvider = crypto;
|
|
||||||
_streamHelper = streamHelper;
|
|
||||||
_mediaSourceManager = mediaSourceManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Get(GetTunerHostTypes request)
|
public object Get(GetTunerHostTypes request)
|
||||||
|
@ -731,7 +737,7 @@ namespace MediaBrowser.Api.LiveTv
|
||||||
var user = request.UserId.Equals(Guid.Empty) ? null : _userManager.GetUserById(request.UserId);
|
var user = request.UserId.Equals(Guid.Empty) ? null : _userManager.GetUserById(request.UserId);
|
||||||
var folders = _liveTvManager.GetRecordingFolders(user);
|
var folders = _liveTvManager.GetRecordingFolders(user);
|
||||||
|
|
||||||
var returnArray = _dtoService.GetBaseItemDtos(folders.ToArray(), new DtoOptions(), user);
|
var returnArray = _dtoService.GetBaseItemDtos(folders, new DtoOptions(), user);
|
||||||
|
|
||||||
var result = new QueryResult<BaseItemDto>
|
var result = new QueryResult<BaseItemDto>
|
||||||
{
|
{
|
||||||
|
@ -756,7 +762,7 @@ namespace MediaBrowser.Api.LiveTv
|
||||||
[HeaderNames.ContentType] = Model.Net.MimeTypes.GetMimeType(path)
|
[HeaderNames.ContentType] = Model.Net.MimeTypes.GetMimeType(path)
|
||||||
};
|
};
|
||||||
|
|
||||||
return new ProgressiveFileCopier(_fileSystem, _streamHelper, path, outputHeaders, Logger, _environment)
|
return new ProgressiveFileCopier(_streamHelper, path, outputHeaders, Logger)
|
||||||
{
|
{
|
||||||
AllowEndOfFile = false
|
AllowEndOfFile = false
|
||||||
};
|
};
|
||||||
|
@ -779,7 +785,7 @@ namespace MediaBrowser.Api.LiveTv
|
||||||
[HeaderNames.ContentType] = Model.Net.MimeTypes.GetMimeType("file." + request.Container)
|
[HeaderNames.ContentType] = Model.Net.MimeTypes.GetMimeType("file." + request.Container)
|
||||||
};
|
};
|
||||||
|
|
||||||
return new ProgressiveFileCopier(directStreamProvider, _streamHelper, outputHeaders, Logger, _environment)
|
return new ProgressiveFileCopier(directStreamProvider, _streamHelper, outputHeaders, Logger)
|
||||||
{
|
{
|
||||||
AllowEndOfFile = false
|
AllowEndOfFile = false
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
@ -5,60 +6,39 @@ using System.Threading.Tasks;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Services;
|
using MediaBrowser.Model.Services;
|
||||||
using MediaBrowser.Model.System;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.LiveTv
|
namespace MediaBrowser.Api.LiveTv
|
||||||
{
|
{
|
||||||
public class ProgressiveFileCopier : IAsyncStreamWriter, IHasHeaders
|
public class ProgressiveFileCopier : IAsyncStreamWriter, IHasHeaders
|
||||||
{
|
{
|
||||||
private readonly IFileSystem _fileSystem;
|
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly string _path;
|
private readonly string _path;
|
||||||
private readonly Dictionary<string, string> _outputHeaders;
|
private readonly Dictionary<string, string> _outputHeaders;
|
||||||
|
|
||||||
const int StreamCopyToBufferSize = 81920;
|
|
||||||
|
|
||||||
public long StartPosition { get; set; }
|
|
||||||
public bool AllowEndOfFile = true;
|
public bool AllowEndOfFile = true;
|
||||||
|
|
||||||
private readonly IDirectStreamProvider _directStreamProvider;
|
private readonly IDirectStreamProvider _directStreamProvider;
|
||||||
private readonly IEnvironmentInfo _environment;
|
|
||||||
private IStreamHelper _streamHelper;
|
private IStreamHelper _streamHelper;
|
||||||
|
|
||||||
public ProgressiveFileCopier(IFileSystem fileSystem, IStreamHelper streamHelper, string path, Dictionary<string, string> outputHeaders, ILogger logger, IEnvironmentInfo environment)
|
public ProgressiveFileCopier(IStreamHelper streamHelper, string path, Dictionary<string, string> outputHeaders, ILogger logger)
|
||||||
{
|
{
|
||||||
_fileSystem = fileSystem;
|
|
||||||
_path = path;
|
_path = path;
|
||||||
_outputHeaders = outputHeaders;
|
_outputHeaders = outputHeaders;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_environment = environment;
|
|
||||||
_streamHelper = streamHelper;
|
_streamHelper = streamHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProgressiveFileCopier(IDirectStreamProvider directStreamProvider, IStreamHelper streamHelper, Dictionary<string, string> outputHeaders, ILogger logger, IEnvironmentInfo environment)
|
public ProgressiveFileCopier(IDirectStreamProvider directStreamProvider, IStreamHelper streamHelper, Dictionary<string, string> outputHeaders, ILogger logger)
|
||||||
{
|
{
|
||||||
_directStreamProvider = directStreamProvider;
|
_directStreamProvider = directStreamProvider;
|
||||||
_outputHeaders = outputHeaders;
|
_outputHeaders = outputHeaders;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_environment = environment;
|
|
||||||
_streamHelper = streamHelper;
|
_streamHelper = streamHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDictionary<string, string> Headers => _outputHeaders;
|
public IDictionary<string, string> Headers => _outputHeaders;
|
||||||
|
|
||||||
private Stream GetInputStream(bool allowAsyncFileRead)
|
|
||||||
{
|
|
||||||
var fileOpenOptions = FileOpenOptions.SequentialScan;
|
|
||||||
|
|
||||||
if (allowAsyncFileRead)
|
|
||||||
{
|
|
||||||
fileOpenOptions |= FileOpenOptions.Asynchronous;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _fileSystem.GetFileStream(_path, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite, fileOpenOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task WriteToAsync(Stream outputStream, CancellationToken cancellationToken)
|
public async Task WriteToAsync(Stream outputStream, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (_directStreamProvider != null)
|
if (_directStreamProvider != null)
|
||||||
|
@ -67,28 +47,23 @@ namespace MediaBrowser.Api.LiveTv
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var eofCount = 0;
|
var fileOptions = FileOptions.SequentialScan;
|
||||||
|
|
||||||
// use non-async filestream along with read due to https://github.com/dotnet/corefx/issues/6039
|
// use non-async filestream along with read due to https://github.com/dotnet/corefx/issues/6039
|
||||||
var allowAsyncFileRead = true;
|
if (Environment.OSVersion.Platform != PlatformID.Win32NT)
|
||||||
|
|
||||||
using (var inputStream = GetInputStream(allowAsyncFileRead))
|
|
||||||
{
|
{
|
||||||
if (StartPosition > 0)
|
fileOptions |= FileOptions.Asynchronous;
|
||||||
{
|
|
||||||
inputStream.Position = StartPosition;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using (var inputStream = new FileStream(_path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, 4096, fileOptions))
|
||||||
|
{
|
||||||
var emptyReadLimit = AllowEndOfFile ? 20 : 100;
|
var emptyReadLimit = AllowEndOfFile ? 20 : 100;
|
||||||
|
var eofCount = 0;
|
||||||
while (eofCount < emptyReadLimit)
|
while (eofCount < emptyReadLimit)
|
||||||
{
|
{
|
||||||
int bytesRead;
|
int bytesRead;
|
||||||
bytesRead = await _streamHelper.CopyToAsync(inputStream, outputStream, cancellationToken).ConfigureAwait(false);
|
bytesRead = await _streamHelper.CopyToAsync(inputStream, outputStream, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
//var position = fs.Position;
|
|
||||||
//_logger.LogDebug("Streamed {0} bytes to position {1} from file {2}", bytesRead, position, path);
|
|
||||||
|
|
||||||
if (bytesRead == 0)
|
if (bytesRead == 0)
|
||||||
{
|
{
|
||||||
eofCount++;
|
eofCount++;
|
||||||
|
|
|
@ -3,7 +3,6 @@ using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Devices;
|
using MediaBrowser.Controller.Devices;
|
||||||
using MediaBrowser.Controller.Dlna;
|
using MediaBrowser.Controller.Dlna;
|
||||||
using MediaBrowser.Controller.Drawing;
|
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.MediaEncoding;
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
|
@ -11,7 +10,6 @@ using MediaBrowser.Model.Configuration;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using MediaBrowser.Model.Services;
|
using MediaBrowser.Model.Services;
|
||||||
using MediaBrowser.Model.System;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Playback.Progressive
|
namespace MediaBrowser.Api.Playback.Progressive
|
||||||
{
|
{
|
||||||
|
@ -46,8 +44,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||||
IDeviceManager deviceManager,
|
IDeviceManager deviceManager,
|
||||||
IMediaSourceManager mediaSourceManager,
|
IMediaSourceManager mediaSourceManager,
|
||||||
IJsonSerializer jsonSerializer,
|
IJsonSerializer jsonSerializer,
|
||||||
IAuthorizationContext authorizationContext,
|
IAuthorizationContext authorizationContext)
|
||||||
IEnvironmentInfo environmentInfo)
|
|
||||||
: base(httpClient,
|
: base(httpClient,
|
||||||
serverConfig,
|
serverConfig,
|
||||||
userManager,
|
userManager,
|
||||||
|
@ -60,8 +57,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||||
deviceManager,
|
deviceManager,
|
||||||
mediaSourceManager,
|
mediaSourceManager,
|
||||||
jsonSerializer,
|
jsonSerializer,
|
||||||
authorizationContext,
|
authorizationContext)
|
||||||
environmentInfo)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -8,15 +7,12 @@ using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Devices;
|
using MediaBrowser.Controller.Devices;
|
||||||
using MediaBrowser.Controller.Dlna;
|
using MediaBrowser.Controller.Dlna;
|
||||||
using MediaBrowser.Controller.Drawing;
|
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.MediaEncoding;
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using MediaBrowser.Model.Services;
|
|
||||||
using MediaBrowser.Model.System;
|
|
||||||
using Microsoft.Net.Http.Headers;
|
using Microsoft.Net.Http.Headers;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Playback.Progressive
|
namespace MediaBrowser.Api.Playback.Progressive
|
||||||
|
@ -26,7 +22,6 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class BaseProgressiveStreamingService : BaseStreamingService
|
public abstract class BaseProgressiveStreamingService : BaseStreamingService
|
||||||
{
|
{
|
||||||
protected readonly IEnvironmentInfo EnvironmentInfo;
|
|
||||||
protected IHttpClient HttpClient { get; private set; }
|
protected IHttpClient HttpClient { get; private set; }
|
||||||
|
|
||||||
public BaseProgressiveStreamingService(
|
public BaseProgressiveStreamingService(
|
||||||
|
@ -42,8 +37,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||||
IDeviceManager deviceManager,
|
IDeviceManager deviceManager,
|
||||||
IMediaSourceManager mediaSourceManager,
|
IMediaSourceManager mediaSourceManager,
|
||||||
IJsonSerializer jsonSerializer,
|
IJsonSerializer jsonSerializer,
|
||||||
IAuthorizationContext authorizationContext,
|
IAuthorizationContext authorizationContext)
|
||||||
IEnvironmentInfo environmentInfo)
|
|
||||||
: base(serverConfig,
|
: base(serverConfig,
|
||||||
userManager,
|
userManager,
|
||||||
libraryManager,
|
libraryManager,
|
||||||
|
@ -57,7 +51,6 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||||
jsonSerializer,
|
jsonSerializer,
|
||||||
authorizationContext)
|
authorizationContext)
|
||||||
{
|
{
|
||||||
EnvironmentInfo = environmentInfo;
|
|
||||||
HttpClient = httpClient;
|
HttpClient = httpClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +150,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||||
// TODO: Don't hardcode this
|
// TODO: Don't hardcode this
|
||||||
outputHeaders[HeaderNames.ContentType] = Model.Net.MimeTypes.GetMimeType("file.ts");
|
outputHeaders[HeaderNames.ContentType] = Model.Net.MimeTypes.GetMimeType("file.ts");
|
||||||
|
|
||||||
return new ProgressiveFileCopier(state.DirectStreamProvider, outputHeaders, null, Logger, EnvironmentInfo, CancellationToken.None)
|
return new ProgressiveFileCopier(state.DirectStreamProvider, outputHeaders, null, Logger, CancellationToken.None)
|
||||||
{
|
{
|
||||||
AllowEndOfFile = false
|
AllowEndOfFile = false
|
||||||
};
|
};
|
||||||
|
@ -203,7 +196,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return new ProgressiveFileCopier(FileSystem, state.MediaPath, outputHeaders, null, Logger, EnvironmentInfo, CancellationToken.None)
|
return new ProgressiveFileCopier(FileSystem, state.MediaPath, outputHeaders, null, Logger, CancellationToken.None)
|
||||||
{
|
{
|
||||||
AllowEndOfFile = false
|
AllowEndOfFile = false
|
||||||
};
|
};
|
||||||
|
@ -397,7 +390,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||||
outputHeaders[item.Key] = item.Value;
|
outputHeaders[item.Key] = item.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ProgressiveFileCopier(FileSystem, outputPath, outputHeaders, job, Logger, EnvironmentInfo, CancellationToken.None);
|
return new ProgressiveFileCopier(FileSystem, outputPath, outputHeaders, job, Logger, CancellationToken.None);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,7 @@ using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Services;
|
using MediaBrowser.Model.Services;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using OperatingSystem = MediaBrowser.Common.System.OperatingSystem;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Playback.Progressive
|
namespace MediaBrowser.Api.Playback.Progressive
|
||||||
{
|
{
|
||||||
|
@ -27,9 +28,8 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||||
public bool AllowEndOfFile = true;
|
public bool AllowEndOfFile = true;
|
||||||
|
|
||||||
private readonly IDirectStreamProvider _directStreamProvider;
|
private readonly IDirectStreamProvider _directStreamProvider;
|
||||||
private readonly IEnvironmentInfo _environment;
|
|
||||||
|
|
||||||
public ProgressiveFileCopier(IFileSystem fileSystem, string path, Dictionary<string, string> outputHeaders, TranscodingJob job, ILogger logger, IEnvironmentInfo environment, CancellationToken cancellationToken)
|
public ProgressiveFileCopier(IFileSystem fileSystem, string path, Dictionary<string, string> outputHeaders, TranscodingJob job, ILogger logger, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_path = path;
|
_path = path;
|
||||||
|
@ -37,17 +37,15 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||||
_job = job;
|
_job = job;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_cancellationToken = cancellationToken;
|
_cancellationToken = cancellationToken;
|
||||||
_environment = environment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProgressiveFileCopier(IDirectStreamProvider directStreamProvider, Dictionary<string, string> outputHeaders, TranscodingJob job, ILogger logger, IEnvironmentInfo environment, CancellationToken cancellationToken)
|
public ProgressiveFileCopier(IDirectStreamProvider directStreamProvider, Dictionary<string, string> outputHeaders, TranscodingJob job, ILogger logger, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
_directStreamProvider = directStreamProvider;
|
_directStreamProvider = directStreamProvider;
|
||||||
_outputHeaders = outputHeaders;
|
_outputHeaders = outputHeaders;
|
||||||
_job = job;
|
_job = job;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_cancellationToken = cancellationToken;
|
_cancellationToken = cancellationToken;
|
||||||
_environment = environment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDictionary<string, string> Headers => _outputHeaders;
|
public IDictionary<string, string> Headers => _outputHeaders;
|
||||||
|
@ -79,7 +77,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||||
var eofCount = 0;
|
var eofCount = 0;
|
||||||
|
|
||||||
// use non-async filestream along with read due to https://github.com/dotnet/corefx/issues/6039
|
// use non-async filestream along with read due to https://github.com/dotnet/corefx/issues/6039
|
||||||
var allowAsyncFileRead = _environment.OperatingSystem != Model.System.OperatingSystem.Windows;
|
var allowAsyncFileRead = OperatingSystem.Id != OperatingSystemId.Windows;
|
||||||
|
|
||||||
using (var inputStream = GetInputStream(allowAsyncFileRead))
|
using (var inputStream = GetInputStream(allowAsyncFileRead))
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,6 @@ using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Devices;
|
using MediaBrowser.Controller.Devices;
|
||||||
using MediaBrowser.Controller.Dlna;
|
using MediaBrowser.Controller.Dlna;
|
||||||
using MediaBrowser.Controller.Drawing;
|
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.MediaEncoding;
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
|
@ -11,7 +10,6 @@ using MediaBrowser.Model.Configuration;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using MediaBrowser.Model.Services;
|
using MediaBrowser.Model.Services;
|
||||||
using MediaBrowser.Model.System;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Playback.Progressive
|
namespace MediaBrowser.Api.Playback.Progressive
|
||||||
{
|
{
|
||||||
|
@ -83,8 +81,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||||
IDeviceManager deviceManager,
|
IDeviceManager deviceManager,
|
||||||
IMediaSourceManager mediaSourceManager,
|
IMediaSourceManager mediaSourceManager,
|
||||||
IJsonSerializer jsonSerializer,
|
IJsonSerializer jsonSerializer,
|
||||||
IAuthorizationContext authorizationContext,
|
IAuthorizationContext authorizationContext)
|
||||||
IEnvironmentInfo environmentInfo)
|
|
||||||
: base(httpClient,
|
: base(httpClient,
|
||||||
serverConfig,
|
serverConfig,
|
||||||
userManager,
|
userManager,
|
||||||
|
@ -97,8 +94,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||||
deviceManager,
|
deviceManager,
|
||||||
mediaSourceManager,
|
mediaSourceManager,
|
||||||
jsonSerializer,
|
jsonSerializer,
|
||||||
authorizationContext,
|
authorizationContext)
|
||||||
environmentInfo)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using MediaBrowser.Model.Services;
|
using MediaBrowser.Model.Services;
|
||||||
using MediaBrowser.Model.System;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Playback
|
namespace MediaBrowser.Api.Playback
|
||||||
|
@ -93,7 +92,6 @@ namespace MediaBrowser.Api.Playback
|
||||||
IAuthorizationContext authorizationContext,
|
IAuthorizationContext authorizationContext,
|
||||||
IImageProcessor imageProcessor,
|
IImageProcessor imageProcessor,
|
||||||
INetworkManager networkManager,
|
INetworkManager networkManager,
|
||||||
IEnvironmentInfo environmentInfo,
|
|
||||||
ILoggerFactory loggerFactory)
|
ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
HttpClient = httpClient;
|
HttpClient = httpClient;
|
||||||
|
@ -112,7 +110,6 @@ namespace MediaBrowser.Api.Playback
|
||||||
AuthorizationContext = authorizationContext;
|
AuthorizationContext = authorizationContext;
|
||||||
ImageProcessor = imageProcessor;
|
ImageProcessor = imageProcessor;
|
||||||
NetworkManager = networkManager;
|
NetworkManager = networkManager;
|
||||||
EnvironmentInfo = environmentInfo;
|
|
||||||
_loggerFactory = loggerFactory;
|
_loggerFactory = loggerFactory;
|
||||||
_logger = loggerFactory.CreateLogger(nameof(UniversalAudioService));
|
_logger = loggerFactory.CreateLogger(nameof(UniversalAudioService));
|
||||||
}
|
}
|
||||||
|
@ -133,7 +130,6 @@ namespace MediaBrowser.Api.Playback
|
||||||
protected IAuthorizationContext AuthorizationContext { get; private set; }
|
protected IAuthorizationContext AuthorizationContext { get; private set; }
|
||||||
protected IImageProcessor ImageProcessor { get; private set; }
|
protected IImageProcessor ImageProcessor { get; private set; }
|
||||||
protected INetworkManager NetworkManager { get; private set; }
|
protected INetworkManager NetworkManager { get; private set; }
|
||||||
protected IEnvironmentInfo EnvironmentInfo { get; private set; }
|
|
||||||
private ILoggerFactory _loggerFactory;
|
private ILoggerFactory _loggerFactory;
|
||||||
private ILogger _logger;
|
private ILogger _logger;
|
||||||
|
|
||||||
|
@ -338,8 +334,7 @@ namespace MediaBrowser.Api.Playback
|
||||||
DeviceManager,
|
DeviceManager,
|
||||||
MediaSourceManager,
|
MediaSourceManager,
|
||||||
JsonSerializer,
|
JsonSerializer,
|
||||||
AuthorizationContext,
|
AuthorizationContext)
|
||||||
EnvironmentInfo)
|
|
||||||
{
|
{
|
||||||
Request = Request
|
Request = Request
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,8 +9,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Jellyfin Project")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
[assembly: AssemblyProduct("Jellyfin Server")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
|
@ -87,11 +87,6 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// <returns>System.Object.</returns>
|
/// <returns>System.Object.</returns>
|
||||||
public object Get(GetArtists request)
|
public object Get(GetArtists request)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(request.IncludeItemTypes))
|
|
||||||
{
|
|
||||||
//request.IncludeItemTypes = "Audio,MusicVideo";
|
|
||||||
}
|
|
||||||
|
|
||||||
return GetResultSlim(request);
|
return GetResultSlim(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,11 +97,6 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// <returns>System.Object.</returns>
|
/// <returns>System.Object.</returns>
|
||||||
public object Get(GetAlbumArtists request)
|
public object Get(GetAlbumArtists request)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(request.IncludeItemTypes))
|
|
||||||
{
|
|
||||||
//request.IncludeItemTypes = "Audio,MusicVideo";
|
|
||||||
}
|
|
||||||
|
|
||||||
var result = GetResultSlim(request);
|
var result = GetResultSlim(request);
|
||||||
|
|
||||||
return ToOptimizedResult(result);
|
return ToOptimizedResult(result);
|
||||||
|
|
|
@ -11,6 +11,12 @@ namespace MediaBrowser.Common.Configuration
|
||||||
/// <value>The program data path.</value>
|
/// <value>The program data path.</value>
|
||||||
string ProgramDataPath { get; }
|
string ProgramDataPath { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the path to the web UI resources folder
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The web UI resources path.</value>
|
||||||
|
string WebPath { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path to the program system folder
|
/// Gets the path to the program system folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Common.Plugins;
|
using MediaBrowser.Common.Plugins;
|
||||||
using MediaBrowser.Model.Events;
|
using MediaBrowser.Model.Events;
|
||||||
|
@ -72,6 +71,12 @@ namespace MediaBrowser.Common
|
||||||
/// <value>The application user agent.</value>
|
/// <value>The application user agent.</value>
|
||||||
string ApplicationUserAgent { get; }
|
string ApplicationUserAgent { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the email address for use within a comment section of a user agent field.
|
||||||
|
/// Presently used to provide contact information to MusicBrainz service.
|
||||||
|
/// </summary>
|
||||||
|
string ApplicationUserAgentAddress { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the exports.
|
/// Gets the exports.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -107,7 +112,7 @@ namespace MediaBrowser.Common
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Inits this instance.
|
/// Inits this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task Init(IServiceCollection serviceCollection);
|
Task InitAsync(IServiceCollection serviceCollection);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the instance.
|
/// Creates the instance.
|
||||||
|
|
|
@ -9,8 +9,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Jellyfin Project")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
[assembly: AssemblyProduct("Jellyfin Server")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using MediaBrowser.Common.Configuration;
|
||||||
|
using MediaBrowser.Model.Providers;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Common.Providers
|
||||||
|
{
|
||||||
|
public class SubtitleConfigurationFactory : IConfigurationFactory
|
||||||
|
{
|
||||||
|
public IEnumerable<ConfigurationStore> GetConfigurations()
|
||||||
|
{
|
||||||
|
yield return new ConfigurationStore()
|
||||||
|
{
|
||||||
|
Key = "subtitles",
|
||||||
|
ConfigurationType = typeof(SubtitleOptions)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
72
MediaBrowser.Common/System/OperatingSystem.cs
Normal file
72
MediaBrowser.Common/System/OperatingSystem.cs
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Threading;
|
||||||
|
using MediaBrowser.Model.System;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Common.System
|
||||||
|
{
|
||||||
|
public static class OperatingSystem
|
||||||
|
{
|
||||||
|
// We can't use Interlocked.CompareExchange for enums
|
||||||
|
private static int _id = int.MaxValue;
|
||||||
|
|
||||||
|
public static OperatingSystemId Id
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_id == int.MaxValue)
|
||||||
|
{
|
||||||
|
Interlocked.CompareExchange(ref _id, (int)GetId(), int.MaxValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (OperatingSystemId)_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
switch (Id)
|
||||||
|
{
|
||||||
|
case OperatingSystemId.BSD: return "BSD";
|
||||||
|
case OperatingSystemId.Linux: return "Linux";
|
||||||
|
case OperatingSystemId.Darwin: return "macOS";
|
||||||
|
case OperatingSystemId.Windows: return "Windows";
|
||||||
|
default: throw new Exception($"Unknown OS {Id}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static OperatingSystemId GetId()
|
||||||
|
{
|
||||||
|
switch (Environment.OSVersion.Platform)
|
||||||
|
{
|
||||||
|
// On .NET Core `MacOSX` got replaced by `Unix`, this case should never be hit.
|
||||||
|
case PlatformID.MacOSX:
|
||||||
|
return OperatingSystemId.Darwin;
|
||||||
|
case PlatformID.Win32NT:
|
||||||
|
return OperatingSystemId.Windows;
|
||||||
|
case PlatformID.Unix:
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
string osDescription = RuntimeInformation.OSDescription;
|
||||||
|
if (osDescription.IndexOf("linux", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
|
{
|
||||||
|
return OperatingSystemId.Linux;
|
||||||
|
}
|
||||||
|
else if (osDescription.IndexOf("darwin", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
|
{
|
||||||
|
return OperatingSystemId.Darwin;
|
||||||
|
}
|
||||||
|
else if (osDescription.IndexOf("bsd", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
|
{
|
||||||
|
return OperatingSystemId.BSD;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Exception($"Can't resolve OS with description: '{osDescription}'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -39,7 +39,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The supported image extensions
|
/// The supported image extensions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly IReadOnlyList<string> SupportedImageExtensions
|
public static readonly string[] SupportedImageExtensions
|
||||||
= new [] { ".png", ".jpg", ".jpeg", ".tbn", ".gif" };
|
= new [] { ".png", ".jpg", ".jpeg", ".tbn", ".gif" };
|
||||||
|
|
||||||
private static readonly List<string> _supportedExtensions = new List<string>(SupportedImageExtensions)
|
private static readonly List<string> _supportedExtensions = new List<string>(SupportedImageExtensions)
|
||||||
|
|
|
@ -9,8 +9,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Jellyfin Project")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
[assembly: AssemblyProduct("Jellyfin Server")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
|
@ -10,7 +10,6 @@ using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Xml;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.LocalMetadata.Parsers
|
namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
|
@ -30,19 +29,14 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
|
|
||||||
private Dictionary<string, string> _validProviderIds;
|
private Dictionary<string, string> _validProviderIds;
|
||||||
|
|
||||||
protected IXmlReaderSettingsFactory XmlReaderSettingsFactory { get; private set; }
|
|
||||||
protected IFileSystem FileSystem { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="BaseItemXmlParser{T}" /> class.
|
/// Initializes a new instance of the <see cref="BaseItemXmlParser{T}" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
public BaseItemXmlParser(ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory, IFileSystem fileSystem)
|
public BaseItemXmlParser(ILogger logger, IProviderManager providerManager)
|
||||||
{
|
{
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
ProviderManager = providerManager;
|
ProviderManager = providerManager;
|
||||||
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
|
|
||||||
FileSystem = fileSystem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -64,11 +58,13 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
throw new ArgumentException("The metadata file was empty or null.", nameof(metadataFile));
|
throw new ArgumentException("The metadata file was empty or null.", nameof(metadataFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
var settings = XmlReaderSettingsFactory.Create(false);
|
var settings = new XmlReaderSettings()
|
||||||
|
{
|
||||||
settings.CheckCharacters = false;
|
ValidationType = ValidationType.None,
|
||||||
settings.IgnoreProcessingInstructions = true;
|
CheckCharacters = false,
|
||||||
settings.IgnoreComments = true;
|
IgnoreProcessingInstructions = true,
|
||||||
|
IgnoreComments = true
|
||||||
|
};
|
||||||
|
|
||||||
_validProviderIds = _validProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
_validProviderIds = _validProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
@ -103,10 +99,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
item.ResetPeople();
|
item.ResetPeople();
|
||||||
|
|
||||||
using (var fileStream = File.OpenRead(metadataFile))
|
using (var fileStream = File.OpenRead(metadataFile))
|
||||||
{
|
|
||||||
using (var streamReader = new StreamReader(fileStream, encoding))
|
using (var streamReader = new StreamReader(fileStream, encoding))
|
||||||
{
|
|
||||||
// Use XmlReader for best performance
|
|
||||||
using (var reader = XmlReader.Create(streamReader, settings))
|
using (var reader = XmlReader.Create(streamReader, settings))
|
||||||
{
|
{
|
||||||
reader.MoveToContent();
|
reader.MoveToContent();
|
||||||
|
@ -128,8 +121,6 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,6 @@ using System.Xml;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Movies;
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.IO;
|
|
||||||
using MediaBrowser.Model.Xml;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.LocalMetadata.Parsers
|
namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
|
@ -87,7 +85,8 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
item.Item.LinkedChildren = list.ToArray();
|
item.Item.LinkedChildren = list.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoxSetXmlParser(ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory, IFileSystem fileSystem) : base(logger, providerManager, xmlReaderSettingsFactory, fileSystem)
|
public BoxSetXmlParser(ILogger logger, IProviderManager providerManager)
|
||||||
|
: base(logger, providerManager)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,6 @@ using System.Xml;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Playlists;
|
using MediaBrowser.Controller.Playlists;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.IO;
|
|
||||||
using MediaBrowser.Model.Xml;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.LocalMetadata.Parsers
|
namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
|
@ -95,7 +93,8 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
item.LinkedChildren = list.ToArray();
|
item.LinkedChildren = list.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlaylistXmlParser(ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory, IFileSystem fileSystem) : base(logger, providerManager, xmlReaderSettingsFactory, fileSystem)
|
public PlaylistXmlParser(ILogger logger, IProviderManager providerManager)
|
||||||
|
: base(logger, providerManager)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Jellyfin Project")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
[assembly: AssemblyProduct("Jellyfin Server")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Controller.Entities.Movies;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.LocalMetadata.Parsers;
|
using MediaBrowser.LocalMetadata.Parsers;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Xml;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.LocalMetadata.Providers
|
namespace MediaBrowser.LocalMetadata.Providers
|
||||||
|
@ -16,19 +15,17 @@ namespace MediaBrowser.LocalMetadata.Providers
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IProviderManager _providerManager;
|
private readonly IProviderManager _providerManager;
|
||||||
protected IXmlReaderSettingsFactory XmlReaderSettingsFactory { get; private set; }
|
|
||||||
|
|
||||||
public BoxSetXmlProvider(IFileSystem fileSystem, ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
|
public BoxSetXmlProvider(IFileSystem fileSystem, ILogger logger, IProviderManager providerManager)
|
||||||
: base(fileSystem)
|
: base(fileSystem)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_providerManager = providerManager;
|
_providerManager = providerManager;
|
||||||
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(MetadataResult<BoxSet> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<BoxSet> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new BoxSetXmlParser(_logger, _providerManager, XmlReaderSettingsFactory, FileSystem).Fetch(result, path, cancellationToken);
|
new BoxSetXmlParser(_logger, _providerManager).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.LocalMetadata.Parsers;
|
using MediaBrowser.LocalMetadata.Parsers;
|
||||||
using MediaBrowser.LocalMetadata.Savers;
|
using MediaBrowser.LocalMetadata.Savers;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Xml;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.LocalMetadata.Providers
|
namespace MediaBrowser.LocalMetadata.Providers
|
||||||
|
@ -13,19 +12,17 @@ namespace MediaBrowser.LocalMetadata.Providers
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IProviderManager _providerManager;
|
private readonly IProviderManager _providerManager;
|
||||||
protected IXmlReaderSettingsFactory XmlReaderSettingsFactory { get; private set; }
|
|
||||||
|
|
||||||
public PlaylistXmlProvider(IFileSystem fileSystem, ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
|
public PlaylistXmlProvider(IFileSystem fileSystem, ILogger logger, IProviderManager providerManager)
|
||||||
: base(fileSystem)
|
: base(fileSystem)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_providerManager = providerManager;
|
_providerManager = providerManager;
|
||||||
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(MetadataResult<Playlist> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<Playlist> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new PlaylistXmlParser(_logger, _providerManager, XmlReaderSettingsFactory, FileSystem).Fetch(result, path, cancellationToken);
|
new PlaylistXmlParser(_logger, _providerManager).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
|
|
@ -14,7 +14,6 @@ using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Playlists;
|
using MediaBrowser.Controller.Playlists;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Xml;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.LocalMetadata.Savers
|
namespace MediaBrowser.LocalMetadata.Savers
|
||||||
|
@ -23,7 +22,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
{
|
{
|
||||||
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
||||||
|
|
||||||
public BaseXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
|
public BaseXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger)
|
||||||
{
|
{
|
||||||
FileSystem = fileSystem;
|
FileSystem = fileSystem;
|
||||||
ConfigurationManager = configurationManager;
|
ConfigurationManager = configurationManager;
|
||||||
|
@ -31,7 +30,6 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
UserManager = userManager;
|
UserManager = userManager;
|
||||||
UserDataManager = userDataManager;
|
UserDataManager = userDataManager;
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IFileSystem FileSystem { get; private set; }
|
protected IFileSystem FileSystem { get; private set; }
|
||||||
|
@ -40,9 +38,6 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
protected IUserManager UserManager { get; private set; }
|
protected IUserManager UserManager { get; private set; }
|
||||||
protected IUserDataManager UserDataManager { get; private set; }
|
protected IUserDataManager UserDataManager { get; private set; }
|
||||||
protected ILogger Logger { get; private set; }
|
protected ILogger Logger { get; private set; }
|
||||||
protected IXmlReaderSettingsFactory XmlReaderSettingsFactory { get; private set; }
|
|
||||||
|
|
||||||
protected ItemUpdateType MinimumUpdateType => ItemUpdateType.MetadataDownload;
|
|
||||||
|
|
||||||
public string Name => XmlProviderUtils.Name;
|
public string Name => XmlProviderUtils.Name;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Movies;
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Xml;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.LocalMetadata.Savers
|
namespace MediaBrowser.LocalMetadata.Savers
|
||||||
|
@ -31,7 +30,8 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
return Path.Combine(item.Path, "collection.xml");
|
return Path.Combine(item.Path, "collection.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoxSetXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
|
public BoxSetXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger)
|
||||||
|
: base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Playlists;
|
using MediaBrowser.Controller.Playlists;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Xml;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.LocalMetadata.Savers
|
namespace MediaBrowser.LocalMetadata.Savers
|
||||||
|
@ -49,7 +48,8 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
return Path.Combine(path, "playlist.xml");
|
return Path.Combine(path, "playlist.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlaylistXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
|
public PlaylistXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger)
|
||||||
|
: base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
private readonly IProcessFactory _processFactory;
|
private readonly IProcessFactory _processFactory;
|
||||||
private readonly int DefaultImageExtractionTimeoutMs;
|
private readonly int DefaultImageExtractionTimeoutMs;
|
||||||
private readonly string StartupOptionFFmpegPath;
|
private readonly string StartupOptionFFmpegPath;
|
||||||
private readonly string StartupOptionFFprobePath;
|
|
||||||
|
|
||||||
private readonly SemaphoreSlim _thumbnailResourcePool = new SemaphoreSlim(1, 1);
|
private readonly SemaphoreSlim _thumbnailResourcePool = new SemaphoreSlim(1, 1);
|
||||||
private readonly List<ProcessWrapper> _runningProcesses = new List<ProcessWrapper>();
|
private readonly List<ProcessWrapper> _runningProcesses = new List<ProcessWrapper>();
|
||||||
|
@ -60,7 +59,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
ILoggerFactory loggerFactory,
|
ILoggerFactory loggerFactory,
|
||||||
IJsonSerializer jsonSerializer,
|
IJsonSerializer jsonSerializer,
|
||||||
string startupOptionsFFmpegPath,
|
string startupOptionsFFmpegPath,
|
||||||
string startupOptionsFFprobePath,
|
|
||||||
IServerConfigurationManager configurationManager,
|
IServerConfigurationManager configurationManager,
|
||||||
IFileSystem fileSystem,
|
IFileSystem fileSystem,
|
||||||
Func<ISubtitleEncoder> subtitleEncoder,
|
Func<ISubtitleEncoder> subtitleEncoder,
|
||||||
|
@ -71,7 +69,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
_logger = loggerFactory.CreateLogger(nameof(MediaEncoder));
|
_logger = loggerFactory.CreateLogger(nameof(MediaEncoder));
|
||||||
_jsonSerializer = jsonSerializer;
|
_jsonSerializer = jsonSerializer;
|
||||||
StartupOptionFFmpegPath = startupOptionsFFmpegPath;
|
StartupOptionFFmpegPath = startupOptionsFFmpegPath;
|
||||||
StartupOptionFFprobePath = startupOptionsFFprobePath;
|
|
||||||
ConfigurationManager = configurationManager;
|
ConfigurationManager = configurationManager;
|
||||||
FileSystem = fileSystem;
|
FileSystem = fileSystem;
|
||||||
SubtitleEncoder = subtitleEncoder;
|
SubtitleEncoder = subtitleEncoder;
|
||||||
|
@ -86,12 +83,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetFFmpegPath()
|
public void SetFFmpegPath()
|
||||||
{
|
{
|
||||||
// ToDo - Finalise removal of the --ffprobe switch
|
|
||||||
if (!string.IsNullOrEmpty(StartupOptionFFprobePath))
|
|
||||||
{
|
|
||||||
_logger.LogWarning("--ffprobe switch is deprecated and shall be removed in the next release");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 1) Custom path stored in config/encoding xml file under tag <EncoderAppPath> takes precedence
|
// 1) Custom path stored in config/encoding xml file under tag <EncoderAppPath> takes precedence
|
||||||
if (!ValidatePath(ConfigurationManager.GetConfiguration<EncodingOptions>("encoding").EncoderAppPath, FFmpegLocation.Custom))
|
if (!ValidatePath(ConfigurationManager.GetConfiguration<EncodingOptions>("encoding").EncoderAppPath, FFmpegLocation.Custom))
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
|
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
|
||||||
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />
|
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />
|
||||||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
||||||
<ProjectReference Include="..\OpenSubtitlesHandler\OpenSubtitlesHandler.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user