diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-05-04 15:05:22 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-04 15:05:22 -0400 |
| commit | 6e53aa0e076c2ce2bd7b1a462196b099c77f90e5 (patch) | |
| tree | 0fb73d80406fffe26b77c40c288389a291ddd3af /MediaBrowser.Api | |
| parent | fb74ee3bb616f7532c79bec0113a14fec3a65be1 (diff) | |
| parent | 364c8206bf500ac466d5360ddfe01b67fa8b59a9 (diff) | |
Merge pull request #2613 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Api')
| -rw-r--r-- | MediaBrowser.Api/ApiEntryPoint.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Api/EnvironmentService.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Api/Images/ImageByNameService.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Api/Images/RemoteImageService.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Api/ItemLookupService.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Api/Playback/BaseStreamingService.cs | 123 | ||||
| -rw-r--r-- | MediaBrowser.Api/Playback/Hls/BaseHlsService.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs | 6 |
8 files changed, 13 insertions, 132 deletions
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index a59ab33a97..53e4749820 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -633,7 +633,7 @@ namespace MediaBrowser.Api /// <param name="outputFilePath">The output file path.</param> private void DeleteHlsPartialStreamFiles(string outputFilePath) { - var directory = Path.GetDirectoryName(outputFilePath); + var directory = _fileSystem.GetDirectoryName(outputFilePath); var name = Path.GetFileNameWithoutExtension(outputFilePath); var filesToDelete = _fileSystem.GetFilePaths(directory) diff --git a/MediaBrowser.Api/EnvironmentService.cs b/MediaBrowser.Api/EnvironmentService.cs index bab538c91f..c4cb0cb1d6 100644 --- a/MediaBrowser.Api/EnvironmentService.cs +++ b/MediaBrowser.Api/EnvironmentService.cs @@ -278,7 +278,7 @@ namespace MediaBrowser.Api public object Get(GetParentPath request) { - var parent = Path.GetDirectoryName(request.Path); + var parent = _fileSystem.GetDirectoryName(request.Path); if (string.IsNullOrEmpty(parent)) { diff --git a/MediaBrowser.Api/Images/ImageByNameService.cs b/MediaBrowser.Api/Images/ImageByNameService.cs index c4cfd7307a..2c8fc2d614 100644 --- a/MediaBrowser.Api/Images/ImageByNameService.cs +++ b/MediaBrowser.Api/Images/ImageByNameService.cs @@ -160,7 +160,7 @@ namespace MediaBrowser.Api.Images private string GetThemeName(string path, string rootImagePath) { - var parentName = Path.GetDirectoryName(path); + var parentName = _fileSystem.GetDirectoryName(path); if (string.Equals(parentName, rootImagePath, StringComparison.OrdinalIgnoreCase)) { diff --git a/MediaBrowser.Api/Images/RemoteImageService.cs b/MediaBrowser.Api/Images/RemoteImageService.cs index d7ccf8f6d0..ebd8b89517 100644 --- a/MediaBrowser.Api/Images/RemoteImageService.cs +++ b/MediaBrowser.Api/Images/RemoteImageService.cs @@ -278,7 +278,7 @@ namespace MediaBrowser.Api.Images var fullCachePath = GetFullCachePath(urlHash + "." + ext); - _fileSystem.CreateDirectory(Path.GetDirectoryName(fullCachePath)); + _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(fullCachePath)); using (var stream = result.Content) { using (var filestream = _fileSystem.GetFileStream(fullCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true)) @@ -287,7 +287,7 @@ namespace MediaBrowser.Api.Images } } - _fileSystem.CreateDirectory(Path.GetDirectoryName(pointerCachePath)); + _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(pointerCachePath)); _fileSystem.WriteAllText(pointerCachePath, fullCachePath); } diff --git a/MediaBrowser.Api/ItemLookupService.cs b/MediaBrowser.Api/ItemLookupService.cs index b5c51bfef0..a454642a42 100644 --- a/MediaBrowser.Api/ItemLookupService.cs +++ b/MediaBrowser.Api/ItemLookupService.cs @@ -299,7 +299,7 @@ namespace MediaBrowser.Api var fullCachePath = GetFullCachePath(urlHash + "." + ext); - _fileSystem.CreateDirectory(Path.GetDirectoryName(fullCachePath)); + _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(fullCachePath)); using (var stream = result.Content) { using (var filestream = _fileSystem.GetFileStream(fullCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true)) @@ -308,7 +308,7 @@ namespace MediaBrowser.Api } } - _fileSystem.CreateDirectory(Path.GetDirectoryName(pointerCachePath)); + _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(pointerCachePath)); _fileSystem.WriteAllText(pointerCachePath, fullCachePath); } diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 464c39d35b..a92cf164ac 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -198,7 +198,7 @@ namespace MediaBrowser.Api.Playback CancellationTokenSource cancellationTokenSource, string workingDirectory = null) { - FileSystem.CreateDirectory(Path.GetDirectoryName(outputPath)); + FileSystem.CreateDirectory(FileSystem.GetDirectoryName(outputPath)); await AcquireResources(state, cancellationTokenSource).ConfigureAwait(false); @@ -263,7 +263,7 @@ namespace MediaBrowser.Api.Playback } var logFilePath = Path.Combine(ServerConfigurationManager.ApplicationPaths.LogDirectoryPath, logFilePrefix + "-" + Guid.NewGuid() + ".txt"); - FileSystem.CreateDirectory(Path.GetDirectoryName(logFilePath)); + FileSystem.CreateDirectory(FileSystem.GetDirectoryName(logFilePath)); // FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory. state.LogFileStream = FileSystem.GetFileStream(logFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true); @@ -315,8 +315,6 @@ namespace MediaBrowser.Api.Playback StartThrottler(state, transcodingJob); } - ReportUsage(state); - return transcodingJob; } @@ -910,123 +908,6 @@ namespace MediaBrowser.Api.Playback } } - private async void ReportUsage(StreamState state) - { - try - { - await ReportUsageInternal(state).ConfigureAwait(false); - } - catch - { - - } - } - - private Task ReportUsageInternal(StreamState state) - { - if (!ServerConfigurationManager.Configuration.EnableAnonymousUsageReporting) - { - return Task.FromResult(true); - } - - if (!MediaEncoder.IsDefaultEncoderPath) - { - return Task.FromResult(true); - } - return Task.FromResult(true); - - //var dict = new Dictionary<string, string>(); - - //var outputAudio = GetAudioEncoder(state); - //if (!string.IsNullOrWhiteSpace(outputAudio)) - //{ - // dict["outputAudio"] = outputAudio; - //} - - //var outputVideo = GetVideoEncoder(state); - //if (!string.IsNullOrWhiteSpace(outputVideo)) - //{ - // dict["outputVideo"] = outputVideo; - //} - - //if (ServerConfigurationManager.Configuration.CodecsUsed.Contains(outputAudio ?? string.Empty, StringComparer.OrdinalIgnoreCase) && - // ServerConfigurationManager.Configuration.CodecsUsed.Contains(outputVideo ?? string.Empty, StringComparer.OrdinalIgnoreCase)) - //{ - // return Task.FromResult(true); - //} - - //dict["id"] = AppHost.SystemId; - //dict["type"] = state.VideoRequest == null ? "Audio" : "Video"; - - //var audioStream = state.AudioStream; - //if (audioStream != null && !string.IsNullOrWhiteSpace(audioStream.Codec)) - //{ - // dict["inputAudio"] = audioStream.Codec; - //} - - //var videoStream = state.VideoStream; - //if (videoStream != null && !string.IsNullOrWhiteSpace(videoStream.Codec)) - //{ - // dict["inputVideo"] = videoStream.Codec; - //} - - //var cert = GetType().Assembly.GetModules().First().GetSignerCertificate(); - //if (cert != null) - //{ - // dict["assemblySig"] = cert.GetCertHashString(); - // dict["certSubject"] = cert.Subject ?? string.Empty; - // dict["certIssuer"] = cert.Issuer ?? string.Empty; - //} - //else - //{ - // return Task.FromResult(true); - //} - - //if (state.SupportedAudioCodecs.Count > 0) - //{ - // dict["supportedAudioCodecs"] = string.Join(",", state.SupportedAudioCodecs.ToArray()); - //} - - //var auth = AuthorizationContext.GetAuthorizationInfo(Request); - - //dict["appName"] = auth.Client ?? string.Empty; - //dict["appVersion"] = auth.Version ?? string.Empty; - //dict["device"] = auth.Device ?? string.Empty; - //dict["deviceId"] = auth.DeviceId ?? string.Empty; - //dict["context"] = "streaming"; - - ////Logger.Info(JsonSerializer.SerializeToString(dict)); - //if (!ServerConfigurationManager.Configuration.CodecsUsed.Contains(outputAudio ?? string.Empty, StringComparer.OrdinalIgnoreCase)) - //{ - // var list = ServerConfigurationManager.Configuration.CodecsUsed.ToList(); - // list.Add(outputAudio); - // ServerConfigurationManager.Configuration.CodecsUsed = list.ToArray(); - //} - - //if (!ServerConfigurationManager.Configuration.CodecsUsed.Contains(outputVideo ?? string.Empty, StringComparer.OrdinalIgnoreCase)) - //{ - // var list = ServerConfigurationManager.Configuration.CodecsUsed.ToList(); - // list.Add(outputVideo); - // ServerConfigurationManager.Configuration.CodecsUsed = list.ToArray(); - //} - - //ServerConfigurationManager.SaveConfiguration(); - - ////Logger.Info(JsonSerializer.SerializeToString(dict)); - //var options = new HttpRequestOptions() - //{ - // Url = "https://mb3admin.com/admin/service/transcoding/report", - // CancellationToken = CancellationToken.None, - // LogRequest = false, - // LogErrors = false, - // BufferContent = false - //}; - //options.RequestContent = JsonSerializer.SerializeToString(dict); - //options.RequestContentType = "application/json"; - - //return HttpClient.Post(options); - } - /// <summary> /// Adds the dlna headers. /// </summary> diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs index 8559bae89d..fcf57cebe2 100644 --- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs @@ -268,7 +268,7 @@ namespace MediaBrowser.Api.Playback.Hls var useGenericSegmenter = true; if (useGenericSegmenter) { - var outputTsArg = Path.Combine(Path.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state.Request); + var outputTsArg = Path.Combine(FileSystem.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state.Request); var timeDeltaParam = String.Empty; diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs index b4618fb87d..0fe1e533d4 100644 --- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs @@ -379,7 +379,7 @@ namespace MediaBrowser.Api.Playback.Hls private static FileSystemMetadata GetLastTranscodingFile(string playlist, string segmentExtension, IFileSystem fileSystem) { - var folder = Path.GetDirectoryName(playlist); + var folder = fileSystem.GetDirectoryName(playlist); var filePrefix = Path.GetFileNameWithoutExtension(playlist) ?? string.Empty; @@ -416,7 +416,7 @@ namespace MediaBrowser.Api.Playback.Hls private string GetSegmentPath(StreamState state, string playlist, int index) { - var folder = Path.GetDirectoryName(playlist); + var folder = FileSystem.GetDirectoryName(playlist); var filename = Path.GetFileNameWithoutExtension(playlist); @@ -926,7 +926,7 @@ namespace MediaBrowser.Api.Playback.Hls if (useGenericSegmenter) { - var outputTsArg = Path.Combine(Path.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state.Request); + var outputTsArg = Path.Combine(FileSystem.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state.Request); var timeDeltaParam = String.Empty; |
