diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-08-29 15:01:00 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-29 15:01:00 -0400 |
| commit | d02cedb5b504ce49e76ae945fa8fe9258f9b58be (patch) | |
| tree | cce3e9e041d9cd6948eae5eac0ce7a99d17887fe /MediaBrowser.Server.Implementations | |
| parent | 1d0e341652b6b08484564a741a5eee49d5a1704d (diff) | |
| parent | e8977c44857907cab171e4726db096508673735a (diff) | |
Merge pull request #2124 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.Server.Implementations')
7 files changed, 56 insertions, 38 deletions
diff --git a/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationNotifier.cs b/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationNotifier.cs index 38b90647c..5c3814f66 100644 --- a/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationNotifier.cs +++ b/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationNotifier.cs @@ -1,14 +1,11 @@ -using MediaBrowser.Controller.FileOrganization; +using MediaBrowser.Common.ScheduledTasks; +using MediaBrowser.Controller.FileOrganization; using MediaBrowser.Controller.Plugins; -using MediaBrowser.Model.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using MediaBrowser.Controller.Session; using MediaBrowser.Model.Events; using MediaBrowser.Model.FileOrganization; -using MediaBrowser.Controller.Session; +using MediaBrowser.Model.Logging; +using System; using System.Threading; namespace MediaBrowser.Server.Implementations.FileOrganization @@ -20,11 +17,13 @@ namespace MediaBrowser.Server.Implementations.FileOrganization { private readonly IFileOrganizationService _organizationService; private readonly ISessionManager _sessionManager; + private readonly ITaskManager _taskManager; - public FileOrganizationNotifier(ILogger logger, IFileOrganizationService organizationService, ISessionManager sessionManager) + public FileOrganizationNotifier(ILogger logger, IFileOrganizationService organizationService, ISessionManager sessionManager, ITaskManager taskManager) { _organizationService = organizationService; _sessionManager = sessionManager; + _taskManager = taskManager; } public void Run() @@ -33,34 +32,47 @@ namespace MediaBrowser.Server.Implementations.FileOrganization _organizationService.ItemRemoved += _organizationService_ItemRemoved; _organizationService.ItemUpdated += _organizationService_ItemUpdated; _organizationService.LogReset += _organizationService_LogReset; + + //_taskManager.TaskCompleted += _taskManager_TaskCompleted; } private void _organizationService_LogReset(object sender, EventArgs e) { - _sessionManager.SendMessageToAdminSessions("AutoOrganizeUpdate", (FileOrganizationResult)null, CancellationToken.None); + _sessionManager.SendMessageToAdminSessions("AutoOrganize_LogReset", (FileOrganizationResult)null, CancellationToken.None); } private void _organizationService_ItemUpdated(object sender, GenericEventArgs<FileOrganizationResult> e) { - _sessionManager.SendMessageToAdminSessions("AutoOrganizeUpdate", e.Argument, CancellationToken.None); + _sessionManager.SendMessageToAdminSessions("AutoOrganize_ItemUpdated", e.Argument, CancellationToken.None); } private void _organizationService_ItemRemoved(object sender, GenericEventArgs<FileOrganizationResult> e) { - _sessionManager.SendMessageToAdminSessions("AutoOrganizeUpdate", (FileOrganizationResult)null, CancellationToken.None); + _sessionManager.SendMessageToAdminSessions("AutoOrganize_ItemRemoved", e.Argument, CancellationToken.None); } private void _organizationService_ItemAdded(object sender, GenericEventArgs<FileOrganizationResult> e) { - _sessionManager.SendMessageToAdminSessions("AutoOrganizeUpdate", (FileOrganizationResult)null, CancellationToken.None); + _sessionManager.SendMessageToAdminSessions("AutoOrganize_ItemAdded", e.Argument, CancellationToken.None); } + //private void _taskManager_TaskCompleted(object sender, TaskCompletionEventArgs e) + //{ + // var taskWithKey = e.Task.ScheduledTask as IHasKey; + // if (taskWithKey != null && taskWithKey.Key == "AutoOrganize") + // { + // _sessionManager.SendMessageToAdminSessions("AutoOrganize_TaskCompleted", (FileOrganizationResult)null, CancellationToken.None); + // } + //} + public void Dispose() { _organizationService.ItemAdded -= _organizationService_ItemAdded; _organizationService.ItemRemoved -= _organizationService_ItemRemoved; _organizationService.ItemUpdated -= _organizationService_ItemUpdated; _organizationService.LogReset -= _organizationService_LogReset; + + //_taskManager.TaskCompleted -= _taskManager_TaskCompleted; } diff --git a/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs b/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs index 7c7a535cd..4a43befed 100644 --- a/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs +++ b/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs @@ -216,7 +216,8 @@ namespace MediaBrowser.Server.Implementations.Intros } return allIntros - .Where(i => IsMatch(i.Path, codec)); + .Where(i => IsMatch(i.Path, codec)) + .OrderBy(i => Guid.NewGuid()); } private IEnumerable<IntroInfo> GetMediaInfoIntrosByAudioStream(List<IntroInfo> allIntros, MediaStream stream) @@ -229,13 +230,15 @@ namespace MediaBrowser.Server.Implementations.Intros } return allIntros - .Where(i => IsAudioMatch(i.Path, stream)); + .Where(i => IsAudioMatch(i.Path, stream)) + .OrderBy(i => Guid.NewGuid()); } private IEnumerable<IntroInfo> GetMediaInfoIntrosByTags(List<IntroInfo> allIntros, List<string> tags) { return allIntros - .Where(i => tags.Any(t => IsMatch(i.Path, t))); + .Where(i => tags.Any(t => IsMatch(i.Path, t))) + .OrderBy(i => Guid.NewGuid()); } private bool IsMatch(string file, string attribute) diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index cc3a7e41f..5d556e3a6 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -1088,10 +1088,6 @@ namespace MediaBrowser.Server.Implementations.Library await RunPostScanTasks(innerProgress, cancellationToken).ConfigureAwait(false); progress.Report(100); - - // Bad practice, i know. But we keep a lot in memory, unfortunately. - GC.Collect(2, GCCollectionMode.Forced, true); - GC.Collect(2, GCCollectionMode.Forced, true); } /// <summary> diff --git a/MediaBrowser.Server.Implementations/Library/Validators/PeopleValidator.cs b/MediaBrowser.Server.Implementations/Library/Validators/PeopleValidator.cs index d90b9615b..93b9c0da1 100644 --- a/MediaBrowser.Server.Implementations/Library/Validators/PeopleValidator.cs +++ b/MediaBrowser.Server.Implementations/Library/Validators/PeopleValidator.cs @@ -165,10 +165,6 @@ namespace MediaBrowser.Server.Implementations.Library.Validators progress.Report(100); _logger.Info("People validation complete"); - - // Bad practice, i know. But we keep a lot in memory, unfortunately. - GC.Collect(2, GCCollectionMode.Forced, true); - GC.Collect(2, GCCollectionMode.Forced, true); } } } diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs index 37e10d925..9485e0325 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs @@ -55,6 +55,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV { name += " " + info.OriginalAirDate.Value.ToString("yyyy-MM-dd"); } + else + { + name += " " + DateTime.Now.ToString("yyyy-MM-dd"); + } if (!string.IsNullOrWhiteSpace(info.EpisodeTitle)) { diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs index 1e4487757..ba5c604ed 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs @@ -284,19 +284,19 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp var capabilitiesElement = deviceElement.Element(n1 + "X_SATIPCAP"); if (capabilitiesElement != null) { - _capabilities = capabilitiesElement.Value; - if (capabilitiesElement.Value.Contains(',')) - { - string[] capabilities = capabilitiesElement.Value.Split(','); - foreach (var capability in capabilities) - { - ReadCapability(capability); - } - } - else - { - ReadCapability(capabilitiesElement.Value); - } + //_capabilities = capabilitiesElement.Value; + //if (capabilitiesElement.Value.Contains(',')) + //{ + // string[] capabilities = capabilitiesElement.Value.Split(','); + // foreach (var capability in capabilities) + // { + // ReadCapability(capability); + // } + //} + //else + //{ + // ReadCapability(capabilitiesElement.Value); + //} } else { diff --git a/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs b/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs index 46ba7d2e7..67ddcc5cc 100644 --- a/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs +++ b/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs @@ -123,10 +123,17 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder { if (extractImages) { - if (video.VideoType == VideoType.HdDvd || video.VideoType == VideoType.Iso || video.VideoType == VideoType.BluRay || video.VideoType == VideoType.Dvd) + if (video.VideoType == VideoType.HdDvd || video.VideoType == VideoType.Iso) { continue; } + if (video.VideoType == VideoType.BluRay || video.VideoType == VideoType.Dvd) + { + if (video.PlayableStreamFileNames.Count != 1) + { + continue; + } + } // Add some time for the first chapter to make sure we don't end up with a black image var time = chapter.StartPositionTicks == 0 ? TimeSpan.FromTicks(Math.Min(FirstChapterTicks, video.RunTimeTicks ?? 0)) : TimeSpan.FromTicks(chapter.StartPositionTicks); |
