diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-11-01 00:39:23 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-11-01 00:39:23 -0400 |
| commit | 8b1b775caa704b11da4d4b93c75d4c23633fd1f0 (patch) | |
| tree | 45b8d814b0e2107bce206c45ef520b227a962484 /MediaBrowser.Server.Implementations | |
| parent | c74acaae59ff595eb05f335cad8695f98bda1a8b (diff) | |
| parent | b1276dc2084515ed817ba8b2af405a9bc1f57cd6 (diff) | |
Merge pull request #2263 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Server.Implementations')
4 files changed, 46 insertions, 9 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs index 60d0d7c41..7b88f12df 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs @@ -88,8 +88,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer Headers["Content-Length"] = source.Length.ToString(UsCulture); } - private const int BufferSize = 81920; - public async Task WriteToAsync(Stream responseStream, CancellationToken cancellationToken) { try @@ -102,7 +100,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer { using (var src = SourceStream) { - await src.CopyToAsync(responseStream, BufferSize).ConfigureAwait(false); + await src.CopyToAsync(responseStream).ConfigureAwait(false); } } } diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 894ab5e58..93fc5459a 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -75,6 +75,16 @@ namespace MediaBrowser.Server.Implementations.LiveTv public event EventHandler<GenericEventArgs<TimerEventInfo>> TimerCreated; public event EventHandler<GenericEventArgs<TimerEventInfo>> SeriesTimerCreated; + public string GetEmbyTvActiveRecordingPath(string id) + { + return EmbyTV.EmbyTV.Current.GetActiveRecordingPath(id); + } + + public Task<LiveStream> GetEmbyTvLiveStream(string id) + { + return EmbyTV.EmbyTV.Current.GetLiveStream(id); + } + public LiveTvManager(IApplicationHost appHost, IServerConfigurationManager config, ILogger logger, IItemRepository itemRepo, IImageProcessor imageProcessor, IUserDataManager userDataManager, IDtoService dtoService, IUserManager userManager, ILibraryManager libraryManager, ITaskManager taskManager, ILocalizationManager localization, IJsonSerializer jsonSerializer, IProviderManager providerManager, IFileSystem fileSystem, ISecurityManager security) { _config = config; diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index f3224127a..24fe077c2 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -70,6 +70,9 @@ <Reference Include="ServiceStack.Api.Swagger"> <HintPath>..\ThirdParty\ServiceStack\ServiceStack.Api.Swagger.dll</HintPath> </Reference> + <Reference Include="ServiceStack.Common"> + <HintPath>..\ThirdParty\ServiceStack\ServiceStack.Common.dll</HintPath> + </Reference> <Reference Include="SharpCompress, Version=0.10.3.0, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\ThirdParty\SharpCompress\SharpCompress.dll</HintPath> @@ -79,7 +82,6 @@ <Private>True</Private> </Reference> <Reference Include="System" /> - <Reference Include="System.Configuration" /> <Reference Include="System.Core" /> <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Data" /> @@ -87,16 +89,12 @@ <Reference Include="System.Net" /> <Reference Include="System.Runtime.Serialization" /> <Reference Include="System.Security" /> - <Reference Include="System.ServiceModel" /> <Reference Include="System.Transactions" /> <Reference Include="System.Web" /> <Reference Include="System.Xml" /> <Reference Include="ServiceStack"> <HintPath>..\ThirdParty\ServiceStack\ServiceStack.dll</HintPath> </Reference> - <Reference Include="ServiceStack.Common"> - <HintPath>..\ThirdParty\ServiceStack\ServiceStack.Common.dll</HintPath> - </Reference> <Reference Include="ServiceStack.Interfaces"> <HintPath>..\ThirdParty\ServiceStack\ServiceStack.Interfaces.dll</HintPath> </Reference> diff --git a/MediaBrowser.Server.Implementations/TextEncoding/TextEncoding.cs b/MediaBrowser.Server.Implementations/TextEncoding/TextEncoding.cs index c1029dfb5..4c047b7d5 100644 --- a/MediaBrowser.Server.Implementations/TextEncoding/TextEncoding.cs +++ b/MediaBrowser.Server.Implementations/TextEncoding/TextEncoding.cs @@ -1,10 +1,18 @@ using System.Text; +using MediaBrowser.Model.IO; using MediaBrowser.Model.TextEncoding; namespace MediaBrowser.Server.Implementations.TextEncoding { - public class TextEncoding : IEncoding + public class TextEncoding : IEncoding { + private readonly IFileSystem _fileSystem; + + public TextEncoding(IFileSystem fileSystem) + { + _fileSystem = fileSystem; + } + public byte[] GetASCIIBytes(string text) { return Encoding.ASCII.GetBytes(text); @@ -14,5 +22,28 @@ namespace MediaBrowser.Server.Implementations.TextEncoding { return Encoding.ASCII.GetString(bytes, 0, bytes.Length); } + + public Encoding GetFileEncoding(string srcFile) + { + // *** Detect byte order mark if any - otherwise assume default + var buffer = new byte[5]; + + using (var file = _fileSystem.OpenRead(srcFile)) + { + file.Read(buffer, 0, 5); + } + + if (buffer[0] == 0xef && buffer[1] == 0xbb && buffer[2] == 0xbf) + return Encoding.UTF8; + if (buffer[0] == 0xfe && buffer[1] == 0xff) + return Encoding.Unicode; + if (buffer[0] == 0 && buffer[1] == 0 && buffer[2] == 0xfe && buffer[3] == 0xff) + return Encoding.UTF32; + if (buffer[0] == 0x2b && buffer[1] == 0x2f && buffer[2] == 0x76) + return Encoding.UTF7; + + // It's ok - anything aside from utf is ok since that's what we're looking for + return Encoding.Default; + } } } |
