From 881928323e16b1cf9a4831753a3da521c38b6e47 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 20 Mar 2015 01:40:51 -0400 Subject: update ILiveTvService --- MediaBrowser.Controller/LiveTv/ILiveTvManager.cs | 4 ++-- MediaBrowser.Controller/LiveTv/ILiveTvService.cs | 23 +++++++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs index 9b36454d2a..0b58a92328 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs @@ -149,7 +149,7 @@ namespace MediaBrowser.Controller.LiveTv /// The identifier. /// The cancellation token. /// Task{Stream}. - Task GetRecordingStream(string id, CancellationToken cancellationToken); + Task GetRecordingStream(string id, CancellationToken cancellationToken); /// /// Gets the channel stream. @@ -157,7 +157,7 @@ namespace MediaBrowser.Controller.LiveTv /// The identifier. /// The cancellation token. /// Task{StreamResponseInfo}. - Task GetChannelStream(string id, CancellationToken cancellationToken); + Task GetChannelStream(string id, CancellationToken cancellationToken); /// /// Gets the program. diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs index 993db00043..d7e3df4e23 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs @@ -4,6 +4,7 @@ using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Drawing; +using MediaBrowser.Model.Dto; namespace MediaBrowser.Controller.LiveTv { @@ -172,18 +173,36 @@ namespace MediaBrowser.Controller.LiveTv /// Gets the recording stream. /// /// The recording identifier. + /// The stream identifier. /// The cancellation token. /// Task{Stream}. - Task GetRecordingStream(string recordingId, CancellationToken cancellationToken); + Task GetRecordingStream(string recordingId, string streamId, CancellationToken cancellationToken); /// /// Gets the channel stream. /// /// The channel identifier. + /// The stream identifier. /// The cancellation token. /// Task{Stream}. - Task GetChannelStream(string channelId, CancellationToken cancellationToken); + Task GetChannelStream(string channelId, string streamId, CancellationToken cancellationToken); + /// + /// Gets the channel stream media sources. + /// + /// The channel identifier. + /// The cancellation token. + /// Task<List<MediaSourceInfo>>. + Task> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken); + + /// + /// Gets the recording stream media sources. + /// + /// The recording identifier. + /// The cancellation token. + /// Task<List<MediaSourceInfo>>. + Task> GetRecordingStreamMediaSources(string recordingId, CancellationToken cancellationToken); + /// /// Closes the live stream. /// -- cgit v1.2.3 From e068e84ab6c2bdee49c41ceef50cbcedd8bcb355 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 20 Mar 2015 16:06:04 -0400 Subject: incorporate file length into image cache tag --- MediaBrowser.Api/Playback/Hls/BaseHlsService.cs | 3 +- MediaBrowser.Controller/Entities/BaseItem.cs | 22 +++++++-- MediaBrowser.Controller/Entities/ItemImageInfo.cs | 6 +++ MediaBrowser.Model/ApiClient/IApiClient.cs | 3 +- .../Manager/ItemImageProvider.cs | 1 + .../Drawing/ImageProcessor.cs | 54 ++++++++++++++-------- .../Dto/DtoService.cs | 5 +- 7 files changed, 66 insertions(+), 28 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs index 8541a60ef5..d4c0ddc70e 100644 --- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs @@ -107,8 +107,7 @@ namespace MediaBrowser.Api.Playback.Hls throw; } - var waitCount = isLive ? 2 : 2; - await WaitForMinimumSegmentCount(playlist, waitCount, cancellationTokenSource.Token).ConfigureAwait(false); + await WaitForMinimumSegmentCount(playlist, 3, cancellationTokenSource.Token).ConfigureAwait(false); } } finally diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index dd6189bc57..cdb52ec668 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1519,6 +1519,7 @@ namespace MediaBrowser.Controller.Entities image.Path = file.FullName; image.DateModified = imageInfo.DateModified; + image.Length = imageInfo.Length; } } @@ -1623,11 +1624,14 @@ namespace MediaBrowser.Controller.Entities return null; } + var fileInfo = new FileInfo(path); + return new ItemImageInfo { Path = path, - DateModified = FileSystem.GetLastWriteTimeUtc(path), - Type = imageType + DateModified = FileSystem.GetLastWriteTimeUtc(fileInfo), + Type = imageType, + Length = fileInfo.Length }; } @@ -1686,6 +1690,7 @@ namespace MediaBrowser.Controller.Entities else { existing.DateModified = FileSystem.GetLastWriteTimeUtc(newImage); + existing.Length = ((FileInfo) newImage).Length; } } @@ -1700,7 +1705,8 @@ namespace MediaBrowser.Controller.Entities { Path = file.FullName, Type = type, - DateModified = FileSystem.GetLastWriteTimeUtc(file) + DateModified = FileSystem.GetLastWriteTimeUtc(file), + Length = ((FileInfo)file).Length }; } @@ -1739,9 +1745,15 @@ namespace MediaBrowser.Controller.Entities FileSystem.SwapFiles(path1, path2); + var file1 = new FileInfo(info1.Path); + var file2 = new FileInfo(info2.Path); + // Refresh these values - info1.DateModified = FileSystem.GetLastWriteTimeUtc(info1.Path); - info2.DateModified = FileSystem.GetLastWriteTimeUtc(info2.Path); + info1.DateModified = FileSystem.GetLastWriteTimeUtc(file1); + info2.DateModified = FileSystem.GetLastWriteTimeUtc(file2); + + info1.Length = file1.Length; + info2.Length = file2.Length; return UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None); } diff --git a/MediaBrowser.Controller/Entities/ItemImageInfo.cs b/MediaBrowser.Controller/Entities/ItemImageInfo.cs index b36b818ffe..1122de4032 100644 --- a/MediaBrowser.Controller/Entities/ItemImageInfo.cs +++ b/MediaBrowser.Controller/Entities/ItemImageInfo.cs @@ -11,6 +11,12 @@ namespace MediaBrowser.Controller.Entities /// The path. public string Path { get; set; } + /// + /// Gets or sets the length. + /// + /// The length. + public long Length { get; set; } + /// /// Gets or sets the type. /// diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs index ef99e444f5..c5b74c5c10 100644 --- a/MediaBrowser.Model/ApiClient/IApiClient.cs +++ b/MediaBrowser.Model/ApiClient/IApiClient.cs @@ -690,8 +690,9 @@ namespace MediaBrowser.Model.ApiClient /// Stops the transcoding processes. /// /// The device identifier. + /// The stream identifier. /// Task. - Task StopTranscodingProcesses(string deviceId); + Task StopTranscodingProcesses(string deviceId, string streamId); /// /// Sets the index of the audio stream. diff --git a/MediaBrowser.Providers/Manager/ItemImageProvider.cs b/MediaBrowser.Providers/Manager/ItemImageProvider.cs index 3c75aa20ad..533e843ea8 100644 --- a/MediaBrowser.Providers/Manager/ItemImageProvider.cs +++ b/MediaBrowser.Providers/Manager/ItemImageProvider.cs @@ -386,6 +386,7 @@ namespace MediaBrowser.Providers.Manager else { currentImage.DateModified = _fileSystem.GetLastWriteTimeUtc(image.FileInfo); + currentImage.Length = ((FileInfo) image.FileInfo).Length; } } } diff --git a/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs b/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs index 79e5a0cf00..a9affe1ec0 100644 --- a/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs +++ b/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs @@ -144,7 +144,7 @@ namespace MediaBrowser.Server.Implementations.Drawing { var tmpPath = Path.Combine(_appPaths.TempDirectory, Guid.NewGuid() + ".webp"); Directory.CreateDirectory(Path.GetDirectoryName(tmpPath)); - + using (var wand = new MagickWand(1, 1, new PixelWand("none", 1))) { wand.SaveImage(tmpPath); @@ -186,21 +186,31 @@ namespace MediaBrowser.Server.Implementations.Drawing } var dateModified = options.Image.DateModified; + var length = options.Image.Length; if (options.CropWhiteSpace) { - var tuple = await GetWhitespaceCroppedImage(originalImagePath, dateModified).ConfigureAwait(false); + var tuple = await GetWhitespaceCroppedImage(originalImagePath, dateModified, length).ConfigureAwait(false); originalImagePath = tuple.Item1; dateModified = tuple.Item2; + length = tuple.Item3; } if (options.Enhancers.Count > 0) { - var tuple = await GetEnhancedImage(options.Image, options.Item, options.ImageIndex, options.Enhancers).ConfigureAwait(false); + var tuple = await GetEnhancedImage(new ItemImageInfo + { + Length = length, + DateModified = dateModified, + Type = options.Image.Type, + Path = originalImagePath + + }, options.Item, options.ImageIndex, options.Enhancers).ConfigureAwait(false); originalImagePath = tuple.Item1; dateModified = tuple.Item2; + length = tuple.Item3; } var originalImageSize = GetImageSize(originalImagePath, dateModified); @@ -217,7 +227,7 @@ namespace MediaBrowser.Server.Implementations.Drawing var quality = options.Quality ?? 90; var outputFormat = GetOutputFormat(options.OutputFormat); - var cacheFilePath = GetCacheFilePath(originalImagePath, newSize, quality, dateModified, outputFormat, options.AddPlayedIndicator, options.PercentPlayed, options.UnplayedCount, options.BackgroundColor); + var cacheFilePath = GetCacheFilePath(originalImagePath, newSize, quality, dateModified, length, outputFormat, options.AddPlayedIndicator, options.PercentPlayed, options.UnplayedCount, options.BackgroundColor); var semaphore = GetLock(cacheFilePath); @@ -341,13 +351,11 @@ namespace MediaBrowser.Server.Implementations.Drawing /// /// Crops whitespace from an image, caches the result, and returns the cached path /// - /// The original image path. - /// The date modified. - /// System.String. - private async Task> GetWhitespaceCroppedImage(string originalImagePath, DateTime dateModified) + private async Task> GetWhitespaceCroppedImage(string originalImagePath, DateTime dateModified, long length) { var name = originalImagePath; name += "datemodified=" + dateModified.Ticks; + name += "length=" + length; var croppedImagePath = GetCachePath(CroppedWhitespaceImageCachePath, name, Path.GetExtension(originalImagePath)); @@ -359,7 +367,7 @@ namespace MediaBrowser.Server.Implementations.Drawing if (File.Exists(croppedImagePath)) { semaphore.Release(); - return new Tuple(croppedImagePath, _fileSystem.GetLastWriteTimeUtc(croppedImagePath)); + return GetResult(croppedImagePath); } try @@ -377,14 +385,21 @@ namespace MediaBrowser.Server.Implementations.Drawing // We have to have a catch-all here because some of the .net image methods throw a plain old Exception _logger.ErrorException("Error cropping image {0}", ex, originalImagePath); - return new Tuple(originalImagePath, dateModified); + return new Tuple(originalImagePath, dateModified, length); } finally { semaphore.Release(); } - return new Tuple(croppedImagePath, _fileSystem.GetLastWriteTimeUtc(croppedImagePath)); + return GetResult(croppedImagePath); + } + + private Tuple GetResult(string path) + { + var file = new FileInfo(path); + + return new Tuple(path, _fileSystem.GetLastWriteTimeUtc(file), file.Length); } /// @@ -395,7 +410,7 @@ namespace MediaBrowser.Server.Implementations.Drawing /// /// Gets the cache file path based on a set of parameters /// - private string GetCacheFilePath(string originalPath, ImageSize outputSize, int quality, DateTime dateModified, ImageFormat format, bool addPlayedIndicator, double percentPlayed, int? unwatchedCount, string backgroundColor) + private string GetCacheFilePath(string originalPath, ImageSize outputSize, int quality, DateTime dateModified, long length, ImageFormat format, bool addPlayedIndicator, double percentPlayed, int? unwatchedCount, string backgroundColor) { var filename = originalPath; @@ -406,6 +421,7 @@ namespace MediaBrowser.Server.Implementations.Drawing filename += "quality=" + quality; filename += "datemodified=" + dateModified.Ticks; + filename += "length=" + length; filename += "f=" + format; @@ -601,16 +617,17 @@ namespace MediaBrowser.Server.Implementations.Drawing var originalImagePath = image.Path; var dateModified = image.DateModified; var imageType = image.Type; + var length = image.Length; // Optimization if (imageEnhancers.Count == 0) { - return (originalImagePath + dateModified.Ticks).GetMD5().ToString("N"); + return (originalImagePath + dateModified.Ticks + string.Empty + length).GetMD5().ToString("N"); } // Cache name is created with supported enhancers combined with the last config change so we pick up new config changes var cacheKeys = imageEnhancers.Select(i => i.GetConfigurationCacheKey(item, imageType)).ToList(); - cacheKeys.Add(originalImagePath + dateModified.Ticks); + cacheKeys.Add(originalImagePath + dateModified.Ticks + string.Empty + length); return string.Join("|", cacheKeys.ToArray()).GetMD5().ToString("N"); } @@ -633,7 +650,7 @@ namespace MediaBrowser.Server.Implementations.Drawing return result.Item1; } - private async Task> GetEnhancedImage(ItemImageInfo image, + private async Task> GetEnhancedImage(ItemImageInfo image, IHasImages item, int imageIndex, List enhancers) @@ -641,6 +658,7 @@ namespace MediaBrowser.Server.Implementations.Drawing var originalImagePath = image.Path; var dateModified = image.DateModified; var imageType = image.Type; + var length = image.Length; try { @@ -652,9 +670,7 @@ namespace MediaBrowser.Server.Implementations.Drawing // If the path changed update dateModified if (!ehnancedImagePath.Equals(originalImagePath, StringComparison.OrdinalIgnoreCase)) { - dateModified = _fileSystem.GetLastWriteTimeUtc(ehnancedImagePath); - - return new Tuple(ehnancedImagePath, dateModified); + return GetResult(ehnancedImagePath); } } catch (Exception ex) @@ -662,7 +678,7 @@ namespace MediaBrowser.Server.Implementations.Drawing _logger.Error("Error enhancing image", ex); } - return new Tuple(originalImagePath, dateModified); + return new Tuple(originalImagePath, dateModified, length); } /// diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index 887a94ab30..b28f26946c 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -765,11 +765,14 @@ namespace MediaBrowser.Server.Implementations.Dto if (!string.IsNullOrEmpty(chapterInfo.ImagePath)) { + var file = new FileInfo(chapterInfo.ImagePath); + dto.ImageTag = GetImageCacheTag(item, new ItemImageInfo { Path = chapterInfo.ImagePath, Type = ImageType.Chapter, - DateModified = _fileSystem.GetLastWriteTimeUtc(chapterInfo.ImagePath) + DateModified = _fileSystem.GetLastWriteTimeUtc(file), + Length = file.Length }); } -- cgit v1.2.3 From c0aec48a31d96726a6fb1814f28b6971fabca163 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 21 Mar 2015 12:10:02 -0400 Subject: beta fixes --- .../BaseApplicationHost.cs | 2 +- .../Persistence/IItemRepository.cs | 2 +- .../Session/ISessionController.cs | 5 ++ .../ContentDirectory/ContentDirectoryBrowser.cs | 2 +- MediaBrowser.Dlna/PlayTo/PlayToController.cs | 4 ++ MediaBrowser.MediaEncoding/Subtitles/AssParser.cs | 71 +++++++++++----------- MediaBrowser.Model/Dlna/Profiles/DefaultProfile.cs | 14 ++--- .../Connect/ConnectManager.cs | 6 +- .../EntryPoints/Notifications/Notifications.cs | 2 +- .../HttpServer/Security/SessionContext.cs | 5 +- .../LiveTv/LiveTvManager.cs | 11 +++- .../Localization/Server/server.json | 2 +- .../Notifications/CoreNotificationTypes.cs | 6 +- .../Persistence/SqliteItemRepository.cs | 11 +--- .../ScheduledTasks/SystemUpdateTask.cs | 2 +- .../Session/HttpSessionController.cs | 4 ++ .../Session/SessionManager.cs | 48 +++++++++------ .../Session/WebSocketController.cs | 19 +++++- .../ApplicationHost.cs | 2 +- MediaBrowser.ServerApplication/ServerNotifyIcon.cs | 4 +- .../Splash/SplashForm.Designer.cs | 4 +- MediaBrowser.WebDashboard/Api/PackageCreator.cs | 4 +- MediaBrowser.XbmcMetadata/Images/XbmcImageSaver.cs | 2 +- 23 files changed, 134 insertions(+), 98 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index 0f89bd1a6f..bc1b0e7855 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -294,7 +294,7 @@ namespace MediaBrowser.Common.Implementations public static void LogEnvironmentInfo(ILogger logger, IApplicationPaths appPaths, bool isStartup) { - logger.LogMultiline("Media Browser", LogSeverity.Info, GetBaseExceptionMessage(appPaths)); + logger.LogMultiline("Emby", LogSeverity.Info, GetBaseExceptionMessage(appPaths)); } protected static StringBuilder GetBaseExceptionMessage(IApplicationPaths appPaths) diff --git a/MediaBrowser.Controller/Persistence/IItemRepository.cs b/MediaBrowser.Controller/Persistence/IItemRepository.cs index edaa15c9df..245c81d706 100644 --- a/MediaBrowser.Controller/Persistence/IItemRepository.cs +++ b/MediaBrowser.Controller/Persistence/IItemRepository.cs @@ -107,7 +107,7 @@ namespace MediaBrowser.Controller.Persistence /// /// The type. /// IEnumerable{Guid}. - IEnumerable GetItemsOfType(Type type); + IEnumerable GetItemsOfType(Type type); /// /// Saves the children. diff --git a/MediaBrowser.Controller/Session/ISessionController.cs b/MediaBrowser.Controller/Session/ISessionController.cs index a4badee473..f8a6ed1fc1 100644 --- a/MediaBrowser.Controller/Session/ISessionController.cs +++ b/MediaBrowser.Controller/Session/ISessionController.cs @@ -115,5 +115,10 @@ namespace MediaBrowser.Controller.Session /// The cancellation token. /// Task. Task SendMessage(string name, T data, CancellationToken cancellationToken); + + /// + /// Called when [activity]. + /// + void OnActivity(); } } diff --git a/MediaBrowser.Dlna/ContentDirectory/ContentDirectoryBrowser.cs b/MediaBrowser.Dlna/ContentDirectory/ContentDirectoryBrowser.cs index 0c62ada809..d90f0765fb 100644 --- a/MediaBrowser.Dlna/ContentDirectory/ContentDirectoryBrowser.cs +++ b/MediaBrowser.Dlna/ContentDirectory/ContentDirectoryBrowser.cs @@ -33,7 +33,7 @@ namespace MediaBrowser.Dlna.ContentDirectory var options = new HttpRequestOptions { CancellationToken = cancellationToken, - UserAgent = "Media Browser", + UserAgent = "Emby", RequestContentType = "text/xml; charset=\"utf-8\"", LogErrorResponseBody = true, Url = request.ContentDirectoryUrl diff --git a/MediaBrowser.Dlna/PlayTo/PlayToController.cs b/MediaBrowser.Dlna/PlayTo/PlayToController.cs index f53318069c..d52428dc9e 100644 --- a/MediaBrowser.Dlna/PlayTo/PlayToController.cs +++ b/MediaBrowser.Dlna/PlayTo/PlayToController.cs @@ -47,6 +47,10 @@ namespace MediaBrowser.Dlna.PlayTo } } + public void OnActivity() + { + } + public bool SupportsMediaControl { get { return IsSessionActive; } diff --git a/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs b/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs index 2a8c958b25..4d426683fe 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs @@ -42,6 +42,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles subEvent.StartPositionTicks = GetTicks(sections[headers["Start"]]); subEvent.EndPositionTicks = GetTicks(sections[headers["End"]]); + + //RemoteNativeFormatting(subEvent); + subEvent.Text = string.Join(",", sections.Skip(headers["Text"])); subEvent.Text = subEvent.Text.Replace(@"\N", ParserValues.NewLine, StringComparison.OrdinalIgnoreCase); subEvent.Text = Regex.Replace(subEvent.Text, @"\{(\\[\w]+\(?([\w\d]+,?)+\)?)+\}", string.Empty, RegexOptions.IgnoreCase); @@ -49,7 +52,6 @@ namespace MediaBrowser.MediaEncoding.Subtitles trackInfo.TrackEvents.Add(subEvent); } } - RemoteNativeFormatting(trackInfo); return trackInfo; } @@ -74,46 +76,43 @@ namespace MediaBrowser.MediaEncoding.Subtitles /// /// Credit: https://github.com/SubtitleEdit/subtitleedit/blob/master/src/Logic/SubtitleFormats/AdvancedSubStationAlpha.cs /// - private void RemoteNativeFormatting(SubtitleTrackInfo subtitle) + private void RemoteNativeFormatting(SubtitleTrackEvent p) { - foreach (var p in subtitle.TrackEvents) + int indexOfBegin = p.Text.IndexOf('{'); + string pre = string.Empty; + while (indexOfBegin >= 0 && p.Text.IndexOf('}') > indexOfBegin) { - int indexOfBegin = p.Text.IndexOf('{'); - string pre = string.Empty; - while (indexOfBegin >= 0 && p.Text.IndexOf('}') > indexOfBegin) + string s = p.Text.Substring(indexOfBegin); + if (s.StartsWith("{\\an1}", StringComparison.Ordinal) || + s.StartsWith("{\\an2}", StringComparison.Ordinal) || + s.StartsWith("{\\an3}", StringComparison.Ordinal) || + s.StartsWith("{\\an4}", StringComparison.Ordinal) || + s.StartsWith("{\\an5}", StringComparison.Ordinal) || + s.StartsWith("{\\an6}", StringComparison.Ordinal) || + s.StartsWith("{\\an7}", StringComparison.Ordinal) || + s.StartsWith("{\\an8}", StringComparison.Ordinal) || + s.StartsWith("{\\an9}", StringComparison.Ordinal)) { - string s = p.Text.Substring(indexOfBegin); - if (s.StartsWith("{\\an1}", StringComparison.Ordinal) || - s.StartsWith("{\\an2}", StringComparison.Ordinal) || - s.StartsWith("{\\an3}", StringComparison.Ordinal) || - s.StartsWith("{\\an4}", StringComparison.Ordinal) || - s.StartsWith("{\\an5}", StringComparison.Ordinal) || - s.StartsWith("{\\an6}", StringComparison.Ordinal) || - s.StartsWith("{\\an7}", StringComparison.Ordinal) || - s.StartsWith("{\\an8}", StringComparison.Ordinal) || - s.StartsWith("{\\an9}", StringComparison.Ordinal)) - { - pre = s.Substring(0, 6); - } - else if (s.StartsWith("{\\an1\\", StringComparison.Ordinal) || - s.StartsWith("{\\an2\\", StringComparison.Ordinal) || - s.StartsWith("{\\an3\\", StringComparison.Ordinal) || - s.StartsWith("{\\an4\\", StringComparison.Ordinal) || - s.StartsWith("{\\an5\\", StringComparison.Ordinal) || - s.StartsWith("{\\an6\\", StringComparison.Ordinal) || - s.StartsWith("{\\an7\\", StringComparison.Ordinal) || - s.StartsWith("{\\an8\\", StringComparison.Ordinal) || - s.StartsWith("{\\an9\\", StringComparison.Ordinal)) - { - pre = s.Substring(0, 5) + "}"; - } - int indexOfEnd = p.Text.IndexOf('}'); - p.Text = p.Text.Remove(indexOfBegin, (indexOfEnd - indexOfBegin) + 1); - - indexOfBegin = p.Text.IndexOf('{'); + pre = s.Substring(0, 6); } - p.Text = pre + p.Text; + else if (s.StartsWith("{\\an1\\", StringComparison.Ordinal) || + s.StartsWith("{\\an2\\", StringComparison.Ordinal) || + s.StartsWith("{\\an3\\", StringComparison.Ordinal) || + s.StartsWith("{\\an4\\", StringComparison.Ordinal) || + s.StartsWith("{\\an5\\", StringComparison.Ordinal) || + s.StartsWith("{\\an6\\", StringComparison.Ordinal) || + s.StartsWith("{\\an7\\", StringComparison.Ordinal) || + s.StartsWith("{\\an8\\", StringComparison.Ordinal) || + s.StartsWith("{\\an9\\", StringComparison.Ordinal)) + { + pre = s.Substring(0, 5) + "}"; + } + int indexOfEnd = p.Text.IndexOf('}'); + p.Text = p.Text.Remove(indexOfBegin, (indexOfEnd - indexOfBegin) + 1); + + indexOfBegin = p.Text.IndexOf('{'); } + p.Text = pre + p.Text; } } } diff --git a/MediaBrowser.Model/Dlna/Profiles/DefaultProfile.cs b/MediaBrowser.Model/Dlna/Profiles/DefaultProfile.cs index 959f8b8016..c9db9fbf85 100644 --- a/MediaBrowser.Model/Dlna/Profiles/DefaultProfile.cs +++ b/MediaBrowser.Model/Dlna/Profiles/DefaultProfile.cs @@ -13,13 +13,13 @@ namespace MediaBrowser.Model.Dlna.Profiles XDlnaDoc = "DMS-1.50"; - FriendlyName = "Media Browser"; - Manufacturer = "Media Browser"; - ModelDescription = "Media Browser"; - ModelName = "Media Browser"; - ModelNumber = "Media Browser"; - ModelUrl = "http://mediabrowser.tv/"; - ManufacturerUrl = "http://mediabrowser.tv/"; + FriendlyName = "Emby"; + Manufacturer = "Emby"; + ModelDescription = "Emby"; + ModelName = "Emby"; + ModelNumber = "Emby"; + ModelUrl = "http://emby.media/"; + ManufacturerUrl = "http://emby.media/"; AlbumArtPn = "JPEG_SM"; diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs index be0b325487..a7f8717a74 100644 --- a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs +++ b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs @@ -150,7 +150,7 @@ namespace MediaBrowser.Server.Implementations.Connect if (string.IsNullOrWhiteSpace(wanApiAddress)) { - _logger.Warn("Cannot update Media Browser Connect information without a WanApiAddress"); + _logger.Warn("Cannot update Emby Connect information without a WanApiAddress"); return; } @@ -411,7 +411,7 @@ namespace MediaBrowser.Server.Implementations.Connect if (!connectUser.IsActive) { - throw new ArgumentException("The Media Browser account has been disabled."); + throw new ArgumentException("The Emby account has been disabled."); } var user = GetUser(userId); @@ -517,7 +517,7 @@ namespace MediaBrowser.Server.Implementations.Connect if (!connectUser.IsActive) { - throw new ArgumentException("The Media Browser account has been disabled."); + throw new ArgumentException("The Emby account has been disabled."); } connectUserId = connectUser.Id; diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs index f6a35973b7..bc995d62ab 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs @@ -389,7 +389,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications var notification = new NotificationRequest { UserIds = new List { e.Argument.Id.ToString("N") }, - Name = "Welcome to Media Browser!", + Name = "Welcome to Emby!", Description = "Check back here for more notifications." }; diff --git a/MediaBrowser.Server.Implementations/HttpServer/Security/SessionContext.cs b/MediaBrowser.Server.Implementations/HttpServer/Security/SessionContext.cs index 1bbe9893b8..c8278dc545 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/Security/SessionContext.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/Security/SessionContext.cs @@ -28,7 +28,10 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security if (!string.IsNullOrWhiteSpace(authorization.Token)) { var auth = GetTokenInfo(requestContext); - return _sessionManager.GetSessionByAuthenticationToken(auth, authorization.DeviceId, requestContext.RemoteIp, authorization.Version); + if (auth != null) + { + return _sessionManager.GetSessionByAuthenticationToken(auth, authorization.DeviceId, requestContext.RemoteIp, authorization.Version); + } } var session = _sessionManager.GetSession(authorization.DeviceId, authorization.Client, authorization.Version); diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 075451146d..aff8015167 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -1111,13 +1111,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv var numComplete = 0; - foreach (var program in list) + foreach (var programId in list) { cancellationToken.ThrowIfCancellationRequested(); - if (!currentIdList.Contains(program.Id)) + if (!currentIdList.Contains(new Guid(programId))) { - await _libraryManager.DeleteItem(program).ConfigureAwait(false); + var program = _libraryManager.GetItemById(programId); + + if (program != null) + { + await _libraryManager.DeleteItem(program).ConfigureAwait(false); + } } numComplete++; diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index c2a115df45..8681eb7c8f 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -16,7 +16,7 @@ "LabelNext": "Next", "LabelYoureDone": "You're Done!", "WelcomeToMediaBrowser": "Welcome to Media Browser!", - "TitleMediaBrowser": "Media Browser", + "TitleMediaBrowser": "Emby", "ThisWizardWillGuideYou": "This wizard will help guide you through the setup process. To begin, please select your preferred language.", "TellUsAboutYourself": "Tell us about yourself", "ButtonQuickStartGuide": "Quick start guide", diff --git a/MediaBrowser.Server.Implementations/Notifications/CoreNotificationTypes.cs b/MediaBrowser.Server.Implementations/Notifications/CoreNotificationTypes.cs index a33fe21477..98d3672fa4 100644 --- a/MediaBrowser.Server.Implementations/Notifications/CoreNotificationTypes.cs +++ b/MediaBrowser.Server.Implementations/Notifications/CoreNotificationTypes.cs @@ -27,7 +27,7 @@ namespace MediaBrowser.Server.Implementations.Notifications { Type = NotificationType.ApplicationUpdateInstalled.ToString(), DefaultDescription = "{ReleaseNotes}", - DefaultTitle = "A new version of Media Browser Server has been installed.", + DefaultTitle = "A new version of Emby Server has been installed.", Variables = new List{"Version"} }, @@ -71,7 +71,7 @@ namespace MediaBrowser.Server.Implementations.Notifications new NotificationTypeInfo { Type = NotificationType.ServerRestartRequired.ToString(), - DefaultTitle = "Please restart Media Browser Server to finish updating." + DefaultTitle = "Please restart Emby Server to finish updating." }, new NotificationTypeInfo @@ -158,7 +158,7 @@ namespace MediaBrowser.Server.Implementations.Notifications knownTypes.Add(new NotificationTypeInfo { Type = NotificationType.ApplicationUpdateAvailable.ToString(), - DefaultTitle = "A new version of Media Browser Server is available for download." + DefaultTitle = "A new version of Emby Server is available for download." }); } diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index 3ffe31ed18..4c45d5b838 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -522,7 +522,7 @@ namespace MediaBrowser.Server.Implementations.Persistence } } - public IEnumerable GetItemsOfType(Type type) + public IEnumerable GetItemsOfType(Type type) { if (type == null) { @@ -533,7 +533,7 @@ namespace MediaBrowser.Server.Implementations.Persistence using (var cmd = _connection.CreateCommand()) { - cmd.CommandText = "select type,data from TypedBaseItems where type = @type"; + cmd.CommandText = "select guid from TypedBaseItems where type = @type"; cmd.Parameters.Add(cmd, "@type", DbType.String).Value = type.FullName; @@ -541,12 +541,7 @@ namespace MediaBrowser.Server.Implementations.Persistence { while (reader.Read()) { - var item = GetItem(reader); - - if (item != null) - { - yield return item; - } + yield return reader.GetString(0); } } } diff --git a/MediaBrowser.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs b/MediaBrowser.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs index 231a98b4ae..fa3cd6be7e 100644 --- a/MediaBrowser.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs +++ b/MediaBrowser.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs @@ -108,7 +108,7 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks } else { - Logger.Info("A new version of Media Browser is available."); + Logger.Info("A new version of " + _appHost.Name + " is available."); } progress.Report(100); diff --git a/MediaBrowser.Server.Implementations/Session/HttpSessionController.cs b/MediaBrowser.Server.Implementations/Session/HttpSessionController.cs index 4d5c408535..9a7fb33dfb 100644 --- a/MediaBrowser.Server.Implementations/Session/HttpSessionController.cs +++ b/MediaBrowser.Server.Implementations/Session/HttpSessionController.cs @@ -43,6 +43,10 @@ namespace MediaBrowser.Server.Implementations.Session ResetPingTimer(); } + public void OnActivity() + { + } + private string PostUrl { get diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 5ea970426a..f88e21aea3 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -236,34 +236,44 @@ namespace MediaBrowser.Server.Implementations.Session } var activityDate = DateTime.UtcNow; - var session = await GetSessionInfo(appName, appVersion, deviceId, deviceName, remoteEndPoint, user).ConfigureAwait(false); - + var lastActivityDate = session.LastActivityDate; session.LastActivityDate = activityDate; - if (user == null) + if (user != null) { - return session; - } - - var lastActivityDate = user.LastActivityDate; + var userLastActivityDate = user.LastActivityDate ?? DateTime.MinValue; + user.LastActivityDate = activityDate; - user.LastActivityDate = activityDate; + // Don't log in the db anymore frequently than 10 seconds + if ((activityDate - userLastActivityDate).TotalSeconds > 10) + { + try + { + // Save this directly. No need to fire off all the events for this. + await _userRepository.SaveUser(user, CancellationToken.None).ConfigureAwait(false); + } + catch (Exception ex) + { + _logger.ErrorException("Error updating user", ex); + } + } + } - // Don't log in the db anymore frequently than 10 seconds - if (lastActivityDate.HasValue && (activityDate - lastActivityDate.Value).TotalSeconds < 10) + if ((activityDate - lastActivityDate).TotalSeconds > 10) { - return session; - } + EventHelper.FireEventIfNotNull(SessionActivity, this, new SessionEventArgs + { + SessionInfo = session - // Save this directly. No need to fire off all the events for this. - await _userRepository.SaveUser(user, CancellationToken.None).ConfigureAwait(false); + }, _logger); + } - EventHelper.FireEventIfNotNull(SessionActivity, this, new SessionEventArgs + var controller = session.SessionController; + if (controller != null) { - SessionInfo = session - - }, _logger); + controller.OnActivity(); + } return session; } @@ -1680,7 +1690,7 @@ namespace MediaBrowser.Server.Implementations.Session deviceId = info.DeviceId; } - return GetSessionInfo(appName, appVersion, deviceId, deviceName, remoteEndpoint, user); + return LogSessionActivity(appName, appVersion, deviceId, deviceName, remoteEndpoint, user); } public Task GetSessionByAuthenticationToken(string token, string deviceId, string remoteEndpoint) diff --git a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs index f51998feac..d4ecd9572e 100644 --- a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs +++ b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs @@ -30,17 +30,28 @@ namespace MediaBrowser.Server.Implementations.Session Sockets = new List(); } + private bool HasOpenSockets + { + get { return GetActiveSockets().Any(); } + } + + public bool SupportsMediaControl + { + get { return HasOpenSockets; } + } + + private bool _isActive; public bool IsSessionActive { get { - return Sockets.Any(i => i.State == WebSocketState.Open); + return _isActive; } } - public bool SupportsMediaControl + public void OnActivity() { - get { return GetActiveSockets().Any(); } + _isActive = true; } private IEnumerable GetActiveSockets() @@ -64,6 +75,8 @@ namespace MediaBrowser.Server.Implementations.Session { if (!GetActiveSockets().Any()) { + _isActive = false; + try { _sessionManager.ReportSessionEnded(Session.Id); diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index f35317cd2a..db3b85e19a 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -432,7 +432,7 @@ namespace MediaBrowser.Server.Startup.Common RegisterSingleInstance(() => new SearchEngine(LogManager, LibraryManager, UserManager)); - HttpServer = ServerFactory.CreateServer(this, LogManager, "Media Browser", "web/index.html"); + HttpServer = ServerFactory.CreateServer(this, LogManager, "Emby", "web/index.html"); RegisterSingleInstance(HttpServer, false); progress.Report(10); diff --git a/MediaBrowser.ServerApplication/ServerNotifyIcon.cs b/MediaBrowser.ServerApplication/ServerNotifyIcon.cs index e3e1359d9a..f04593e903 100644 --- a/MediaBrowser.ServerApplication/ServerNotifyIcon.cs +++ b/MediaBrowser.ServerApplication/ServerNotifyIcon.cs @@ -75,7 +75,7 @@ namespace MediaBrowser.ServerApplication // notifyIcon1.ContextMenuStrip = contextMenuStrip1; notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon"))); - notifyIcon1.Text = "Media Browser"; + notifyIcon1.Text = "Emby"; notifyIcon1.Visible = true; // // contextMenuStrip1 @@ -162,7 +162,7 @@ namespace MediaBrowser.ServerApplication if (_appHost.IsFirstRun) { - Action action = () => notifyIcon1.ShowBalloonTip(5000, "Media Browser", "Welcome to Media Browser Server!", ToolTipIcon.Info); + Action action = () => notifyIcon1.ShowBalloonTip(5000, "Emby", "Welcome to Emby Server!", ToolTipIcon.Info); contextMenuStrip1.Invoke(action); } diff --git a/MediaBrowser.ServerApplication/Splash/SplashForm.Designer.cs b/MediaBrowser.ServerApplication/Splash/SplashForm.Designer.cs index ef3b796996..190a98178c 100644 --- a/MediaBrowser.ServerApplication/Splash/SplashForm.Designer.cs +++ b/MediaBrowser.ServerApplication/Splash/SplashForm.Designer.cs @@ -123,7 +123,7 @@ this.lblStatus.Name = "lblStatus"; this.lblStatus.Size = new System.Drawing.Size(469, 59); this.lblStatus.TabIndex = 0; - this.lblStatus.Text = "Loading Media Browser"; + this.lblStatus.Text = "Loading Emby Server"; this.lblStatus.UseWaitCursor = true; // // panel1 @@ -162,7 +162,7 @@ this.Name = "SplashForm"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Media Browser"; + this.Text = "Emby"; this.UseWaitCursor = true; this.panelMainContainer.ResumeLayout(false); this.panel2.ResumeLayout(false); diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index a93cccfbcf..4262a314dc 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -180,11 +180,9 @@ namespace MediaBrowser.WebDashboard.Api sb.Append(""); //sb.Append(""); sb.Append(""); - sb.Append(""); + sb.Append(""); //sb.Append(""); - sb.Append(""); - sb.Append(""); // http://developer.apple.com/library/ios/#DOCUMENTATION/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html diff --git a/MediaBrowser.XbmcMetadata/Images/XbmcImageSaver.cs b/MediaBrowser.XbmcMetadata/Images/XbmcImageSaver.cs index 054a7eabbe..01eeb5f3b3 100644 --- a/MediaBrowser.XbmcMetadata/Images/XbmcImageSaver.cs +++ b/MediaBrowser.XbmcMetadata/Images/XbmcImageSaver.cs @@ -266,7 +266,7 @@ namespace MediaBrowser.XbmcMetadata.Images public string Name { - get { return "Media Browser/Plex/Xbmc Images"; } + get { return "Emby/Plex/Xbmc Images"; } } } } -- cgit v1.2.3 From 6fbbf913e4b4f70a6e190a1af926905d5fff1d5c Mon Sep 17 00:00:00 2001 From: Mike Date: Mon, 23 Mar 2015 21:37:21 -0400 Subject: Fix season images not showing up when Emby starts. The TvdbSeasonImageProvider was running before the TvdbSeasonImageProvider. This caused the seriesid be null on the series. (This is apparently populated as part of the metadata refresh on the series. Moving that scan before the seasons seems to fix the problem. See the following code from TvdbSeriesImageProvider var seriesId = series != null ? series.GetProviderId(MetadataProviders.Tvdb) : null; if (!string.IsNullOrEmpty(seriesId) && season.IndexNumber.HasValue) --- MediaBrowser.Controller/Entities/TV/Series.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index b4e1d9d6e5..91014ccdad 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -232,7 +232,10 @@ namespace MediaBrowser.Controller.Entities.TV refreshOptions = new MetadataRefreshOptions(refreshOptions); refreshOptions.IsPostRecursiveRefresh = true; - // Refresh songs + // Refresh current item + await RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false); + + // Refresh TV foreach (var item in seasons) { cancellationToken.ThrowIfCancellationRequested(); @@ -245,9 +248,6 @@ namespace MediaBrowser.Controller.Entities.TV progress.Report(percent * 100); } - // Refresh current item - await RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false); - // Refresh all non-songs foreach (var item in otherItems) { -- cgit v1.2.3 From caebcf82c0c0c83dd77cd69051e9fc3a8b37b9ff Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 24 Mar 2015 21:14:24 -0400 Subject: removed ProcessManager --- MediaBrowser.Api/Playback/BaseStreamingService.cs | 7 +- MediaBrowser.Api/Playback/Dash/MpegDashService.cs | 4 +- MediaBrowser.Api/Playback/Hls/BaseHlsService.cs | 3 +- MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs | 3 +- MediaBrowser.Api/Playback/Hls/VideoHlsService.cs | 3 +- .../Playback/Progressive/AudioService.cs | 3 +- .../Progressive/BaseProgressiveStreamingService.cs | 3 +- .../Playback/Progressive/VideoService.cs | 3 +- MediaBrowser.Api/Playback/TranscodingThrottler.cs | 7 +- .../Diagnostics/IProcessManager.cs | 28 -------- .../MediaBrowser.Controller.csproj | 1 - MediaBrowser.Model/Sync/LocalItemQuery.cs | 2 +- .../Diagnostics/LinuxProcessManager.cs | 25 ------- .../MediaBrowser.Server.Mono.csproj | 1 - MediaBrowser.Server.Mono/Native/BaseMonoApp.cs | 13 ---- .../ApplicationHost.cs | 2 - .../Diagnostics/ProcessManager.cs | 23 ------ MediaBrowser.Server.Startup.Common/INativeApp.cs | 7 -- .../MediaBrowser.Server.Startup.Common.csproj | 1 - .../MediaBrowser.ServerApplication.csproj | 1 - .../Native/WindowsApp.cs | 7 -- .../Native/WindowsProcessManager.cs | 83 ---------------------- 22 files changed, 12 insertions(+), 218 deletions(-) delete mode 100644 MediaBrowser.Controller/Diagnostics/IProcessManager.cs delete mode 100644 MediaBrowser.Server.Mono/Diagnostics/LinuxProcessManager.cs delete mode 100644 MediaBrowser.Server.Startup.Common/Diagnostics/ProcessManager.cs delete mode 100644 MediaBrowser.ServerApplication/Native/WindowsProcessManager.cs (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 106085c46b..ae71ac2625 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -3,7 +3,6 @@ using MediaBrowser.Common.IO; using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Devices; -using MediaBrowser.Controller.Diagnostics; using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; @@ -70,18 +69,16 @@ namespace MediaBrowser.Api.Playback protected IDlnaManager DlnaManager { get; private set; } protected IDeviceManager DeviceManager { get; private set; } protected ISubtitleEncoder SubtitleEncoder { get; private set; } - protected IProcessManager ProcessManager { get; private set; } protected IMediaSourceManager MediaSourceManager { get; private set; } protected IZipClient ZipClient { get; private set; } /// /// Initializes a new instance of the class. /// - protected BaseStreamingService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IProcessManager processManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient) + protected BaseStreamingService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient) { ZipClient = zipClient; MediaSourceManager = mediaSourceManager; - ProcessManager = processManager; DeviceManager = deviceManager; SubtitleEncoder = subtitleEncoder; DlnaManager = dlnaManager; @@ -1126,7 +1123,7 @@ namespace MediaBrowser.Api.Playback { if (state.RunTimeTicks.Value >= TimeSpan.FromMinutes(5).Ticks && state.IsInputVideo) { - state.TranscodingThrottler = new TranscodingThrottler(transcodingJob, Logger, ProcessManager); + state.TranscodingThrottler = new TranscodingThrottler(transcodingJob, Logger); state.TranscodingThrottler.Start(); } } diff --git a/MediaBrowser.Api/Playback/Dash/MpegDashService.cs b/MediaBrowser.Api/Playback/Dash/MpegDashService.cs index 38b0d35d11..3c3f4c0397 100644 --- a/MediaBrowser.Api/Playback/Dash/MpegDashService.cs +++ b/MediaBrowser.Api/Playback/Dash/MpegDashService.cs @@ -3,7 +3,6 @@ using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Devices; -using MediaBrowser.Controller.Diagnostics; using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.LiveTv; @@ -55,8 +54,7 @@ namespace MediaBrowser.Api.Playback.Dash public class MpegDashService : BaseHlsService { - public MpegDashService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IProcessManager processManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, INetworkManager networkManager) - : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, liveTvManager, dlnaManager, subtitleEncoder, deviceManager, processManager, mediaSourceManager, zipClient) + public MpegDashService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, INetworkManager networkManager) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, liveTvManager, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient) { NetworkManager = networkManager; } diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs index d4c0ddc70e..09574e772c 100644 --- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs @@ -1,7 +1,6 @@ using MediaBrowser.Common.IO; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Devices; -using MediaBrowser.Controller.Diagnostics; using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.LiveTv; @@ -23,7 +22,7 @@ namespace MediaBrowser.Api.Playback.Hls /// public abstract class BaseHlsService : BaseStreamingService { - protected BaseHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IProcessManager processManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, liveTvManager, dlnaManager, subtitleEncoder, deviceManager, processManager, mediaSourceManager, zipClient) + protected BaseHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, liveTvManager, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient) { } diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs index e35570f765..c9ae6669b6 100644 --- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs @@ -2,7 +2,6 @@ using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Devices; -using MediaBrowser.Controller.Diagnostics; using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.LiveTv; @@ -63,7 +62,7 @@ namespace MediaBrowser.Api.Playback.Hls public class DynamicHlsService : BaseHlsService { - public DynamicHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IProcessManager processManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, INetworkManager networkManager) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, liveTvManager, dlnaManager, subtitleEncoder, deviceManager, processManager, mediaSourceManager, zipClient) + public DynamicHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, INetworkManager networkManager) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, liveTvManager, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient) { NetworkManager = networkManager; } diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs index 533764f64a..69e86777b3 100644 --- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs @@ -1,7 +1,6 @@ using MediaBrowser.Common.IO; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Devices; -using MediaBrowser.Controller.Diagnostics; using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.LiveTv; @@ -57,7 +56,7 @@ namespace MediaBrowser.Api.Playback.Hls /// public class VideoHlsService : BaseHlsService { - public VideoHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IProcessManager processManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, liveTvManager, dlnaManager, subtitleEncoder, deviceManager, processManager, mediaSourceManager, zipClient) + public VideoHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, liveTvManager, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient) { } diff --git a/MediaBrowser.Api/Playback/Progressive/AudioService.cs b/MediaBrowser.Api/Playback/Progressive/AudioService.cs index f3193c9548..af2cf6b038 100644 --- a/MediaBrowser.Api/Playback/Progressive/AudioService.cs +++ b/MediaBrowser.Api/Playback/Progressive/AudioService.cs @@ -2,7 +2,6 @@ using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Devices; -using MediaBrowser.Controller.Diagnostics; using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Library; @@ -32,7 +31,7 @@ namespace MediaBrowser.Api.Playback.Progressive /// public class AudioService : BaseProgressiveStreamingService { - public AudioService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IProcessManager processManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IImageProcessor imageProcessor, IHttpClient httpClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, liveTvManager, dlnaManager, subtitleEncoder, deviceManager, processManager, mediaSourceManager, zipClient, imageProcessor, httpClient) + public AudioService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IImageProcessor imageProcessor, IHttpClient httpClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, liveTvManager, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, imageProcessor, httpClient) { } diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs index baf6ab653a..7a2990e2af 100644 --- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs +++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs @@ -2,7 +2,6 @@ using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Devices; -using MediaBrowser.Controller.Diagnostics; using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Library; @@ -28,7 +27,7 @@ namespace MediaBrowser.Api.Playback.Progressive protected readonly IImageProcessor ImageProcessor; protected readonly IHttpClient HttpClient; - protected BaseProgressiveStreamingService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IProcessManager processManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IImageProcessor imageProcessor, IHttpClient httpClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, liveTvManager, dlnaManager, subtitleEncoder, deviceManager, processManager, mediaSourceManager, zipClient) + protected BaseProgressiveStreamingService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IImageProcessor imageProcessor, IHttpClient httpClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, liveTvManager, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient) { ImageProcessor = imageProcessor; HttpClient = httpClient; diff --git a/MediaBrowser.Api/Playback/Progressive/VideoService.cs b/MediaBrowser.Api/Playback/Progressive/VideoService.cs index e7b90c820f..eb18288e98 100644 --- a/MediaBrowser.Api/Playback/Progressive/VideoService.cs +++ b/MediaBrowser.Api/Playback/Progressive/VideoService.cs @@ -2,7 +2,6 @@ using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Devices; -using MediaBrowser.Controller.Diagnostics; using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Library; @@ -63,7 +62,7 @@ namespace MediaBrowser.Api.Playback.Progressive /// public class VideoService : BaseProgressiveStreamingService { - public VideoService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IProcessManager processManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IImageProcessor imageProcessor, IHttpClient httpClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, liveTvManager, dlnaManager, subtitleEncoder, deviceManager, processManager, mediaSourceManager, zipClient, imageProcessor, httpClient) + public VideoService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IImageProcessor imageProcessor, IHttpClient httpClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, liveTvManager, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, imageProcessor, httpClient) { } diff --git a/MediaBrowser.Api/Playback/TranscodingThrottler.cs b/MediaBrowser.Api/Playback/TranscodingThrottler.cs index 943a4d0652..38ce9e2989 100644 --- a/MediaBrowser.Api/Playback/TranscodingThrottler.cs +++ b/MediaBrowser.Api/Playback/TranscodingThrottler.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Controller.Diagnostics; -using MediaBrowser.Model.Logging; +using MediaBrowser.Model.Logging; using System; using System.IO; using System.Threading; @@ -10,17 +9,15 @@ namespace MediaBrowser.Api.Playback { private readonly TranscodingJob _job; private readonly ILogger _logger; - private readonly IProcessManager _processManager; private Timer _timer; private bool _isPaused; private readonly long _gapLengthInTicks = TimeSpan.FromMinutes(2).Ticks; - public TranscodingThrottler(TranscodingJob job, ILogger logger, IProcessManager processManager) + public TranscodingThrottler(TranscodingJob job, ILogger logger) { _job = job; _logger = logger; - _processManager = processManager; } public void Start() diff --git a/MediaBrowser.Controller/Diagnostics/IProcessManager.cs b/MediaBrowser.Controller/Diagnostics/IProcessManager.cs deleted file mode 100644 index 2e076bd882..0000000000 --- a/MediaBrowser.Controller/Diagnostics/IProcessManager.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Diagnostics; - -namespace MediaBrowser.Controller.Diagnostics -{ - /// - /// Interface IProcessManager - /// - public interface IProcessManager - { - /// - /// Gets a value indicating whether [supports suspension]. - /// - /// true if [supports suspension]; otherwise, false. - bool SupportsSuspension { get; } - - /// - /// Suspends the process. - /// - /// The process. - void SuspendProcess(Process process); - - /// - /// Resumes the process. - /// - /// The process. - void ResumeProcess(Process process); - } -} diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index e4a31c82d2..d7a69ceb22 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -105,7 +105,6 @@ - diff --git a/MediaBrowser.Model/Sync/LocalItemQuery.cs b/MediaBrowser.Model/Sync/LocalItemQuery.cs index 0993929083..795a557ca0 100644 --- a/MediaBrowser.Model/Sync/LocalItemQuery.cs +++ b/MediaBrowser.Model/Sync/LocalItemQuery.cs @@ -4,7 +4,7 @@ namespace MediaBrowser.Model.Sync public class LocalItemQuery { public string ServerId { get; set; } - public string AlbumArtist { get; set; } + public string AlbumArtistId { get; set; } public string AlbumId { get; set; } public string SeriesId { get; set; } public string Type { get; set; } diff --git a/MediaBrowser.Server.Mono/Diagnostics/LinuxProcessManager.cs b/MediaBrowser.Server.Mono/Diagnostics/LinuxProcessManager.cs deleted file mode 100644 index a66365212b..0000000000 --- a/MediaBrowser.Server.Mono/Diagnostics/LinuxProcessManager.cs +++ /dev/null @@ -1,25 +0,0 @@ -using MediaBrowser.Controller.Diagnostics; -using System.Diagnostics; - -namespace MediaBrowser.Server.Mono.Diagnostics -{ - public class LinuxProcessManager : IProcessManager - { - public bool SupportsSuspension - { - get { return true; } - } - - public void SuspendProcess(Process process) - { - // http://jumptuck.com/2011/11/23/quick-tip-pause-process-linux/ - process.StandardInput.WriteLine("^Z"); - } - - public void ResumeProcess(Process process) - { - // http://jumptuck.com/2011/11/23/quick-tip-pause-process-linux/ - process.StandardInput.WriteLine("fg"); - } - } -} diff --git a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj index 8f552ee362..cd010e1c13 100644 --- a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj +++ b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj @@ -74,7 +74,6 @@ Properties\SharedVersion.cs - diff --git a/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs b/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs index 139661aa28..1ec0109ad8 100644 --- a/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs +++ b/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs @@ -1,8 +1,6 @@ using MediaBrowser.Common.Net; -using MediaBrowser.Controller.Diagnostics; using MediaBrowser.IsoMounter; using MediaBrowser.Model.Logging; -using MediaBrowser.Server.Mono.Diagnostics; using MediaBrowser.Server.Mono.Networking; using MediaBrowser.Server.Startup.Common; using Mono.Unix.Native; @@ -191,16 +189,5 @@ namespace MediaBrowser.Server.Mono.Native public string sysname = string.Empty; public string machine = string.Empty; } - - - public IProcessManager GetProcessManager() - { - if (Environment.OperatingSystem == Startup.Common.OperatingSystem.Linux) - { - return new LinuxProcessManager(); - } - - return new ProcessManager(); - } } } diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index db3b85e19a..9a7f03341c 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -381,8 +381,6 @@ namespace MediaBrowser.Server.Startup.Common RegisterSingleInstance(ServerConfigurationManager); - RegisterSingleInstance(NativeApp.GetProcessManager()); - LocalizationManager = new LocalizationManager(ServerConfigurationManager, FileSystemManager, JsonSerializer); RegisterSingleInstance(LocalizationManager); diff --git a/MediaBrowser.Server.Startup.Common/Diagnostics/ProcessManager.cs b/MediaBrowser.Server.Startup.Common/Diagnostics/ProcessManager.cs deleted file mode 100644 index d01756d0e2..0000000000 --- a/MediaBrowser.Server.Startup.Common/Diagnostics/ProcessManager.cs +++ /dev/null @@ -1,23 +0,0 @@ -using MediaBrowser.Controller.Diagnostics; -using System.Diagnostics; - -namespace MediaBrowser.Server.Mono.Diagnostics -{ - public class ProcessManager : IProcessManager - { - public void SuspendProcess(Process process) - { - process.PriorityClass = ProcessPriorityClass.Idle; - } - - public void ResumeProcess(Process process) - { - process.PriorityClass = ProcessPriorityClass.Normal; - } - - public bool SupportsSuspension - { - get { return true; } - } - } -} diff --git a/MediaBrowser.Server.Startup.Common/INativeApp.cs b/MediaBrowser.Server.Startup.Common/INativeApp.cs index 1c4b5b1d58..2dbd844baa 100644 --- a/MediaBrowser.Server.Startup.Common/INativeApp.cs +++ b/MediaBrowser.Server.Startup.Common/INativeApp.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Net; -using MediaBrowser.Controller.Diagnostics; using MediaBrowser.Model.Logging; using System.Collections.Generic; using System.Reflection; @@ -85,11 +84,5 @@ namespace MediaBrowser.Server.Startup.Common /// Prevents the system stand by. /// void PreventSystemStandby(); - - /// - /// Gets the process manager. - /// - /// IProcessManager. - IProcessManager GetProcessManager(); } } diff --git a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj index 625b29d369..38e07fde49 100644 --- a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj +++ b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj @@ -56,7 +56,6 @@ - diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 888b41b212..2adb9fbbc6 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -113,7 +113,6 @@ - diff --git a/MediaBrowser.ServerApplication/Native/WindowsApp.cs b/MediaBrowser.ServerApplication/Native/WindowsApp.cs index 74abcb36c2..476fb58b9d 100644 --- a/MediaBrowser.ServerApplication/Native/WindowsApp.cs +++ b/MediaBrowser.ServerApplication/Native/WindowsApp.cs @@ -1,9 +1,7 @@ using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; -using MediaBrowser.Controller.Diagnostics; using MediaBrowser.IsoMounter; using MediaBrowser.Model.Logging; -using MediaBrowser.Server.Mono.Diagnostics; using MediaBrowser.Server.Startup.Common; using MediaBrowser.ServerApplication.Networking; using System.Collections.Generic; @@ -111,10 +109,5 @@ namespace MediaBrowser.ServerApplication.Native { Standby.PreventSystemStandby(); } - - public IProcessManager GetProcessManager() - { - return new WindowsProcessManager(); - } } } diff --git a/MediaBrowser.ServerApplication/Native/WindowsProcessManager.cs b/MediaBrowser.ServerApplication/Native/WindowsProcessManager.cs deleted file mode 100644 index a88f5c1e50..0000000000 --- a/MediaBrowser.ServerApplication/Native/WindowsProcessManager.cs +++ /dev/null @@ -1,83 +0,0 @@ -using MediaBrowser.Controller.Diagnostics; -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; - -namespace MediaBrowser.ServerApplication.Native -{ - public class WindowsProcessManager : IProcessManager - { - public void SuspendProcess(Process process) - { - process.Suspend(); - } - - public void ResumeProcess(Process process) - { - process.Resume(); - } - - public bool SupportsSuspension - { - get { return true; } - } - } - - public static class ProcessExtension - { - [DllImport("kernel32.dll")] - static extern IntPtr OpenThread(ThreadAccess dwDesiredAccess, bool bInheritHandle, uint dwThreadId); - [DllImport("kernel32.dll")] - static extern uint SuspendThread(IntPtr hThread); - [DllImport("kernel32.dll")] - static extern int ResumeThread(IntPtr hThread); - [DllImport("kernel32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool CloseHandle(IntPtr hThread); - - public static void Suspend(this Process process) - { - foreach (ProcessThread thread in process.Threads) - { - var pOpenThread = OpenThread(ThreadAccess.SUSPEND_RESUME, false, (uint)thread.Id); - if (pOpenThread == IntPtr.Zero) - { - break; - } - SuspendThread(pOpenThread); - CloseHandle(pOpenThread); - } - } - public static void Resume(this Process process) - { - foreach (ProcessThread thread in process.Threads) - { - var pOpenThread = OpenThread(ThreadAccess.SUSPEND_RESUME, false, (uint)thread.Id); - if (pOpenThread == IntPtr.Zero) - { - break; - } - ResumeThread(pOpenThread); - CloseHandle(pOpenThread); - } - } - public static void Print(this Process process) - { - Console.WriteLine("{0,8} {1}", process.Id, process.ProcessName); - } - } - - [Flags] - public enum ThreadAccess : int - { - TERMINATE = (0x0001), - SUSPEND_RESUME = (0x0002), - GET_CONTEXT = (0x0008), - SET_CONTEXT = (0x0010), - SET_INFORMATION = (0x0020), - QUERY_INFORMATION = (0x0040), - SET_THREAD_TOKEN = (0x0080), - IMPERSONATE = (0x0100), - DIRECT_IMPERSONATION = (0x0200) - } -} -- cgit v1.2.3 From bbaf88ae1f088584f9130852cd99ad372adce136 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 24 Mar 2015 23:54:32 -0400 Subject: update tv db cleanup --- MediaBrowser.Controller/Persistence/IItemRepository.cs | 2 +- MediaBrowser.Dlna/PlayTo/PlayToController.cs | 5 ----- .../HttpServer/Security/SessionContext.cs | 16 ++++++++-------- .../LiveTv/LiveTvManager.cs | 2 +- .../Persistence/SqliteItemRepository.cs | 6 +++--- .../Photos/BaseDynamicImageProvider.cs | 2 +- .../Session/WebSocketController.cs | 10 +++++++++- 7 files changed, 23 insertions(+), 20 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Persistence/IItemRepository.cs b/MediaBrowser.Controller/Persistence/IItemRepository.cs index 245c81d706..f306518df4 100644 --- a/MediaBrowser.Controller/Persistence/IItemRepository.cs +++ b/MediaBrowser.Controller/Persistence/IItemRepository.cs @@ -107,7 +107,7 @@ namespace MediaBrowser.Controller.Persistence /// /// The type. /// IEnumerable{Guid}. - IEnumerable GetItemsOfType(Type type); + IEnumerable GetItemsOfType(Type type); /// /// Saves the children. diff --git a/MediaBrowser.Dlna/PlayTo/PlayToController.cs b/MediaBrowser.Dlna/PlayTo/PlayToController.cs index d52428dc9e..f8f939f479 100644 --- a/MediaBrowser.Dlna/PlayTo/PlayToController.cs +++ b/MediaBrowser.Dlna/PlayTo/PlayToController.cs @@ -134,11 +134,6 @@ namespace MediaBrowser.Dlna.PlayTo } } - private string GetServerAddress() - { - return _serverAddress; - } - async void _device_MediaChanged(object sender, MediaChangedEventArgs e) { try diff --git a/MediaBrowser.Server.Implementations/HttpServer/Security/SessionContext.cs b/MediaBrowser.Server.Implementations/HttpServer/Security/SessionContext.cs index c8278dc545..f40d117c42 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/Security/SessionContext.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/Security/SessionContext.cs @@ -25,14 +25,14 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security { var authorization = _authContext.GetAuthorizationInfo(requestContext); - if (!string.IsNullOrWhiteSpace(authorization.Token)) - { - var auth = GetTokenInfo(requestContext); - if (auth != null) - { - return _sessionManager.GetSessionByAuthenticationToken(auth, authorization.DeviceId, requestContext.RemoteIp, authorization.Version); - } - } + //if (!string.IsNullOrWhiteSpace(authorization.Token)) + //{ + // var auth = GetTokenInfo(requestContext); + // if (auth != null) + // { + // return _sessionManager.GetSessionByAuthenticationToken(auth, authorization.DeviceId, requestContext.RemoteIp, authorization.Version); + // } + //} var session = _sessionManager.GetSession(authorization.DeviceId, authorization.Client, authorization.Version); return Task.FromResult(session); diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index ffa7743006..2bc6cbadfe 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -1115,7 +1115,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv { cancellationToken.ThrowIfCancellationRequested(); - if (!currentIdList.Contains(new Guid(programId))) + if (!currentIdList.Contains(programId)) { var program = _libraryManager.GetItemById(programId); diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index 4c45d5b838..12ce60d45b 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -521,8 +521,8 @@ namespace MediaBrowser.Server.Implementations.Persistence } } } - - public IEnumerable GetItemsOfType(Type type) + + public IEnumerable GetItemsOfType(Type type) { if (type == null) { @@ -541,7 +541,7 @@ namespace MediaBrowser.Server.Implementations.Persistence { while (reader.Read()) { - yield return reader.GetString(0); + yield return reader.GetGuid(0); } } } diff --git a/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs b/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs index 2cfc873dea..6fb02358e4 100644 --- a/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs +++ b/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs @@ -125,7 +125,7 @@ namespace MediaBrowser.Server.Implementations.Photos protected abstract Task> GetItemsWithImages(IHasImages item); - private const string Version = "3"; + private const string Version = "4"; protected string GetConfigurationCacheKey(List items, string itemName) { var parts = Version + "_" + (itemName ?? string.Empty) + "_" + diff --git a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs index 1e19495337..765664299e 100644 --- a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs +++ b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs @@ -41,17 +41,25 @@ namespace MediaBrowser.Server.Implementations.Session } private bool _isActive; + private DateTime _lastActivityDate; public bool IsSessionActive { get { - return HasOpenSockets; + if (HasOpenSockets) + { + return true; + } + + //return false; + return _isActive && (DateTime.UtcNow - _lastActivityDate).TotalMinutes <= 10; } } public void OnActivity() { _isActive = true; + _lastActivityDate = DateTime.UtcNow; } private IEnumerable GetActiveSockets() -- cgit v1.2.3