diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-11-13 22:44:54 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-11-13 22:44:54 -0500 |
| commit | 635c8d50a361dc2eabbeea0ae55048d1e9f4ad8f (patch) | |
| tree | ebcf01208a34c24215416bdae32e66eab1438e6a | |
| parent | 0e9cd51f9c64d4cfad5cb5c7b0ddae6af8d18ac6 (diff) | |
update character escaping
| -rw-r--r-- | Emby.Server.Implementations/Channels/ChannelManager.cs | 17 | ||||
| -rw-r--r-- | Emby.Server.Implementations/Security/MBLicenseFile.cs | 12 | ||||
| -rw-r--r-- | MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 10 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dlna/StreamBuilder.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/WindowsAppHost.cs | 25 |
5 files changed, 52 insertions, 14 deletions
diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs index 94ff7c342..0df916ded 100644 --- a/Emby.Server.Implementations/Channels/ChannelManager.cs +++ b/Emby.Server.Implementations/Channels/ChannelManager.cs @@ -1108,7 +1108,11 @@ namespace Emby.Server.Implementations.Channels { if (_fileSystem.GetLastWriteTimeUtc(cachePath).Add(cacheLength) > DateTime.UtcNow) { - return _jsonSerializer.DeserializeFromFile<ChannelItemResult>(cachePath); + var cachedResult = _jsonSerializer.DeserializeFromFile<ChannelItemResult>(cachePath); + if (cachedResult != null) + { + return cachedResult; + } } } } @@ -1131,7 +1135,11 @@ namespace Emby.Server.Implementations.Channels { if (_fileSystem.GetLastWriteTimeUtc(cachePath).Add(cacheLength) > DateTime.UtcNow) { - return _jsonSerializer.DeserializeFromFile<ChannelItemResult>(cachePath); + var cachedResult = _jsonSerializer.DeserializeFromFile<ChannelItemResult>(cachePath); + if (cachedResult != null) + { + return cachedResult; + } } } } @@ -1162,6 +1170,11 @@ namespace Emby.Server.Implementations.Channels var result = await channel.GetChannelItems(query, cancellationToken).ConfigureAwait(false); + if (result == null) + { + throw new InvalidOperationException("Channel returned a null result from GetChannelItems"); + } + if (!startIndex.HasValue && !limit.HasValue) { CacheResponse(result, cachePath); diff --git a/Emby.Server.Implementations/Security/MBLicenseFile.cs b/Emby.Server.Implementations/Security/MBLicenseFile.cs index 4b6a82b6c..76741bdf8 100644 --- a/Emby.Server.Implementations/Security/MBLicenseFile.cs +++ b/Emby.Server.Implementations/Security/MBLicenseFile.cs @@ -57,9 +57,14 @@ namespace Emby.Server.Implementations.Security _updateRecords.AddOrUpdate(key, value, (k, v) => value); } + private Guid GetKey(string featureId) + { + return new Guid(_cryptographyProvider.ComputeMD5(Encoding.Unicode.GetBytes(featureId))); + } + public void AddRegCheck(string featureId) { - var key = new Guid(_cryptographyProvider.ComputeMD5(Encoding.Unicode.GetBytes(featureId))); + var key = GetKey(featureId); var value = DateTime.UtcNow; SetUpdateRecord(key, value); @@ -68,7 +73,7 @@ namespace Emby.Server.Implementations.Security public void RemoveRegCheck(string featureId) { - var key = new Guid(_cryptographyProvider.ComputeMD5(Encoding.Unicode.GetBytes(featureId))); + var key = GetKey(featureId); DateTime val; _updateRecords.TryRemove(key, out val); @@ -78,8 +83,9 @@ namespace Emby.Server.Implementations.Security public DateTime LastChecked(string featureId) { + var key = GetKey(featureId); DateTime last; - _updateRecords.TryGetValue(new Guid(_cryptographyProvider.ComputeMD5(Encoding.Unicode.GetBytes(featureId))), out last); + _updateRecords.TryGetValue(key, out last); // guard agains people just putting a large number in the file return last < DateTime.UtcNow ? last : DateTime.MinValue; diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index bae367d82..a52ac0e60 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -88,8 +88,8 @@ namespace MediaBrowser.MediaEncoding.Encoder private readonly int DefaultImageExtractionTimeoutMs; private readonly bool EnableEncoderFontFile; - public MediaEncoder(ILogger logger, IJsonSerializer jsonSerializer, string ffMpegPath, string ffProbePath, bool hasExternalEncoder, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ILiveTvManager liveTvManager, IIsoManager isoManager, ILibraryManager libraryManager, IChannelManager channelManager, ISessionManager sessionManager, Func<ISubtitleEncoder> subtitleEncoder, Func<IMediaSourceManager> mediaSourceManager, IHttpClient httpClient, IZipClient zipClient, IMemoryStreamFactory memoryStreamProvider, IProcessFactory processFactory, - int defaultImageExtractionTimeoutMs, + public MediaEncoder(ILogger logger, IJsonSerializer jsonSerializer, string ffMpegPath, string ffProbePath, bool hasExternalEncoder, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ILiveTvManager liveTvManager, IIsoManager isoManager, ILibraryManager libraryManager, IChannelManager channelManager, ISessionManager sessionManager, Func<ISubtitleEncoder> subtitleEncoder, Func<IMediaSourceManager> mediaSourceManager, IHttpClient httpClient, IZipClient zipClient, IMemoryStreamFactory memoryStreamProvider, IProcessFactory processFactory, + int defaultImageExtractionTimeoutMs, bool enableEncoderFontFile) { _logger = logger; @@ -459,7 +459,7 @@ namespace MediaBrowser.MediaEncoding.Encoder if (request.AnalyzeDurationSections > 0) { analyzeDuration = "-analyzeduration " + - (request.AnalyzeDurationSections*1000000).ToString(CultureInfo.InvariantCulture); + (request.AnalyzeDurationSections * 1000000).ToString(CultureInfo.InvariantCulture); } else { @@ -1221,9 +1221,7 @@ namespace MediaBrowser.MediaEncoding.Encoder // https://ffmpeg.org/ffmpeg-filters.html#Notes-on-filtergraph-escaping // We need to double escape - var escapeChars = new[] {':', '\'', ','}; - - return path.Replace('\\', '/').Replace(":/", "\\:/").Replace("'", "'\\\\\\''"); + return path.Replace('\\', '/').Replace(":", "\\:").Replace("'", "'\\\\\\''"); } /// <summary> diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index 06a883c06..c11cfb523 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -976,7 +976,7 @@ namespace MediaBrowser.Model.Dlna if (item.Bitrate.Value > maxBitrate.Value) { - _logger.Info("Bitrate exceeds DirectPlay limit"); + _logger.Info("Bitrate exceeds DirectPlay limit: media bitrate: {0}, max bitrate: {1}", item.Bitrate.Value.ToString(CultureInfo.InvariantCulture), maxBitrate.Value.ToString(CultureInfo.InvariantCulture)); return false; } diff --git a/MediaBrowser.ServerApplication/WindowsAppHost.cs b/MediaBrowser.ServerApplication/WindowsAppHost.cs index d9bead6b7..fa18b5229 100644 --- a/MediaBrowser.ServerApplication/WindowsAppHost.cs +++ b/MediaBrowser.ServerApplication/WindowsAppHost.cs @@ -32,11 +32,32 @@ namespace MediaBrowser.ServerApplication info.FFMpegFilename = "ffmpeg.exe"; info.FFProbeFilename = "ffprobe.exe"; - info.Version = "0"; + info.Version = "20160410"; + info.ArchiveType = "7z"; + info.DownloadUrls = GetDownloadUrls(); return info; } + private string[] GetDownloadUrls() + { + switch (EnvironmentInfo.SystemArchitecture) + { + case Architecture.X64: + return new[] + { + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win64.7z" + }; + case Architecture.X86: + return new[] + { + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win32.7z" + }; + } + + return new string[] { }; + } + protected override void RestartInternal() { MainStartup.Restart(); @@ -80,7 +101,7 @@ namespace MediaBrowser.ServerApplication var shortcutPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.StartMenu), "Emby", "Emby Server.lnk"); var startupPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Startup); - + if (autorun) { //Copy our shortut into the startup folder for this user |
