diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-04-16 15:28:00 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-04-16 15:28:00 -0400 |
| commit | f3f3da0d8be8b7e6c956982b525283ae4b86876e (patch) | |
| tree | b49edf8c7291886f46569437349e1075b30c66f5 | |
| parent | b0839ffd2c10cb7a8ec0837f897db61ddd3a7c01 (diff) | |
| parent | 18dbdb194b6db75c1acb5457e9797d8b37150c07 (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/Emby
545 files changed, 3663 insertions, 3272 deletions
diff --git a/Emby.Drawing/Common/ImageHeader.cs b/Emby.Drawing/Common/ImageHeader.cs index 266dcdfb8..b5c672a56 100644 --- a/Emby.Drawing/Common/ImageHeader.cs +++ b/Emby.Drawing/Common/ImageHeader.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Model.Drawing; +using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Logging; using System; using System.Collections.Generic; diff --git a/Emby.Drawing/GDI/DynamicImageHelpers.cs b/Emby.Drawing/GDI/DynamicImageHelpers.cs index 5cedf820d..7b8ef2f98 100644 --- a/Emby.Drawing/GDI/DynamicImageHelpers.cs +++ b/Emby.Drawing/GDI/DynamicImageHelpers.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using System.Collections.Generic; +using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; diff --git a/Emby.Drawing/ImageMagick/PlayedIndicatorDrawer.cs b/Emby.Drawing/ImageMagick/PlayedIndicatorDrawer.cs index 0870b3767..d838410b9 100644 --- a/Emby.Drawing/ImageMagick/PlayedIndicatorDrawer.cs +++ b/Emby.Drawing/ImageMagick/PlayedIndicatorDrawer.cs @@ -6,7 +6,6 @@ using System; using System.IO; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; namespace Emby.Drawing.ImageMagick { diff --git a/Emby.Drawing/ImageMagick/StripCollageBuilder.cs b/Emby.Drawing/ImageMagick/StripCollageBuilder.cs index a7e3a155d..c9e291a5e 100644 --- a/Emby.Drawing/ImageMagick/StripCollageBuilder.cs +++ b/Emby.Drawing/ImageMagick/StripCollageBuilder.cs @@ -3,7 +3,6 @@ using MediaBrowser.Common.Configuration; using System; using System.Collections.Generic; using CommonIO; -using MediaBrowser.Common.IO; namespace Emby.Drawing.ImageMagick { @@ -296,9 +295,9 @@ namespace Emby.Drawing.ImageMagick wand.OpenImage("gradient:#111111-#111111"); using (var draw = new DrawingWand()) { - var iSlice = Convert.ToInt32(width * .1166666667 * 2); + var iSlice = Convert.ToInt32(width * 0.24125); int iTrans = Convert.ToInt32(height * .25); - int iHeight = Convert.ToInt32(height * .62); + int iHeight = Convert.ToInt32(height * .70); var horizontalImagePadding = Convert.ToInt32(width * 0.0125); foreach (var element in wandImages.ImageList) @@ -340,7 +339,7 @@ namespace Emby.Drawing.ImageMagick wandList.AddImage(mwr); int ex = (int)(wand.CurrentImage.Width - mwg.CurrentImage.Width) / 2; - wand.CurrentImage.CompositeImage(wandList.AppendImages(true), CompositeOperator.AtopCompositeOp, ex, Convert.ToInt32(height * .085)); + wand.CurrentImage.CompositeImage(wandList.AppendImages(true), CompositeOperator.AtopCompositeOp, ex, Convert.ToInt32(height * .045)); } } } @@ -361,9 +360,9 @@ namespace Emby.Drawing.ImageMagick wand.OpenImage("gradient:#111111-#111111"); using (var draw = new DrawingWand()) { - var iSlice = Convert.ToInt32(width * .3); + var iSlice = Convert.ToInt32(width * .32); int iTrans = Convert.ToInt32(height * .25); - int iHeight = Convert.ToInt32(height * .63); + int iHeight = Convert.ToInt32(height * .68); var horizontalImagePadding = Convert.ToInt32(width * 0.02); foreach (var element in wandImages.ImageList) @@ -405,7 +404,7 @@ namespace Emby.Drawing.ImageMagick wandList.AddImage(mwr); int ex = (int)(wand.CurrentImage.Width - mwg.CurrentImage.Width) / 2; - wand.CurrentImage.CompositeImage(wandList.AppendImages(true), CompositeOperator.AtopCompositeOp, ex, Convert.ToInt32(height * .07)); + wand.CurrentImage.CompositeImage(wandList.AppendImages(true), CompositeOperator.AtopCompositeOp, ex, Convert.ToInt32(height * .03)); } } } diff --git a/Emby.Drawing/ImageMagick/UnplayedCountIndicator.cs b/Emby.Drawing/ImageMagick/UnplayedCountIndicator.cs index d3d9c1e7a..1d35b52c4 100644 --- a/Emby.Drawing/ImageMagick/UnplayedCountIndicator.cs +++ b/Emby.Drawing/ImageMagick/UnplayedCountIndicator.cs @@ -1,6 +1,5 @@ using ImageMagickSharp; using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Model.Drawing; using System.Globalization; using CommonIO; diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index 89e2649b5..dc93cb730 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Entities; diff --git a/Emby.Drawing/Properties/AssemblyInfo.cs b/Emby.Drawing/Properties/AssemblyInfo.cs index fba168d03..b9e9c2ff7 100644 --- a/Emby.Drawing/Properties/AssemblyInfo.cs +++ b/Emby.Drawing/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index 117ff2305..66ca8c25d 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -1,6 +1,5 @@ using MediaBrowser.Api.Playback; using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Plugins; @@ -350,7 +349,7 @@ namespace MediaBrowser.Api if (job.Type != TranscodingJobType.Progressive) { - timerDuration = 1800000; + timerDuration = 60000; } job.PingTimeout = timerDuration; diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs index 4f3e3fb28..30750b374 100644 --- a/MediaBrowser.Api/BaseApiService.cs +++ b/MediaBrowser.Api/BaseApiService.cs @@ -9,7 +9,6 @@ using MediaBrowser.Model.Logging; using ServiceStack.Text.Controller; using ServiceStack.Web; using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; diff --git a/MediaBrowser.Api/ConfigurationService.cs b/MediaBrowser.Api/ConfigurationService.cs index 3c0b7f140..446415fbb 100644 --- a/MediaBrowser.Api/ConfigurationService.cs +++ b/MediaBrowser.Api/ConfigurationService.cs @@ -1,6 +1,4 @@ -using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Api/DisplayPreferencesService.cs b/MediaBrowser.Api/DisplayPreferencesService.cs index df04de79e..69c4c89ee 100644 --- a/MediaBrowser.Api/DisplayPreferencesService.cs +++ b/MediaBrowser.Api/DisplayPreferencesService.cs @@ -3,7 +3,6 @@ using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Serialization; using ServiceStack; -using System; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.Api/Images/ImageByNameService.cs b/MediaBrowser.Api/Images/ImageByNameService.cs index e17b35569..7bcb39b4d 100644 --- a/MediaBrowser.Api/Images/ImageByNameService.cs +++ b/MediaBrowser.Api/Images/ImageByNameService.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Net; diff --git a/MediaBrowser.Api/Images/RemoteImageService.cs b/MediaBrowser.Api/Images/RemoteImageService.cs index 9683632b2..02d1cdbe2 100644 --- a/MediaBrowser.Api/Images/RemoteImageService.cs +++ b/MediaBrowser.Api/Images/RemoteImageService.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller; using MediaBrowser.Controller.Dto; diff --git a/MediaBrowser.Api/ItemLookupService.cs b/MediaBrowser.Api/ItemLookupService.cs index 8e1abef14..41bfd9da2 100644 --- a/MediaBrowser.Api/ItemLookupService.cs +++ b/MediaBrowser.Api/ItemLookupService.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; @@ -203,14 +202,19 @@ namespace MediaBrowser.Api // } //} Logger.Info("Setting provider id's to item {0}-{1}: {2}", item.Id, item.Name, _json.SerializeToString(request.ProviderIds)); + + // Since the refresh process won't erase provider Ids, we need to set this explicitly now. item.ProviderIds = request.ProviderIds; + //item.ProductionYear = request.ProductionYear; + //item.Name = request.Name; - var task = _providerManager.RefreshFullItem(item, new MetadataRefreshOptions(_fileSystem) + var task = _providerManager.RefreshFullItem(item, new MetadataRefreshOptions(_fileSystem) { MetadataRefreshMode = MetadataRefreshMode.FullRefresh, ImageRefreshMode = ImageRefreshMode.FullRefresh, ReplaceAllMetadata = true, - ReplaceAllImages = request.ReplaceAllImages + ReplaceAllImages = request.ReplaceAllImages, + SearchResult = request }, CancellationToken.None); Task.WaitAll(task); @@ -235,7 +239,7 @@ namespace MediaBrowser.Api contentPath = await reader.ReadToEndAsync().ConfigureAwait(false); } - if (_fileSystem.FileExists(contentPath)) + if (_fileSystem.FileExists(contentPath)) { return ToStaticFileResult(contentPath); } @@ -276,7 +280,7 @@ namespace MediaBrowser.Api var fullCachePath = GetFullCachePath(urlHash + "." + ext); - _fileSystem.CreateDirectory(Path.GetDirectoryName(fullCachePath)); + _fileSystem.CreateDirectory(Path.GetDirectoryName(fullCachePath)); using (var stream = result.Content) { using (var filestream = _fileSystem.GetFileStream(fullCachePath, FileMode.Create, FileAccess.Write, FileShare.Read, true)) @@ -285,7 +289,7 @@ namespace MediaBrowser.Api } } - _fileSystem.CreateDirectory(Path.GetDirectoryName(pointerCachePath)); + _fileSystem.CreateDirectory(Path.GetDirectoryName(pointerCachePath)); using (var writer = new StreamWriter(pointerCachePath)) { await writer.WriteAsync(fullCachePath).ConfigureAwait(false); diff --git a/MediaBrowser.Api/ItemRefreshService.cs b/MediaBrowser.Api/ItemRefreshService.cs index 1e912c92d..5aab15dff 100644 --- a/MediaBrowser.Api/ItemRefreshService.cs +++ b/MediaBrowser.Api/ItemRefreshService.cs @@ -5,7 +5,6 @@ using MediaBrowser.Controller.Providers; using ServiceStack; using System.Threading; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Api { diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.cs index 23ff74495..f37874774 100644 --- a/MediaBrowser.Api/ItemUpdateService.cs +++ b/MediaBrowser.Api/ItemUpdateService.cs @@ -331,7 +331,7 @@ namespace MediaBrowser.Api hasAspectRatio.AspectRatio = request.AspectRatio; } - item.IsLocked = (request.LockData ?? false); + item.IsLocked = request.LockData ?? false; if (request.LockedFields != null) { diff --git a/MediaBrowser.Api/Library/LibraryHelpers.cs b/MediaBrowser.Api/Library/LibraryHelpers.cs index 7e30ffc93..46ec4f270 100644 --- a/MediaBrowser.Api/Library/LibraryHelpers.cs +++ b/MediaBrowser.Api/Library/LibraryHelpers.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller; +using MediaBrowser.Controller; using System; using System.IO; using System.Linq; diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs index 097546af6..f9b3def97 100644 --- a/MediaBrowser.Api/Library/LibraryService.cs +++ b/MediaBrowser.Api/Library/LibraryService.cs @@ -1,7 +1,6 @@ using MediaBrowser.Api.Movies; using MediaBrowser.Api.Music; using MediaBrowser.Controller.Activity; -using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; @@ -14,13 +13,11 @@ using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.TV; using MediaBrowser.Model.Activity; -using MediaBrowser.Model.Channels; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; using ServiceStack; using System; -using System.Collections; using System.Collections.Generic; using System.Globalization; using System.IO; @@ -28,7 +25,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Api.Library { diff --git a/MediaBrowser.Api/Library/LibraryStructureService.cs b/MediaBrowser.Api/Library/LibraryStructureService.cs index 82931e11e..244dcf09f 100644 --- a/MediaBrowser.Api/Library/LibraryStructureService.cs +++ b/MediaBrowser.Api/Library/LibraryStructureService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller; +using MediaBrowser.Controller; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Net; using MediaBrowser.Model.Entities; diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs index 5b7bc78a8..ebcf8fbea 100644 --- a/MediaBrowser.Api/LiveTv/LiveTvService.cs +++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs @@ -482,7 +482,14 @@ namespace MediaBrowser.Api.LiveTv [Authenticated(AllowBeforeStartupWizard = true)] public class GetSatIniMappings : IReturn<List<NameValuePair>> { - + + } + + [Route("/LiveTv/TunerHosts/Satip/ChannelScan", "GET", Summary = "Scans for available channels")] + [Authenticated(AllowBeforeStartupWizard = true)] + public class GetSatChannnelScanResult : TunerHostInfo + { + } public class LiveTvService : BaseApiService @@ -504,6 +511,13 @@ namespace MediaBrowser.Api.LiveTv _dtoService = dtoService; } + public async Task<object> Get(GetSatChannnelScanResult request) + { + var result = await _liveTvManager.GetSatChannelScanResult(request, CancellationToken.None).ConfigureAwait(false); + + return ToOptimizedResult(result); + } + public async Task<object> Get(GetLiveTvRegistrationInfo request) { var result = await _liveTvManager.GetRegistrationInfo(request.ChannelId, request.ProgramId, request.Feature).ConfigureAwait(false); diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj index cdc0cd6ae..db8961a66 100644 --- a/MediaBrowser.Api/MediaBrowser.Api.csproj +++ b/MediaBrowser.Api/MediaBrowser.Api.csproj @@ -80,8 +80,6 @@ <Compile Include="FilterService.cs" /> <Compile Include="IHasDtoOptions.cs" /> <Compile Include="Library\ChapterService.cs" /> - <Compile Include="Playback\Dash\ManifestBuilder.cs" /> - <Compile Include="Playback\Dash\MpegDashService.cs" /> <Compile Include="Playback\MediaInfoService.cs" /> <Compile Include="Playback\TranscodingThrottler.cs" /> <Compile Include="PlaylistService.cs" /> diff --git a/MediaBrowser.Api/Movies/MoviesService.cs b/MediaBrowser.Api/Movies/MoviesService.cs index 970e8df51..065f88268 100644 --- a/MediaBrowser.Api/Movies/MoviesService.cs +++ b/MediaBrowser.Api/Movies/MoviesService.cs @@ -1,12 +1,10 @@ using MediaBrowser.Common.Extensions; -using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Persistence; -using MediaBrowser.Model.Channels; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; @@ -15,7 +13,6 @@ using ServiceStack; using System; using System.Collections.Generic; using System.Linq; -using System.Threading; using System.Threading.Tasks; namespace MediaBrowser.Api.Movies diff --git a/MediaBrowser.Api/Movies/TrailersService.cs b/MediaBrowser.Api/Movies/TrailersService.cs index 4883b38fb..d74dd5b6a 100644 --- a/MediaBrowser.Api/Movies/TrailersService.cs +++ b/MediaBrowser.Api/Movies/TrailersService.cs @@ -1,17 +1,9 @@ using MediaBrowser.Api.UserLibrary; -using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Dto; -using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Net; -using MediaBrowser.Model.Channels; -using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; using ServiceStack; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using MediaBrowser.Controller.Collections; using MediaBrowser.Controller.Localization; using MediaBrowser.Model.Serialization; diff --git a/MediaBrowser.Api/Music/AlbumsService.cs b/MediaBrowser.Api/Music/AlbumsService.cs index 9628ab231..e774c3077 100644 --- a/MediaBrowser.Api/Music/AlbumsService.cs +++ b/MediaBrowser.Api/Music/AlbumsService.cs @@ -4,7 +4,6 @@ using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Persistence; -using MediaBrowser.Model.Querying; using ServiceStack; using System; using System.Collections.Generic; diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 9d2c8c444..901554973 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -1,12 +1,10 @@ using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Devices; using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; -using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; @@ -290,11 +288,9 @@ namespace MediaBrowser.Api.Playback { if (string.Equals(ApiEntryPoint.Instance.GetEncodingOptions().HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase)) { - // It's currently failing on live tv - if (state.RunTimeTicks.HasValue) - { + return "h264_qsv"; - } + } return "libx264"; @@ -442,6 +438,8 @@ namespace MediaBrowser.Api.Playback param += " -level " + state.VideoRequest.Level; break; } + + return param; } else { @@ -616,7 +614,7 @@ namespace MediaBrowser.Api.Playback if (!string.IsNullOrEmpty(state.SubtitleStream.Language)) { - var charenc = SubtitleEncoder.GetSubtitleFileCharacterSet(subtitlePath, state.MediaSource.Protocol, CancellationToken.None).Result; + var charenc = SubtitleEncoder.GetSubtitleFileCharacterSet(subtitlePath, state.SubtitleStream.Language, state.MediaSource.Protocol, CancellationToken.None).Result; if (!string.IsNullOrEmpty(charenc)) { @@ -997,7 +995,17 @@ namespace MediaBrowser.Api.Playback var commandLineLogMessage = process.StartInfo.FileName + " " + process.StartInfo.Arguments; Logger.Info(commandLineLogMessage); - var logFilePath = Path.Combine(ServerConfigurationManager.ApplicationPaths.LogDirectoryPath, "transcode-" + Guid.NewGuid() + ".txt"); + var logFilePrefix = "transcode"; + if (state.VideoRequest != null && string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase) && string.Equals(state.OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase)) + { + logFilePrefix = "directstream"; + } + else if (state.VideoRequest != null && string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase)) + { + logFilePrefix = "remux"; + } + + var logFilePath = Path.Combine(ServerConfigurationManager.ApplicationPaths.LogDirectoryPath, logFilePrefix + "-" + Guid.NewGuid() + ".txt"); FileSystem.CreateDirectory(Path.GetDirectoryName(logFilePath)); // FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory. @@ -1028,7 +1036,7 @@ namespace MediaBrowser.Api.Playback StartStreamingLog(transcodingJob, state, process.StandardError.BaseStream, state.LogFileStream); // Wait for the file to exist before proceeeding - while (!FileSystem.FileExists(state.WaitForPath ?? outputPath) && !transcodingJob.HasExited) + while (!FileSystem.FileExists(state.WaitForPath ?? outputPath) && !transcodingJob.HasExited) { await Task.Delay(100, cancellationTokenSource.Token).ConfigureAwait(false); } @@ -1454,10 +1462,7 @@ namespace MediaBrowser.Api.Playback } else if (i == 19) { - if (videoRequest != null) - { - videoRequest.Cabac = string.Equals("true", val, StringComparison.OrdinalIgnoreCase); - } + // cabac no longer used } else if (i == 20) { @@ -1548,7 +1553,7 @@ namespace MediaBrowser.Api.Playback double digit; if (double.TryParse(time, NumberStyles.Any, UsCulture, out digit)) { - secondsSum += (digit * timeFactor); + secondsSum += digit * timeFactor; } else { @@ -1656,9 +1661,9 @@ namespace MediaBrowser.Api.Playback if (state.OutputVideoBitrate.HasValue) { var resolution = ResolutionNormalizer.Normalize( - state.VideoStream == null ? (int?)null : state.VideoStream.BitRate, - state.OutputVideoBitrate.Value, - state.VideoStream == null ? null : state.VideoStream.Codec, + state.VideoStream == null ? (int?)null : state.VideoStream.BitRate, + state.OutputVideoBitrate.Value, + state.VideoStream == null ? null : state.VideoStream.Codec, state.OutputVideoCodec, videoRequest.MaxWidth, videoRequest.MaxHeight); @@ -1682,12 +1687,12 @@ namespace MediaBrowser.Api.Playback private void TryStreamCopy(StreamState state, VideoStreamRequest videoRequest) { - if (state.VideoStream != null && CanStreamCopyVideo(videoRequest, state.VideoStream)) + if (state.VideoStream != null && CanStreamCopyVideo(state)) { state.OutputVideoCodec = "copy"; } - if (state.AudioStream != null && CanStreamCopyAudio(videoRequest, state.AudioStream, state.SupportedAudioCodecs)) + if (state.AudioStream != null && CanStreamCopyAudio(state, state.SupportedAudioCodecs)) { state.OutputAudioCodec = "copy"; } @@ -1775,8 +1780,11 @@ namespace MediaBrowser.Api.Playback state.MediaSource = mediaSource; } - protected virtual bool CanStreamCopyVideo(VideoStreamRequest request, MediaStream videoStream) + protected virtual bool CanStreamCopyVideo(StreamState state) { + var request = state.VideoRequest; + var videoStream = state.VideoStream; + if (videoStream.IsInterlaced) { return false; @@ -1786,7 +1794,7 @@ namespace MediaBrowser.Api.Playback { return false; } - + // Can't stream copy if we're burning in subtitles if (request.SubtitleStreamIndex.HasValue) { @@ -1807,10 +1815,10 @@ namespace MediaBrowser.Api.Playback { if (string.IsNullOrEmpty(videoStream.Profile)) { - return false; + //return false; } - if (!string.Equals(request.Profile, videoStream.Profile, StringComparison.OrdinalIgnoreCase)) + if (!string.IsNullOrEmpty(videoStream.Profile) && !string.Equals(request.Profile, videoStream.Profile, StringComparison.OrdinalIgnoreCase)) { var currentScore = GetVideoProfileScore(videoStream.Profile); var requestedScore = GetVideoProfileScore(request.Profile); @@ -1886,24 +1894,16 @@ namespace MediaBrowser.Api.Playback { if (!videoStream.Level.HasValue) { - return false; + //return false; } - if (videoStream.Level.Value > requestLevel) + if (videoStream.Level.HasValue && videoStream.Level.Value > requestLevel) { return false; } } } - if (request.Cabac.HasValue && request.Cabac.Value) - { - if (videoStream.IsCabac.HasValue && !videoStream.IsCabac.Value) - { - return false; - } - } - return request.EnableAutoStreamCopy; } @@ -1923,8 +1923,11 @@ namespace MediaBrowser.Api.Playback return Array.FindIndex(list.ToArray(), t => string.Equals(t, profile, StringComparison.OrdinalIgnoreCase)); } - protected virtual bool CanStreamCopyAudio(VideoStreamRequest request, MediaStream audioStream, List<string> supportedAudioCodecs) + protected virtual bool CanStreamCopyAudio(StreamState state, List<string> supportedAudioCodecs) { + var request = state.VideoRequest; + var audioStream = state.AudioStream; + // Source and target codecs must match if (string.IsNullOrEmpty(audioStream.Codec) || !supportedAudioCodecs.Contains(audioStream.Codec, StringComparer.OrdinalIgnoreCase)) { @@ -2030,7 +2033,6 @@ namespace MediaBrowser.Api.Playback state.TargetPacketLength, state.TargetTimestamp, state.IsTargetAnamorphic, - state.IsTargetCabac, state.TargetRefFrames, state.TargetVideoStreamCount, state.TargetAudioStreamCount, @@ -2056,6 +2058,7 @@ namespace MediaBrowser.Api.Playback if (state.VideoRequest != null) { state.VideoRequest.CopyTimestamps = transcodingProfile.CopyTimestamps; + state.VideoRequest.ForceLiveStream = transcodingProfile.ForceLiveStream; } } } @@ -2133,7 +2136,6 @@ namespace MediaBrowser.Api.Playback state.TargetPacketLength, state.TranscodeSeekInfo, state.IsTargetAnamorphic, - state.IsTargetCabac, state.TargetRefFrames, state.TargetVideoStreamCount, state.TargetAudioStreamCount, @@ -2225,7 +2227,7 @@ namespace MediaBrowser.Api.Playback inputModifier += " -noaccurate_seek"; } } - + return inputModifier; } diff --git a/MediaBrowser.Api/Playback/Dash/ManifestBuilder.cs b/MediaBrowser.Api/Playback/Dash/ManifestBuilder.cs deleted file mode 100644 index 35e252a19..000000000 --- a/MediaBrowser.Api/Playback/Dash/ManifestBuilder.cs +++ /dev/null @@ -1,224 +0,0 @@ -using System; -using System.Globalization; -using System.Security; -using System.Text; - -namespace MediaBrowser.Api.Playback.Dash -{ - public class ManifestBuilder - { - protected readonly CultureInfo UsCulture = new CultureInfo("en-US"); - - public string GetManifestText(StreamState state, string playlistUrl) - { - var builder = new StringBuilder(); - - var time = TimeSpan.FromTicks(state.RunTimeTicks.Value); - - var duration = "PT" + time.Hours.ToString("00", UsCulture) + "H" + time.Minutes.ToString("00", UsCulture) + "M" + time.Seconds.ToString("00", UsCulture) + ".00S"; - - builder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); - - builder.AppendFormat( - "<MPD xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:mpeg:dash:schema:mpd:2011\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xsi:schemaLocation=\"urn:mpeg:DASH:schema:MPD:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd\" profiles=\"urn:mpeg:dash:profile:isoff-live:2011\" type=\"static\" mediaPresentationDuration=\"{0}\" minBufferTime=\"PT5.0S\">", - duration); - - builder.Append("<ProgramInformation>"); - builder.Append("</ProgramInformation>"); - - builder.Append("<Period start=\"PT0S\">"); - builder.Append(GetVideoAdaptationSet(state, playlistUrl)); - builder.Append(GetAudioAdaptationSet(state, playlistUrl)); - builder.Append("</Period>"); - - builder.Append("</MPD>"); - - return builder.ToString(); - } - - private string GetVideoAdaptationSet(StreamState state, string playlistUrl) - { - var builder = new StringBuilder(); - - builder.Append("<AdaptationSet id=\"video\" segmentAlignment=\"true\" bitstreamSwitching=\"true\">"); - builder.Append(GetVideoRepresentationOpenElement(state)); - - AppendSegmentList(state, builder, "0", playlistUrl); - - builder.Append("</Representation>"); - builder.Append("</AdaptationSet>"); - - return builder.ToString(); - } - - private string GetAudioAdaptationSet(StreamState state, string playlistUrl) - { - var builder = new StringBuilder(); - - builder.Append("<AdaptationSet id=\"audio\" segmentAlignment=\"true\" bitstreamSwitching=\"true\">"); - builder.Append(GetAudioRepresentationOpenElement(state)); - - builder.Append("<AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"6\" />"); - - AppendSegmentList(state, builder, "1", playlistUrl); - - builder.Append("</Representation>"); - builder.Append("</AdaptationSet>"); - - return builder.ToString(); - } - - private string GetVideoRepresentationOpenElement(StreamState state) - { - var codecs = GetVideoCodecDescriptor(state); - - var mime = "video/mp4"; - - var xml = "<Representation id=\"0\" mimeType=\"" + mime + "\" codecs=\"" + codecs + "\""; - - if (state.OutputWidth.HasValue) - { - xml += " width=\"" + state.OutputWidth.Value.ToString(UsCulture) + "\""; - } - if (state.OutputHeight.HasValue) - { - xml += " height=\"" + state.OutputHeight.Value.ToString(UsCulture) + "\""; - } - if (state.OutputVideoBitrate.HasValue) - { - xml += " bandwidth=\"" + state.OutputVideoBitrate.Value.ToString(UsCulture) + "\""; - } - - xml += ">"; - - return xml; - } - - private string GetAudioRepresentationOpenElement(StreamState state) - { - var codecs = GetAudioCodecDescriptor(state); - - var mime = "audio/mp4"; - - var xml = "<Representation id=\"1\" mimeType=\"" + mime + "\" codecs=\"" + codecs + "\""; - - if (state.OutputAudioSampleRate.HasValue) - { - xml += " audioSamplingRate=\"" + state.OutputAudioSampleRate.Value.ToString(UsCulture) + "\""; - } - if (state.OutputAudioBitrate.HasValue) - { - xml += " bandwidth=\"" + state.OutputAudioBitrate.Value.ToString(UsCulture) + "\""; - } - - xml += ">"; - - return xml; - } - - private string GetVideoCodecDescriptor(StreamState state) - { - // https://developer.apple.com/library/ios/documentation/networkinginternet/conceptual/streamingmediaguide/FrequentlyAskedQuestions/FrequentlyAskedQuestions.html - // http://www.chipwreck.de/blog/2010/02/25/html-5-video-tag-and-attributes/ - - var level = state.TargetVideoLevel ?? 0; - var profile = state.TargetVideoProfile ?? string.Empty; - - if (profile.IndexOf("high", StringComparison.OrdinalIgnoreCase) != -1) - { - if (level >= 4.1) - { - return "avc1.640028"; - } - - if (level >= 4) - { - return "avc1.640028"; - } - - return "avc1.64001f"; - } - - if (profile.IndexOf("main", StringComparison.OrdinalIgnoreCase) != -1) - { - if (level >= 4) - { - return "avc1.4d0028"; - } - - if (level >= 3.1) - { - return "avc1.4d001f"; - } - - return "avc1.4d001e"; - } - - if (level >= 3.1) - { - return "avc1.42001f"; - } - - return "avc1.42E01E"; - } - - private string GetAudioCodecDescriptor(StreamState state) - { - // https://developer.apple.com/library/ios/documentation/networkinginternet/conceptual/streamingmediaguide/FrequentlyAskedQuestions/FrequentlyAskedQuestions.html - - if (string.Equals(state.OutputAudioCodec, "mp3", StringComparison.OrdinalIgnoreCase)) - { - return "mp4a.40.34"; - } - - // AAC 5ch - if (state.OutputAudioChannels.HasValue && state.OutputAudioChannels.Value >= 5) - { - return "mp4a.40.5"; - } - - // AAC 2ch - return "mp4a.40.2"; - } - - private void AppendSegmentList(StreamState state, StringBuilder builder, string type, string playlistUrl) - { - var extension = ".m4s"; - - var seconds = TimeSpan.FromTicks(state.RunTimeTicks ?? 0).TotalSeconds; - - var queryStringIndex = playlistUrl.IndexOf('?'); - var queryString = queryStringIndex == -1 ? string.Empty : playlistUrl.Substring(queryStringIndex); - - var index = 0; - var duration = 1000000 * state.SegmentLength; - builder.AppendFormat("<SegmentList timescale=\"1000000\" duration=\"{0}\" startNumber=\"1\">", duration.ToString(CultureInfo.InvariantCulture)); - - while (seconds > 0) - { - var filename = index == 0 - ? "init" - : (index - 1).ToString(UsCulture); - - var segmentUrl = string.Format("dash/{3}/{0}{1}{2}", - filename, - extension, - SecurityElement.Escape(queryString), - type); - - if (index == 0) - { - builder.AppendFormat("<Initialization sourceURL=\"{0}\"/>", segmentUrl); - } - else - { - builder.AppendFormat("<SegmentURL media=\"{0}\"/>", segmentUrl); - } - - seconds -= state.SegmentLength; - index++; - } - builder.Append("</SegmentList>"); - } - } -} diff --git a/MediaBrowser.Api/Playback/Dash/MpegDashService.cs b/MediaBrowser.Api/Playback/Dash/MpegDashService.cs deleted file mode 100644 index defb2eef0..000000000 --- a/MediaBrowser.Api/Playback/Dash/MpegDashService.cs +++ /dev/null @@ -1,548 +0,0 @@ -using MediaBrowser.Api.Playback.Hls; -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; -using MediaBrowser.Controller.Configuration; -using MediaBrowser.Controller.Devices; -using MediaBrowser.Controller.Dlna; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.MediaEncoding; -using MediaBrowser.Controller.Net; -using MediaBrowser.Model.IO; -using MediaBrowser.Model.Serialization; -using ServiceStack; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using CommonIO; -using MimeTypes = MediaBrowser.Model.Net.MimeTypes; - -namespace MediaBrowser.Api.Playback.Dash -{ - /// <summary> - /// Options is needed for chromecast. Threw Head in there since it's related - /// </summary> - [Route("/Videos/{Id}/master.mpd", "GET", Summary = "Gets a video stream using Mpeg dash.")] - [Route("/Videos/{Id}/master.mpd", "HEAD", Summary = "Gets a video stream using Mpeg dash.")] - public class GetMasterManifest : VideoStreamRequest - { - public bool EnableAdaptiveBitrateStreaming { get; set; } - - public GetMasterManifest() - { - EnableAdaptiveBitrateStreaming = true; - } - } - - [Route("/Videos/{Id}/dash/{RepresentationId}/{SegmentId}.m4s", "GET")] - public class GetDashSegment : VideoStreamRequest - { - /// <summary> - /// Gets or sets the segment id. - /// </summary> - /// <value>The segment id.</value> - public string SegmentId { get; set; } - - /// <summary> - /// Gets or sets the representation identifier. - /// </summary> - /// <value>The representation identifier.</value> - public string RepresentationId { get; set; } - } - - public class MpegDashService : BaseHlsService - { - public MpegDashService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, INetworkManager networkManager) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer) - { - NetworkManager = networkManager; - } - - protected INetworkManager NetworkManager { get; private set; } - - public object Get(GetMasterManifest request) - { - var result = GetAsync(request, "GET").Result; - - return result; - } - - public object Head(GetMasterManifest request) - { - var result = GetAsync(request, "HEAD").Result; - - return result; - } - - protected override bool EnableOutputInSubFolder - { - get - { - return true; - } - } - - private async Task<object> GetAsync(GetMasterManifest request, string method) - { - if (string.IsNullOrEmpty(request.MediaSourceId)) - { - throw new ArgumentException("MediaSourceId is required"); - } - - var state = await GetState(request, CancellationToken.None).ConfigureAwait(false); - - var playlistText = string.Empty; - - if (string.Equals(method, "GET", StringComparison.OrdinalIgnoreCase)) - { - playlistText = new ManifestBuilder().GetManifestText(state, Request.RawUrl); - } - - return ResultFactory.GetResult(playlistText, MimeTypes.GetMimeType("playlist.mpd"), new Dictionary<string, string>()); - } - - public object Get(GetDashSegment request) - { - return GetDynamicSegment(request, request.SegmentId, request.RepresentationId).Result; - } - - private async Task<object> GetDynamicSegment(VideoStreamRequest request, string segmentId, string representationId) - { - if ((request.StartTimeTicks ?? 0) > 0) - { - throw new ArgumentException("StartTimeTicks is not allowed."); - } - - var cancellationTokenSource = new CancellationTokenSource(); - var cancellationToken = cancellationTokenSource.Token; - - var requestedIndex = string.Equals(segmentId, "init", StringComparison.OrdinalIgnoreCase) ? - -1 : - int.Parse(segmentId, NumberStyles.Integer, UsCulture); - - var state = await GetState(request, cancellationToken).ConfigureAwait(false); - - var playlistPath = Path.ChangeExtension(state.OutputFilePath, ".mpd"); - - var segmentExtension = GetSegmentFileExtension(state); - - var segmentPath = FindSegment(playlistPath, representationId, segmentExtension, requestedIndex); - var segmentLength = state.SegmentLength; - - TranscodingJob job = null; - - if (!string.IsNullOrWhiteSpace(segmentPath)) - { - job = ApiEntryPoint.Instance.GetTranscodingJob(playlistPath, TranscodingJobType); - return await GetSegmentResult(playlistPath, segmentPath, requestedIndex, segmentLength, job, cancellationToken).ConfigureAwait(false); - } - - await ApiEntryPoint.Instance.TranscodingStartLock.WaitAsync(cancellationTokenSource.Token).ConfigureAwait(false); - try - { - segmentPath = FindSegment(playlistPath, representationId, segmentExtension, requestedIndex); - if (!string.IsNullOrWhiteSpace(segmentPath)) - { - job = ApiEntryPoint.Instance.GetTranscodingJob(playlistPath, TranscodingJobType); - return await GetSegmentResult(playlistPath, segmentPath, requestedIndex, segmentLength, job, cancellationToken).ConfigureAwait(false); - } - else - { - if (string.Equals(representationId, "0", StringComparison.OrdinalIgnoreCase)) - { - job = ApiEntryPoint.Instance.GetTranscodingJob(playlistPath, TranscodingJobType); - var currentTranscodingIndex = GetCurrentTranscodingIndex(playlistPath, segmentExtension); - var segmentGapRequiringTranscodingChange = 24 / state.SegmentLength; - Logger.Debug("Current transcoding index is {0}. requestedIndex={1}. segmentGapRequiringTranscodingChange={2}", currentTranscodingIndex ?? -2, requestedIndex, segmentGapRequiringTranscodingChange); - if (currentTranscodingIndex == null || requestedIndex < currentTranscodingIndex.Value || (requestedIndex - currentTranscodingIndex.Value) > segmentGapRequiringTranscodingChange) - { - // If the playlist doesn't already exist, startup ffmpeg - try - { - ApiEntryPoint.Instance.KillTranscodingJobs(request.DeviceId, request.PlaySessionId, p => false); - - if (currentTranscodingIndex.HasValue) - { - DeleteLastTranscodedFiles(playlistPath, 0); - } - - var positionTicks = GetPositionTicks(state, requestedIndex); - request.StartTimeTicks = positionTicks; - - var startNumber = GetStartNumber(state); - - var workingDirectory = Path.Combine(Path.GetDirectoryName(playlistPath), (startNumber == -1 ? 0 : startNumber).ToString(CultureInfo.InvariantCulture)); - state.WaitForPath = Path.Combine(workingDirectory, Path.GetFileName(playlistPath)); - FileSystem.CreateDirectory(workingDirectory); - job = await StartFfMpeg(state, playlistPath, cancellationTokenSource, workingDirectory).ConfigureAwait(false); - await WaitForMinimumDashSegmentCount(Path.Combine(workingDirectory, Path.GetFileName(playlistPath)), 1, cancellationTokenSource.Token).ConfigureAwait(false); - } - catch - { - state.Dispose(); - throw; - } - } - } - } - } - finally - { - ApiEntryPoint.Instance.TranscodingStartLock.Release(); - } - - while (string.IsNullOrWhiteSpace(segmentPath)) - { - segmentPath = FindSegment(playlistPath, representationId, segmentExtension, requestedIndex); - await Task.Delay(50, cancellationToken).ConfigureAwait(false); - } - - Logger.Info("returning {0}", segmentPath); - return await GetSegmentResult(playlistPath, segmentPath, requestedIndex, segmentLength, job ?? ApiEntryPoint.Instance.GetTranscodingJob(playlistPath, TranscodingJobType), cancellationToken).ConfigureAwait(false); - } - - private long GetPositionTicks(StreamState state, int requestedIndex) - { - if (requestedIndex <= 0) - { - return 0; - } - - var startSeconds = requestedIndex * state.SegmentLength; - return TimeSpan.FromSeconds(startSeconds).Ticks; - } - - protected Task WaitForMinimumDashSegmentCount(string playlist, int segmentCount, CancellationToken cancellationToken) - { - return WaitForSegment(playlist, "stream0-" + segmentCount.ToString("00000", CultureInfo.InvariantCulture) + ".m4s", cancellationToken); - } - - private async Task<object> GetSegmentResult(string playlistPath, - string segmentPath, - int segmentIndex, - int segmentLength, - TranscodingJob transcodingJob, - CancellationToken cancellationToken) - { - // If all transcoding has completed, just return immediately - if (transcodingJob != null && transcodingJob.HasExited) - { - return GetSegmentResult(segmentPath, segmentIndex, segmentLength, transcodingJob); - } - - // Wait for the file to stop being written to, then stream it - var length = new FileInfo(segmentPath).Length; - var eofCount = 0; - - while (eofCount < 10) - { - var info = new FileInfo(segmentPath); - - if (!info.Exists) - { - break; - } - - var newLength = info.Length; - - if (newLength == length) - { - eofCount++; - } - else - { - eofCount = 0; - } - - length = newLength; - await Task.Delay(100, cancellationToken).ConfigureAwait(false); - } - - return GetSegmentResult(segmentPath, segmentIndex, segmentLength, transcodingJob); - } - - private object GetSegmentResult(string segmentPath, int index, int segmentLength, TranscodingJob transcodingJob) - { - var segmentEndingSeconds = (1 + index) * segmentLength; - var segmentEndingPositionTicks = TimeSpan.FromSeconds(segmentEndingSeconds).Ticks; - - return ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions - { - Path = segmentPath, - FileShare = FileShare.ReadWrite, - OnComplete = () => - { - if (transcodingJob != null) - { - transcodingJob.DownloadPositionTicks = Math.Max(transcodingJob.DownloadPositionTicks ?? segmentEndingPositionTicks, segmentEndingPositionTicks); - } - - } - }); - } - - public int? GetCurrentTranscodingIndex(string playlist, string segmentExtension) - { - var job = ApiEntryPoint.Instance.GetTranscodingJob(playlist, TranscodingJobType); - - if (job == null || job.HasExited) - { - return null; - } - - var file = GetLastTranscodingFiles(playlist, segmentExtension, FileSystem, 1).FirstOrDefault(); - - if (file == null) - { - return null; - } - - return GetIndex(file.FullName); - } - - public int GetIndex(string segmentPath) - { - var indexString = Path.GetFileNameWithoutExtension(segmentPath).Split('-').LastOrDefault(); - - if (string.Equals(indexString, "init", StringComparison.OrdinalIgnoreCase)) - { - return -1; - } - var startNumber = int.Parse(Path.GetFileNameWithoutExtension(Path.GetDirectoryName(segmentPath)), NumberStyles.Integer, UsCulture); - - return startNumber + int.Parse(indexString, NumberStyles.Integer, UsCulture) - 1; - } - - private void DeleteLastTranscodedFiles(string playlistPath, int retryCount) - { - if (retryCount >= 5) - { - return; - } - } - - private static List<FileSystemMetadata> GetLastTranscodingFiles(string playlist, string segmentExtension, IFileSystem fileSystem, int count) - { - var folder = Path.GetDirectoryName(playlist); - - try - { - return fileSystem.GetFiles(folder) - .Where(i => string.Equals(i.Extension, segmentExtension, StringComparison.OrdinalIgnoreCase)) - .OrderByDescending(fileSystem.GetLastWriteTimeUtc) - .Take(count) - .ToList(); - } - catch (DirectoryNotFoundException) - { - return new List<FileSystemMetadata>(); - } - } - - private string FindSegment(string playlist, string representationId, string segmentExtension, int requestedIndex) - { - var folder = Path.GetDirectoryName(playlist); - - if (requestedIndex == -1) - { - var path = Path.Combine(folder, "0", "stream" + representationId + "-" + "init" + segmentExtension); - return FileSystem.FileExists(path) ? path : null; - } - - try - { - foreach (var subfolder in FileSystem.GetDirectoryPaths(folder).ToList()) - { - var subfolderName = Path.GetFileNameWithoutExtension(subfolder); - int startNumber; - if (int.TryParse(subfolderName, NumberStyles.Any, UsCulture, out startNumber)) - { - var segmentIndex = requestedIndex - startNumber + 1; - var path = Path.Combine(folder, subfolderName, "stream" + representationId + "-" + segmentIndex.ToString("00000", CultureInfo.InvariantCulture) + segmentExtension); - if (FileSystem.FileExists(path)) - { - return path; - } - } - } - } - catch (DirectoryNotFoundException) - { - - } - - return null; - } - - protected override string GetAudioArguments(StreamState state) - { - var codec = GetAudioEncoder(state); - - if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase)) - { - return "-codec:a:0 copy"; - } - - var args = "-codec:a:0 " + codec; - - var channels = state.OutputAudioChannels; - - if (channels.HasValue) - { - args += " -ac " + channels.Value; - } - - var bitrate = state.OutputAudioBitrate; - - if (bitrate.HasValue) - { - args += " -ab " + bitrate.Value.ToString(UsCulture); - } - - args += " " + GetAudioFilterParam(state, true); - - return args; - } - - protected override string GetVideoArguments(StreamState state) - { - var codec = GetVideoEncoder(state); - - var args = "-codec:v:0 " + codec; - - if (state.EnableMpegtsM2TsMode) - { - args += " -mpegts_m2ts_mode 1"; - } - - // See if we can save come cpu cycles by avoiding encoding - if (codec.Equals("copy", StringComparison.OrdinalIgnoreCase)) - { - return state.VideoStream != null && IsH264(state.VideoStream) ? - args + " -bsf:v h264_mp4toannexb" : - args; - } - - var keyFrameArg = string.Format(" -force_key_frames expr:gte(t,n_forced*{0})", - state.SegmentLength.ToString(UsCulture)); - - var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream; - - args += " " + GetVideoQualityParam(state, GetH264Encoder(state)) + keyFrameArg; - - // Add resolution params, if specified - if (!hasGraphicalSubs) - { - args += GetOutputSizeParam(state, codec, false); - } - - // This is for internal graphical subs - if (hasGraphicalSubs) - { - args += GetGraphicalSubtitleParam(state, codec); - } - - return args; - } - - protected override string GetCommandLineArguments(string outputPath, StreamState state, bool isEncoding) - { - // test url http://192.168.1.2:8096/videos/233e8905d559a8f230db9bffd2ac9d6d/master.mpd?mediasourceid=233e8905d559a8f230db9bffd2ac9d6d&videocodec=h264&audiocodec=aac&maxwidth=1280&videobitrate=500000&audiobitrate=128000&profile=baseline&level=3 - // Good info on i-frames http://blog.streamroot.io/encode-multi-bitrate-videos-mpeg-dash-mse-based-media-players/ - - var threads = GetNumberOfThreads(state, false); - - var inputModifier = GetInputModifier(state); - - var initSegmentName = "stream$RepresentationID$-init.m4s"; - var segmentName = "stream$RepresentationID$-$Number%05d$.m4s"; - - var args = string.Format("{0} {1} -map_metadata -1 -threads {2} {3} {4} -copyts {5} -f dash -init_seg_name \"{6}\" -media_seg_name \"{7}\" -use_template 0 -use_timeline 1 -min_seg_duration {8} -y \"{9}\"", - inputModifier, - GetInputArgument(state), - threads, - GetMapArgs(state), - GetVideoArguments(state), - GetAudioArguments(state), - initSegmentName, - segmentName, - (state.SegmentLength * 1000000).ToString(CultureInfo.InvariantCulture), - state.WaitForPath - ).Trim(); - - return args; - } - - protected override int GetStartNumber(StreamState state) - { - return GetStartNumber(state.VideoRequest); - } - - private int GetStartNumber(VideoStreamRequest request) - { - var segmentId = "0"; - - var segmentRequest = request as GetDashSegment; - if (segmentRequest != null) - { - segmentId = segmentRequest.SegmentId; - } - - if (string.Equals(segmentId, "init", StringComparison.OrdinalIgnoreCase)) - { - return -1; - } - - return int.Parse(segmentId, NumberStyles.Integer, UsCulture); - } - - /// <summary> - /// Gets the segment file extension. - /// </summary> - /// <param name="state">The state.</param> - /// <returns>System.String.</returns> - protected override string GetSegmentFileExtension(StreamState state) - { - return ".m4s"; - } - - protected override TranscodingJobType TranscodingJobType - { - get - { - return TranscodingJobType.Dash; - } - } - - private async Task WaitForSegment(string playlist, string segment, CancellationToken cancellationToken) - { - var segmentFilename = Path.GetFileName(segment); - - Logger.Debug("Waiting for {0} in {1}", segmentFilename, playlist); - - while (true) - { - // Need to use FileShare.ReadWrite because we're reading the file at the same time it's being written - using (var fileStream = GetPlaylistFileStream(playlist)) - { - using (var reader = new StreamReader(fileStream)) - { - while (!reader.EndOfStream) - { - var line = await reader.ReadLineAsync().ConfigureAwait(false); - - if (line.IndexOf(segmentFilename, StringComparison.OrdinalIgnoreCase) != -1) - { - Logger.Debug("Finished waiting for {0} in {1}", segmentFilename, playlist); - return; - } - } - await Task.Delay(100, cancellationToken).ConfigureAwait(false); - } - } - } - } - } -} diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs index 766e8a003..cb344690c 100644 --- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Devices; using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Library; @@ -84,11 +83,6 @@ namespace MediaBrowser.Api.Playback.Hls var state = await GetState(request, cancellationTokenSource.Token).ConfigureAwait(false); - if (isLive) - { - state.Request.StartTimeTicks = null; - } - TranscodingJob job = null; var playlist = state.OutputFilePath; @@ -138,13 +132,6 @@ namespace MediaBrowser.Api.Playback.Hls var appendBaselineStream = false; var baselineStreamBitrate = 64000; - var hlsVideoRequest = state.VideoRequest as GetHlsVideoStreamLegacy; - if (hlsVideoRequest != null) - { - appendBaselineStream = hlsVideoRequest.AppendBaselineStream; - baselineStreamBitrate = hlsVideoRequest.BaselineStreamAudioBitRate ?? baselineStreamBitrate; - } - var playlistText = GetMasterPlaylistFileText(playlist, videoBitrate + audioBitrate, appendBaselineStream, baselineStreamBitrate); job = job ?? ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlist, TranscodingJobType); @@ -249,11 +236,7 @@ namespace MediaBrowser.Api.Playback.Hls protected override string GetCommandLineArguments(string outputPath, StreamState state, bool isEncoding) { - var hlsVideoRequest = state.VideoRequest as GetHlsVideoStreamLegacy; - - var itsOffsetMs = hlsVideoRequest == null - ? 0 - : hlsVideoRequest.TimeStampOffsetMs; + var itsOffsetMs = 0; var itsOffset = itsOffsetMs == 0 ? string.Empty : string.Format("-itsoffset {0} ", TimeSpan.FromMilliseconds(itsOffsetMs).TotalSeconds.ToString(UsCulture)); @@ -287,26 +270,6 @@ namespace MediaBrowser.Api.Playback.Hls outputPath ).Trim(); - if (hlsVideoRequest != null) - { - if (hlsVideoRequest.AppendBaselineStream) - { - var lowBitratePath = Path.Combine(Path.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath) + "-low.m3u8"); - - var bitrate = hlsVideoRequest.BaselineStreamAudioBitRate ?? 64000; - - var lowBitrateParams = string.Format(" -threads {0} -vn -codec:a:0 libmp3lame -ac 2 -ab {1} -hls_time {2} -start_number {3} -hls_list_size {4} -y \"{5}\"", - threads, - bitrate / 2, - state.SegmentLength.ToString(UsCulture), - startNumberParam, - state.HlsListSize.ToString(UsCulture), - lowBitratePath); - - args += " " + lowBitrateParams; - } - } - return args; } @@ -315,9 +278,28 @@ namespace MediaBrowser.Api.Playback.Hls return 0; } - protected override bool CanStreamCopyAudio(VideoStreamRequest request, MediaStream audioStream, List<string> supportedAudioCodecs) + protected bool IsLiveStream(StreamState state) { - return false; + var isLiveStream = (state.RunTimeTicks ?? 0) == 0; + + if (state.VideoRequest.ForceLiveStream) + { + return true; + } + + return isLiveStream; + } + + protected override bool CanStreamCopyAudio(StreamState state, List<string> supportedAudioCodecs) + { + var isLiveStream = IsLiveStream(state); + + if (!isLiveStream) + { + return false; + } + + return base.CanStreamCopyAudio(state, supportedAudioCodecs); } } }
\ No newline at end of file diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs index 000c02256..65e236525 100644 --- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs @@ -199,9 +199,9 @@ namespace MediaBrowser.Api.Playback.Hls Logger.Debug("Starting transcoding because requestedIndex={0} and currentTranscodingIndex={1}", requestedIndex, currentTranscodingIndex); startTranscoding = true; } - else if ((requestedIndex - currentTranscodingIndex.Value) > segmentGapRequiringTranscodingChange) + else if (requestedIndex - currentTranscodingIndex.Value > segmentGapRequiringTranscodingChange) { - Logger.Debug("Starting transcoding because segmentGap is {0} and max allowed gap is {1}. requestedIndex={2}", (requestedIndex - currentTranscodingIndex.Value), segmentGapRequiringTranscodingChange, requestedIndex); + Logger.Debug("Starting transcoding because segmentGap is {0} and max allowed gap is {1}. requestedIndex={2}", requestedIndex - currentTranscodingIndex.Value, segmentGapRequiringTranscodingChange, requestedIndex); startTranscoding = true; } if (startTranscoding) @@ -500,13 +500,25 @@ namespace MediaBrowser.Api.Playback.Hls return ResultFactory.GetResult(playlistText, MimeTypes.GetMimeType("playlist.m3u8"), new Dictionary<string, string>()); } + private bool IsLiveStream(StreamState state) + { + var isLiveStream = (state.RunTimeTicks ?? 0) == 0; + + if (state.VideoRequest.ForceLiveStream) + { + return true; + } + + return isLiveStream; + } + private string GetMasterPlaylistFileText(StreamState state, int totalBitrate) { var builder = new StringBuilder(); builder.AppendLine("#EXTM3U"); - var isLiveStream = (state.RunTimeTicks ?? 0) == 0; + var isLiveStream = IsLiveStream(state); var queryStringIndex = Request.RawUrl.IndexOf('?'); var queryString = queryStringIndex == -1 ? string.Empty : Request.RawUrl.Substring(queryStringIndex); @@ -524,7 +536,7 @@ namespace MediaBrowser.Api.Playback.Hls .ToList(); var subtitleGroup = subtitleStreams.Count > 0 && - (request is GetMasterHlsVideoPlaylist) && + request is GetMasterHlsVideoPlaylist && ((GetMasterHlsVideoPlaylist)request).SubtitleMethod == SubtitleDeliveryMethod.Hls ? "subs" : null; @@ -544,12 +556,12 @@ namespace MediaBrowser.Api.Playback.Hls var variation = GetBitrateVariation(totalBitrate); var newBitrate = totalBitrate - variation; - var variantUrl = ReplaceBitrate(playlistUrl, requestedVideoBitrate, (requestedVideoBitrate - variation)); + var variantUrl = ReplaceBitrate(playlistUrl, requestedVideoBitrate, requestedVideoBitrate - variation); AppendPlaylist(builder, state, variantUrl, newBitrate, subtitleGroup); variation *= 2; newBitrate = totalBitrate - variation; - variantUrl = ReplaceBitrate(playlistUrl, requestedVideoBitrate, (requestedVideoBitrate - variation)); + variantUrl = ReplaceBitrate(playlistUrl, requestedVideoBitrate, requestedVideoBitrate - variation); AppendPlaylist(builder, state, variantUrl, newBitrate, subtitleGroup); } @@ -703,7 +715,7 @@ namespace MediaBrowser.Api.Playback.Hls builder.AppendLine("#EXTM3U"); builder.AppendLine("#EXT-X-PLAYLIST-TYPE:VOD"); builder.AppendLine("#EXT-X-VERSION:3"); - builder.AppendLine("#EXT-X-TARGETDURATION:" + Math.Ceiling((segmentLengths.Length > 0 ? segmentLengths.Max() : state.SegmentLength)).ToString(UsCulture)); + builder.AppendLine("#EXT-X-TARGETDURATION:" + Math.Ceiling(segmentLengths.Length > 0 ? segmentLengths.Max() : state.SegmentLength).ToString(UsCulture)); builder.AppendLine("#EXT-X-MEDIA-SEQUENCE:0"); var queryStringIndex = Request.RawUrl.IndexOf('?'); @@ -929,10 +941,16 @@ namespace MediaBrowser.Api.Playback.Hls return isOutputVideo ? ".ts" : ".ts"; } - protected override bool CanStreamCopyVideo(VideoStreamRequest request, MediaStream videoStream) + protected override bool CanStreamCopyVideo(StreamState state) { - return false; - //return base.CanStreamCopyVideo(request, videoStream); + var isLiveStream = IsLiveStream(state); + + if (!isLiveStream) + { + return false; + } + + return base.CanStreamCopyVideo(state); } } }
\ No newline at end of file diff --git a/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs b/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs index b44d7f660..e9f33161e 100644 --- a/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs +++ b/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs @@ -32,25 +32,6 @@ namespace MediaBrowser.Api.Playback.Hls } /// <summary> - /// Class GetHlsVideoStream - /// </summary> - [Route("/Videos/{Id}/stream.m3u8", "GET")] - [Api(Description = "Gets a video stream using HTTP live streaming.")] - public class GetHlsVideoStreamLegacy : VideoStreamRequest - { - // TODO: Deprecate with new iOS app - - [ApiMember(Name = "BaselineStreamAudioBitRate", Description = "Optional. Specify the audio bitrate for the baseline stream.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] - public int? BaselineStreamAudioBitRate { get; set; } - - [ApiMember(Name = "AppendBaselineStream", Description = "Optional. Whether or not to include a baseline audio-only stream in the master playlist.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] - public bool AppendBaselineStream { get; set; } - - [ApiMember(Name = "TimeStampOffsetMs", Description = "Optional. Alter the timestamps in the playlist by a given amount, in ms. Default is 1000.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] - public int TimeStampOffsetMs { get; set; } - } - - /// <summary> /// Class GetHlsVideoSegment /// </summary> [Route("/Videos/{Id}/hls/{PlaylistId}/stream.m3u8", "GET")] diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs index f8adbdc22..5f427146e 100644 --- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs @@ -1,4 +1,3 @@ -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Devices; using MediaBrowser.Controller.Dlna; @@ -28,16 +27,6 @@ namespace MediaBrowser.Api.Playback.Hls { } - /// <summary> - /// Gets the specified request. - /// </summary> - /// <param name="request">The request.</param> - /// <returns>System.Object.</returns> - public object Get(GetHlsVideoStreamLegacy request) - { - return ProcessRequest(request, false); - } - public object Get(GetLiveHlsStream request) { return ProcessRequest(request, true); @@ -97,11 +86,10 @@ namespace MediaBrowser.Api.Playback.Hls // See if we can save come cpu cycles by avoiding encoding if (codec.Equals("copy", StringComparison.OrdinalIgnoreCase)) { - return state.VideoStream != null && IsH264(state.VideoStream) ? - args + " -bsf:v h264_mp4toannexb" : - args; + // if h264_mp4toannexb is ever added, do not use it for live tv + return args; } - + var keyFrameArg = string.Format(" -force_key_frames \"expr:gte(t,n_forced*{0})\"", state.SegmentLength.ToString(UsCulture)); diff --git a/MediaBrowser.Api/Playback/MediaInfoService.cs b/MediaBrowser.Api/Playback/MediaInfoService.cs index 2bf61f90b..ffe7c50c8 100644 --- a/MediaBrowser.Api/Playback/MediaInfoService.cs +++ b/MediaBrowser.Api/Playback/MediaInfoService.cs @@ -227,7 +227,7 @@ namespace MediaBrowser.Api.Playback SetDeviceSpecificData(item, mediaSource, profile, auth, maxBitrate, startTimeTicks, mediaSourceId, audioStreamIndex, subtitleStreamIndex, result.PlaySessionId); } - SortMediaSources(result); + SortMediaSources(result, maxBitrate); } private void SetDeviceSpecificData(BaseItem item, @@ -375,7 +375,7 @@ namespace MediaBrowser.Api.Playback } } - private void SortMediaSources(PlaybackInfoResponse result) + private void SortMediaSources(PlaybackInfoResponse result, int? maxBitrate) { var originalList = result.MediaSources.ToList(); @@ -409,6 +409,23 @@ namespace MediaBrowser.Api.Playback return 1; } + }).ThenBy(i => + { + if (maxBitrate.HasValue) + { + if (i.Bitrate.HasValue) + { + if (i.Bitrate.Value <= maxBitrate.Value) + { + return 0; + } + + return 2; + } + } + + return 1; + }).ThenBy(originalList.IndexOf) .ToList(); } diff --git a/MediaBrowser.Api/Playback/Progressive/AudioService.cs b/MediaBrowser.Api/Playback/Progressive/AudioService.cs index 1d8f5003f..032a0719c 100644 --- a/MediaBrowser.Api/Playback/Progressive/AudioService.cs +++ b/MediaBrowser.Api/Playback/Progressive/AudioService.cs @@ -1,11 +1,9 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Devices; using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Model.IO; using MediaBrowser.Model.Serialization; diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs index 61c3e9aa8..3211f9e39 100644 --- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs +++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Devices; using MediaBrowser.Controller.Dlna; @@ -14,7 +13,6 @@ using ServiceStack.Web; using System; using System.Collections.Generic; using System.Globalization; -using System.IO; using System.Threading; using System.Threading.Tasks; using CommonIO; diff --git a/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs b/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs index f766f46b1..9f02c51cd 100644 --- a/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs +++ b/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Model.Logging; +using MediaBrowser.Model.Logging; using ServiceStack.Web; using System; using System.Collections.Generic; diff --git a/MediaBrowser.Api/Playback/Progressive/VideoService.cs b/MediaBrowser.Api/Playback/Progressive/VideoService.cs index 1353d8fe7..b0d87c975 100644 --- a/MediaBrowser.Api/Playback/Progressive/VideoService.cs +++ b/MediaBrowser.Api/Playback/Progressive/VideoService.cs @@ -1,4 +1,3 @@ -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Devices; @@ -10,7 +9,6 @@ using MediaBrowser.Model.IO; using MediaBrowser.Model.Serialization; using ServiceStack; using System; -using System.Globalization; using System.IO; using CommonIO; using MediaBrowser.Model.Dlna; @@ -139,12 +137,10 @@ namespace MediaBrowser.Api.Playback.Progressive args += " -mpegts_m2ts_mode 1"; } - var isOutputMkv = string.Equals(state.OutputContainer, "mkv", StringComparison.OrdinalIgnoreCase); - if (string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase)) { if (state.VideoStream != null && IsH264(state.VideoStream) && - (string.Equals(state.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase) || isOutputMkv)) + (string.Equals(state.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase))) { args += " -bsf:v h264_mp4toannexb"; } diff --git a/MediaBrowser.Api/Playback/StreamRequest.cs b/MediaBrowser.Api/Playback/StreamRequest.cs index 1135a3a54..371dbbda2 100644 --- a/MediaBrowser.Api/Playback/StreamRequest.cs +++ b/MediaBrowser.Api/Playback/StreamRequest.cs @@ -189,10 +189,9 @@ namespace MediaBrowser.Api.Playback [ApiMember(Name = "CopyTimestamps", Description = "Whether or not to copy timestamps when transcoding with an offset. Defaults to false.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] public bool CopyTimestamps { get; set; } - - [ApiMember(Name = "Cabac", Description = "Enable if cabac encoding is required", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] - public bool? Cabac { get; set; } - + + public bool ForceLiveStream { get; set; } + public VideoStreamRequest() { EnableAutoStreamCopy = true; diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs index d61bb9c0f..ed8a27faf 100644 --- a/MediaBrowser.Api/Playback/StreamState.cs +++ b/MediaBrowser.Api/Playback/StreamState.cs @@ -185,7 +185,7 @@ namespace MediaBrowser.Api.Playback private async void DisposeLiveStream() { - if ((MediaSource.RequiresClosing) && string.IsNullOrWhiteSpace(Request.LiveStreamId)) + if (MediaSource.RequiresClosing && string.IsNullOrWhiteSpace(Request.LiveStreamId)) { try { @@ -480,18 +480,5 @@ namespace MediaBrowser.Api.Playback return false; } } - - public bool? IsTargetCabac - { - get - { - if (Request.Static) - { - return VideoStream == null ? null : VideoStream.IsCabac; - } - - return true; - } - } } } diff --git a/MediaBrowser.Api/PluginService.cs b/MediaBrowser.Api/PluginService.cs index aead73def..3bf70715f 100644 --- a/MediaBrowser.Api/PluginService.cs +++ b/MediaBrowser.Api/PluginService.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common; -using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Net; using MediaBrowser.Common.Security; using MediaBrowser.Common.Updates; diff --git a/MediaBrowser.Api/Reports/Activities/ReportActivitiesBuilder.cs b/MediaBrowser.Api/Reports/Activities/ReportActivitiesBuilder.cs index 83816c6e3..8fe5246f6 100644 --- a/MediaBrowser.Api/Reports/Activities/ReportActivitiesBuilder.cs +++ b/MediaBrowser.Api/Reports/Activities/ReportActivitiesBuilder.cs @@ -1,10 +1,7 @@ using MediaBrowser.Model.Activity; using MediaBrowser.Model.Querying; -using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using MediaBrowser.Controller.Library; namespace MediaBrowser.Api.Reports { diff --git a/MediaBrowser.Api/Reports/Common/HeaderActivitiesMetadata.cs b/MediaBrowser.Api/Reports/Common/HeaderActivitiesMetadata.cs index 69c0ff234..4a45f2646 100644 --- a/MediaBrowser.Api/Reports/Common/HeaderActivitiesMetadata.cs +++ b/MediaBrowser.Api/Reports/Common/HeaderActivitiesMetadata.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; - namespace MediaBrowser.Api.Reports { public enum HeaderActivitiesMetadata diff --git a/MediaBrowser.Api/Reports/Common/HeaderMetadata.cs b/MediaBrowser.Api/Reports/Common/HeaderMetadata.cs index 62f941a7a..b25123df8 100644 --- a/MediaBrowser.Api/Reports/Common/HeaderMetadata.cs +++ b/MediaBrowser.Api/Reports/Common/HeaderMetadata.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; - namespace MediaBrowser.Api.Reports { public enum HeaderMetadata diff --git a/MediaBrowser.Api/Reports/Common/ItemViewType.cs b/MediaBrowser.Api/Reports/Common/ItemViewType.cs index 098442115..ede6705e0 100644 --- a/MediaBrowser.Api/Reports/Common/ItemViewType.cs +++ b/MediaBrowser.Api/Reports/Common/ItemViewType.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; - namespace MediaBrowser.Api.Reports { public enum ItemViewType diff --git a/MediaBrowser.Api/Reports/Common/ReportBuilderBase.cs b/MediaBrowser.Api/Reports/Common/ReportBuilderBase.cs index 6e1dd8d35..39b2610d5 100644 --- a/MediaBrowser.Api/Reports/Common/ReportBuilderBase.cs +++ b/MediaBrowser.Api/Reports/Common/ReportBuilderBase.cs @@ -1,5 +1,4 @@ using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Channels; @@ -8,8 +7,6 @@ using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace MediaBrowser.Api.Reports { @@ -327,7 +324,7 @@ namespace MediaBrowser.Api.Reports if (stream != null && stream.Width != null) return string.Format("{0} * {1}", stream.Width, - (stream.Height != null ? stream.Height.ToString() : "-")); + stream.Height != null ? stream.Height.ToString() : "-"); return string.Empty; } diff --git a/MediaBrowser.Api/Reports/Common/ReportDisplayType.cs b/MediaBrowser.Api/Reports/Common/ReportDisplayType.cs index 69d6d71ee..681bb3928 100644 --- a/MediaBrowser.Api/Reports/Common/ReportDisplayType.cs +++ b/MediaBrowser.Api/Reports/Common/ReportDisplayType.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; - namespace MediaBrowser.Api.Reports { public enum ReportDisplayType diff --git a/MediaBrowser.Api/Reports/Common/ReportExportType.cs b/MediaBrowser.Api/Reports/Common/ReportExportType.cs index 05f27f72e..4ac4cad21 100644 --- a/MediaBrowser.Api/Reports/Common/ReportExportType.cs +++ b/MediaBrowser.Api/Reports/Common/ReportExportType.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; - namespace MediaBrowser.Api.Reports { public enum ReportExportType diff --git a/MediaBrowser.Api/Reports/Common/ReportFieldType.cs b/MediaBrowser.Api/Reports/Common/ReportFieldType.cs index 58523657a..63c48dff0 100644 --- a/MediaBrowser.Api/Reports/Common/ReportFieldType.cs +++ b/MediaBrowser.Api/Reports/Common/ReportFieldType.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; - namespace MediaBrowser.Api.Reports { public enum ReportFieldType diff --git a/MediaBrowser.Api/Reports/Common/ReportHeaderIdType.cs b/MediaBrowser.Api/Reports/Common/ReportHeaderIdType.cs index 58c118151..32b2bc04d 100644 --- a/MediaBrowser.Api/Reports/Common/ReportHeaderIdType.cs +++ b/MediaBrowser.Api/Reports/Common/ReportHeaderIdType.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; - namespace MediaBrowser.Api.Reports { public enum ReportHeaderIdType diff --git a/MediaBrowser.Api/Reports/Common/ReportIncludeItemTypes.cs b/MediaBrowser.Api/Reports/Common/ReportIncludeItemTypes.cs index 4b6d96792..65cc2b686 100644 --- a/MediaBrowser.Api/Reports/Common/ReportIncludeItemTypes.cs +++ b/MediaBrowser.Api/Reports/Common/ReportIncludeItemTypes.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; - namespace MediaBrowser.Api.Reports { public enum ReportIncludeItemTypes diff --git a/MediaBrowser.Api/Reports/Common/ReportViewType.cs b/MediaBrowser.Api/Reports/Common/ReportViewType.cs index d9b049bb7..a5ffc7085 100644 --- a/MediaBrowser.Api/Reports/Common/ReportViewType.cs +++ b/MediaBrowser.Api/Reports/Common/ReportViewType.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; - namespace MediaBrowser.Api.Reports { public enum ReportViewType diff --git a/MediaBrowser.Api/Reports/Data/ReportBuilder.cs b/MediaBrowser.Api/Reports/Data/ReportBuilder.cs index 5e339dc73..e4a560383 100644 --- a/MediaBrowser.Api/Reports/Data/ReportBuilder.cs +++ b/MediaBrowser.Api/Reports/Data/ReportBuilder.cs @@ -1,19 +1,10 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; -using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Localization; -using MediaBrowser.Model.Channels; -using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Querying; -using System; using System.Collections.Generic; using System.Linq; -using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; namespace MediaBrowser.Api.Reports { @@ -616,9 +607,9 @@ namespace MediaBrowser.Api.Reports Id = item.Id.ToString("N"), HasLockData = item.IsLocked, HasLocalTrailer = hasTrailers != null ? hasTrailers.GetTrailerIds().Count() > 0 : false, - HasImageTagsPrimary = (item.ImageInfos != null && item.ImageInfos.Count(n => n.Type == ImageType.Primary) > 0), - HasImageTagsBackdrop = (item.ImageInfos != null && item.ImageInfos.Count(n => n.Type == ImageType.Backdrop) > 0), - HasImageTagsLogo = (item.ImageInfos != null && item.ImageInfos.Count(n => n.Type == ImageType.Logo) > 0), + HasImageTagsPrimary = item.ImageInfos != null && item.ImageInfos.Count(n => n.Type == ImageType.Primary) > 0, + HasImageTagsBackdrop = item.ImageInfos != null && item.ImageInfos.Count(n => n.Type == ImageType.Backdrop) > 0, + HasImageTagsLogo = item.ImageInfos != null && item.ImageInfos.Count(n => n.Type == ImageType.Logo) > 0, HasSpecials = hasSpecialFeatures != null ? hasSpecialFeatures.SpecialFeatureIds.Count > 0 : false, HasSubtitles = video != null ? video.HasSubtitles : false, RowType = ReportHelper.GetRowType(item.GetClientTypeName()) diff --git a/MediaBrowser.Api/Reports/Data/ReportExport.cs b/MediaBrowser.Api/Reports/Data/ReportExport.cs index f313cf252..6d751e030 100644 --- a/MediaBrowser.Api/Reports/Data/ReportExport.cs +++ b/MediaBrowser.Api/Reports/Data/ReportExport.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; +using System.Linq; using System.Text; -using System.Threading.Tasks; namespace MediaBrowser.Api.Reports { diff --git a/MediaBrowser.Api/Reports/Data/ReportOptions.cs b/MediaBrowser.Api/Reports/Data/ReportOptions.cs index b4fd2ee85..fae91fca3 100644 --- a/MediaBrowser.Api/Reports/Data/ReportOptions.cs +++ b/MediaBrowser.Api/Reports/Data/ReportOptions.cs @@ -1,9 +1,4 @@ -using MediaBrowser.Controller.Entities; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System; namespace MediaBrowser.Api.Reports { diff --git a/MediaBrowser.Api/Reports/Model/ReportGroup.cs b/MediaBrowser.Api/Reports/Model/ReportGroup.cs index 49c76c7ba..06ffa9082 100644 --- a/MediaBrowser.Api/Reports/Model/ReportGroup.cs +++ b/MediaBrowser.Api/Reports/Model/ReportGroup.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; namespace MediaBrowser.Api.Reports { diff --git a/MediaBrowser.Api/Reports/Model/ReportHeader.cs b/MediaBrowser.Api/Reports/Model/ReportHeader.cs index 6bff9b37e..f08339037 100644 --- a/MediaBrowser.Api/Reports/Model/ReportHeader.cs +++ b/MediaBrowser.Api/Reports/Model/ReportHeader.cs @@ -1,11 +1,4 @@ -using MediaBrowser.Controller.Entities; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MediaBrowser.Api.Reports +namespace MediaBrowser.Api.Reports { /// <summary> A report header. </summary> public class ReportHeader diff --git a/MediaBrowser.Api/Reports/Model/ReportItem.cs b/MediaBrowser.Api/Reports/Model/ReportItem.cs index 06d0b0c46..8d53dd9a1 100644 --- a/MediaBrowser.Api/Reports/Model/ReportItem.cs +++ b/MediaBrowser.Api/Reports/Model/ReportItem.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MediaBrowser.Api.Reports +namespace MediaBrowser.Api.Reports { /// <summary> A report item. </summary> public class ReportItem diff --git a/MediaBrowser.Api/Reports/Model/ReportRow.cs b/MediaBrowser.Api/Reports/Model/ReportRow.cs index 1a46b72b7..e8e26a053 100644 --- a/MediaBrowser.Api/Reports/Model/ReportRow.cs +++ b/MediaBrowser.Api/Reports/Model/ReportRow.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; namespace MediaBrowser.Api.Reports { diff --git a/MediaBrowser.Api/Reports/ReportRequests.cs b/MediaBrowser.Api/Reports/ReportRequests.cs index b11e293d5..36f4bb379 100644 --- a/MediaBrowser.Api/Reports/ReportRequests.cs +++ b/MediaBrowser.Api/Reports/ReportRequests.cs @@ -1,9 +1,6 @@ using MediaBrowser.Api.UserLibrary; -using MediaBrowser.Model.Entities; using ServiceStack; -using System; using System.Collections.Generic; -using System.Linq; namespace MediaBrowser.Api.Reports { diff --git a/MediaBrowser.Api/Reports/ReportsService.cs b/MediaBrowser.Api/Reports/ReportsService.cs index ae6fbc9e2..c3af09cd5 100644 --- a/MediaBrowser.Api/Reports/ReportsService.cs +++ b/MediaBrowser.Api/Reports/ReportsService.cs @@ -1,26 +1,15 @@ -using MediaBrowser.Controller.Dto; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Querying; using System.Collections.Generic; using System.Threading.Tasks; using System.Globalization; using System.Linq; -using MediaBrowser.Model.Dto; using MediaBrowser.Controller.Localization; -using MediaBrowser.Controller.Entities.Movies; -using MediaBrowser.Controller.Persistence; -using MediaBrowser.Api.UserLibrary; -using MediaBrowser.Controller.Collections; -using MediaBrowser.Controller.Entities.TV; using System; -using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Model.Entities; -using MediaBrowser.Controller.Net; using MediaBrowser.Model.Activity; using MediaBrowser.Controller.Activity; -using System.IO; -using System.Text; namespace MediaBrowser.Api.Reports { diff --git a/MediaBrowser.Api/Reports/Stat/ReportStatBuilder.cs b/MediaBrowser.Api/Reports/Stat/ReportStatBuilder.cs index fb694d6e1..0da4857ac 100644 --- a/MediaBrowser.Api/Reports/Stat/ReportStatBuilder.cs +++ b/MediaBrowser.Api/Reports/Stat/ReportStatBuilder.cs @@ -1,11 +1,8 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; -using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace MediaBrowser.Api.Reports { diff --git a/MediaBrowser.Api/Reports/Stat/ReportStatGroup.cs b/MediaBrowser.Api/Reports/Stat/ReportStatGroup.cs index 378eda935..f901b5417 100644 --- a/MediaBrowser.Api/Reports/Stat/ReportStatGroup.cs +++ b/MediaBrowser.Api/Reports/Stat/ReportStatGroup.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; namespace MediaBrowser.Api.Reports { diff --git a/MediaBrowser.Api/Reports/Stat/ReportStatItem.cs b/MediaBrowser.Api/Reports/Stat/ReportStatItem.cs index c7b14511f..c93ba15af 100644 --- a/MediaBrowser.Api/Reports/Stat/ReportStatItem.cs +++ b/MediaBrowser.Api/Reports/Stat/ReportStatItem.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MediaBrowser.Api.Reports +namespace MediaBrowser.Api.Reports { /// <summary> A report stat item. </summary> public class ReportStatItem diff --git a/MediaBrowser.Api/Reports/Stat/ReportStatResult.cs b/MediaBrowser.Api/Reports/Stat/ReportStatResult.cs index 66d5f16a4..fbf98fc17 100644 --- a/MediaBrowser.Api/Reports/Stat/ReportStatResult.cs +++ b/MediaBrowser.Api/Reports/Stat/ReportStatResult.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; namespace MediaBrowser.Api.Reports { diff --git a/MediaBrowser.Api/ScheduledTasks/ScheduledTasksWebSocketListener.cs b/MediaBrowser.Api/ScheduledTasks/ScheduledTasksWebSocketListener.cs index cb8f91ab6..5d3465c58 100644 --- a/MediaBrowser.Api/ScheduledTasks/ScheduledTasksWebSocketListener.cs +++ b/MediaBrowser.Api/ScheduledTasks/ScheduledTasksWebSocketListener.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.Net; -using MediaBrowser.Common.ScheduledTasks; +using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Controller.Net; using MediaBrowser.Model.Events; using MediaBrowser.Model.Logging; diff --git a/MediaBrowser.Api/SearchService.cs b/MediaBrowser.Api/SearchService.cs index 89fc29f3d..5f6767a35 100644 --- a/MediaBrowser.Api/SearchService.cs +++ b/MediaBrowser.Api/SearchService.cs @@ -4,12 +4,10 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.Net; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Search; using ServiceStack; -using System; using System.Linq; using System.Threading.Tasks; diff --git a/MediaBrowser.Api/Subtitles/SubtitleService.cs b/MediaBrowser.Api/Subtitles/SubtitleService.cs index ff17e988e..c3f31e75a 100644 --- a/MediaBrowser.Api/Subtitles/SubtitleService.cs +++ b/MediaBrowser.Api/Subtitles/SubtitleService.cs @@ -17,7 +17,6 @@ using System.Threading; using System.Threading.Tasks; using CommonIO; using MimeTypes = MediaBrowser.Model.Net.MimeTypes; -using MediaBrowser.Common.IO; namespace MediaBrowser.Api.Subtitles { diff --git a/MediaBrowser.Api/System/SystemInfoWebSocketListener.cs b/MediaBrowser.Api/System/SystemInfoWebSocketListener.cs index 49a3e3291..9ab7770ed 100644 --- a/MediaBrowser.Api/System/SystemInfoWebSocketListener.cs +++ b/MediaBrowser.Api/System/SystemInfoWebSocketListener.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.Net; -using MediaBrowser.Controller; +using MediaBrowser.Controller; using MediaBrowser.Controller.Net; using MediaBrowser.Model.Logging; using MediaBrowser.Model.System; diff --git a/MediaBrowser.Api/System/SystemService.cs b/MediaBrowser.Api/System/SystemService.cs index 2661c245f..b4b41c844 100644 --- a/MediaBrowser.Api/System/SystemService.cs +++ b/MediaBrowser.Api/System/SystemService.cs @@ -1,10 +1,8 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Common.Security; using MediaBrowser.Controller; using MediaBrowser.Controller.Net; -using MediaBrowser.Model.Entities; using MediaBrowser.Model.System; using ServiceStack; using System; diff --git a/MediaBrowser.Api/TvShowsService.cs b/MediaBrowser.Api/TvShowsService.cs index 5b5b0a902..cd95d9f10 100644 --- a/MediaBrowser.Api/TvShowsService.cs +++ b/MediaBrowser.Api/TvShowsService.cs @@ -123,7 +123,7 @@ namespace MediaBrowser.Api } [Route("/Shows/{Id}/Episodes", "GET", Summary = "Gets episodes for a tv season")] - public class GetEpisodes : IReturn<ItemsResult>, IHasItemFields + public class GetEpisodes : IReturn<ItemsResult>, IHasItemFields, IHasDtoOptions { /// <summary> /// Gets or sets the user id. @@ -173,10 +173,19 @@ namespace MediaBrowser.Api /// <value>The limit.</value> [ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] public int? Limit { get; set; } + + [ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")] + public bool? EnableImages { get; set; } + + [ApiMember(Name = "ImageTypeLimit", Description = "Optional, the max number of images to return, per image type", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] + public int? ImageTypeLimit { get; set; } + + [ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] + public string EnableImageTypes { get; set; } } [Route("/Shows/{Id}/Seasons", "GET", Summary = "Gets seasons for a tv series")] - public class GetSeasons : IReturn<ItemsResult>, IHasItemFields + public class GetSeasons : IReturn<ItemsResult>, IHasItemFields, IHasDtoOptions { /// <summary> /// Gets or sets the user id. @@ -206,6 +215,15 @@ namespace MediaBrowser.Api [ApiMember(Name = "AdjacentTo", Description = "Optional. Return items that are siblings of a supplied item.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public string AdjacentTo { get; set; } + + [ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")] + public bool? EnableImages { get; set; } + + [ApiMember(Name = "ImageTypeLimit", Description = "Optional, the max number of images to return, per image type", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] + public int? ImageTypeLimit { get; set; } + + [ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] + public string EnableImageTypes { get; set; } } /// <summary> @@ -273,7 +291,7 @@ namespace MediaBrowser.Api { var user = _userManager.GetUserById(request.UserId); - var minPremiereDate = DateTime.Now.Date.ToUniversalTime(); + var minPremiereDate = DateTime.Now.Date.ToUniversalTime().AddDays(-1); var parentIds = string.IsNullOrWhiteSpace(request.ParentId) ? new string[] { } : new[] { request.ParentId }; diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs index a28202943..6ae2b0832 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs @@ -2,7 +2,6 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Persistence; -using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; using ServiceStack; @@ -332,7 +331,7 @@ namespace MediaBrowser.Api.UserLibrary { return false; } - if (!(tags.Any(v => hasTags.Tags.Contains(v, StringComparer.OrdinalIgnoreCase)))) + if (!tags.Any(v => hasTags.Tags.Contains(v, StringComparer.OrdinalIgnoreCase))) { return false; } @@ -347,7 +346,7 @@ namespace MediaBrowser.Api.UserLibrary // Apply genre filter var genres = request.GetGenres(); - if (genres.Length > 0 && !(genres.Any(v => i.Genres.Contains(v, StringComparer.OrdinalIgnoreCase)))) + if (genres.Length > 0 && !genres.Any(v => i.Genres.Contains(v, StringComparer.OrdinalIgnoreCase))) { return false; } diff --git a/MediaBrowser.Api/UserLibrary/GameGenresService.cs b/MediaBrowser.Api/UserLibrary/GameGenresService.cs index a1ad14a4d..58237f80f 100644 --- a/MediaBrowser.Api/UserLibrary/GameGenresService.cs +++ b/MediaBrowser.Api/UserLibrary/GameGenresService.cs @@ -5,7 +5,6 @@ using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Querying; using ServiceStack; using System; using System.Collections.Generic; diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index ea7e16e8d..cfdc40bb2 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -1,8 +1,6 @@ using MediaBrowser.Controller.Collections; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Entities.Audio; -using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Localization; using MediaBrowser.Controller.Net; diff --git a/MediaBrowser.Api/UserLibrary/MusicGenresService.cs b/MediaBrowser.Api/UserLibrary/MusicGenresService.cs index 182691584..12cb62fac 100644 --- a/MediaBrowser.Api/UserLibrary/MusicGenresService.cs +++ b/MediaBrowser.Api/UserLibrary/MusicGenresService.cs @@ -5,9 +5,7 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Querying; using ServiceStack; -using System; using System.Collections.Generic; using System.Linq; diff --git a/MediaBrowser.Api/UserLibrary/PlaystateService.cs b/MediaBrowser.Api/UserLibrary/PlaystateService.cs index 0a96a5b06..94c391cb5 100644 --- a/MediaBrowser.Api/UserLibrary/PlaystateService.cs +++ b/MediaBrowser.Api/UserLibrary/PlaystateService.cs @@ -285,7 +285,7 @@ namespace MediaBrowser.Api.UserLibrary /// <param name="request">The request.</param> public void Post(OnPlaybackStart request) { - var queueableMediaTypes = (request.QueueableMediaTypes ?? string.Empty); + var queueableMediaTypes = request.QueueableMediaTypes ?? string.Empty; Post(new ReportPlaybackStart { diff --git a/MediaBrowser.Api/UserLibrary/StudiosService.cs b/MediaBrowser.Api/UserLibrary/StudiosService.cs index 7cf8d752a..2cdabf721 100644 --- a/MediaBrowser.Api/UserLibrary/StudiosService.cs +++ b/MediaBrowser.Api/UserLibrary/StudiosService.cs @@ -4,9 +4,7 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Querying; using ServiceStack; -using System; using System.Collections.Generic; using System.Linq; diff --git a/MediaBrowser.Api/UserLibrary/YearsService.cs b/MediaBrowser.Api/UserLibrary/YearsService.cs index 4b3fe6c8e..ef80f8714 100644 --- a/MediaBrowser.Api/UserLibrary/YearsService.cs +++ b/MediaBrowser.Api/UserLibrary/YearsService.cs @@ -4,9 +4,7 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Querying; using ServiceStack; -using System; using System.Collections.Generic; using System.Linq; diff --git a/MediaBrowser.Api/UserService.cs b/MediaBrowser.Api/UserService.cs index a35a1c3a2..9b611c397 100644 --- a/MediaBrowser.Api/UserService.cs +++ b/MediaBrowser.Api/UserService.cs @@ -2,7 +2,6 @@ using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Devices; -using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Session; diff --git a/MediaBrowser.Api/VideosService.cs b/MediaBrowser.Api/VideosService.cs index 0cffbb42c..c6ec69c85 100644 --- a/MediaBrowser.Api/VideosService.cs +++ b/MediaBrowser.Api/VideosService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; diff --git a/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs b/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs index 0009c7193..1272e43b9 100644 --- a/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs +++ b/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs @@ -5,10 +5,8 @@ using SharpCompress.Archive.Tar; using SharpCompress.Common; using SharpCompress.Reader; using SharpCompress.Reader.Zip; -using System; using System.IO; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Common.Implementations.Archiving { diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index caf8f54a6..f44c975d4 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -7,7 +7,6 @@ using MediaBrowser.Common.Implementations.ScheduledTasks; using MediaBrowser.Common.Implementations.Security; using MediaBrowser.Common.Implementations.Serialization; using MediaBrowser.Common.Implementations.Updates; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Common.Plugins; using MediaBrowser.Common.Progress; @@ -251,7 +250,7 @@ namespace MediaBrowser.Common.Implementations progress.Report(15); var innerProgress = new ActionableProgress<double>(); - innerProgress.RegisterAction(p => progress.Report((.8 * p) + 15)); + innerProgress.RegisterAction(p => progress.Report(.8 * p + 15)); await RegisterResources(innerProgress).ConfigureAwait(false); @@ -661,7 +660,7 @@ namespace MediaBrowser.Common.Implementations { try { - return Assembly.Load(File.ReadAllBytes((file))); + return Assembly.Load(File.ReadAllBytes(file)); } catch (Exception ex) { diff --git a/MediaBrowser.Common.Implementations/Configuration/ConfigurationHelper.cs b/MediaBrowser.Common.Implementations/Configuration/ConfigurationHelper.cs index 276da58d4..419b85fa7 100644 --- a/MediaBrowser.Common.Implementations/Configuration/ConfigurationHelper.cs +++ b/MediaBrowser.Common.Implementations/Configuration/ConfigurationHelper.cs @@ -2,7 +2,6 @@ using System; using System.IO; using System.Linq; -using MediaBrowser.Common.IO; namespace MediaBrowser.Common.Implementations.Configuration { diff --git a/MediaBrowser.Common.Implementations/Devices/DeviceId.cs b/MediaBrowser.Common.Implementations/Devices/DeviceId.cs index 4cad3cd31..f1581704b 100644 --- a/MediaBrowser.Common.Implementations/Devices/DeviceId.cs +++ b/MediaBrowser.Common.Implementations/Devices/DeviceId.cs @@ -4,7 +4,6 @@ using System; using System.IO; using System.Text; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Common.Implementations.Devices { diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs index f3316646b..3aab59ee1 100644 --- a/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs +++ b/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs @@ -11,7 +11,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; using Microsoft.Win32; namespace MediaBrowser.Common.Implementations.ScheduledTasks diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs index c7423a775..b4cc5d753 100644 --- a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs +++ b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Model.Logging; using System; diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs index 8507d3184..b18ea03b1 100644 --- a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs +++ b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs @@ -1,9 +1,7 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Common.ScheduledTasks; using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -57,7 +55,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks public Task Execute(CancellationToken cancellationToken, IProgress<double> progress) { // Delete log files more than n days old - var minDateModified = DateTime.UtcNow.AddDays(-(ConfigurationManager.CommonConfiguration.LogFileRetentionDays)); + var minDateModified = DateTime.UtcNow.AddDays(-ConfigurationManager.CommonConfiguration.LogFileRetentionDays); var filesToDelete = _fileSystem.GetFiles(ConfigurationManager.CommonApplicationPaths.LogDirectoryPath, true) .Where(f => _fileSystem.GetLastWriteTimeUtc(f) < minDateModified) diff --git a/MediaBrowser.Common.Implementations/Security/MBLicenseFile.cs b/MediaBrowser.Common.Implementations/Security/MBLicenseFile.cs index 79e558794..78515cd14 100644 --- a/MediaBrowser.Common.Implementations/Security/MBLicenseFile.cs +++ b/MediaBrowser.Common.Implementations/Security/MBLicenseFile.cs @@ -103,11 +103,11 @@ namespace MediaBrowser.Common.Implementations.Security } catch (DirectoryNotFoundException) { - (File.Create(licenseFile)).Close(); + File.Create(licenseFile).Close(); } catch (FileNotFoundException) { - (File.Create(licenseFile)).Close(); + File.Create(licenseFile).Close(); } } if (contents != null && contents.Length > 0) diff --git a/MediaBrowser.Common.Implementations/Security/MbAdmin.cs b/MediaBrowser.Common.Implementations/Security/MbAdmin.cs index ab4a83257..76ff92c2e 100644 --- a/MediaBrowser.Common.Implementations/Security/MbAdmin.cs +++ b/MediaBrowser.Common.Implementations/Security/MbAdmin.cs @@ -3,11 +3,11 @@ namespace MediaBrowser.Common.Implementations.Security { public class MbAdmin { - public const string HttpUrl = "http://www.mb3admin.com/admin/"; + public const string HttpUrl = "https://www.mb3admin.com/admin/"; /// <summary> /// Leaving as http for now until we get it squared away /// </summary> - public const string HttpsUrl = "http://www.mb3admin.com/admin/"; + public const string HttpsUrl = "https://www.mb3admin.com/admin/"; } } diff --git a/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs b/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs index a6dbf77e9..4e01041bc 100644 --- a/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs +++ b/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs @@ -21,7 +21,7 @@ namespace MediaBrowser.Common.Implementations.Security public class PluginSecurityManager : ISecurityManager { private const string MBValidateUrl = MbAdmin.HttpsUrl + "service/registration/validate"; - private const string AppstoreRegUrl = /*MbAdmin.HttpsUrl*/ "http://mb3admin.com/admin/service/appstore/register"; + private const string AppstoreRegUrl = /*MbAdmin.HttpsUrl*/ "https://mb3admin.com/admin/service/appstore/register"; /// <summary> /// The _is MB supporter @@ -299,7 +299,7 @@ namespace MediaBrowser.Common.Implementations.Security }; record.TrialVersion = IsInTrial(reg.expDate, record.RegChecked, record.IsRegistered); - record.IsValid = !record.RegChecked || (record.IsRegistered || record.TrialVersion); + record.IsValid = !record.RegChecked || record.IsRegistered || record.TrialVersion; return record; } @@ -314,7 +314,7 @@ namespace MediaBrowser.Common.Implementations.Security var isInTrial = expirationDate > DateTime.UtcNow; - return (isInTrial && !isRegistered); + return isInTrial && !isRegistered; } /// <summary> diff --git a/MediaBrowser.Common.Implementations/Serialization/JsonSerializer.cs b/MediaBrowser.Common.Implementations/Serialization/JsonSerializer.cs index 269294b36..6610cd3ff 100644 --- a/MediaBrowser.Common.Implementations/Serialization/JsonSerializer.cs +++ b/MediaBrowser.Common.Implementations/Serialization/JsonSerializer.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Model.Serialization; +using MediaBrowser.Model.Serialization; using System; using System.IO; using CommonIO; diff --git a/MediaBrowser.Common.Implementations/Serialization/XmlSerializer.cs b/MediaBrowser.Common.Implementations/Serialization/XmlSerializer.cs index 449c23b2d..189fb7afc 100644 --- a/MediaBrowser.Common.Implementations/Serialization/XmlSerializer.cs +++ b/MediaBrowser.Common.Implementations/Serialization/XmlSerializer.cs @@ -4,7 +4,6 @@ using System.Collections.Concurrent; using System.IO; using System.Xml; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Common.Implementations.Serialization { diff --git a/MediaBrowser.Common.Implementations/Updates/GithubUpdater.cs b/MediaBrowser.Common.Implementations/Updates/GithubUpdater.cs index 90a324193..2ffaedc4b 100644 --- a/MediaBrowser.Common.Implementations/Updates/GithubUpdater.cs +++ b/MediaBrowser.Common.Implementations/Updates/GithubUpdater.cs @@ -2,8 +2,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Reflection; -using System.Text; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Common.Net; diff --git a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs index 8e0df9005..5c82ccb0e 100644 --- a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs +++ b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs @@ -1,7 +1,6 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Events; using MediaBrowser.Common.Implementations.Security; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Common.Plugins; using MediaBrowser.Common.Progress; @@ -200,7 +199,7 @@ namespace MediaBrowser.Common.Implementations.Updates { var packages = _jsonSerializer.DeserializeFromStream<List<PackageInfo>>(stream).ToList(); - if ((DateTime.UtcNow - _lastPackageUpdateTime) > GetCacheLength()) + if (DateTime.UtcNow - _lastPackageUpdateTime > GetCacheLength()) { UpdateCachedPackages(CancellationToken.None, false); } @@ -233,7 +232,7 @@ namespace MediaBrowser.Common.Implementations.Updates try { - if ((DateTime.UtcNow - _lastPackageUpdateTime) < GetCacheLength()) + if (DateTime.UtcNow - _lastPackageUpdateTime < GetCacheLength()) { return; } diff --git a/MediaBrowser.Common/IO/ProgressStream.cs b/MediaBrowser.Common/IO/ProgressStream.cs index d41c715d9..468b3d345 100644 --- a/MediaBrowser.Common/IO/ProgressStream.cs +++ b/MediaBrowser.Common/IO/ProgressStream.cs @@ -147,7 +147,7 @@ namespace MediaBrowser.Common.IO BytesProcessed += read; double percent = BytesProcessed; - percent /= (ReadLength ?? BaseStream.Length); + percent /= ReadLength ?? BaseStream.Length; percent *= 100; ProgressAction(percent); diff --git a/MediaBrowser.Common/Security/ISecurityManager.cs b/MediaBrowser.Common/Security/ISecurityManager.cs index 0d8934a62..b47511c33 100644 --- a/MediaBrowser.Common/Security/ISecurityManager.cs +++ b/MediaBrowser.Common/Security/ISecurityManager.cs @@ -1,4 +1,3 @@ -using System; using MediaBrowser.Model.Entities; using System.Threading.Tasks; diff --git a/MediaBrowser.Controller/Channels/Channel.cs b/MediaBrowser.Controller/Channels/Channel.cs index 43f7b6637..718a0d878 100644 --- a/MediaBrowser.Controller/Channels/Channel.cs +++ b/MediaBrowser.Controller/Channels/Channel.cs @@ -38,7 +38,7 @@ namespace MediaBrowser.Controller.Channels set { } } - public override async Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query) + protected override async Task<QueryResult<BaseItem>> GetItemsInternal(InternalItemsQuery query) { try { diff --git a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs deleted file mode 100644 index bcb2dc234..000000000 --- a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs +++ /dev/null @@ -1,102 +0,0 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Entities.Audio; -using MediaBrowser.Model.Channels; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Users; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.Serialization; -using System.Threading; - -namespace MediaBrowser.Controller.Channels -{ - public class ChannelAudioItem : Audio - { - public ChannelMediaContentType ContentType { get; set; } - - public List<ChannelMediaInfo> ChannelMediaSources { get; set; } - - public override UnratedItem GetBlockUnratedType() - { - return UnratedItem.ChannelContent; - } - - protected override string CreateUserDataKey() - { - return ExternalId; - } - - [IgnoreDataMember] - public override bool SupportsLocalMetadata - { - get - { - return false; - } - } - - public override bool IsSaveLocalMetadataEnabled() - { - return false; - } - - public ChannelAudioItem() - { - ChannelMediaSources = new List<ChannelMediaInfo>(); - } - - [IgnoreDataMember] - public override LocationType LocationType - { - get - { - if (string.IsNullOrEmpty(Path)) - { - return LocationType.Remote; - } - - return base.LocationType; - } - } - - protected override string GetInternalMetadataPath(string basePath) - { - return System.IO.Path.Combine(basePath, "channels", ChannelId, Id.ToString("N")); - } - - public override IEnumerable<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution) - { - var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None) - .Result.ToList(); - - if (sources.Count > 0) - { - return sources; - } - - var list = base.GetMediaSources(enablePathSubstitution).ToList(); - - foreach (var mediaSource in list) - { - if (string.IsNullOrWhiteSpace(mediaSource.Path)) - { - mediaSource.Type = MediaSourceType.Placeholder; - } - } - - return list; - } - - public override bool CanDelete() - { - return false; - } - - public override bool IsVisibleStandalone(User user) - { - return IsVisibleStandaloneInternal(user, false) && ChannelVideoItem.IsChannelVisible(this, user); - } - } -} diff --git a/MediaBrowser.Controller/Channels/ChannelFolderItem.cs b/MediaBrowser.Controller/Channels/ChannelFolderItem.cs deleted file mode 100644 index 174cd282a..000000000 --- a/MediaBrowser.Controller/Channels/ChannelFolderItem.cs +++ /dev/null @@ -1,90 +0,0 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Channels; -using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Users; -using System; -using System.Runtime.Serialization; -using System.Threading; -using System.Threading.Tasks; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Entities; - -namespace MediaBrowser.Controller.Channels -{ - public class ChannelFolderItem : Folder - { - public ChannelFolderType ChannelFolderType { get; set; } - - protected override bool GetBlockUnratedValue(UserPolicy config) - { - // Don't block. - return false; - } - - public override UnratedItem GetBlockUnratedType() - { - return UnratedItem.ChannelContent; - } - - [IgnoreDataMember] - public override bool SupportsLocalMetadata - { - get - { - return false; - } - } - - public override bool IsSaveLocalMetadataEnabled() - { - return false; - } - - protected override string CreateUserDataKey() - { - return ExternalId; - } - - public override async Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query) - { - try - { - // Don't blow up here because it could cause parent screens with other content to fail - return await ChannelManager.GetChannelItemsInternal(new ChannelItemQuery - { - ChannelId = ChannelId, - FolderId = Id.ToString("N"), - Limit = query.Limit, - StartIndex = query.StartIndex, - UserId = query.User.Id.ToString("N"), - SortBy = query.SortBy, - SortOrder = query.SortOrder - - }, new Progress<double>(), CancellationToken.None); - } - catch - { - // Already logged at lower levels - return new QueryResult<BaseItem> - { - - }; - } - } - - protected override string GetInternalMetadataPath(string basePath) - { - return System.IO.Path.Combine(basePath, "channels", ChannelId, Id.ToString("N")); - } - - public override bool CanDelete() - { - return false; - } - - public override bool IsVisibleStandalone(User user) - { - return IsVisibleStandaloneInternal(user, false) && ChannelVideoItem.IsChannelVisible(this, user); - } - } -} diff --git a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs deleted file mode 100644 index e12a84ba2..000000000 --- a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs +++ /dev/null @@ -1,128 +0,0 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Channels; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Users; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Runtime.Serialization; -using System.Threading; - -namespace MediaBrowser.Controller.Channels -{ - public class ChannelVideoItem : Video - { - public ChannelMediaContentType ContentType { get; set; } - - public List<ChannelMediaInfo> ChannelMediaSources { get; set; } - - protected override string CreateUserDataKey() - { - if (ContentType == ChannelMediaContentType.MovieExtra) - { - var key = this.GetProviderId(MetadataProviders.Imdb) ?? this.GetProviderId(MetadataProviders.Tmdb); - - if (!string.IsNullOrWhiteSpace(key)) - { - key = key + "-" + ExtraType.ToString().ToLower(); - - // Make sure different trailers have their own data. - if (RunTimeTicks.HasValue) - { - key += "-" + RunTimeTicks.Value.ToString(CultureInfo.InvariantCulture); - } - - return key; - } - } - - return ExternalId; - } - - public override UnratedItem GetBlockUnratedType() - { - return UnratedItem.ChannelContent; - } - - [IgnoreDataMember] - public override bool SupportsLocalMetadata - { - get - { - return false; - } - } - - public override bool IsSaveLocalMetadataEnabled() - { - return false; - } - - public ChannelVideoItem() - { - ChannelMediaSources = new List<ChannelMediaInfo>(); - } - - [IgnoreDataMember] - public override LocationType LocationType - { - get - { - if (string.IsNullOrEmpty(Path)) - { - return LocationType.Remote; - } - - return base.LocationType; - } - } - - public override IEnumerable<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution) - { - var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None) - .Result.ToList(); - - if (sources.Count > 0) - { - return sources; - } - - var list = base.GetMediaSources(enablePathSubstitution).ToList(); - - foreach (var mediaSource in list) - { - if (string.IsNullOrWhiteSpace(mediaSource.Path)) - { - mediaSource.Type = MediaSourceType.Placeholder; - } - } - - return list; - } - - protected override string GetInternalMetadataPath(string basePath) - { - return System.IO.Path.Combine(basePath, "channels", ChannelId, Id.ToString("N")); - } - - public override bool CanDelete() - { - return false; - } - - public override bool IsVisibleStandalone(User user) - { - return IsVisibleStandaloneInternal(user, false) && IsChannelVisible(this, user); - } - - internal static bool IsChannelVisible(BaseItem item, User user) - { - var channel = ChannelManager.GetChannel(item.ChannelId); - - return channel.IsVisible(user); - } - } -} diff --git a/MediaBrowser.Controller/Channels/IChannelItem.cs b/MediaBrowser.Controller/Channels/IChannelItem.cs deleted file mode 100644 index 9b5f0359b..000000000 --- a/MediaBrowser.Controller/Channels/IChannelItem.cs +++ /dev/null @@ -1,11 +0,0 @@ -using MediaBrowser.Controller.Entities; - -namespace MediaBrowser.Controller.Channels -{ - public interface IChannelItem : IHasImages, IHasTags - { - string ChannelId { get; set; } - - string ExternalId { get; set; } - } -} diff --git a/MediaBrowser.Controller/Channels/IChannelMediaItem.cs b/MediaBrowser.Controller/Channels/IChannelMediaItem.cs deleted file mode 100644 index 60a29da90..000000000 --- a/MediaBrowser.Controller/Channels/IChannelMediaItem.cs +++ /dev/null @@ -1,18 +0,0 @@ -using MediaBrowser.Model.Channels; -using MediaBrowser.Model.Entities; -using System.Collections.Generic; - -namespace MediaBrowser.Controller.Channels -{ - public interface IChannelMediaItem : IChannelItem - { - long? RunTimeTicks { get; set; } - string MediaType { get; } - - ChannelMediaContentType ContentType { get; set; } - - ExtraType? ExtraType { get; set; } - - List<ChannelMediaInfo> ChannelMediaSources { get; set; } - } -}
\ No newline at end of file diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs index f843b10e4..018ff6da0 100644 --- a/MediaBrowser.Controller/Entities/AggregateFolder.cs +++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs @@ -3,11 +3,9 @@ using MediaBrowser.Controller.Library; using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Runtime.Serialization; using CommonIO; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Providers; namespace MediaBrowser.Controller.Entities diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index 4c66a6562..929308ba0 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -3,7 +3,6 @@ using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.MediaInfo; -using MediaBrowser.Model.Users; using System; using System.Collections.Generic; using System.Linq; @@ -191,7 +190,7 @@ namespace MediaBrowser.Controller.Entities.Audio if (IndexNumber.HasValue) { var songKey = (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "") - + (IndexNumber.Value.ToString("0000 - ")); + + IndexNumber.Value.ToString("0000 - "); return parentKey + songKey; } diff --git a/MediaBrowser.Controller/Entities/Audio/AudioPodcast.cs b/MediaBrowser.Controller/Entities/Audio/AudioPodcast.cs index 983cc0100..9072e1094 100644 --- a/MediaBrowser.Controller/Entities/Audio/AudioPodcast.cs +++ b/MediaBrowser.Controller/Entities/Audio/AudioPodcast.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MediaBrowser.Controller.Entities.Audio +namespace MediaBrowser.Controller.Entities.Audio { public class AudioPodcast : Audio { diff --git a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs index 5f24dbf67..45304d47e 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs @@ -69,7 +69,7 @@ namespace MediaBrowser.Controller.Entities.Audio public Func<BaseItem, bool> GetItemFilter() { - return i => (i is IHasMusicGenres) && i.Genres.Contains(Name, StringComparer.OrdinalIgnoreCase); + return i => i is IHasMusicGenres && i.Genres.Contains(Name, StringComparer.OrdinalIgnoreCase); } [IgnoreDataMember] diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index a85ab621d..04371c13b 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -255,6 +255,11 @@ namespace MediaBrowser.Controller.Entities if (string.IsNullOrWhiteSpace(Path)) { + if (SourceType == SourceType.Channel) + { + return LocationType.Remote; + } + return LocationType.Virtual; } @@ -301,13 +306,13 @@ namespace MediaBrowser.Controller.Entities } } - private List<Tuple<StringBuilder,bool>> GetSortChunks(string s1) + private List<Tuple<StringBuilder, bool>> GetSortChunks(string s1) { var list = new List<Tuple<StringBuilder, bool>>(); int thisMarker = 0, thisNumericChunk = 0; - while ((thisMarker < s1.Length)) + while (thisMarker < s1.Length) { if (thisMarker >= s1.Length) { @@ -407,6 +412,9 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] public DateTime DateLastRefreshed { get; set; } + [IgnoreDataMember] + public DateTime? DateModifiedDuringLastRefresh { get; set; } + /// <summary> /// The logger /// </summary> @@ -494,7 +502,19 @@ namespace MediaBrowser.Controller.Entities { get { - return _sortName ?? (_sortName = CreateSortName()); + if (_sortName == null) + { + if (!string.IsNullOrWhiteSpace(ForcedSortName)) + { + // Need the ToLower because that's what CreateSortName does + _sortName = ModifySortChunks(ForcedSortName).ToLower(); + } + else + { + _sortName = CreateSortName(); + } + } + return _sortName; } set { @@ -529,11 +549,6 @@ namespace MediaBrowser.Controller.Entities /// <returns>System.String.</returns> protected virtual string CreateSortName() { - if (!string.IsNullOrWhiteSpace(ForcedSortName)) - { - return ModifySortChunks(ForcedSortName).ToLower(); - } - if (Name == null) return null; //some items may not have name filled in properly if (!EnableAlphaNumericSorting) @@ -653,9 +668,30 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public virtual BaseItem DisplayParent + public virtual Guid? DisplayParentId { - get { return GetParent(); } + get + { + if (ParentId == Guid.Empty) + { + return null; + } + return ParentId; + } + } + + [IgnoreDataMember] + public BaseItem DisplayParent + { + get + { + var id = DisplayParentId; + if (!id.HasValue || id.Value == Guid.Empty) + { + return null; + } + return LibraryManager.GetItemById(id.Value); + } } /// <summary> @@ -1312,6 +1348,19 @@ namespace MediaBrowser.Controller.Entities return LocalizationManager.GetRatingLevel(rating); } + public List<string> GetInheritedTags() + { + var list = new List<string>(); + list.AddRange(Tags); + + foreach (var parent in GetParents()) + { + list.AddRange(parent.Tags); + } + + return list.Distinct(StringComparer.OrdinalIgnoreCase).ToList(); + } + private bool IsVisibleViaTags(User user) { var hasTags = this as IHasTags; diff --git a/MediaBrowser.Controller/Entities/Book.cs b/MediaBrowser.Controller/Entities/Book.cs index 5ef098ff8..1c86a53f0 100644 --- a/MediaBrowser.Controller/Entities/Book.cs +++ b/MediaBrowser.Controller/Entities/Book.cs @@ -1,10 +1,8 @@ using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; -using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Users; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index b2c7c2fa8..429700327 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -3,13 +3,11 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index bec8cd28b..f4cdc8fa1 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -6,7 +6,6 @@ using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; using System; -using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; @@ -14,9 +13,6 @@ using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Entities.Movies; -using MediaBrowser.Controller.Playlists; using MediaBrowser.Model.Channels; namespace MediaBrowser.Controller.Entities @@ -115,7 +111,7 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] protected virtual bool SupportsShortcutChildren { - get { return ConfigurationManager.Configuration.EnableWindowsShortcuts; } + get { return false; } } /// <summary> @@ -500,7 +496,7 @@ namespace MediaBrowser.Controller.Entities var innerProgress = new ActionableProgress<double>(); - innerProgress.RegisterAction(p => progress.Report((.80 * p) + 20)); + innerProgress.RegisterAction(p => progress.Report(.80 * p + 20)); if (container != null) { @@ -634,7 +630,7 @@ namespace MediaBrowser.Controller.Entities var percent = percentages.Values.Sum(); percent /= childCount; - progress.Report((10 * percent) + 10); + progress.Report(10 * percent + 10); } }); @@ -1126,7 +1122,18 @@ namespace MediaBrowser.Controller.Entities return false; } - public virtual async Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query) + public Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query) + { + if (query.ItemIds.Length > 0) + { + var specificItems = query.ItemIds.Select(LibraryManager.GetItemById).Where(i => i != null).ToList(); + return Task.FromResult(PostFilterAndSort(specificItems, query)); + } + + return GetItemsInternal(query); + } + + protected virtual async Task<QueryResult<BaseItem>> GetItemsInternal(InternalItemsQuery query) { if (SourceType == SourceType.Channel) { @@ -1179,9 +1186,7 @@ namespace MediaBrowser.Controller.Entities : GetChildren(user, true).Where(filter); } - var result = PostFilterAndSort(items, query); - - return result; + return PostFilterAndSort(items, query); } protected QueryResult<BaseItem> PostFilterAndSort(IEnumerable<BaseItem> items, InternalItemsQuery query) diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs index e073d09f6..e597b2a15 100644 --- a/MediaBrowser.Controller/Entities/Game.cs +++ b/MediaBrowser.Controller/Entities/Game.cs @@ -1,7 +1,6 @@ using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Users; using System; using System.Collections.Generic; using System.Linq; diff --git a/MediaBrowser.Controller/Entities/GameGenre.cs b/MediaBrowser.Controller/Entities/GameGenre.cs index bf448da0d..d2b6b4856 100644 --- a/MediaBrowser.Controller/Entities/GameGenre.cs +++ b/MediaBrowser.Controller/Entities/GameGenre.cs @@ -60,7 +60,7 @@ namespace MediaBrowser.Controller.Entities public Func<BaseItem, bool> GetItemFilter() { - return i => (i is Game) && i.Genres.Contains(Name, StringComparer.OrdinalIgnoreCase); + return i => i is Game && i.Genres.Contains(Name, StringComparer.OrdinalIgnoreCase); } [IgnoreDataMember] diff --git a/MediaBrowser.Controller/Entities/IHasImages.cs b/MediaBrowser.Controller/Entities/IHasImages.cs index 28835168a..897250caa 100644 --- a/MediaBrowser.Controller/Entities/IHasImages.cs +++ b/MediaBrowser.Controller/Entities/IHasImages.cs @@ -1,11 +1,10 @@ -using MediaBrowser.Controller.Providers; +using System; +using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using System.Collections.Generic; -using System.IO; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Library; namespace MediaBrowser.Controller.Entities @@ -208,6 +207,8 @@ namespace MediaBrowser.Controller.Entities /// <param name="image">The image.</param> /// <param name="index">The index.</param> void SetImage(ItemImageInfo image, int index); + + DateTime? DateModifiedDuringLastRefresh { get; set; } } public static class HasImagesExtensions diff --git a/MediaBrowser.Controller/Entities/IHasMetadata.cs b/MediaBrowser.Controller/Entities/IHasMetadata.cs index 473ee120e..1f680b35f 100644 --- a/MediaBrowser.Controller/Entities/IHasMetadata.cs +++ b/MediaBrowser.Controller/Entities/IHasMetadata.cs @@ -1,9 +1,4 @@ -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Providers; -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System; namespace MediaBrowser.Controller.Entities { @@ -30,6 +25,8 @@ namespace MediaBrowser.Controller.Entities /// <value>The date last saved.</value> DateTime DateLastSaved { get; set; } + SourceType SourceType { get; set; } + /// <summary> /// Gets or sets the date last refreshed. /// </summary> diff --git a/MediaBrowser.Controller/Entities/IHasProgramAttributes.cs b/MediaBrowser.Controller/Entities/IHasProgramAttributes.cs index 1c3270d72..106b8bce4 100644 --- a/MediaBrowser.Controller/Entities/IHasProgramAttributes.cs +++ b/MediaBrowser.Controller/Entities/IHasProgramAttributes.cs @@ -1,5 +1,4 @@ using MediaBrowser.Model.LiveTv; -using System; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/Entities/IHasTrailers.cs b/MediaBrowser.Controller/Entities/IHasTrailers.cs index bc1c7d875..e5cbdff72 100644 --- a/MediaBrowser.Controller/Entities/IHasTrailers.cs +++ b/MediaBrowser.Controller/Entities/IHasTrailers.cs @@ -1,6 +1,7 @@ using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; +using System.Linq; namespace MediaBrowser.Controller.Entities { @@ -18,11 +19,20 @@ namespace MediaBrowser.Controller.Entities /// <value>The local trailer ids.</value> List<Guid> LocalTrailerIds { get; set; } List<Guid> RemoteTrailerIds { get; set; } + } + public static class HasTrailerExtensions + { /// <summary> /// Gets the trailer ids. /// </summary> /// <returns>List<Guid>.</returns> - List<Guid> GetTrailerIds(); + public static List<Guid> GetTrailerIds(this IHasTrailers item) + { + var list = item.LocalTrailerIds.ToList(); + list.AddRange(item.RemoteTrailerIds); + return list; + } + } } diff --git a/MediaBrowser.Controller/Entities/IHiddenFromDisplay.cs b/MediaBrowser.Controller/Entities/IHiddenFromDisplay.cs index 82d581fcf..ba6311296 100644 --- a/MediaBrowser.Controller/Entities/IHiddenFromDisplay.cs +++ b/MediaBrowser.Controller/Entities/IHiddenFromDisplay.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MediaBrowser.Controller.Entities +namespace MediaBrowser.Controller.Entities { public interface IHiddenFromDisplay { diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs index b568aec18..fbf246b3a 100644 --- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs +++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs @@ -33,6 +33,7 @@ namespace MediaBrowser.Controller.Entities public string[] IncludeItemTypes { get; set; } public string[] ExcludeItemTypes { get; set; } public string[] ExcludeTags { get; set; } + public string[] ExcludeInheritedTags { get; set; } public string[] Genres { get; set; } public bool? IsMissing { get; set; } @@ -157,6 +158,7 @@ namespace MediaBrowser.Controller.Entities AncestorIds = new string[] { }; TopParentIds = new string[] { }; ExcludeTags = new string[] { }; + ExcludeInheritedTags = new string[] { }; LocationTypes = new LocationType[] { }; ExcludeLocationTypes = new LocationType[] { }; PresetViews = new string[] { }; @@ -181,7 +183,7 @@ namespace MediaBrowser.Controller.Entities BlockUnratedItems = policy.BlockUnratedItems; } - ExcludeTags = policy.BlockedTags; + ExcludeInheritedTags = policy.BlockedTags; User = user; } diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs index 4c31356d0..4d2ca9ffe 100644 --- a/MediaBrowser.Controller/Entities/Movies/Movie.cs +++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs @@ -1,16 +1,13 @@ using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Users; using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Entities.Movies { @@ -82,17 +79,6 @@ namespace MediaBrowser.Controller.Entities.Movies } /// <summary> - /// Gets the trailer ids. - /// </summary> - /// <returns>List<Guid>.</returns> - public List<Guid> GetTrailerIds() - { - var list = LocalTrailerIds.ToList(); - list.AddRange(RemoteTrailerIds); - return list; - } - - /// <summary> /// Gets the user data key. /// </summary> /// <returns>System.String.</returns> diff --git a/MediaBrowser.Controller/Entities/MusicVideo.cs b/MediaBrowser.Controller/Entities/MusicVideo.cs index 8a820b5ff..b52f16a46 100644 --- a/MediaBrowser.Controller/Entities/MusicVideo.cs +++ b/MediaBrowser.Controller/Entities/MusicVideo.cs @@ -2,11 +2,8 @@ using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; -using System; using System.Collections.Generic; -using System.Linq; using System.Runtime.Serialization; -using MediaBrowser.Model.Users; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/Entities/Photo.cs b/MediaBrowser.Controller/Entities/Photo.cs index aa9e44297..3358ccc6f 100644 --- a/MediaBrowser.Controller/Entities/Photo.cs +++ b/MediaBrowser.Controller/Entities/Photo.cs @@ -1,9 +1,7 @@ -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Drawing; +using MediaBrowser.Model.Drawing; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; -using MediaBrowser.Model.Users; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/Entities/PhotoAlbum.cs b/MediaBrowser.Controller/Entities/PhotoAlbum.cs index 1f4faaf49..c8ab67a69 100644 --- a/MediaBrowser.Controller/Entities/PhotoAlbum.cs +++ b/MediaBrowser.Controller/Entities/PhotoAlbum.cs @@ -1,11 +1,7 @@ -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Users; -using System; using System.Linq; using System.Runtime.Serialization; -using System.Threading; -using System.Threading.Tasks; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index d4f829917..ec65221bc 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -1,7 +1,6 @@ using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Users; using System; using System.Collections.Generic; using System.Linq; @@ -91,11 +90,11 @@ namespace MediaBrowser.Controller.Entities.TV } [IgnoreDataMember] - public override BaseItem DisplayParent + public override Guid? DisplayParentId { get { - return Season ?? GetParent(); + return SeasonId; } } @@ -176,7 +175,7 @@ namespace MediaBrowser.Controller.Entities.TV /// <returns>System.String.</returns> protected override string CreateSortName() { - return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("000-") : "") + return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("000 - ") : "") + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name; } diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs index 9efa609ef..acd02e8ab 100644 --- a/MediaBrowser.Controller/Entities/TV/Season.cs +++ b/MediaBrowser.Controller/Entities/TV/Season.cs @@ -33,9 +33,13 @@ namespace MediaBrowser.Controller.Entities.TV } [IgnoreDataMember] - public override BaseItem DisplayParent + public override Guid? DisplayParentId { - get { return Series ?? GetParent(); } + get + { + var series = Series; + return series == null ? ParentId : series.Id; + } } // Genre, Rating and Stuido will all be the same @@ -129,7 +133,7 @@ namespace MediaBrowser.Controller.Entities.TV get { return (IndexNumber ?? -1) == 0; } } - public override Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query) + protected override Task<QueryResult<BaseItem>> GetItemsInternal(InternalItemsQuery query) { var user = query.User; diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index aa07ab378..9eeb89a1f 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -157,7 +157,7 @@ namespace MediaBrowser.Controller.Entities.TV return GetSeasons(user, config.DisplayMissingEpisodes, config.DisplayUnairedEpisodes); } - public override Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query) + protected override Task<QueryResult<BaseItem>> GetItemsInternal(InternalItemsQuery query) { var user = query.User; diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs index 9d5ef2035..c3e24090c 100644 --- a/MediaBrowser.Controller/Entities/Trailer.cs +++ b/MediaBrowser.Controller/Entities/Trailer.cs @@ -1,11 +1,8 @@ using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Users; -using System; using System.Collections.Generic; using System.Globalization; -using System.Linq; using System.Runtime.Serialization; using MediaBrowser.Controller.Entities.Movies; @@ -24,11 +21,11 @@ namespace MediaBrowser.Controller.Entities Taglines = new List<string>(); Keywords = new List<string>(); ProductionLocations = new List<string>(); - TrailerTypes = new List<TrailerType>(); + TrailerTypes = new List<TrailerType> { TrailerType.LocalTrailer }; } public List<TrailerType> TrailerTypes { get; set; } - + public float? Metascore { get; set; } public List<MediaUrl> RemoteTrailers { get; set; } @@ -89,7 +86,7 @@ namespace MediaBrowser.Controller.Entities var info = GetItemLookupInfo<TrailerInfo>(); info.IsLocalTrailer = TrailerTypes.Contains(TrailerType.LocalTrailer); - + if (!IsInMixedFolder) { info.Name = System.IO.Path.GetFileName(ContainingFolderPath); diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs index 6c9266d74..e5b39003d 100644 --- a/MediaBrowser.Controller/Entities/User.cs +++ b/MediaBrowser.Controller/Entities/User.cs @@ -5,7 +5,6 @@ using MediaBrowser.Model.Connect; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Users; using System; -using System.IO; using System.Linq; using System.Runtime.Serialization; using System.Threading; diff --git a/MediaBrowser.Controller/Entities/UserRootFolder.cs b/MediaBrowser.Controller/Entities/UserRootFolder.cs index 104408860..8ce39c697 100644 --- a/MediaBrowser.Controller/Entities/UserRootFolder.cs +++ b/MediaBrowser.Controller/Entities/UserRootFolder.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.Library; namespace MediaBrowser.Controller.Entities { @@ -17,7 +18,7 @@ namespace MediaBrowser.Controller.Entities /// </summary> public class UserRootFolder : Folder { - public override async Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query) + protected override async Task<QueryResult<BaseItem>> GetItemsInternal(InternalItemsQuery query) { if (query.Recursive) { diff --git a/MediaBrowser.Controller/Entities/UserView.cs b/MediaBrowser.Controller/Entities/UserView.cs index 41c19f11d..40fec3e28 100644 --- a/MediaBrowser.Controller/Entities/UserView.cs +++ b/MediaBrowser.Controller/Entities/UserView.cs @@ -45,7 +45,7 @@ namespace MediaBrowser.Controller.Entities return list; } - public override Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query) + protected override Task<QueryResult<BaseItem>> GetItemsInternal(InternalItemsQuery query) { var parent = this as Folder; diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs index a74859a46..db669ca37 100644 --- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs +++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs @@ -363,14 +363,14 @@ namespace MediaBrowser.Controller.Entities private QueryResult<BaseItem> GetMusicAlbums(Folder parent, User user, InternalItemsQuery query) { - var items = GetRecursiveChildren(parent, user, new[] { CollectionType.Music, CollectionType.MusicVideos }, i => (i is MusicAlbum) && FilterItem(i, query)); + var items = GetRecursiveChildren(parent, user, new[] { CollectionType.Music, CollectionType.MusicVideos }, i => i is MusicAlbum && FilterItem(i, query)); return PostFilterAndSort(items, parent, null, query); } private QueryResult<BaseItem> GetMusicSongs(Folder parent, User user, InternalItemsQuery query) { - var items = GetRecursiveChildren(parent, user, new[] { CollectionType.Music, CollectionType.MusicVideos }, i => (i is Audio.Audio) && FilterItem(i, query)); + var items = GetRecursiveChildren(parent, user, new[] { CollectionType.Music, CollectionType.MusicVideos }, i => i is Audio.Audio && FilterItem(i, query)); return PostFilterAndSort(items, parent, null, query); } @@ -382,7 +382,7 @@ namespace MediaBrowser.Controller.Entities UserId = user.Id.ToString("N"), Limit = GetSpecialItemsLimit(), IncludeItemTypes = new[] { typeof(Audio.Audio).Name }, - ParentId = (parent == null ? null : parent.Id.ToString("N")), + ParentId = parent == null ? null : parent.Id.ToString("N"), GroupItems = true }).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null); @@ -398,7 +398,7 @@ namespace MediaBrowser.Controller.Entities { query.IsFavorite = true; - var items = GetRecursiveChildren(parent, user, new[] { CollectionType.Music }, i => (i is Audio.Audio) && FilterItem(i, query)); + var items = GetRecursiveChildren(parent, user, new[] { CollectionType.Music }, i => i is Audio.Audio && FilterItem(i, query)); return PostFilterAndSort(items, parent, null, query); } @@ -407,7 +407,7 @@ namespace MediaBrowser.Controller.Entities { query.IsFavorite = true; - var items = GetRecursiveChildren(parent, user, new[] { CollectionType.Music }, i => (i is MusicAlbum) && FilterItem(i, query)); + var items = GetRecursiveChildren(parent, user, new[] { CollectionType.Music }, i => i is MusicAlbum && FilterItem(i, query)); return PostFilterAndSort(items, parent, null, query); } @@ -459,7 +459,7 @@ namespace MediaBrowser.Controller.Entities { query.IsFavorite = true; - var items = GetRecursiveChildren(parent, user, new[] { CollectionType.Movies, CollectionType.BoxSets, string.Empty }, i => (i is Movie) && FilterItem(i, query)); + var items = GetRecursiveChildren(parent, user, new[] { CollectionType.Movies, CollectionType.BoxSets, string.Empty }, i => i is Movie && FilterItem(i, query)); return PostFilterAndSort(items, parent, null, query); } @@ -468,7 +468,7 @@ namespace MediaBrowser.Controller.Entities { query.IsFavorite = true; - var items = GetRecursiveChildren(parent, user, new[] { CollectionType.TvShows, string.Empty }, i => (i is Series) && FilterItem(i, query)); + var items = GetRecursiveChildren(parent, user, new[] { CollectionType.TvShows, string.Empty }, i => i is Series && FilterItem(i, query)); return PostFilterAndSort(items, parent, null, query); } @@ -477,21 +477,21 @@ namespace MediaBrowser.Controller.Entities { query.IsFavorite = true; - var items = GetRecursiveChildren(parent, user, new[] { CollectionType.TvShows, string.Empty }, i => (i is Episode) && FilterItem(i, query)); + var items = GetRecursiveChildren(parent, user, new[] { CollectionType.TvShows, string.Empty }, i => i is Episode && FilterItem(i, query)); return PostFilterAndSort(items, parent, null, query); } private QueryResult<BaseItem> GetMovieMovies(Folder parent, User user, InternalItemsQuery query) { - var items = GetRecursiveChildren(parent, user, new[] { CollectionType.Movies, CollectionType.BoxSets, string.Empty }, i => (i is Movie) && FilterItem(i, query)); + var items = GetRecursiveChildren(parent, user, new[] { CollectionType.Movies, CollectionType.BoxSets, string.Empty }, i => i is Movie && FilterItem(i, query)); return PostFilterAndSort(items, parent, null, query); } private QueryResult<BaseItem> GetMovieCollections(Folder parent, User user, InternalItemsQuery query) { - var items = GetRecursiveChildren(parent, user, new[] { CollectionType.Movies, CollectionType.BoxSets, string.Empty }, i => (i is BoxSet) && FilterItem(i, query)); + var items = GetRecursiveChildren(parent, user, new[] { CollectionType.Movies, CollectionType.BoxSets, string.Empty }, i => i is BoxSet && FilterItem(i, query)); return PostFilterAndSort(items, parent, null, query); } @@ -785,7 +785,7 @@ namespace MediaBrowser.Controller.Entities return false; } - if (query.IncludeItemTypes.Contains("Movie", StringComparer.OrdinalIgnoreCase)) + if (query.IncludeItemTypes.Length == 0 || query.IncludeItemTypes.Contains("Movie", StringComparer.OrdinalIgnoreCase)) { param = true; } @@ -1516,7 +1516,7 @@ namespace MediaBrowser.Controller.Entities } // Apply genre filter - if (query.Genres.Length > 0 && !(query.Genres.Any(v => item.Genres.Contains(v, StringComparer.OrdinalIgnoreCase)))) + if (query.Genres.Length > 0 && !query.Genres.Any(v => item.Genres.Contains(v, StringComparer.OrdinalIgnoreCase))) { return false; } @@ -1603,7 +1603,7 @@ namespace MediaBrowser.Controller.Entities { return false; } - if (!(tags.Any(v => hasTags.Tags.Contains(v, StringComparer.OrdinalIgnoreCase)))) + if (!tags.Any(v => hasTags.Tags.Contains(v, StringComparer.OrdinalIgnoreCase))) { return false; } diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index 3b1da85b5..2c7d3856b 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -7,14 +7,11 @@ using MediaBrowser.Model.MediaInfo; using System; using System.Collections.Generic; using System.Globalization; -using System.IO; using System.Linq; -using System.Net.Mime; using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Channels; namespace MediaBrowser.Controller.Entities @@ -83,23 +80,6 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override LocationType LocationType - { - get - { - if (SourceType == SourceType.Channel) - { - if (string.IsNullOrEmpty(Path)) - { - return LocationType.Remote; - } - } - - return base.LocationType; - } - } - - [IgnoreDataMember] public override bool SupportsAddingToPlaylist { get { return LocationType == LocationType.FileSystem && RunTimeTicks.HasValue; } diff --git a/MediaBrowser.Controller/IO/FileData.cs b/MediaBrowser.Controller/IO/FileData.cs index ed5acbb3d..6e7e60f88 100644 --- a/MediaBrowser.Controller/IO/FileData.cs +++ b/MediaBrowser.Controller/IO/FileData.cs @@ -1,10 +1,8 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Logging; using System; using System.Collections.Generic; -using System.IO; using CommonIO; namespace MediaBrowser.Controller.IO diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 752ac2dad..c8b3d5131 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -8,11 +8,9 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; using System; using System.Collections.Generic; -using System.IO; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Library { diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs index 9084ea56b..ea3199b31 100644 --- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs +++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Library { @@ -118,8 +117,8 @@ namespace MediaBrowser.Controller.Library var parentDir = System.IO.Path.GetDirectoryName(Path) ?? string.Empty; - return (parentDir.Length > _appPaths.RootFolderPath.Length - && parentDir.StartsWith(_appPaths.RootFolderPath, StringComparison.OrdinalIgnoreCase)); + return parentDir.Length > _appPaths.RootFolderPath.Length + && parentDir.StartsWith(_appPaths.RootFolderPath, StringComparison.OrdinalIgnoreCase); } } @@ -280,7 +279,7 @@ namespace MediaBrowser.Controller.Library /// <returns><c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.</returns> public override bool Equals(object obj) { - return (Equals(obj as ItemResolveArgs)); + return Equals(obj as ItemResolveArgs); } /// <summary> diff --git a/MediaBrowser.Controller/Library/LibraryManagerExtensions.cs b/MediaBrowser.Controller/Library/LibraryManagerExtensions.cs index 4c9831bf9..ec69bea6e 100644 --- a/MediaBrowser.Controller/Library/LibraryManagerExtensions.cs +++ b/MediaBrowser.Controller/Library/LibraryManagerExtensions.cs @@ -1,5 +1,4 @@ using System; -using System.Threading.Tasks; using MediaBrowser.Controller.Entities; namespace MediaBrowser.Controller.Library diff --git a/MediaBrowser.Controller/LiveTv/ChannelInfo.cs b/MediaBrowser.Controller/LiveTv/ChannelInfo.cs index 7d8df96ed..372b095fd 100644 --- a/MediaBrowser.Controller/LiveTv/ChannelInfo.cs +++ b/MediaBrowser.Controller/LiveTv/ChannelInfo.cs @@ -59,5 +59,9 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value><c>null</c> if [is favorite] contains no value, <c>true</c> if [is favorite]; otherwise, <c>false</c>.</value> public bool? IsFavorite { get; set; } + + public bool? IsHD { get; set; } + public string AudioCodec { get; set; } + public string VideoCodec { get; set; } } } diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs index 4cc7b27ea..a4bd32fff 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs @@ -1,5 +1,4 @@ using System; -using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Dto; @@ -384,5 +383,7 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <returns>List<NameValuePair>.</returns> List<NameValuePair> GetSatIniMappings(); + + Task<List<ChannelInfo>> GetSatChannelScanResult(TunerHostInfo info, CancellationToken cancellationToken); } } diff --git a/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs index 2657ade42..17a27eac1 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs @@ -4,7 +4,6 @@ using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.LiveTv; -using MediaBrowser.Model.Users; using System; using System.Collections.Generic; using System.Linq; diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs index 24ec3f5e1..35b9a1959 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs @@ -4,9 +4,7 @@ using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.MediaInfo; -using MediaBrowser.Model.Users; using System.Collections.Generic; -using System.Linq; using System.Runtime.Serialization; namespace MediaBrowser.Controller.LiveTv diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs index 684af9974..59b921c6a 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs @@ -3,11 +3,8 @@ using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.LiveTv; -using MediaBrowser.Model.Users; using System; -using System.Linq; using System.Runtime.Serialization; -using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.LiveTv { diff --git a/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs index 6dff66438..f310a957c 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs @@ -4,7 +4,6 @@ using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.LiveTv; -using MediaBrowser.Model.Users; using System; using System.Collections.Generic; using System.Linq; diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 6f429ed2f..6ff4e39e2 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -75,20 +75,15 @@ </Compile> <Compile Include="Activity\IActivityManager.cs" /> <Compile Include="Activity\IActivityRepository.cs" /> - <Compile Include="Channels\ChannelAudioItem.cs" /> - <Compile Include="Channels\ChannelFolderItem.cs" /> <Compile Include="Channels\ChannelItemInfo.cs" /> <Compile Include="Channels\ChannelItemResult.cs" /> <Compile Include="Channels\ChannelItemType.cs" /> <Compile Include="Channels\ChannelMediaInfo.cs" /> <Compile Include="Channels\ChannelParentalRating.cs" /> <Compile Include="Channels\ChannelSearchInfo.cs" /> - <Compile Include="Channels\ChannelVideoItem.cs" /> <Compile Include="Channels\IChannel.cs" /> - <Compile Include="Channels\IChannelItem.cs" /> <Compile Include="Channels\IChannelManager.cs" /> <Compile Include="Channels\Channel.cs" /> - <Compile Include="Channels\IChannelMediaItem.cs" /> <Compile Include="Channels\IHasCacheKey.cs" /> <Compile Include="Channels\IIndexableChannel.cs" /> <Compile Include="Channels\InternalAllChannelMediaQuery.cs" /> diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs index ddaf7ff6d..c87ac4e73 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs @@ -58,8 +58,6 @@ namespace MediaBrowser.Controller.MediaEncoding } } - public bool? Cabac { get; set; } - public EncodingJobOptions() { @@ -87,7 +85,6 @@ namespace MediaBrowser.Controller.MediaEncoding MaxRefFrames = info.MaxRefFrames; MaxVideoBitDepth = info.MaxVideoBitDepth; SubtitleMethod = info.SubtitleDeliveryMethod; - Cabac = info.Cabac; Context = info.Context; if (info.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External) diff --git a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs index 76ef054de..d2feb4116 100644 --- a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs +++ b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs @@ -51,6 +51,8 @@ namespace MediaBrowser.Controller.MediaEncoding /// <returns>Task{Stream}.</returns> Task<Stream> ExtractVideoImage(string[] inputFiles, MediaProtocol protocol, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken); + Task<Stream> ExtractVideoImage(string[] inputFiles, MediaProtocol protocol, int? imageStreamIndex, CancellationToken cancellationToken); + /// <summary> /// Extracts the video images on interval. /// </summary> diff --git a/MediaBrowser.Controller/MediaEncoding/ISubtitleEncoder.cs b/MediaBrowser.Controller/MediaEncoding/ISubtitleEncoder.cs index 826711e51..e538b84d8 100644 --- a/MediaBrowser.Controller/MediaEncoding/ISubtitleEncoder.cs +++ b/MediaBrowser.Controller/MediaEncoding/ISubtitleEncoder.cs @@ -33,6 +33,6 @@ namespace MediaBrowser.Controller.MediaEncoding /// <param name="protocol">The protocol.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>System.String.</returns> - Task<string> GetSubtitleFileCharacterSet(string path, MediaProtocol protocol, CancellationToken cancellationToken); + Task<string> GetSubtitleFileCharacterSet(string path, string language, MediaProtocol protocol, CancellationToken cancellationToken); } } diff --git a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs index 7985ec054..66a9fa60b 100644 --- a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs +++ b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.MediaEncoding { diff --git a/MediaBrowser.Controller/Net/IWebSocketListener.cs b/MediaBrowser.Controller/Net/IWebSocketListener.cs index 2b4fc7676..29698c1a4 100644 --- a/MediaBrowser.Controller/Net/IWebSocketListener.cs +++ b/MediaBrowser.Controller/Net/IWebSocketListener.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.Net; -using System.Threading.Tasks; +using System.Threading.Tasks; namespace MediaBrowser.Controller.Net { diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs index 2192ebcac..c057c9707 100644 --- a/MediaBrowser.Controller/Providers/DirectoryService.cs +++ b/MediaBrowser.Controller/Providers/DirectoryService.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Providers { diff --git a/MediaBrowser.Controller/Providers/IDirectoryService.cs b/MediaBrowser.Controller/Providers/IDirectoryService.cs index 062a10901..09f9ba8c0 100644 --- a/MediaBrowser.Controller/Providers/IDirectoryService.cs +++ b/MediaBrowser.Controller/Providers/IDirectoryService.cs @@ -1,7 +1,5 @@ using System.Collections.Generic; -using System.IO; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Providers { diff --git a/MediaBrowser.Controller/Providers/IHasItemChangeMonitor.cs b/MediaBrowser.Controller/Providers/IHasItemChangeMonitor.cs index 4c7069dd6..9441c3ecd 100644 --- a/MediaBrowser.Controller/Providers/IHasItemChangeMonitor.cs +++ b/MediaBrowser.Controller/Providers/IHasItemChangeMonitor.cs @@ -8,9 +8,8 @@ namespace MediaBrowser.Controller.Providers /// Determines whether the specified item has changed. /// </summary> /// <param name="item">The item.</param> - /// <param name="status">The status.</param> /// <param name="directoryService">The directory service.</param> /// <returns><c>true</c> if the specified item has changed; otherwise, <c>false</c>.</returns> - bool HasChanged(IHasMetadata item, MetadataStatus status, IDirectoryService directoryService); + bool HasChanged(IHasMetadata item, IDirectoryService directoryService); } }
\ No newline at end of file diff --git a/MediaBrowser.Controller/Providers/IMetadataProvider.cs b/MediaBrowser.Controller/Providers/IMetadataProvider.cs index 26f43d820..0f534c328 100644 --- a/MediaBrowser.Controller/Providers/IMetadataProvider.cs +++ b/MediaBrowser.Controller/Providers/IMetadataProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Controller.Entities; -using System.Collections.Generic; namespace MediaBrowser.Controller.Providers { diff --git a/MediaBrowser.Controller/Providers/IProviderRepository.cs b/MediaBrowser.Controller/Providers/IProviderRepository.cs index 3cd2c3f31..1f77d0ca1 100644 --- a/MediaBrowser.Controller/Providers/IProviderRepository.cs +++ b/MediaBrowser.Controller/Providers/IProviderRepository.cs @@ -1,6 +1,5 @@ using MediaBrowser.Controller.Persistence; using System; -using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.Controller/Providers/ISeriesOrderManager.cs b/MediaBrowser.Controller/Providers/ISeriesOrderManager.cs index 235d0ada5..970f7a7be 100644 --- a/MediaBrowser.Controller/Providers/ISeriesOrderManager.cs +++ b/MediaBrowser.Controller/Providers/ISeriesOrderManager.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Collections.Generic; using System.Threading.Tasks; -using MediaBrowser.Common; namespace MediaBrowser.Controller.Providers { diff --git a/MediaBrowser.Controller/Providers/LocalImageInfo.cs b/MediaBrowser.Controller/Providers/LocalImageInfo.cs index 51916268f..14f292bec 100644 --- a/MediaBrowser.Controller/Providers/LocalImageInfo.cs +++ b/MediaBrowser.Controller/Providers/LocalImageInfo.cs @@ -1,6 +1,4 @@ -using System.IO; using CommonIO; -using MediaBrowser.Common.IO; using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Providers diff --git a/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs b/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs index 6f217eea2..9427b2afd 100644 --- a/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs +++ b/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs @@ -1,6 +1,6 @@ using System.Linq; using CommonIO; -using MediaBrowser.Common.IO; +using MediaBrowser.Model.Providers; namespace MediaBrowser.Controller.Providers { @@ -14,6 +14,7 @@ namespace MediaBrowser.Controller.Providers public bool IsPostRecursiveRefresh { get; set; } public MetadataRefreshMode MetadataRefreshMode { get; set; } + public RemoteSearchResult SearchResult { get; set; } public bool ForceSave { get; set; } @@ -38,6 +39,7 @@ namespace MediaBrowser.Controller.Providers ImageRefreshMode = copy.ImageRefreshMode; ReplaceAllImages = copy.ReplaceAllImages; ReplaceImages = copy.ReplaceImages.ToList(); + SearchResult = copy.SearchResult; } } } diff --git a/MediaBrowser.Controller/Providers/TrailerInfo.cs b/MediaBrowser.Controller/Providers/TrailerInfo.cs index 65ddc2d1e..fe26ec43e 100644 --- a/MediaBrowser.Controller/Providers/TrailerInfo.cs +++ b/MediaBrowser.Controller/Providers/TrailerInfo.cs @@ -1,5 +1,3 @@ -using MediaBrowser.Model.Entities; - namespace MediaBrowser.Controller.Providers { public class TrailerInfo : ItemLookupInfo diff --git a/MediaBrowser.Controller/RelatedMedia/IRelatedMediaProvider.cs b/MediaBrowser.Controller/RelatedMedia/IRelatedMediaProvider.cs index 1cf5742b2..bb2a0cd89 100644 --- a/MediaBrowser.Controller/RelatedMedia/IRelatedMediaProvider.cs +++ b/MediaBrowser.Controller/RelatedMedia/IRelatedMediaProvider.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MediaBrowser.Controller.RelatedMedia +namespace MediaBrowser.Controller.RelatedMedia { public interface IRelatedMediaProvider { diff --git a/MediaBrowser.Controller/Resolvers/IItemResolver.cs b/MediaBrowser.Controller/Resolvers/IItemResolver.cs index f747c055e..bdff5fffa 100644 --- a/MediaBrowser.Controller/Resolvers/IItemResolver.cs +++ b/MediaBrowser.Controller/Resolvers/IItemResolver.cs @@ -2,9 +2,7 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using System.Collections.Generic; -using System.IO; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Resolvers { diff --git a/MediaBrowser.Controller/Sorting/SortHelper.cs b/MediaBrowser.Controller/Sorting/SortHelper.cs index 95a3c26c4..3456b9b04 100644 --- a/MediaBrowser.Controller/Sorting/SortHelper.cs +++ b/MediaBrowser.Controller/Sorting/SortHelper.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MediaBrowser.Controller.Sorting +namespace MediaBrowser.Controller.Sorting { public static class SortHelper { diff --git a/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs b/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs index e781c048b..a2371426a 100644 --- a/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs +++ b/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs @@ -19,6 +19,7 @@ namespace MediaBrowser.Controller.Subtitles public int? ParentIndexNumber { get; set; } public int? ProductionYear { get; set; } public long? RuntimeTicks { get; set; } + public bool IsPerfectMatch { get; set; } public Dictionary<string, string> ProviderIds { get; set; } public bool SearchAllProviders { get; set; } diff --git a/MediaBrowser.Controller/Sync/ISyncManager.cs b/MediaBrowser.Controller/Sync/ISyncManager.cs index fd373050f..8eb934eaa 100644 --- a/MediaBrowser.Controller/Sync/ISyncManager.cs +++ b/MediaBrowser.Controller/Sync/ISyncManager.cs @@ -1,5 +1,4 @@ using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Events; using MediaBrowser.Model.Querying; using MediaBrowser.Model.Sync; diff --git a/MediaBrowser.Dlna/Channels/DlnaChannelFactory.cs b/MediaBrowser.Dlna/Channels/DlnaChannelFactory.cs index 315313c04..b6ee3d434 100644 --- a/MediaBrowser.Dlna/Channels/DlnaChannelFactory.cs +++ b/MediaBrowser.Dlna/Channels/DlnaChannelFactory.cs @@ -1,22 +1,4 @@ -using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.Net; -using MediaBrowser.Controller.Channels; -using MediaBrowser.Controller.Configuration; -using MediaBrowser.Controller.Dlna; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Dlna.ContentDirectory; -using MediaBrowser.Dlna.PlayTo; -using MediaBrowser.Dlna.Ssdp; -using MediaBrowser.Model.Channels; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Dlna.Channels +namespace MediaBrowser.Dlna.Channels { //public class DlnaChannelFactory : IChannelFactory, IDisposable //{ diff --git a/MediaBrowser.Dlna/ContentDirectory/ContentDirectoryBrowser.cs b/MediaBrowser.Dlna/ContentDirectory/ContentDirectoryBrowser.cs index d90f0765f..77b0a70fd 100644 --- a/MediaBrowser.Dlna/ContentDirectory/ContentDirectoryBrowser.cs +++ b/MediaBrowser.Dlna/ContentDirectory/ContentDirectoryBrowser.cs @@ -2,10 +2,8 @@ using System.Xml.Linq; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Channels; -using MediaBrowser.Dlna.PlayTo; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Querying; -using System; using System.Globalization; using System.IO; using System.Security; diff --git a/MediaBrowser.Dlna/ContentDirectory/ControlHandler.cs b/MediaBrowser.Dlna/ContentDirectory/ControlHandler.cs index 55b775751..01c7c33b6 100644 --- a/MediaBrowser.Dlna/ContentDirectory/ControlHandler.cs +++ b/MediaBrowser.Dlna/ContentDirectory/ControlHandler.cs @@ -10,7 +10,6 @@ using MediaBrowser.Controller.Localization; using MediaBrowser.Dlna.Didl; using MediaBrowser.Dlna.Server; using MediaBrowser.Dlna.Service; -using MediaBrowser.Model.Channels; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Entities; @@ -24,7 +23,6 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using System.Xml; -using MediaBrowser.Model.Library; namespace MediaBrowser.Dlna.ContentDirectory { diff --git a/MediaBrowser.Dlna/Didl/DidlBuilder.cs b/MediaBrowser.Dlna/Didl/DidlBuilder.cs index e8e969a5f..89d00eb32 100644 --- a/MediaBrowser.Dlna/Didl/DidlBuilder.cs +++ b/MediaBrowser.Dlna/Didl/DidlBuilder.cs @@ -93,10 +93,10 @@ namespace MediaBrowser.Dlna.Didl } else { - var parent = item.DisplayParent; - if (parent != null) + var parent = item.DisplayParentId; + if (parent.HasValue) { - element.SetAttribute("parentID", GetClientId(parent, null)); + element.SetAttribute("parentID", GetClientId(parent.Value, null)); } } @@ -171,7 +171,6 @@ namespace MediaBrowser.Dlna.Didl streamInfo.TargetPacketLength, streamInfo.TranscodeSeekInfo, streamInfo.IsTargetAnamorphic, - streamInfo.IsTargetCabac, streamInfo.TargetRefFrames, streamInfo.TargetVideoStreamCount, streamInfo.TargetAudioStreamCount, @@ -317,7 +316,6 @@ namespace MediaBrowser.Dlna.Didl streamInfo.TargetPacketLength, streamInfo.TargetTimestamp, streamInfo.IsTargetAnamorphic, - streamInfo.IsTargetCabac, streamInfo.TargetRefFrames, streamInfo.TargetVideoStreamCount, streamInfo.TargetAudioStreamCount, @@ -501,14 +499,21 @@ namespace MediaBrowser.Dlna.Didl { container.SetAttribute("id", clientId); - var parent = context ?? folder.DisplayParent; - if (parent == null) + if (context != null) { - container.SetAttribute("parentID", "0"); + container.SetAttribute("parentID", GetClientId(context, null)); } else { - container.SetAttribute("parentID", GetClientId(parent, null)); + var parent = folder.DisplayParentId; + if (!parent.HasValue) + { + container.SetAttribute("parentID", "0"); + } + else + { + container.SetAttribute("parentID", GetClientId(parent.Value, null)); + } } } @@ -981,7 +986,10 @@ namespace MediaBrowser.Dlna.Didl if (item != null) { - return GetImageInfo(item, ImageType.Primary); + if (item.HasImage(ImageType.Primary)) + { + return GetImageInfo(item, ImageType.Primary); + } } return null; @@ -1058,7 +1066,12 @@ namespace MediaBrowser.Dlna.Didl public static string GetClientId(BaseItem item, StubType? stubType) { - var id = item.Id.ToString("N"); + return GetClientId(item.Id, stubType); + } + + public static string GetClientId(Guid idValue, StubType? stubType) + { + var id = idValue.ToString("N"); if (stubType.HasValue) { diff --git a/MediaBrowser.Dlna/DlnaManager.cs b/MediaBrowser.Dlna/DlnaManager.cs index dd5c4b77e..3cc6a4379 100644 --- a/MediaBrowser.Dlna/DlnaManager.cs +++ b/MediaBrowser.Dlna/DlnaManager.cs @@ -1,6 +1,5 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller; using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Drawing; diff --git a/MediaBrowser.Dlna/Eventing/EventManager.cs b/MediaBrowser.Dlna/Eventing/EventManager.cs index 3a19434b3..65e742d49 100644 --- a/MediaBrowser.Dlna/Eventing/EventManager.cs +++ b/MediaBrowser.Dlna/Eventing/EventManager.cs @@ -1,7 +1,6 @@ using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Dlna; -using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Logging; using System; using System.Collections.Concurrent; diff --git a/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs b/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs index 8a30fbf40..37584f006 100644 --- a/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs +++ b/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs @@ -9,13 +9,11 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Localization; using MediaBrowser.Controller.Plugins; using MediaBrowser.Controller.Session; -using MediaBrowser.Dlna.Channels; using MediaBrowser.Dlna.PlayTo; using MediaBrowser.Dlna.Ssdp; using MediaBrowser.Model.Logging; using System; using System.Collections.Generic; -using System.Net; namespace MediaBrowser.Dlna.Main { diff --git a/MediaBrowser.Dlna/PlayTo/PlayToController.cs b/MediaBrowser.Dlna/PlayTo/PlayToController.cs index 314756cdf..db5e0ee29 100644 --- a/MediaBrowser.Dlna/PlayTo/PlayToController.cs +++ b/MediaBrowser.Dlna/PlayTo/PlayToController.cs @@ -523,7 +523,6 @@ namespace MediaBrowser.Dlna.PlayTo streamInfo.TargetPacketLength, streamInfo.TranscodeSeekInfo, streamInfo.IsTargetAnamorphic, - streamInfo.IsTargetCabac, streamInfo.TargetRefFrames, streamInfo.TargetVideoStreamCount, streamInfo.TargetAudioStreamCount, diff --git a/MediaBrowser.Dlna/PlayTo/PlayToManager.cs b/MediaBrowser.Dlna/PlayTo/PlayToManager.cs index d2b48474c..18daef331 100644 --- a/MediaBrowser.Dlna/PlayTo/PlayToManager.cs +++ b/MediaBrowser.Dlna/PlayTo/PlayToManager.cs @@ -6,14 +6,12 @@ using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Localization; using MediaBrowser.Controller.Session; -using MediaBrowser.Dlna.Ssdp; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Session; using System; using System.Collections.Generic; using System.Linq; using System.Net; -using System.Threading; namespace MediaBrowser.Dlna.PlayTo { diff --git a/MediaBrowser.Dlna/Profiles/DefaultProfile.cs b/MediaBrowser.Dlna/Profiles/DefaultProfile.cs index a8e6b1ca6..386a4eb1e 100644 --- a/MediaBrowser.Dlna/Profiles/DefaultProfile.cs +++ b/MediaBrowser.Dlna/Profiles/DefaultProfile.cs @@ -15,10 +15,9 @@ namespace MediaBrowser.Dlna.Profiles XDlnaDoc = "DMS-1.50"; - FriendlyName = "Emby"; Manufacturer = "Emby"; ModelDescription = "Emby"; - ModelName = "Emby"; + ModelName = "Emby Server"; ModelNumber = "Emby"; ModelUrl = "http://emby.media/"; ManufacturerUrl = "http://emby.media/"; diff --git a/MediaBrowser.Dlna/Profiles/LinksysDMA2100Profile.cs b/MediaBrowser.Dlna/Profiles/LinksysDMA2100Profile.cs index e7542ea9e..da00d9e86 100644 --- a/MediaBrowser.Dlna/Profiles/LinksysDMA2100Profile.cs +++ b/MediaBrowser.Dlna/Profiles/LinksysDMA2100Profile.cs @@ -1,5 +1,4 @@ using System.Xml.Serialization; -using MediaBrowser.Controller.Dlna; using MediaBrowser.Model.Dlna; namespace MediaBrowser.Dlna.Profiles diff --git a/MediaBrowser.Dlna/Profiles/Xml/BubbleUPnp.xml b/MediaBrowser.Dlna/Profiles/Xml/BubbleUPnp.xml index b80137dea..2b67b0eaf 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/BubbleUPnp.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/BubbleUPnp.xml @@ -7,10 +7,9 @@ <HttpHeaderInfo name="User-Agent" value="BubbleUPnp" match="Substring" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Emby</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> - <ModelName>Emby</ModelName> + <ModelName>Emby Server</ModelName> <ModelDescription>Emby</ModelDescription> <ModelNumber>Emby</ModelNumber> <ModelUrl>http://emby.media/</ModelUrl> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Default.xml b/MediaBrowser.Dlna/Profiles/Xml/Default.xml index bfb4a7bc2..779c800e5 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Default.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Default.xml @@ -1,10 +1,9 @@ <?xml version="1.0"?> <Profile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Name>Generic Device</Name> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Emby</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> - <ModelName>Emby</ModelName> + <ModelName>Emby Server</ModelName> <ModelDescription>Emby</ModelDescription> <ModelNumber>Emby</ModelNumber> <ModelUrl>http://emby.media/</ModelUrl> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Denon AVR.xml b/MediaBrowser.Dlna/Profiles/Xml/Denon AVR.xml index d0a5026fd..89f6c03c7 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Denon AVR.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Denon AVR.xml @@ -6,10 +6,9 @@ <Manufacturer>Denon</Manufacturer> <Headers /> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Emby</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> - <ModelName>Emby</ModelName> + <ModelName>Emby Server</ModelName> <ModelDescription>Emby</ModelDescription> <ModelNumber>Emby</ModelNumber> <ModelUrl>http://emby.media/</ModelUrl> diff --git a/MediaBrowser.Dlna/Profiles/Xml/DirecTV HD-DVR.xml b/MediaBrowser.Dlna/Profiles/Xml/DirecTV HD-DVR.xml index 5cc027549..437e6bdb4 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/DirecTV HD-DVR.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/DirecTV HD-DVR.xml @@ -7,10 +7,9 @@ <HttpHeaderInfo name="User-Agent" value="DIRECTV" match="Substring" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Emby</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> - <ModelName>Emby</ModelName> + <ModelName>Emby Server</ModelName> <ModelDescription>Emby</ModelDescription> <ModelNumber>Emby</ModelNumber> <ModelUrl>http://emby.media/</ModelUrl> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Dish Hopper-Joey.xml b/MediaBrowser.Dlna/Profiles/Xml/Dish Hopper-Joey.xml index dfd8730fb..62cc5d81e 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Dish Hopper-Joey.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Dish Hopper-Joey.xml @@ -8,10 +8,9 @@ <HttpHeaderInfo name="User-Agent" value="XiP" match="Substring" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Emby</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> - <ModelName>Emby</ModelName> + <ModelName>Emby Server</ModelName> <ModelDescription>Emby</ModelDescription> <ModelNumber>Emby</ModelNumber> <ModelUrl>http://emby.media/</ModelUrl> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Kodi.xml b/MediaBrowser.Dlna/Profiles/Xml/Kodi.xml index 48c4dcd8e..73cb54c70 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Kodi.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Kodi.xml @@ -7,10 +7,9 @@ <HttpHeaderInfo name="User-Agent" value="Kodi" match="Substring" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Emby</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> - <ModelName>Emby</ModelName> + <ModelName>Emby Server</ModelName> <ModelDescription>Emby</ModelDescription> <ModelNumber>Emby</ModelNumber> <ModelUrl>http://emby.media/</ModelUrl> diff --git a/MediaBrowser.Dlna/Profiles/Xml/LG Smart TV.xml b/MediaBrowser.Dlna/Profiles/Xml/LG Smart TV.xml index 6717504bf..9649b5e68 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/LG Smart TV.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/LG Smart TV.xml @@ -7,10 +7,9 @@ <HttpHeaderInfo name="User-Agent" value="LG" match="Substring" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Emby</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> - <ModelName>Emby</ModelName> + <ModelName>Emby Server</ModelName> <ModelDescription>Emby</ModelDescription> <ModelNumber>Emby</ModelNumber> <ModelUrl>http://emby.media/</ModelUrl> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Linksys DMA2100.xml b/MediaBrowser.Dlna/Profiles/Xml/Linksys DMA2100.xml index f101fb7b6..102e05d93 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Linksys DMA2100.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Linksys DMA2100.xml @@ -5,10 +5,9 @@ <ModelName>DMA2100us</ModelName> <Headers /> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Emby</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> - <ModelName>Emby</ModelName> + <ModelName>Emby Server</ModelName> <ModelDescription>Emby</ModelDescription> <ModelNumber>Emby</ModelNumber> <ModelUrl>http://emby.media/</ModelUrl> diff --git a/MediaBrowser.Dlna/Profiles/Xml/MediaMonkey.xml b/MediaBrowser.Dlna/Profiles/Xml/MediaMonkey.xml index 5756bc219..588752d91 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/MediaMonkey.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/MediaMonkey.xml @@ -7,10 +7,9 @@ <HttpHeaderInfo name="User-Agent" value="MediaMonkey" match="Substring" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Emby</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> - <ModelName>Emby</ModelName> + <ModelName>Emby Server</ModelName> <ModelDescription>Emby</ModelDescription> <ModelNumber>Emby</ModelNumber> <ModelUrl>http://emby.media/</ModelUrl> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Panasonic Viera.xml b/MediaBrowser.Dlna/Profiles/Xml/Panasonic Viera.xml index adbbbb386..20a112b67 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Panasonic Viera.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Panasonic Viera.xml @@ -8,10 +8,9 @@ <HttpHeaderInfo name="User-Agent" value="Panasonic MIL DLNA" match="Substring" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Emby</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> - <ModelName>Emby</ModelName> + <ModelName>Emby Server</ModelName> <ModelDescription>Emby</ModelDescription> <ModelNumber>Emby</ModelNumber> <ModelUrl>http://emby.media/</ModelUrl> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Popcorn Hour.xml b/MediaBrowser.Dlna/Profiles/Xml/Popcorn Hour.xml index a38236476..b6b420ba2 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Popcorn Hour.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Popcorn Hour.xml @@ -1,10 +1,9 @@ <?xml version="1.0"?> <Profile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Name>Popcorn Hour</Name> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Emby</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> - <ModelName>Emby</ModelName> + <ModelName>Emby Server</ModelName> <ModelDescription>Emby</ModelDescription> <ModelNumber>Emby</ModelNumber> <ModelUrl>http://emby.media/</ModelUrl> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Samsung Smart TV.xml b/MediaBrowser.Dlna/Profiles/Xml/Samsung Smart TV.xml index af4f6e913..1f3692322 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Samsung Smart TV.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Samsung Smart TV.xml @@ -7,10 +7,9 @@ <HttpHeaderInfo name="User-Agent" value="SEC_" match="Substring" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Emby</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> - <ModelName>Emby</ModelName> + <ModelName>Emby Server</ModelName> <ModelDescription>Emby</ModelDescription> <ModelNumber>Emby</ModelNumber> <ModelUrl>http://emby.media/</ModelUrl> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml index b32c369f3..673affa70 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml @@ -7,7 +7,6 @@ <Manufacturer>Sony</Manufacturer> <Headers /> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Microsoft Corporation</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> <ModelName>Windows Media Player Sharing</ModelName> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player.xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player.xml index 7d05fdbdc..8780229c5 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player.xml @@ -9,7 +9,6 @@ <HttpHeaderInfo name="X-AV-Physical-Unit-Info" value="(Blu-ray Disc Player|Home Theater System|Home Theatre System|Media Player)" match="Regex" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Microsoft Corporation</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> <ModelName>Windows Media Player Sharing</ModelName> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2010).xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2010).xml index 73f5baf65..1ea6276f8 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2010).xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2010).xml @@ -8,7 +8,6 @@ <HttpHeaderInfo name="X-AV-Client-Info" value=".*KDL-\d{2}[EHLNPB]X\d[01]\d.*" match="Regex" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Microsoft Corporation</Manufacturer> <ManufacturerUrl>http://www.microsoft.com/</ManufacturerUrl> <ModelName>Windows Media Player Sharing</ModelName> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2011).xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2011).xml index b156bfa5b..012b6ca73 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2011).xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2011).xml @@ -8,7 +8,6 @@ <HttpHeaderInfo name="X-AV-Client-Info" value=".*KDL-\d{2}([A-Z]X\d2\d|CX400).*" match="Regex" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Microsoft Corporation</Manufacturer> <ManufacturerUrl>http://www.microsoft.com/</ManufacturerUrl> <ModelName>Windows Media Player Sharing</ModelName> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2012).xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2012).xml index c0f92fe15..52a3e196c 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2012).xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2012).xml @@ -8,7 +8,6 @@ <HttpHeaderInfo name="X-AV-Client-Info" value=".*KDL-\d{2}[A-Z]X\d5(\d|G).*" match="Regex" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Microsoft Corporation</Manufacturer> <ManufacturerUrl>http://www.microsoft.com/</ManufacturerUrl> <ModelName>Windows Media Player Sharing</ModelName> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2013).xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2013).xml index f21da6ecc..f060f6ef4 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2013).xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2013).xml @@ -8,7 +8,6 @@ <HttpHeaderInfo name="X-AV-Client-Info" value=".*KDL-\d{2}[WR][5689]\d{2}A.*" match="Regex" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Microsoft Corporation</Manufacturer> <ManufacturerUrl>http://www.microsoft.com/</ManufacturerUrl> <ModelName>Windows Media Player Sharing</ModelName> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2014).xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2014).xml index a407ba473..de418f8be 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2014).xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2014).xml @@ -8,7 +8,6 @@ <HttpHeaderInfo name="X-AV-Client-Info" value=".*(KDL-\d{2}W[5-9]\d{2}B|KDL-\d{2}R480|XBR-\d{2}X[89]\d{2}B|KD-\d{2}[SX][89]\d{3}B).*" match="Regex" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Microsoft Corporation</Manufacturer> <ManufacturerUrl>http://www.microsoft.com/</ManufacturerUrl> <ModelName>Windows Media Player Sharing</ModelName> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 3.xml b/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 3.xml index f0c7cb40a..f147d75b6 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 3.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 3.xml @@ -8,10 +8,9 @@ <HttpHeaderInfo name="X-AV-Client-Info" value="PLAYSTATION 3" match="Substring" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Emby</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> - <ModelName>Emby</ModelName> + <ModelName>Emby Server</ModelName> <ModelDescription>Emby</ModelDescription> <ModelNumber>Emby</ModelNumber> <ModelUrl>http://emby.media/</ModelUrl> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 4.xml b/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 4.xml index 58c76d914..bc83d488e 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 4.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 4.xml @@ -8,10 +8,9 @@ <HttpHeaderInfo name="X-AV-Client-Info" value="PLAYSTATION 4" match="Substring" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Emby</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> - <ModelName>Emby</ModelName> + <ModelName>Emby Server</ModelName> <ModelDescription>Emby</ModelDescription> <ModelNumber>Emby</ModelNumber> <ModelUrl>http://emby.media/</ModelUrl> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Vlc.xml b/MediaBrowser.Dlna/Profiles/Xml/Vlc.xml index 7a7f37b66..69ee8a002 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Vlc.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Vlc.xml @@ -7,10 +7,9 @@ <HttpHeaderInfo name="User-Agent" value="vlc" match="Substring" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Emby</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> - <ModelName>Emby</ModelName> + <ModelName>Emby Server</ModelName> <ModelDescription>Emby</ModelDescription> <ModelNumber>Emby</ModelNumber> <ModelUrl>http://emby.media/</ModelUrl> diff --git a/MediaBrowser.Dlna/Profiles/Xml/WDTV Live.xml b/MediaBrowser.Dlna/Profiles/Xml/WDTV Live.xml index 50f30d40f..2c812f98c 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/WDTV Live.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/WDTV Live.xml @@ -8,10 +8,9 @@ <HttpHeaderInfo name="User-Agent" value="ALPHA Networks" match="Substring" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Emby</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> - <ModelName>Emby</ModelName> + <ModelName>Emby Server</ModelName> <ModelDescription>Emby</ModelDescription> <ModelNumber>Emby</ModelNumber> <ModelUrl>http://emby.media/</ModelUrl> diff --git a/MediaBrowser.Dlna/Profiles/Xml/Xbox One.xml b/MediaBrowser.Dlna/Profiles/Xml/Xbox One.xml index ab8ed713f..ad08adf0d 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Xbox One.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Xbox One.xml @@ -8,10 +8,9 @@ <HttpHeaderInfo name="User-Agent" value="NSPlayer/12" match="Substring" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Emby</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> - <ModelName>Emby</ModelName> + <ModelName>Emby Server</ModelName> <ModelDescription>Emby</ModelDescription> <ModelNumber>Emby</ModelNumber> <ModelUrl>http://emby.media/</ModelUrl> diff --git a/MediaBrowser.Dlna/Profiles/Xml/foobar2000.xml b/MediaBrowser.Dlna/Profiles/Xml/foobar2000.xml index 0aeb4d912..12eba1e35 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/foobar2000.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/foobar2000.xml @@ -7,10 +7,9 @@ <HttpHeaderInfo name="User-Agent" value="foobar" match="Substring" /> </Headers> </Identification> - <FriendlyName>Emby</FriendlyName> <Manufacturer>Emby</Manufacturer> <ManufacturerUrl>http://emby.media/</ManufacturerUrl> - <ModelName>Emby</ModelName> + <ModelName>Emby Server</ModelName> <ModelDescription>Emby</ModelDescription> <ModelNumber>Emby</ModelNumber> <ModelUrl>http://emby.media/</ModelUrl> diff --git a/MediaBrowser.Dlna/Server/DescriptionXmlBuilder.cs b/MediaBrowser.Dlna/Server/DescriptionXmlBuilder.cs index 386370596..37006915c 100644 --- a/MediaBrowser.Dlna/Server/DescriptionXmlBuilder.cs +++ b/MediaBrowser.Dlna/Server/DescriptionXmlBuilder.cs @@ -138,6 +138,11 @@ namespace MediaBrowser.Dlna.Server private string GetFriendlyName() { + if (string.IsNullOrWhiteSpace(_profile.FriendlyName)) + { + return "Emby - " + _serverName; + } + var characters = _serverName.Where(c => (char.IsLetterOrDigit(c) || c == '-')).ToArray(); var serverName = new string(characters); diff --git a/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs b/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs index 70f6d0e53..a2eac41ec 100644 --- a/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs +++ b/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs @@ -7,12 +7,10 @@ using System; using System.Collections.Generic; using System.Linq; using System.Net; -using System.Net.NetworkInformation; using System.Net.Sockets; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Common.Net; -using MoreLinq; namespace MediaBrowser.Dlna.Ssdp { diff --git a/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs b/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs index 2d1ec1273..3cdeb1afd 100644 --- a/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs +++ b/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs @@ -36,7 +36,7 @@ namespace MediaBrowser.Dlna.Ssdp private Timer _notificationTimer; private bool _isDisposed; - private readonly ConcurrentDictionary<string, List<UpnpDevice>> _devices = new ConcurrentDictionary<string, List<UpnpDevice>>(); + private readonly Dictionary<string, List<UpnpDevice>> _devices = new Dictionary<string, List<UpnpDevice>>(); private readonly IApplicationHost _appHost; @@ -172,9 +172,12 @@ namespace MediaBrowser.Dlna.Ssdp { get { - var devices = _devices.ToList(); + lock (_devices) + { + var devices = _devices.ToList(); - return devices.SelectMany(i => i.Value).ToList(); + return devices.SelectMany(i => i.Value).ToList(); + } } } @@ -482,26 +485,42 @@ namespace MediaBrowser.Dlna.Ssdp public void RegisterNotification(string uuid, Uri descriptionUri, IPAddress address, IEnumerable<string> services) { - var list = _devices.GetOrAdd(uuid, new List<UpnpDevice>()); + lock (_devices) + { + List<UpnpDevice> list; + List<UpnpDevice> dl; + if (_devices.TryGetValue(uuid, out dl)) + { + list = dl; + } + else + { + list = new List<UpnpDevice>(); + _devices[uuid] = list; + } - list.AddRange(services.Select(i => new UpnpDevice(uuid, i, descriptionUri, address))); + list.AddRange(services.Select(i => new UpnpDevice(uuid, i, descriptionUri, address))); - NotifyAll(); - _logger.Debug("Registered mount {0} at {1}", uuid, descriptionUri); + NotifyAll(); + _logger.Debug("Registered mount {0} at {1}", uuid, descriptionUri); + } } public void UnregisterNotification(string uuid) { - List<UpnpDevice> dl; - if (_devices.TryRemove(uuid, out dl)) + lock (_devices) { - - foreach (var d in dl.ToList()) + List<UpnpDevice> dl; + if (_devices.TryGetValue(uuid, out dl)) { - NotifyDevice(d, "byebye", true); - } + _devices.Remove(uuid); + foreach (var d in dl.ToList()) + { + NotifyDevice(d, "byebye", true); + } - _logger.Debug("Unregistered mount {0}", uuid); + _logger.Debug("Unregistered mount {0}", uuid); + } } } diff --git a/MediaBrowser.LocalMetadata/BaseXmlProvider.cs b/MediaBrowser.LocalMetadata/BaseXmlProvider.cs index 0364eaf99..4fc1d210d 100644 --- a/MediaBrowser.LocalMetadata/BaseXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/BaseXmlProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; using System; using System.IO; diff --git a/MediaBrowser.LocalMetadata/Images/CollectionFolderImageProvider.cs b/MediaBrowser.LocalMetadata/Images/CollectionFolderImageProvider.cs index 0e04fd9ec..21b3cedae 100644 --- a/MediaBrowser.LocalMetadata/Images/CollectionFolderImageProvider.cs +++ b/MediaBrowser.LocalMetadata/Images/CollectionFolderImageProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; using System.Collections.Generic; using CommonIO; diff --git a/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs index 434488bf6..716d40d8f 100644 --- a/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs +++ b/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; diff --git a/MediaBrowser.LocalMetadata/Images/ImagesByNameImageProvider.cs b/MediaBrowser.LocalMetadata/Images/ImagesByNameImageProvider.cs index 833a8a985..6034008de 100644 --- a/MediaBrowser.LocalMetadata/Images/ImagesByNameImageProvider.cs +++ b/MediaBrowser.LocalMetadata/Images/ImagesByNameImageProvider.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.IO; using CommonIO; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.LocalMetadata/Images/InternalMetadataFolderImageProvider.cs b/MediaBrowser.LocalMetadata/Images/InternalMetadataFolderImageProvider.cs index cdf29a5fe..1cec4d305 100644 --- a/MediaBrowser.LocalMetadata/Images/InternalMetadataFolderImageProvider.cs +++ b/MediaBrowser.LocalMetadata/Images/InternalMetadataFolderImageProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs index c597be913..fe61a7a46 100644 --- a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs +++ b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs @@ -6,7 +6,6 @@ using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; using System.Globalization; -using System.IO; using System.Linq; using CommonIO; diff --git a/MediaBrowser.LocalMetadata/Parsers/EpisodeXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/EpisodeXmlParser.cs index e3cc64605..d2ef01465 100644 --- a/MediaBrowser.LocalMetadata/Parsers/EpisodeXmlParser.cs +++ b/MediaBrowser.LocalMetadata/Parsers/EpisodeXmlParser.cs @@ -9,7 +9,6 @@ using System.IO; using System.Threading; using System.Xml; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.LocalMetadata.Parsers { diff --git a/MediaBrowser.LocalMetadata/Properties/AssemblyInfo.cs b/MediaBrowser.LocalMetadata/Properties/AssemblyInfo.cs index a26bfd954..0d5a8003e 100644 --- a/MediaBrowser.LocalMetadata/Properties/AssemblyInfo.cs +++ b/MediaBrowser.LocalMetadata/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/MediaBrowser.LocalMetadata/Providers/BoxSetXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/BoxSetXmlProvider.cs index 01eaf33d2..217a5f355 100644 --- a/MediaBrowser.LocalMetadata/Providers/BoxSetXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/BoxSetXmlProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Entities.Movies; +using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Providers; using MediaBrowser.LocalMetadata.Parsers; using MediaBrowser.Model.Logging; diff --git a/MediaBrowser.LocalMetadata/Providers/EpisodeXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/EpisodeXmlProvider.cs index 17ef5fd2e..d3e365838 100644 --- a/MediaBrowser.LocalMetadata/Providers/EpisodeXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/EpisodeXmlProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Entities.TV; +using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Providers; using MediaBrowser.LocalMetadata.Parsers; using MediaBrowser.Model.Entities; diff --git a/MediaBrowser.LocalMetadata/Providers/FolderXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/FolderXmlProvider.cs index 20fa889cc..248fad363 100644 --- a/MediaBrowser.LocalMetadata/Providers/FolderXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/FolderXmlProvider.cs @@ -1,7 +1,6 @@ using System.IO; using System.Threading; using CommonIO; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Logging; diff --git a/MediaBrowser.LocalMetadata/Providers/GameSystemXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/GameSystemXmlProvider.cs index 6abb019b4..646fce805 100644 --- a/MediaBrowser.LocalMetadata/Providers/GameSystemXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/GameSystemXmlProvider.cs @@ -1,7 +1,6 @@ using System.IO; using System.Threading; using CommonIO; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; using MediaBrowser.LocalMetadata.Parsers; diff --git a/MediaBrowser.LocalMetadata/Providers/GameXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/GameXmlProvider.cs index 8d1a4d690..28736eddd 100644 --- a/MediaBrowser.LocalMetadata/Providers/GameXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/GameXmlProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; using MediaBrowser.LocalMetadata.Parsers; using MediaBrowser.Model.Logging; diff --git a/MediaBrowser.LocalMetadata/Providers/MovieXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/MovieXmlProvider.cs index 0930e9198..e4f83dd1f 100644 --- a/MediaBrowser.LocalMetadata/Providers/MovieXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/MovieXmlProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Entities.Movies; +using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Providers; using MediaBrowser.LocalMetadata.Parsers; using MediaBrowser.Model.Logging; diff --git a/MediaBrowser.LocalMetadata/Providers/MusicVideoXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/MusicVideoXmlProvider.cs index e24e46310..1060fe895 100644 --- a/MediaBrowser.LocalMetadata/Providers/MusicVideoXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/MusicVideoXmlProvider.cs @@ -1,7 +1,5 @@ -using System.IO; -using System.Threading; +using System.Threading; using CommonIO; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; using MediaBrowser.LocalMetadata.Parsers; diff --git a/MediaBrowser.LocalMetadata/Providers/PersonXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/PersonXmlProvider.cs index dd3541d56..b65977c8e 100644 --- a/MediaBrowser.LocalMetadata/Providers/PersonXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/PersonXmlProvider.cs @@ -1,7 +1,6 @@ using System.IO; using System.Threading; using CommonIO; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Logging; diff --git a/MediaBrowser.LocalMetadata/Providers/PlaylistXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/PlaylistXmlProvider.cs index 81c87ee4d..eb9e9a660 100644 --- a/MediaBrowser.LocalMetadata/Providers/PlaylistXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/PlaylistXmlProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Playlists; +using MediaBrowser.Controller.Playlists; using MediaBrowser.Controller.Providers; using MediaBrowser.LocalMetadata.Parsers; using MediaBrowser.Model.Logging; diff --git a/MediaBrowser.LocalMetadata/Providers/SeasonXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/SeasonXmlProvider.cs index bea0de88e..7c82d9811 100644 --- a/MediaBrowser.LocalMetadata/Providers/SeasonXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/SeasonXmlProvider.cs @@ -1,7 +1,6 @@ using System.IO; using System.Threading; using CommonIO; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Providers; using MediaBrowser.LocalMetadata.Parsers; diff --git a/MediaBrowser.LocalMetadata/Providers/SeriesXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/SeriesXmlProvider.cs index 85bbcbc02..8f9d21eae 100644 --- a/MediaBrowser.LocalMetadata/Providers/SeriesXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/SeriesXmlProvider.cs @@ -1,7 +1,6 @@ using System.IO; using System.Threading; using CommonIO; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Providers; using MediaBrowser.LocalMetadata.Parsers; diff --git a/MediaBrowser.LocalMetadata/Providers/VideoXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/VideoXmlProvider.cs index 0600161b3..c7bde4fa8 100644 --- a/MediaBrowser.LocalMetadata/Providers/VideoXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/VideoXmlProvider.cs @@ -1,9 +1,7 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; using MediaBrowser.LocalMetadata.Parsers; using MediaBrowser.Model.Logging; -using System.IO; using System.Threading; using CommonIO; diff --git a/MediaBrowser.LocalMetadata/Savers/BoxSetXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BoxSetXmlSaver.cs index b709c9b83..31a2901b7 100644 --- a/MediaBrowser.LocalMetadata/Savers/BoxSetXmlSaver.cs +++ b/MediaBrowser.LocalMetadata/Savers/BoxSetXmlSaver.cs @@ -7,7 +7,6 @@ using System.IO; using System.Text; using System.Threading; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.LocalMetadata.Savers { diff --git a/MediaBrowser.LocalMetadata/Savers/FolderXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/FolderXmlSaver.cs index 73a90ac85..056bd49a8 100644 --- a/MediaBrowser.LocalMetadata/Savers/FolderXmlSaver.cs +++ b/MediaBrowser.LocalMetadata/Savers/FolderXmlSaver.cs @@ -10,7 +10,6 @@ using System.IO; using System.Text; using System.Threading; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.LocalMetadata.Savers { diff --git a/MediaBrowser.LocalMetadata/Savers/GameSystemXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/GameSystemXmlSaver.cs index 57a8900a4..dea4721af 100644 --- a/MediaBrowser.LocalMetadata/Savers/GameSystemXmlSaver.cs +++ b/MediaBrowser.LocalMetadata/Savers/GameSystemXmlSaver.cs @@ -7,7 +7,6 @@ using System.Security; using System.Text; using System.Threading; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.LocalMetadata.Savers { diff --git a/MediaBrowser.LocalMetadata/Savers/GameXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/GameXmlSaver.cs index 53efc7811..a90789a3e 100644 --- a/MediaBrowser.LocalMetadata/Savers/GameXmlSaver.cs +++ b/MediaBrowser.LocalMetadata/Savers/GameXmlSaver.cs @@ -1,7 +1,6 @@ using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; -using MediaBrowser.Model.Entities; using System.Collections.Generic; using System.Globalization; using System.IO; @@ -9,7 +8,6 @@ using System.Security; using System.Text; using System.Threading; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.LocalMetadata.Savers { diff --git a/MediaBrowser.LocalMetadata/Savers/PersonXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/PersonXmlSaver.cs index 481c5967d..bf6ed03ad 100644 --- a/MediaBrowser.LocalMetadata/Savers/PersonXmlSaver.cs +++ b/MediaBrowser.LocalMetadata/Savers/PersonXmlSaver.cs @@ -7,7 +7,6 @@ using System.Security; using System.Text; using System.Threading; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.LocalMetadata.Savers { diff --git a/MediaBrowser.LocalMetadata/Savers/PlaylistXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/PlaylistXmlSaver.cs index d03b45dcd..8862f9c03 100644 --- a/MediaBrowser.LocalMetadata/Savers/PlaylistXmlSaver.cs +++ b/MediaBrowser.LocalMetadata/Savers/PlaylistXmlSaver.cs @@ -8,7 +8,6 @@ using System.Security; using System.Text; using System.Threading; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.LocalMetadata.Savers { diff --git a/MediaBrowser.LocalMetadata/Savers/XmlSaverHelpers.cs b/MediaBrowser.LocalMetadata/Savers/XmlSaverHelpers.cs index 48c4fe2fd..be81d21d2 100644 --- a/MediaBrowser.LocalMetadata/Savers/XmlSaverHelpers.cs +++ b/MediaBrowser.LocalMetadata/Savers/XmlSaverHelpers.cs @@ -15,7 +15,6 @@ using System.Security; using System.Text; using System.Xml; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.LocalMetadata.Savers { diff --git a/MediaBrowser.MediaEncoding/Configuration/EncodingConfigurationFactory.cs b/MediaBrowser.MediaEncoding/Configuration/EncodingConfigurationFactory.cs index 1ddb73d11..42a28d313 100644 --- a/MediaBrowser.MediaEncoding/Configuration/EncodingConfigurationFactory.cs +++ b/MediaBrowser.MediaEncoding/Configuration/EncodingConfigurationFactory.cs @@ -3,7 +3,6 @@ using MediaBrowser.Model.Configuration; using System.Collections.Generic; using System.IO; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.MediaEncoding.Configuration { diff --git a/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs index c2754217f..968d703be 100644 --- a/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs @@ -1,8 +1,5 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Channels; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.Session; using MediaBrowser.Model.IO; diff --git a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs index 1df7ffab3..263efbb62 100644 --- a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs @@ -1,10 +1,8 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.Session; -using MediaBrowser.MediaEncoding.Subtitles; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; @@ -971,7 +969,7 @@ namespace MediaBrowser.MediaEncoding.Encoder if (!string.IsNullOrEmpty(state.SubtitleStream.Language)) { - var charenc = SubtitleEncoder.GetSubtitleFileCharacterSet(subtitlePath, state.MediaSource.Protocol, CancellationToken.None).Result; + var charenc = SubtitleEncoder.GetSubtitleFileCharacterSet(subtitlePath, state.SubtitleStream.Language, state.MediaSource.Protocol, CancellationToken.None).Result; if (!string.IsNullOrEmpty(charenc)) { diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs index 07626db33..b23bd16f3 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs @@ -1,6 +1,5 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; -using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Dto; @@ -392,19 +391,6 @@ namespace MediaBrowser.MediaEncoding.Encoder } } - public bool? IsTargetCabac - { - get - { - if (Options.Static) - { - return VideoStream == null ? null : VideoStream.IsCabac; - } - - return true; - } - } - public int? TargetVideoStreamCount { get diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs index c64b574a9..070aae3a7 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs @@ -10,7 +10,6 @@ using MediaBrowser.Model.MediaInfo; using System; using System.Collections.Generic; using System.Globalization; -using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -665,14 +664,6 @@ namespace MediaBrowser.MediaEncoding.Encoder } } - if (request.Cabac.HasValue && request.Cabac.Value) - { - if (videoStream.IsCabac.HasValue && !videoStream.IsCabac.Value) - { - return false; - } - } - return request.EnableAutoStreamCopy; } @@ -774,7 +765,6 @@ namespace MediaBrowser.MediaEncoding.Encoder state.TargetPacketLength, state.TargetTimestamp, state.IsTargetAnamorphic, - state.IsTargetCabac, state.TargetRefFrames, state.TargetVideoStreamCount, state.TargetAudioStreamCount, diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 934fbc18f..01fb31d0c 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -1,4 +1,3 @@ -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Library; @@ -9,7 +8,6 @@ using MediaBrowser.MediaEncoding.Probing; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Extensions; using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using MediaBrowser.Model.MediaInfo; @@ -486,12 +484,16 @@ namespace MediaBrowser.MediaEncoding.Encoder return ExtractImage(new[] { path }, imageStreamIndex, MediaProtocol.File, true, null, null, cancellationToken); } - public Task<Stream> ExtractVideoImage(string[] inputFiles, MediaProtocol protocol, Video3DFormat? threedFormat, - TimeSpan? offset, CancellationToken cancellationToken) + public Task<Stream> ExtractVideoImage(string[] inputFiles, MediaProtocol protocol, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken) { return ExtractImage(inputFiles, null, protocol, false, threedFormat, offset, cancellationToken); } + public Task<Stream> ExtractVideoImage(string[] inputFiles, MediaProtocol protocol, int? imageStreamIndex, CancellationToken cancellationToken) + { + return ExtractImage(inputFiles, imageStreamIndex, protocol, false, null, null, cancellationToken); + } + private async Task<Stream> ExtractImage(string[] inputFiles, int? imageStreamIndex, MediaProtocol protocol, bool isAudio, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken) { diff --git a/MediaBrowser.MediaEncoding/Encoder/VideoEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/VideoEncoder.cs index d1afcc720..41bfb3b96 100644 --- a/MediaBrowser.MediaEncoding/Encoder/VideoEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/VideoEncoder.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.Session; diff --git a/MediaBrowser.MediaEncoding/Probing/FFProbeHelpers.cs b/MediaBrowser.MediaEncoding/Probing/FFProbeHelpers.cs index 859f38950..396c85e21 100644 --- a/MediaBrowser.MediaEncoding/Probing/FFProbeHelpers.cs +++ b/MediaBrowser.MediaEncoding/Probing/FFProbeHelpers.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Controller.MediaEncoding; -using System; +using System; using System.Collections.Generic; namespace MediaBrowser.MediaEncoding.Probing diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs index 57c2f75cc..6ec9e6435 100644 --- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs +++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Extensions; using System; @@ -10,7 +9,6 @@ using System.Linq; using System.Text; using System.Xml; using CommonIO; -using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Model.MediaInfo; @@ -140,10 +138,14 @@ namespace MediaBrowser.MediaEncoding.Probing var parts = iTunEXTC.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); // Example // mpaa|G|100|For crude humor - if (parts.Length == 4) + if (parts.Length > 1) { info.OfficialRating = parts[1]; - info.OfficialRatingDescription = parts[3]; + + if (parts.Length > 3) + { + info.OfficialRatingDescription = parts[3]; + } } } @@ -452,7 +454,7 @@ namespace MediaBrowser.MediaEncoding.Probing } else if (string.Equals(streamInfo.codec_type, "video", StringComparison.OrdinalIgnoreCase)) { - stream.Type = isAudio || string.Equals(stream.Codec, "mjpeg", StringComparison.OrdinalIgnoreCase) || string.Equals(stream.Codec, "gif", StringComparison.OrdinalIgnoreCase) + stream.Type = isAudio || string.Equals(stream.Codec, "mjpeg", StringComparison.OrdinalIgnoreCase) || string.Equals(stream.Codec, "gif", StringComparison.OrdinalIgnoreCase) || string.Equals(stream.Codec, "png", StringComparison.OrdinalIgnoreCase) ? MediaStreamType.EmbeddedImage : MediaStreamType.Video; @@ -793,6 +795,11 @@ namespace MediaBrowser.MediaEncoding.Probing } + if (audio.AlbumArtists.Count == 0) + { + audio.AlbumArtists = audio.Artists.Take(1).ToList(); + } + // Track number audio.IndexNumber = GetDictionaryDiscValue(tags, "track"); diff --git a/MediaBrowser.MediaEncoding/Properties/AssemblyInfo.cs b/MediaBrowser.MediaEncoding/Properties/AssemblyInfo.cs index 6b456b98d..53f4eb403 100644 --- a/MediaBrowser.MediaEncoding/Properties/AssemblyInfo.cs +++ b/MediaBrowser.MediaEncoding/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/MediaBrowser.MediaEncoding/Subtitles/ParserValues.cs b/MediaBrowser.MediaEncoding/Subtitles/ParserValues.cs index d79aeee76..b8c2fef1e 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/ParserValues.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/ParserValues.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MediaBrowser.MediaEncoding.Subtitles +namespace MediaBrowser.MediaEncoding.Subtitles { public class ParserValues { diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs index cbe24bda8..8c33cc7c0 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs @@ -1,6 +1,5 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; @@ -162,16 +161,16 @@ namespace MediaBrowser.MediaEncoding.Subtitles var fileInfo = await GetReadableFile(mediaSource.Path, inputFiles, mediaSource.Protocol, subtitleStream, cancellationToken).ConfigureAwait(false); - var stream = await GetSubtitleStream(fileInfo.Item1, fileInfo.Item2, fileInfo.Item4, cancellationToken).ConfigureAwait(false); + var stream = await GetSubtitleStream(fileInfo.Item1, subtitleStream.Language, fileInfo.Item2, fileInfo.Item4, cancellationToken).ConfigureAwait(false); return new Tuple<Stream, string>(stream, fileInfo.Item3); } - private async Task<Stream> GetSubtitleStream(string path, MediaProtocol protocol, bool requiresCharset, CancellationToken cancellationToken) + private async Task<Stream> GetSubtitleStream(string path, string language, MediaProtocol protocol, bool requiresCharset, CancellationToken cancellationToken) { if (requiresCharset) { - var charset = await GetSubtitleFileCharacterSet(path, protocol, cancellationToken).ConfigureAwait(false); + var charset = await GetSubtitleFileCharacterSet(path, language, protocol, cancellationToken).ConfigureAwait(false); if (!string.IsNullOrEmpty(charset)) { @@ -198,14 +197,19 @@ namespace MediaBrowser.MediaEncoding.Subtitles { throw new ArgumentNullException("charset"); } - + + _logger.Debug("Getting encoding object for character set: {0}", charset); + try { return Encoding.GetEncoding(charset); } catch (ArgumentException) { - return Encoding.GetEncoding(charset.Replace("-", string.Empty)); + charset = charset.Replace("-", string.Empty); + _logger.Debug("Getting encoding object for character set: {0}", charset); + + return Encoding.GetEncoding(charset); } } @@ -220,14 +224,15 @@ namespace MediaBrowser.MediaEncoding.Subtitles string outputFormat; string outputCodec; - if (string.Equals(subtitleStream.Codec, "ass", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(subtitleStream.Codec, "ass", StringComparison.OrdinalIgnoreCase) || + string.Equals(subtitleStream.Codec, "ssa", StringComparison.OrdinalIgnoreCase) || + string.Equals(subtitleStream.Codec, "srt", StringComparison.OrdinalIgnoreCase)) { // Extract outputCodec = "copy"; - outputFormat = "ass"; + outputFormat = subtitleStream.Codec; } - else if (string.Equals(subtitleStream.Codec, "subrip", StringComparison.OrdinalIgnoreCase) || - string.Equals(subtitleStream.Codec, "srt", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(subtitleStream.Codec, "subrip", StringComparison.OrdinalIgnoreCase)) { // Extract outputCodec = "copy"; @@ -257,7 +262,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles // Convert var outputPath = GetSubtitleCachePath(mediaPath, protocol, subtitleStream.Index, ".srt"); - await ConvertTextSubtitleToSrt(subtitleStream.Path, protocol, outputPath, cancellationToken).ConfigureAwait(false); + await ConvertTextSubtitleToSrt(subtitleStream.Path, subtitleStream.Language, protocol, outputPath, cancellationToken).ConfigureAwait(false); return new Tuple<string, MediaProtocol, string, bool>(outputPath, MediaProtocol.File, "srt", true); } @@ -356,7 +361,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles /// <param name="outputPath">The output path.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> - private async Task ConvertTextSubtitleToSrt(string inputPath, MediaProtocol inputProtocol, string outputPath, CancellationToken cancellationToken) + private async Task ConvertTextSubtitleToSrt(string inputPath, string language, MediaProtocol inputProtocol, string outputPath, CancellationToken cancellationToken) { var semaphore = GetLock(outputPath); @@ -364,9 +369,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles try { - if (!_fileSystem.FileExists(outputPath)) + if (!_fileSystem.FileExists(outputPath)) { - await ConvertTextSubtitleToSrtInternal(inputPath, inputProtocol, outputPath, cancellationToken).ConfigureAwait(false); + await ConvertTextSubtitleToSrtInternal(inputPath, language, inputProtocol, outputPath, cancellationToken).ConfigureAwait(false); } } finally @@ -389,7 +394,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles /// outputPath /// </exception> /// <exception cref="System.ApplicationException"></exception> - private async Task ConvertTextSubtitleToSrtInternal(string inputPath, MediaProtocol inputProtocol, string outputPath, CancellationToken cancellationToken) + private async Task ConvertTextSubtitleToSrtInternal(string inputPath, string language, MediaProtocol inputProtocol, string outputPath, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(inputPath)) { @@ -401,9 +406,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles throw new ArgumentNullException("outputPath"); } - _fileSystem.CreateDirectory(Path.GetDirectoryName(outputPath)); + _fileSystem.CreateDirectory(Path.GetDirectoryName(outputPath)); - var encodingParam = await GetSubtitleFileCharacterSet(inputPath, inputProtocol, cancellationToken).ConfigureAwait(false); + var encodingParam = await GetSubtitleFileCharacterSet(inputPath, language, inputProtocol, cancellationToken).ConfigureAwait(false); if (!string.IsNullOrEmpty(encodingParam)) { @@ -431,7 +436,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles _logger.Info("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments); var logFilePath = Path.Combine(_appPaths.LogDirectoryPath, "ffmpeg-sub-convert-" + Guid.NewGuid() + ".txt"); - _fileSystem.CreateDirectory(Path.GetDirectoryName(logFilePath)); + _fileSystem.CreateDirectory(Path.GetDirectoryName(logFilePath)); var logFileStream = _fileSystem.GetFileStream(logFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, true); @@ -484,7 +489,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles { failed = true; - if (_fileSystem.FileExists(outputPath)) + if (_fileSystem.FileExists(outputPath)) { try { @@ -497,7 +502,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles } } } - else if (!_fileSystem.FileExists(outputPath)) + else if (!_fileSystem.FileExists(outputPath)) { failed = true; } @@ -533,7 +538,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles try { - if (!_fileSystem.FileExists(outputPath)) + if (!_fileSystem.FileExists(outputPath)) { await ExtractTextSubtitleInternal(_mediaEncoder.GetInputArgument(inputFiles, protocol), subtitleStreamIndex, outputCodec, outputPath, cancellationToken).ConfigureAwait(false); @@ -558,7 +563,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles throw new ArgumentNullException("outputPath"); } - _fileSystem.CreateDirectory(Path.GetDirectoryName(outputPath)); + _fileSystem.CreateDirectory(Path.GetDirectoryName(outputPath)); var processArgs = string.Format("-i {0} -map 0:{1} -an -vn -c:s {2} \"{3}\"", inputPath, subtitleStreamIndex, outputCodec, outputPath); @@ -584,7 +589,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles _logger.Info("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments); var logFilePath = Path.Combine(_appPaths.LogDirectoryPath, "ffmpeg-sub-extract-" + Guid.NewGuid() + ".txt"); - _fileSystem.CreateDirectory(Path.GetDirectoryName(logFilePath)); + _fileSystem.CreateDirectory(Path.GetDirectoryName(logFilePath)); var logFileStream = _fileSystem.GetFileStream(logFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, true); @@ -653,7 +658,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles _logger.ErrorException("Error deleting extracted subtitle {0}", ex, outputPath); } } - else if (!_fileSystem.FileExists(outputPath)) + else if (!_fileSystem.FileExists(outputPath)) { failed = true; } @@ -733,7 +738,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles } } - public async Task<string> GetSubtitleFileCharacterSet(string path, MediaProtocol protocol, CancellationToken cancellationToken) + public async Task<string> GetSubtitleFileCharacterSet(string path, string language, MediaProtocol protocol, CancellationToken cancellationToken) { if (protocol == MediaProtocol.File) { @@ -743,7 +748,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles } } - var charset = await DetectCharset(path, protocol, cancellationToken).ConfigureAwait(false); + var charset = await DetectCharset(path, language, protocol, cancellationToken).ConfigureAwait(false); if (!string.IsNullOrWhiteSpace(charset)) { @@ -755,6 +760,11 @@ namespace MediaBrowser.MediaEncoding.Subtitles return charset; } + if (!string.IsNullOrWhiteSpace(language)) + { + return GetSubtitleFileCharacterSetFromLanguage(language); + } + return null; } @@ -799,7 +809,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles } } - private async Task<string> DetectCharset(string path, MediaProtocol protocol, CancellationToken cancellationToken) + private async Task<string> DetectCharset(string path, string language, MediaProtocol protocol, CancellationToken cancellationToken) { try { @@ -816,6 +826,15 @@ namespace MediaBrowser.MediaEncoding.Subtitles _logger.Info("UniversalDetector detected charset {0} for {1}", charset, path); } + // This is often incorrectly indetected. If this happens, try to use other techniques instead + if (string.Equals("x-mac-cyrillic", charset, StringComparison.OrdinalIgnoreCase)) + { + if (!string.IsNullOrWhiteSpace(language)) + { + return null; + } + } + return charset; } } diff --git a/MediaBrowser.Model.Portable/Properties/AssemblyInfo.cs b/MediaBrowser.Model.Portable/Properties/AssemblyInfo.cs index f48ad294c..a24dd014e 100644 --- a/MediaBrowser.Model.Portable/Properties/AssemblyInfo.cs +++ b/MediaBrowser.Model.Portable/Properties/AssemblyInfo.cs @@ -1,7 +1,5 @@ using System.Resources; using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information diff --git a/MediaBrowser.Model.net35/Properties/AssemblyInfo.cs b/MediaBrowser.Model.net35/Properties/AssemblyInfo.cs index 0e8af504b..838cccf66 100644 --- a/MediaBrowser.Model.net35/Properties/AssemblyInfo.cs +++ b/MediaBrowser.Model.net35/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 041f51a89..ba3362332 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -196,8 +196,6 @@ namespace MediaBrowser.Model.Configuration public int SharingExpirationDays { get; set; } - public bool EnableWindowsShortcuts { get; set; } - public bool EnableDateLastRefresh { get; set; } public string[] Migrations { get; set; } diff --git a/MediaBrowser.Model/Configuration/UserConfiguration.cs b/MediaBrowser.Model/Configuration/UserConfiguration.cs index f294d1dec..5f42dd2de 100644 --- a/MediaBrowser.Model/Configuration/UserConfiguration.cs +++ b/MediaBrowser.Model/Configuration/UserConfiguration.cs @@ -46,7 +46,7 @@ namespace MediaBrowser.Model.Configuration public string[] PlainFolderViews { get; set; } public bool HidePlayedInLatest { get; set; } - public bool DisplayChannelsInline { get; set; } + public bool EnableChannelView { get; set; } public bool RememberAudioSelections { get; set; } public bool RememberSubtitleSelections { get; set; } @@ -60,7 +60,6 @@ namespace MediaBrowser.Model.Configuration EnableNextEpisodeAutoPlay = true; RememberAudioSelections = true; RememberSubtitleSelections = true; - DisplayChannelsInline = true; HidePlayedInLatest = true; PlayDefaultAudioTrack = true; diff --git a/MediaBrowser.Model/Dlna/ConditionProcessor.cs b/MediaBrowser.Model/Dlna/ConditionProcessor.cs index fef04647a..69f1369dc 100644 --- a/MediaBrowser.Model/Dlna/ConditionProcessor.cs +++ b/MediaBrowser.Model/Dlna/ConditionProcessor.cs @@ -17,7 +17,6 @@ namespace MediaBrowser.Model.Dlna int? packetLength, TransportStreamTimestamp? timestamp, bool? isAnamorphic, - bool? isCabac, int? refFrames, int? numVideoStreams, int? numAudioStreams, @@ -27,8 +26,6 @@ namespace MediaBrowser.Model.Dlna { case ProfileConditionValue.IsAnamorphic: return IsConditionSatisfied(condition, isAnamorphic); - case ProfileConditionValue.IsCabac: - return IsConditionSatisfied(condition, isCabac); case ProfileConditionValue.VideoFramerate: return IsConditionSatisfied(condition, videoFramerate); case ProfileConditionValue.VideoLevel: diff --git a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs index 58d669c22..c4b3383a2 100644 --- a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs +++ b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs @@ -115,7 +115,6 @@ namespace MediaBrowser.Model.Dlna int? packetLength, TranscodeSeekInfo transcodeSeekInfo, bool? isAnamorphic, - bool? isCabac, int? refFrames, int? numVideoStreams, int? numAudioStreams, @@ -157,7 +156,6 @@ namespace MediaBrowser.Model.Dlna packetLength, timestamp, isAnamorphic, - isCabac, refFrames, numVideoStreams, numAudioStreams, diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.cs index 778db8fb5..423928f62 100644 --- a/MediaBrowser.Model/Dlna/DeviceProfile.cs +++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs @@ -131,7 +131,7 @@ namespace MediaBrowser.Model.Dlna public TranscodingProfile GetAudioTranscodingProfile(string container, string audioCodec) { - container = StringHelper.TrimStart((container ?? string.Empty), '.'); + container = StringHelper.TrimStart(container ?? string.Empty, '.'); foreach (var i in TranscodingProfiles) { @@ -157,7 +157,7 @@ namespace MediaBrowser.Model.Dlna public TranscodingProfile GetVideoTranscodingProfile(string container, string audioCodec, string videoCodec) { - container = StringHelper.TrimStart((container ?? string.Empty), '.'); + container = StringHelper.TrimStart(container ?? string.Empty, '.'); foreach (var i in TranscodingProfiles) { @@ -188,7 +188,7 @@ namespace MediaBrowser.Model.Dlna public ResponseProfile GetAudioMediaProfile(string container, string audioCodec, int? audioChannels, int? audioBitrate) { - container = StringHelper.TrimStart((container ?? string.Empty), '.'); + container = StringHelper.TrimStart(container ?? string.Empty, '.'); foreach (var i in ResponseProfiles) { @@ -233,7 +233,7 @@ namespace MediaBrowser.Model.Dlna public ResponseProfile GetImageMediaProfile(string container, int? width, int? height) { - container = StringHelper.TrimStart((container ?? string.Empty), '.'); + container = StringHelper.TrimStart(container ?? string.Empty, '.'); foreach (var i in ResponseProfiles) { @@ -283,13 +283,12 @@ namespace MediaBrowser.Model.Dlna int? packetLength, TransportStreamTimestamp timestamp, bool? isAnamorphic, - bool? isCabac, int? refFrames, int? numVideoStreams, int? numAudioStreams, string videoCodecTag) { - container = StringHelper.TrimStart((container ?? string.Empty), '.'); + container = StringHelper.TrimStart(container ?? string.Empty, '.'); foreach (var i in ResponseProfiles) { @@ -321,7 +320,7 @@ namespace MediaBrowser.Model.Dlna var anyOff = false; foreach (ProfileCondition c in i.Conditions) { - if (!conditionProcessor.IsVideoConditionSatisfied(c, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) + if (!conditionProcessor.IsVideoConditionSatisfied(c, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) { anyOff = true; break; diff --git a/MediaBrowser.Model/Dlna/DlnaFlags.cs b/MediaBrowser.Model/Dlna/DlnaFlags.cs index 7c7fe8d8f..b981e8455 100644 --- a/MediaBrowser.Model/Dlna/DlnaFlags.cs +++ b/MediaBrowser.Model/Dlna/DlnaFlags.cs @@ -13,12 +13,12 @@ namespace MediaBrowser.Model.Dlna and there are no issues with causing a buffer overflow if the receiver uses TCP flow control to reduce total throughput. */ - BackgroundTransferMode = (1 << 22), + BackgroundTransferMode = 1 << 22, - ByteBasedSeek = (1 << 29), - ConnectionStall = (1 << 21), + ByteBasedSeek = 1 << 29, + ConnectionStall = 1 << 21, - DlnaV15 = (1 << 20), + DlnaV15 = 1 << 20, /*! <i>Interactive</i> transfer mode. For best effort transfer of images and non-real-time transfers. @@ -27,13 +27,13 @@ namespace MediaBrowser.Model.Dlna \ref DH_TransferMode_Bulk is that the former assumes that the transfer is intended for immediate rendering. */ - InteractiveTransferMode = (1 << 23), + InteractiveTransferMode = 1 << 23, - PlayContainer = (1 << 28), - RtspPause = (1 << 25), - S0Increase = (1 << 27), - SenderPaced = (1L << 31), - SnIncrease = (1 << 26), + PlayContainer = 1 << 28, + RtspPause = 1 << 25, + S0Increase = 1 << 27, + SenderPaced = 1L << 31, + SnIncrease = 1 << 26, /*! <i>Streaming</i> transfer mode. The server transmits at a throughput sufficient for real-time playback of @@ -41,8 +41,8 @@ namespace MediaBrowser.Model.Dlna \ref DH_TransferMode_Interactive and \ref DH_TransferMode_Bulk transfer modes. The most well-known exception to this general claim is for live streams. */ - StreamingTransferMode = (1 << 24), + StreamingTransferMode = 1 << 24, - TimeBasedSeek = (1 << 30) + TimeBasedSeek = 1 << 30 } }
\ No newline at end of file diff --git a/MediaBrowser.Model/Dlna/ProfileConditionValue.cs b/MediaBrowser.Model/Dlna/ProfileConditionValue.cs index 4ad326e51..c17a09c3f 100644 --- a/MediaBrowser.Model/Dlna/ProfileConditionValue.cs +++ b/MediaBrowser.Model/Dlna/ProfileConditionValue.cs @@ -17,7 +17,6 @@ VideoTimestamp = 12, IsAnamorphic = 13, RefFrames = 14, - IsCabac = 15, NumAudioStreams = 16, NumVideoStreams = 17, IsSecondaryAudio = 18, diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index b04f1b0fb..1e6b7c729 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -55,7 +55,7 @@ namespace MediaBrowser.Model.Dlna stream.DeviceProfileId = options.Profile.Id; } - return GetOptimalStream(streams); + return GetOptimalStream(streams, options.GetMaxBitrate()); } public StreamInfo BuildVideoItem(VideoOptions options) @@ -88,12 +88,12 @@ namespace MediaBrowser.Model.Dlna stream.DeviceProfileId = options.Profile.Id; } - return GetOptimalStream(streams); + return GetOptimalStream(streams, options.GetMaxBitrate()); } - private StreamInfo GetOptimalStream(List<StreamInfo> streams) + private StreamInfo GetOptimalStream(List<StreamInfo> streams, int? maxBitrate) { - streams = StreamInfoSorter.SortMediaSources(streams); + streams = StreamInfoSorter.SortMediaSources(streams, maxBitrate); foreach (StreamInfo stream in streams) { @@ -383,7 +383,7 @@ namespace MediaBrowser.Model.Dlna if (subtitleStream != null) { - SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, options.Context, directPlay.Value); + SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, directPlay.Value); playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method; playlistItem.SubtitleFormat = subtitleProfile.Format; @@ -413,7 +413,7 @@ namespace MediaBrowser.Model.Dlna if (subtitleStream != null) { - SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, options.Context, PlayMethod.Transcode); + SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.Transcode); playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method; playlistItem.SubtitleFormat = subtitleProfile.Format; @@ -424,7 +424,7 @@ namespace MediaBrowser.Model.Dlna playlistItem.EstimateContentLength = transcodingProfile.EstimateContentLength; playlistItem.TranscodeSeekInfo = transcodingProfile.TranscodeSeekInfo; - // TODO: We should probably preserve the full list and sent it tp the server that way + // TODO: We should probably preserve the full list and sent it to the server that way string[] supportedAudioCodecs = transcodingProfile.AudioCodec.Split(','); string inputAudioCodec = audioStream == null ? null : audioStream.Codec; foreach (string supportedAudioCodec in supportedAudioCodecs) @@ -443,6 +443,7 @@ namespace MediaBrowser.Model.Dlna playlistItem.VideoCodec = transcodingProfile.VideoCodec; playlistItem.CopyTimestamps = transcodingProfile.CopyTimestamps; + playlistItem.ForceLiveStream = transcodingProfile.ForceLiveStream; playlistItem.SubProtocol = transcodingProfile.Protocol; playlistItem.AudioStreamIndex = audioStreamIndex; @@ -508,12 +509,23 @@ namespace MediaBrowser.Model.Dlna private int GetAudioBitrate(int? maxTotalBitrate, int? targetAudioChannels, string targetAudioCodec, MediaStream audioStream) { var defaultBitrate = 128000; + if (StringHelper.EqualsIgnoreCase(targetAudioCodec, "ac3")) + { + defaultBitrate = 192000; + } if (targetAudioChannels.HasValue) { if (targetAudioChannels.Value >= 5 && (maxTotalBitrate ?? 0) >= 2000000) { - defaultBitrate = 320000; + if (StringHelper.EqualsIgnoreCase(targetAudioCodec, "ac3")) + { + defaultBitrate = 448000; + } + else + { + defaultBitrate = 320000; + } } } @@ -597,7 +609,6 @@ namespace MediaBrowser.Model.Dlna string videoProfile = videoStream == null ? null : videoStream.Profile; float? videoFramerate = videoStream == null ? null : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate; bool? isAnamorphic = videoStream == null ? null : videoStream.IsAnamorphic; - bool? isCabac = videoStream == null ? null : videoStream.IsCabac; string videoCodecTag = videoStream == null ? null : videoStream.CodecTag; int? audioBitrate = audioStream == null ? null : audioStream.BitRate; @@ -614,7 +625,7 @@ namespace MediaBrowser.Model.Dlna // Check container conditions foreach (ProfileCondition i in conditions) { - if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) + if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) { LogConditionFailure(profile, "VideoContainerProfile", i, mediaSource); @@ -647,7 +658,7 @@ namespace MediaBrowser.Model.Dlna foreach (ProfileCondition i in conditions) { - if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) + if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) { LogConditionFailure(profile, "VideoCodecProfile", i, mediaSource); @@ -739,7 +750,7 @@ namespace MediaBrowser.Model.Dlna { if (subtitleStream != null) { - SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, options.Context, playMethod); + SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, playMethod); if (subtitleProfile.Method != SubtitleDeliveryMethod.External && subtitleProfile.Method != SubtitleDeliveryMethod.Embed) { @@ -751,7 +762,7 @@ namespace MediaBrowser.Model.Dlna return IsAudioEligibleForDirectPlay(item, maxBitrate); } - public static SubtitleProfile GetSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, EncodingContext context, PlayMethod playMethod) + public static SubtitleProfile GetSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, PlayMethod playMethod) { if (playMethod != PlayMethod.Transcode && !subtitleStream.IsExternal) { @@ -775,7 +786,16 @@ namespace MediaBrowser.Model.Dlna } } - // Look for an external profile that matches the stream type (text/graphical) + // Look for an external or hls profile that matches the stream type (text/graphical) and doesn't require conversion + return GetExternalSubtitleProfile(subtitleStream, subtitleProfiles, playMethod, false) ?? GetExternalSubtitleProfile(subtitleStream, subtitleProfiles, playMethod, true) ?? new SubtitleProfile + { + Method = SubtitleDeliveryMethod.Encode, + Format = subtitleStream.Codec + }; + } + + private static SubtitleProfile GetExternalSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, PlayMethod playMethod, bool allowConversion) + { foreach (SubtitleProfile profile in subtitleProfiles) { if (profile.Method != SubtitleDeliveryMethod.External && profile.Method != SubtitleDeliveryMethod.Hls) @@ -798,32 +818,47 @@ namespace MediaBrowser.Model.Dlna { bool requiresConversion = !StringHelper.EqualsIgnoreCase(subtitleStream.Codec, profile.Format); - if (subtitleStream.IsTextSubtitleStream || !requiresConversion) + if (requiresConversion && !allowConversion) { - if (subtitleStream.SupportsExternalStream) - { - return profile; - } + continue; + } + + if (!requiresConversion) + { + return profile; + } + + if (subtitleStream.IsTextSubtitleStream && subtitleStream.SupportsExternalStream) + { + return profile; } } } - return new SubtitleProfile - { - Method = SubtitleDeliveryMethod.Encode, - Format = subtitleStream.Codec - }; + return null; } private bool IsAudioEligibleForDirectPlay(MediaSourceInfo item, int? maxBitrate) { - if (!maxBitrate.HasValue || (item.Bitrate.HasValue && item.Bitrate.Value <= maxBitrate.Value)) + if (!maxBitrate.HasValue) + { + _logger.Info("Cannot direct play due to unknown supported bitrate"); + return false; + } + + if (!item.Bitrate.HasValue) { - return true; + _logger.Info("Cannot direct play due to unknown content bitrate"); + return false; } - _logger.Info("Bitrate exceeds DirectPlay limit"); - return false; + if (item.Bitrate.Value > maxBitrate.Value) + { + _logger.Info("Bitrate exceeds DirectPlay limit"); + return false; + } + + return true; } private void ValidateInput(VideoOptions options) @@ -898,22 +933,6 @@ namespace MediaBrowser.Model.Dlna } break; } - case ProfileConditionValue.IsCabac: - { - bool val; - if (BoolHelper.TryParseCultureInvariant(value, out val)) - { - if (condition.Condition == ProfileConditionType.Equals) - { - item.Cabac = val; - } - else if (condition.Condition == ProfileConditionType.NotEquals) - { - item.Cabac = !val; - } - } - break; - } case ProfileConditionValue.IsAnamorphic: case ProfileConditionValue.AudioProfile: case ProfileConditionValue.Has64BitOffsets: diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs index 9118efb35..644f732a7 100644 --- a/MediaBrowser.Model/Dlna/StreamInfo.cs +++ b/MediaBrowser.Model/Dlna/StreamInfo.cs @@ -6,7 +6,6 @@ using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.Session; using System; using System.Collections.Generic; -using System.Globalization; namespace MediaBrowser.Model.Dlna { @@ -31,8 +30,8 @@ namespace MediaBrowser.Model.Dlna public string VideoCodec { get; set; } public string VideoProfile { get; set; } - public bool? Cabac { get; set; } public bool CopyTimestamps { get; set; } + public bool ForceLiveStream { get; set; } public string AudioCodec { get; set; } public int? AudioStreamIndex { get; set; } @@ -194,7 +193,7 @@ namespace MediaBrowser.Model.Dlna list.Add(new NameValuePair("DeviceProfileId", item.DeviceProfileId ?? string.Empty)); list.Add(new NameValuePair("DeviceId", item.DeviceId ?? string.Empty)); list.Add(new NameValuePair("MediaSourceId", item.MediaSourceId ?? string.Empty)); - list.Add(new NameValuePair("Static", (item.IsDirectStream).ToString().ToLower())); + list.Add(new NameValuePair("Static", item.IsDirectStream.ToString().ToLower())); list.Add(new NameValuePair("VideoCodec", item.VideoCodec ?? string.Empty)); list.Add(new NameValuePair("AudioCodec", item.AudioCodec ?? string.Empty)); list.Add(new NameValuePair("AudioStreamIndex", item.AudioStreamIndex.HasValue ? StringHelper.ToStringCultureInvariant(item.AudioStreamIndex.Value) : string.Empty)); @@ -206,7 +205,7 @@ namespace MediaBrowser.Model.Dlna list.Add(new NameValuePair("MaxWidth", item.MaxWidth.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxWidth.Value) : string.Empty)); list.Add(new NameValuePair("MaxHeight", item.MaxHeight.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxHeight.Value) : string.Empty)); - if (StringHelper.EqualsIgnoreCase(item.SubProtocol, "hls")) + if (StringHelper.EqualsIgnoreCase(item.SubProtocol, "hls") && !item.ForceLiveStream) { list.Add(new NameValuePair("StartTimeTicks", string.Empty)); } @@ -220,7 +219,9 @@ namespace MediaBrowser.Model.Dlna list.Add(new NameValuePair("MaxRefFrames", item.MaxRefFrames.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxRefFrames.Value) : string.Empty)); list.Add(new NameValuePair("MaxVideoBitDepth", item.MaxVideoBitDepth.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxVideoBitDepth.Value) : string.Empty)); list.Add(new NameValuePair("Profile", item.VideoProfile ?? string.Empty)); - list.Add(new NameValuePair("Cabac", item.Cabac.HasValue ? item.Cabac.Value.ToString() : string.Empty)); + + // no longer used + list.Add(new NameValuePair("Cabac", string.Empty)); list.Add(new NameValuePair("PlaySessionId", item.PlaySessionId ?? string.Empty)); list.Add(new NameValuePair("api_key", accessToken ?? string.Empty)); @@ -233,7 +234,8 @@ namespace MediaBrowser.Model.Dlna list.Add(new NameValuePair("ItemId", item.ItemId)); } - list.Add(new NameValuePair("CopyTimestamps", (item.CopyTimestamps).ToString().ToLower())); + list.Add(new NameValuePair("CopyTimestamps", item.CopyTimestamps.ToString().ToLower())); + list.Add(new NameValuePair("ForceLiveStream", item.ForceLiveStream.ToString().ToLower())); list.Add(new NameValuePair("SubtitleMethod", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External ? item.SubtitleDeliveryMethod.ToString() : string.Empty)); return list; @@ -322,7 +324,7 @@ namespace MediaBrowser.Model.Dlna private SubtitleStreamInfo GetSubtitleStreamInfo(MediaStream stream, string baseUrl, string accessToken, long startPositionTicks, SubtitleProfile[] subtitleProfiles) { - SubtitleProfile subtitleProfile = StreamBuilder.GetSubtitleProfile(stream, subtitleProfiles, Context, PlayMethod); + SubtitleProfile subtitleProfile = StreamBuilder.GetSubtitleProfile(stream, subtitleProfiles, PlayMethod); SubtitleStreamInfo info = new SubtitleStreamInfo { IsForced = stream.IsForced, @@ -633,19 +635,6 @@ namespace MediaBrowser.Model.Dlna } } - public bool? IsTargetCabac - { - get - { - if (IsDirectStream) - { - return TargetVideoStream == null ? null : TargetVideoStream.IsCabac; - } - - return true; - } - } - public int? TargetWidth { get diff --git a/MediaBrowser.Model/Dlna/StreamInfoSorter.cs b/MediaBrowser.Model/Dlna/StreamInfoSorter.cs index 0cccd8080..293054e5b 100644 --- a/MediaBrowser.Model/Dlna/StreamInfoSorter.cs +++ b/MediaBrowser.Model/Dlna/StreamInfoSorter.cs @@ -7,7 +7,7 @@ namespace MediaBrowser.Model.Dlna { public class StreamInfoSorter { - public static List<StreamInfo> SortMediaSources(List<StreamInfo> streams) + public static List<StreamInfo> SortMediaSources(List<StreamInfo> streams, int? maxBitrate) { return streams.OrderBy(i => { @@ -41,6 +41,23 @@ namespace MediaBrowser.Model.Dlna return 1; } + }).ThenBy(i => + { + if (maxBitrate.HasValue) + { + if (i.MediaSource.Bitrate.HasValue) + { + if (i.MediaSource.Bitrate.Value <= maxBitrate.Value) + { + return 0; + } + + return 2; + } + } + + return 1; + }).ToList(); } } diff --git a/MediaBrowser.Model/Dlna/TranscodingProfile.cs b/MediaBrowser.Model/Dlna/TranscodingProfile.cs index e59ee6d63..bf6bf092f 100644 --- a/MediaBrowser.Model/Dlna/TranscodingProfile.cs +++ b/MediaBrowser.Model/Dlna/TranscodingProfile.cs @@ -35,6 +35,9 @@ namespace MediaBrowser.Model.Dlna [XmlAttribute("context")] public EncodingContext Context { get; set; } + [XmlAttribute("forceLiveStream")] + public bool ForceLiveStream { get; set; } + public List<string> GetAudioCodecs() { List<string> list = new List<string>(); diff --git a/MediaBrowser.Model/Dto/ItemCounts.cs b/MediaBrowser.Model/Dto/ItemCounts.cs index e80de26b1..a3a00c341 100644 --- a/MediaBrowser.Model/Dto/ItemCounts.cs +++ b/MediaBrowser.Model/Dto/ItemCounts.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -namespace MediaBrowser.Model.Dto +namespace MediaBrowser.Model.Dto { /// <summary> /// Class LibrarySummary diff --git a/MediaBrowser.Model/Dto/MediaSourceInfo.cs b/MediaBrowser.Model/Dto/MediaSourceInfo.cs index f09a8b3a7..4e3e60063 100644 --- a/MediaBrowser.Model/Dto/MediaSourceInfo.cs +++ b/MediaBrowser.Model/Dto/MediaSourceInfo.cs @@ -113,7 +113,7 @@ namespace MediaBrowser.Model.Dto { foreach (MediaStream i in MediaStreams) { - if (i.Type == MediaStreamType.Video && StringHelper.IndexOfIgnoreCase((i.Codec ?? string.Empty), "jpeg") == -1) + if (i.Type == MediaStreamType.Video && StringHelper.IndexOfIgnoreCase(i.Codec ?? string.Empty, "jpeg") == -1) { return i; } @@ -160,6 +160,16 @@ namespace MediaBrowser.Model.Dto public bool? IsSecondaryAudio(MediaStream stream) { + // Look for the first audio track marked as default + foreach (MediaStream currentStream in MediaStreams) + { + if (currentStream.Type == MediaStreamType.Audio && currentStream.IsDefault) + { + return currentStream.Index != stream.Index; + } + } + + // Look for the first audio track foreach (MediaStream currentStream in MediaStreams) { if (currentStream.Type == MediaStreamType.Audio) diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index 1e19a0601..bdc043e9a 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; -using System.Runtime.Serialization; -using MediaBrowser.Model.Dlna; +using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Extensions; using System.Diagnostics; @@ -234,11 +232,5 @@ namespace MediaBrowser.Model.Entities /// </summary> /// <value><c>true</c> if this instance is anamorphic; otherwise, <c>false</c>.</value> public bool? IsAnamorphic { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether this instance is cabac. - /// </summary> - /// <value><c>null</c> if [is cabac] contains no value, <c>true</c> if [is cabac]; otherwise, <c>false</c>.</value> - public bool? IsCabac { get; set; } } } diff --git a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs index 71f87ac3a..46f630fe0 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs @@ -31,18 +31,24 @@ namespace MediaBrowser.Model.LiveTv public string Type { get; set; } public string DeviceId { get; set; } public bool ImportFavoritesOnly { get; set; } + public bool AllowHWTranscoding { get; set; } public bool IsEnabled { get; set; } public string M3UUrl { get; set; } public string InfoUrl { get; set; } public string FriendlyName { get; set; } public int Tuners { get; set; } public string DiseqC { get; set; } + public string SourceA { get; set; } + public string SourceB { get; set; } + public string SourceC { get; set; } + public string SourceD { get; set; } public int DataVersion { get; set; } public TunerHostInfo() { IsEnabled = true; + AllowHWTranscoding = true; } } @@ -66,4 +72,4 @@ namespace MediaBrowser.Model.LiveTv EnableAllTuners = true; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Notifications/NotificationOption.cs b/MediaBrowser.Model/Notifications/NotificationOption.cs index 09f7072dd..e8a7178c4 100644 --- a/MediaBrowser.Model/Notifications/NotificationOption.cs +++ b/MediaBrowser.Model/Notifications/NotificationOption.cs @@ -1,5 +1,3 @@ -using MediaBrowser.Model.Configuration; - namespace MediaBrowser.Model.Notifications { public class NotificationOption diff --git a/MediaBrowser.Model/Notifications/NotificationOptions.cs b/MediaBrowser.Model/Notifications/NotificationOptions.cs index 683f1a76c..7a33c92f9 100644 --- a/MediaBrowser.Model/Notifications/NotificationOptions.cs +++ b/MediaBrowser.Model/Notifications/NotificationOptions.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Extensions; +using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Users; namespace MediaBrowser.Model.Notifications diff --git a/MediaBrowser.Model/Providers/SubtitleOptions.cs b/MediaBrowser.Model/Providers/SubtitleOptions.cs index 2b15c0e1f..5587e897f 100644 --- a/MediaBrowser.Model/Providers/SubtitleOptions.cs +++ b/MediaBrowser.Model/Providers/SubtitleOptions.cs @@ -12,11 +12,14 @@ namespace MediaBrowser.Model.Providers public string OpenSubtitlesPasswordHash { get; set; } public bool IsOpenSubtitleVipAccount { get; set; } + public bool RequirePerfectMatch { get; set; } + public SubtitleOptions() { DownloadLanguages = new string[] { }; SkipIfAudioTrackMatches = true; + RequirePerfectMatch = true; } } }
\ No newline at end of file diff --git a/MediaBrowser.Model/Search/SearchHint.cs b/MediaBrowser.Model/Search/SearchHint.cs index 3a1d45cc4..cea15a2a7 100644 --- a/MediaBrowser.Model/Search/SearchHint.cs +++ b/MediaBrowser.Model/Search/SearchHint.cs @@ -1,6 +1,4 @@ -using System; - -namespace MediaBrowser.Model.Search +namespace MediaBrowser.Model.Search { /// <summary> /// Class SearchHintResult diff --git a/MediaBrowser.Model/Tasks/TaskInfo.cs b/MediaBrowser.Model/Tasks/TaskInfo.cs index 83ee0b7e6..50276f8eb 100644 --- a/MediaBrowser.Model/Tasks/TaskInfo.cs +++ b/MediaBrowser.Model/Tasks/TaskInfo.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; namespace MediaBrowser.Model.Tasks { diff --git a/MediaBrowser.Model/Updates/InstallationInfo.cs b/MediaBrowser.Model/Updates/InstallationInfo.cs index b904a0e58..8c6e686d8 100644 --- a/MediaBrowser.Model/Updates/InstallationInfo.cs +++ b/MediaBrowser.Model/Updates/InstallationInfo.cs @@ -1,6 +1,4 @@ -using System; - -namespace MediaBrowser.Model.Updates +namespace MediaBrowser.Model.Updates { /// <summary> /// Class InstallationInfo diff --git a/MediaBrowser.Providers/Books/BookMetadataService.cs b/MediaBrowser.Providers/Books/BookMetadataService.cs index 0d030c039..eb3335c9a 100644 --- a/MediaBrowser.Providers/Books/BookMetadataService.cs +++ b/MediaBrowser.Providers/Books/BookMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs b/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs index 3cf657c44..9a2488781 100644 --- a/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs +++ b/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Library; diff --git a/MediaBrowser.Providers/BoxSets/MovieDbBoxSetProvider.cs b/MediaBrowser.Providers/BoxSets/MovieDbBoxSetProvider.cs index bd4078b27..53a573bd1 100644 --- a/MediaBrowser.Providers/BoxSets/MovieDbBoxSetProvider.cs +++ b/MediaBrowser.Providers/BoxSets/MovieDbBoxSetProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.Movies; diff --git a/MediaBrowser.Providers/Channels/ChannelMetadataService.cs b/MediaBrowser.Providers/Channels/ChannelMetadataService.cs index 6fd7b2539..3a1d2374c 100644 --- a/MediaBrowser.Providers/Channels/ChannelMetadataService.cs +++ b/MediaBrowser.Providers/Channels/ChannelMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Channels; +using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/Folders/CollectionFolderMetadataService.cs b/MediaBrowser.Providers/Folders/CollectionFolderMetadataService.cs new file mode 100644 index 000000000..e1de443de --- /dev/null +++ b/MediaBrowser.Providers/Folders/CollectionFolderMetadataService.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CommonIO; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Logging; +using MediaBrowser.Providers.Manager; + +namespace MediaBrowser.Providers.Folders +{ + public class CollectionFolderMetadataService : MetadataService<CollectionFolder, ItemLookupInfo> + { + public CollectionFolderMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) + : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) + { + } + + protected override void MergeData(MetadataResult<CollectionFolder> source, MetadataResult<CollectionFolder> target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings) + { + ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); + } + } +} diff --git a/MediaBrowser.Providers/Folders/DefaultImageProvider.cs b/MediaBrowser.Providers/Folders/DefaultImageProvider.cs index ee83efd26..afd8c583d 100644 --- a/MediaBrowser.Providers/Folders/DefaultImageProvider.cs +++ b/MediaBrowser.Providers/Folders/DefaultImageProvider.cs @@ -157,7 +157,7 @@ namespace MediaBrowser.Providers.Folders }); } - public bool HasChanged(IHasMetadata item, MetadataStatus status, IDirectoryService directoryService) + public bool HasChanged(IHasMetadata item, IDirectoryService directoryService) { return GetSupportedImages(item).Any(i => !item.HasImage(i)); } diff --git a/MediaBrowser.Providers/Folders/FolderMetadataService.cs b/MediaBrowser.Providers/Folders/FolderMetadataService.cs index c7b60afcc..e938297b7 100644 --- a/MediaBrowser.Providers/Folders/FolderMetadataService.cs +++ b/MediaBrowser.Providers/Folders/FolderMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/Folders/UserViewMetadataService.cs b/MediaBrowser.Providers/Folders/UserViewMetadataService.cs index a9366a9d3..7c298a3ed 100644 --- a/MediaBrowser.Providers/Folders/UserViewMetadataService.cs +++ b/MediaBrowser.Providers/Folders/UserViewMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; @@ -22,17 +21,4 @@ namespace MediaBrowser.Providers.Folders ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } } - - public class CollectionFolderMetadataService : MetadataService<CollectionFolder, ItemLookupInfo> - { - public CollectionFolderMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) - : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) - { - } - - protected override void MergeData(MetadataResult<CollectionFolder> source, MetadataResult<CollectionFolder> target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings) - { - ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); - } - } } diff --git a/MediaBrowser.Providers/GameGenres/GameGenreImageProvider.cs b/MediaBrowser.Providers/GameGenres/GameGenreImageProvider.cs index 9d4b90ff3..3a532257f 100644 --- a/MediaBrowser.Providers/GameGenres/GameGenreImageProvider.cs +++ b/MediaBrowser.Providers/GameGenres/GameGenreImageProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/GameGenres/GameGenreMetadataService.cs b/MediaBrowser.Providers/GameGenres/GameGenreMetadataService.cs index 676c08c56..f80691d72 100644 --- a/MediaBrowser.Providers/GameGenres/GameGenreMetadataService.cs +++ b/MediaBrowser.Providers/GameGenres/GameGenreMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/Games/GameMetadataService.cs b/MediaBrowser.Providers/Games/GameMetadataService.cs index 26359dfb8..23284b84e 100644 --- a/MediaBrowser.Providers/Games/GameMetadataService.cs +++ b/MediaBrowser.Providers/Games/GameMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/Games/GameSystemMetadataService.cs b/MediaBrowser.Providers/Games/GameSystemMetadataService.cs index 112b01957..a70b5c7fe 100644 --- a/MediaBrowser.Providers/Games/GameSystemMetadataService.cs +++ b/MediaBrowser.Providers/Games/GameSystemMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; @@ -7,8 +6,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Providers.Manager; using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; using CommonIO; namespace MediaBrowser.Providers.Games diff --git a/MediaBrowser.Providers/Genres/GenreImageProvider.cs b/MediaBrowser.Providers/Genres/GenreImageProvider.cs index 373f59acc..7c2ed00a6 100644 --- a/MediaBrowser.Providers/Genres/GenreImageProvider.cs +++ b/MediaBrowser.Providers/Genres/GenreImageProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/Genres/GenreMetadataService.cs b/MediaBrowser.Providers/Genres/GenreMetadataService.cs index a93c33e66..7aba931a2 100644 --- a/MediaBrowser.Providers/Genres/GenreMetadataService.cs +++ b/MediaBrowser.Providers/Genres/GenreMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/ImagesByName/ImageUtils.cs b/MediaBrowser.Providers/ImagesByName/ImageUtils.cs index fc818b690..b53348749 100644 --- a/MediaBrowser.Providers/ImagesByName/ImageUtils.cs +++ b/MediaBrowser.Providers/ImagesByName/ImageUtils.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Entities; using System; using System.Collections.Generic; diff --git a/MediaBrowser.Providers/LiveTv/AudioRecordingService.cs b/MediaBrowser.Providers/LiveTv/AudioRecordingService.cs index 0798f3ef4..4ccbb9116 100644 --- a/MediaBrowser.Providers/LiveTv/AudioRecordingService.cs +++ b/MediaBrowser.Providers/LiveTv/AudioRecordingService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.Providers; @@ -7,8 +6,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Providers.Manager; using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; using CommonIO; namespace MediaBrowser.Providers.LiveTv diff --git a/MediaBrowser.Providers/LiveTv/ChannelMetadataService.cs b/MediaBrowser.Providers/LiveTv/ChannelMetadataService.cs index 31af0916c..0b9b18bbc 100644 --- a/MediaBrowser.Providers/LiveTv/ChannelMetadataService.cs +++ b/MediaBrowser.Providers/LiveTv/ChannelMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.Providers; @@ -7,8 +6,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Providers.Manager; using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; using CommonIO; namespace MediaBrowser.Providers.LiveTv diff --git a/MediaBrowser.Providers/LiveTv/ProgramMetadataService.cs b/MediaBrowser.Providers/LiveTv/ProgramMetadataService.cs index 385f455b2..0bf4a1b37 100644 --- a/MediaBrowser.Providers/LiveTv/ProgramMetadataService.cs +++ b/MediaBrowser.Providers/LiveTv/ProgramMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/LiveTv/VideoRecordingService.cs b/MediaBrowser.Providers/LiveTv/VideoRecordingService.cs index e80768ff8..47ac546a2 100644 --- a/MediaBrowser.Providers/LiveTv/VideoRecordingService.cs +++ b/MediaBrowser.Providers/LiveTv/VideoRecordingService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.Providers; @@ -7,8 +6,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Providers.Manager; using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; using CommonIO; namespace MediaBrowser.Providers.LiveTv diff --git a/MediaBrowser.Providers/Manager/ItemImageProvider.cs b/MediaBrowser.Providers/Manager/ItemImageProvider.cs index 73e09c1e6..97dd1ed4c 100644 --- a/MediaBrowser.Providers/Manager/ItemImageProvider.cs +++ b/MediaBrowser.Providers/Manager/ItemImageProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index b7991cb78..3d584e858 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -12,8 +12,12 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using CommonIO; +using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Entities.Movies; +using MediaBrowser.Controller.LiveTv; +using MediaBrowser.Controller.Playlists; +using MediaBrowser.Model.Providers; namespace MediaBrowser.Providers.Manager { @@ -68,6 +72,11 @@ namespace MediaBrowser.Providers.Manager result.ItemDateModified = item.DateModified; + if (EnableDateLastRefreshed(item)) + { + return Task.FromResult(true); + } + return ProviderRepo.SaveMetadataStatus(result, CancellationToken.None); } @@ -83,7 +92,22 @@ namespace MediaBrowser.Providers.Manager return new MetadataStatus { ItemId = item.Id }; } - return ProviderRepo.GetMetadataStatus(item.Id) ?? new MetadataStatus { ItemId = item.Id }; + if (EnableDateLastRefreshed(item) && item.DateModifiedDuringLastRefresh.HasValue) + { + return new MetadataStatus + { + ItemId = item.Id, + DateLastImagesRefresh = item.DateLastRefreshed, + DateLastMetadataRefresh = item.DateLastRefreshed, + ItemDateModified = item.DateModifiedDuringLastRefresh.Value + }; + } + + var result = ProviderRepo.GetMetadataStatus(item.Id) ?? new MetadataStatus { ItemId = item.Id }; + + item.DateModifiedDuringLastRefresh = result.ItemDateModified; + + return result; } public async Task<ItemUpdateType> RefreshMetadata(IHasMetadata item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken) @@ -119,13 +143,20 @@ namespace MediaBrowser.Providers.Manager Item = itemOfType }; + bool hasRefreshedMetadata = true; + bool hasRefreshedImages = true; + // Next run metadata providers if (refreshOptions.MetadataRefreshMode != MetadataRefreshMode.None) { var providers = GetProviders(item, refreshResult, refreshOptions) .ToList(); - if (providers.Count > 0 || !refreshResult.DateLastMetadataRefresh.HasValue) + var dateLastRefresh = EnableDateLastRefreshed(item) + ? item.DateLastRefreshed + : refreshResult.DateLastMetadataRefresh ?? default(DateTime); + + if (providers.Count > 0 || dateLastRefresh == default(DateTime)) { if (item.BeforeMetadataRefresh()) { @@ -137,6 +168,11 @@ namespace MediaBrowser.Providers.Manager { var id = itemOfType.GetLookupInfo(); + if (refreshOptions.SearchResult != null) + { + ApplySearchResult(id, refreshOptions.SearchResult); + } + //await FindIdentities(id, cancellationToken).ConfigureAwait(false); id.IsAutomated = refreshOptions.IsAutomated; @@ -146,9 +182,11 @@ namespace MediaBrowser.Providers.Manager if (result.Failures == 0) { refreshResult.SetDateLastMetadataRefresh(DateTime.UtcNow); + hasRefreshedMetadata = true; } else { + hasRefreshedMetadata = false; refreshResult.SetDateLastMetadataRefresh(null); } } @@ -167,9 +205,11 @@ namespace MediaBrowser.Providers.Manager if (result.Failures == 0) { refreshResult.SetDateLastImagesRefresh(DateTime.UtcNow); + hasRefreshedImages = true; } else { + hasRefreshedImages = false; refreshResult.SetDateLastImagesRefresh(null); } } @@ -189,9 +229,15 @@ namespace MediaBrowser.Providers.Manager updateType = updateType | ItemUpdateType.MetadataDownload; } - if (refreshOptions.MetadataRefreshMode >= MetadataRefreshMode.Default && refreshOptions.ImageRefreshMode >= ImageRefreshMode.Default) + if (hasRefreshedMetadata && hasRefreshedImages) { item.DateLastRefreshed = DateTime.UtcNow; + item.DateModifiedDuringLastRefresh = item.DateModified; + } + else + { + item.DateLastRefreshed = default(DateTime); + item.DateModifiedDuringLastRefresh = null; } // Save to database @@ -208,6 +254,13 @@ namespace MediaBrowser.Providers.Manager return updateType; } + private void ApplySearchResult(ItemLookupInfo lookupInfo, RemoteSearchResult result) + { + lookupInfo.ProviderIds = result.ProviderIds; + lookupInfo.Name = result.Name; + lookupInfo.Year = result.ProductionYear; + } + private async Task FindIdentities(TIdType id, CancellationToken cancellationToken) { try @@ -242,7 +295,17 @@ namespace MediaBrowser.Providers.Manager return true; } - if (item is BoxSet || (item is IItemByName && !(item is MusicArtist))) + if (item is BoxSet || item is IItemByName || item is Playlist) + { + return true; + } + + if (item.SourceType != SourceType.Library) + { + return true; + } + + if (item is ICollectionFolder) { return true; } @@ -352,8 +415,12 @@ namespace MediaBrowser.Providers.Manager // Get providers to refresh var providers = ((ProviderManager)ProviderManager).GetMetadataProviders<TItemType>(item).ToList(); + var dateLastRefresh = EnableDateLastRefreshed(item) + ? item.DateLastRefreshed + : status.DateLastMetadataRefresh ?? default(DateTime); + // Run all if either of these flags are true - var runAllProviders = options.ReplaceAllMetadata || options.MetadataRefreshMode == MetadataRefreshMode.FullRefresh || !status.DateLastMetadataRefresh.HasValue; + var runAllProviders = options.ReplaceAllMetadata || options.MetadataRefreshMode == MetadataRefreshMode.FullRefresh || dateLastRefresh == default(DateTime); if (!runAllProviders) { @@ -372,7 +439,7 @@ namespace MediaBrowser.Providers.Manager var hasFileChangeMonitor = i as IHasItemChangeMonitor; if (hasFileChangeMonitor != null) { - return HasChanged(item, hasFileChangeMonitor, status, options.DirectoryService); + return HasChanged(item, hasFileChangeMonitor, options.DirectoryService); } return false; @@ -417,8 +484,12 @@ namespace MediaBrowser.Providers.Manager // Get providers to refresh var providers = allImageProviders.Where(i => !(i is ILocalImageProvider)).ToList(); + var dateLastImageRefresh = EnableDateLastRefreshed(item) + ? item.DateLastRefreshed + : status.DateLastImagesRefresh ?? default(DateTime); + // Run all if either of these flags are true - var runAllProviders = options.ImageRefreshMode == ImageRefreshMode.FullRefresh || !status.DateLastImagesRefresh.HasValue; + var runAllProviders = options.ImageRefreshMode == ImageRefreshMode.FullRefresh || dateLastImageRefresh == default(DateTime); if (!runAllProviders) { @@ -428,13 +499,13 @@ namespace MediaBrowser.Providers.Manager var hasChangeMonitor = i as IHasChangeMonitor; if (hasChangeMonitor != null) { - return HasChanged(item, hasChangeMonitor, status.DateLastImagesRefresh.Value, options.DirectoryService); + return HasChanged(item, hasChangeMonitor, dateLastImageRefresh, options.DirectoryService); } var hasFileChangeMonitor = i as IHasItemChangeMonitor; if (hasFileChangeMonitor != null) { - return HasChanged(item, hasFileChangeMonitor, status, options.DirectoryService); + return HasChanged(item, hasFileChangeMonitor, options.DirectoryService); } return false; @@ -546,7 +617,7 @@ namespace MediaBrowser.Providers.Manager if (options.MetadataRefreshMode != MetadataRefreshMode.FullRefresh) { // If the local provider fails don't continue with remote providers because the user's saved metadata could be lost - return refreshResult; + //return refreshResult; } } } @@ -726,11 +797,11 @@ namespace MediaBrowser.Providers.Manager } } - private bool HasChanged(IHasMetadata item, IHasItemChangeMonitor changeMonitor, MetadataStatus status, IDirectoryService directoryService) + private bool HasChanged(IHasMetadata item, IHasItemChangeMonitor changeMonitor, IDirectoryService directoryService) { try { - var hasChanged = changeMonitor.HasChanged(item, status, directoryService); + var hasChanged = changeMonitor.HasChanged(item, directoryService); //if (hasChanged) //{ diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs index a83a40bc3..06db8a237 100644 --- a/MediaBrowser.Providers/Manager/ProviderManager.cs +++ b/MediaBrowser.Providers/Manager/ProviderManager.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Net; using MediaBrowser.Controller; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; diff --git a/MediaBrowser.Providers/Manager/ProviderUtils.cs b/MediaBrowser.Providers/Manager/ProviderUtils.cs index 20b2ac6cd..278d8ed71 100644 --- a/MediaBrowser.Providers/Manager/ProviderUtils.cs +++ b/MediaBrowser.Providers/Manager/ProviderUtils.cs @@ -10,9 +10,9 @@ namespace MediaBrowser.Providers.Manager public static class ProviderUtils { public static void MergeBaseItemData<T>(MetadataResult<T> sourceResult, - MetadataResult<T> targetResult, - List<MetadataFields> lockedFields, - bool replaceData, + MetadataResult<T> targetResult, + List<MetadataFields> lockedFields, + bool replaceData, bool mergeMetadataSettings) where T : BaseItem { @@ -89,7 +89,7 @@ namespace MediaBrowser.Providers.Manager { target.CustomRating = source.CustomRating; } - + if (!lockedFields.Contains(MetadataFields.Overview)) { if (replaceData || string.IsNullOrEmpty(target.Overview)) @@ -107,7 +107,7 @@ namespace MediaBrowser.Providers.Manager { if (replaceData || targetResult.People == null || targetResult.People.Count == 0) { - targetResult.People = sourceResult.People ?? new List<PersonInfo>(); + targetResult.People = sourceResult.People; } } @@ -238,7 +238,7 @@ namespace MediaBrowser.Providers.Manager targetHasDisplayOrder.DisplayOrder = sourceHasDisplayOrder.DisplayOrder; } } - + private static void MergeShortOverview(BaseItem source, BaseItem target, List<MetadataFields> lockedFields, bool replaceData) { var sourceHasShortOverview = source as IHasShortOverview; diff --git a/MediaBrowser.Providers/Manager/SeriesOrderManager.cs b/MediaBrowser.Providers/Manager/SeriesOrderManager.cs index 39175d1f9..1050bdbbd 100644 --- a/MediaBrowser.Providers/Manager/SeriesOrderManager.cs +++ b/MediaBrowser.Providers/Manager/SeriesOrderManager.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using MediaBrowser.Common; using MediaBrowser.Controller.Providers; namespace MediaBrowser.Providers.Manager diff --git a/MediaBrowser.Providers/MediaBrowser.Providers.csproj b/MediaBrowser.Providers/MediaBrowser.Providers.csproj index 8927e00aa..f07478f98 100644 --- a/MediaBrowser.Providers/MediaBrowser.Providers.csproj +++ b/MediaBrowser.Providers/MediaBrowser.Providers.csproj @@ -88,6 +88,7 @@ <Compile Include="BoxSets\MovieDbBoxSetProvider.cs" /> <Compile Include="Channels\ChannelMetadataService.cs" /> <Compile Include="Chapters\ChapterManager.cs" /> + <Compile Include="Folders\CollectionFolderMetadataService.cs" /> <Compile Include="Folders\DefaultImageProvider.cs" /> <Compile Include="Folders\FolderMetadataService.cs" /> <Compile Include="Folders\UserViewMetadataService.cs" /> diff --git a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs index f9108b9fd..4b795a474 100644 --- a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs @@ -1,6 +1,5 @@ using System; using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; @@ -79,7 +78,8 @@ namespace MediaBrowser.Providers.MediaInfo _fileSystem.CreateDirectory(Path.GetDirectoryName(path)); var imageStream = imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("front", StringComparison.OrdinalIgnoreCase) != -1) ?? - imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("cover", StringComparison.OrdinalIgnoreCase) != -1); + imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("cover", StringComparison.OrdinalIgnoreCase) != -1) ?? + imageStreams.FirstOrDefault(); var imageStreamIndex = imageStream == null ? (int?)null : imageStream.Index; @@ -160,14 +160,11 @@ namespace MediaBrowser.Providers.MediaInfo return item.LocationType == LocationType.FileSystem && audio != null && !audio.IsArchive; } - public bool HasChanged(IHasMetadata item, MetadataStatus status, IDirectoryService directoryService) + public bool HasChanged(IHasMetadata item, IDirectoryService directoryService) { - if (status.ItemDateModified.HasValue) + if (item.DateModifiedDuringLastRefresh.HasValue) { - if (status.ItemDateModified.Value != item.DateModified) - { - return true; - } + return item.DateModifiedDuringLastRefresh.Value != item.DateModified; } return false; diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs index 78906fa85..baa561487 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs @@ -11,7 +11,6 @@ using MediaBrowser.Model.Serialization; using System.Collections.Generic; using System.Globalization; using System.IO; -using System.Linq; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs index 7955191c8..9db4ab96e 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Chapters; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; @@ -19,7 +18,6 @@ using MediaBrowser.Model.Logging; using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.Serialization; using System; -using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -165,11 +163,11 @@ namespace MediaBrowser.Providers.MediaInfo return prober.Probe(item, cancellationToken); } - public bool HasChanged(IHasMetadata item, MetadataStatus status, IDirectoryService directoryService) + public bool HasChanged(IHasMetadata item, IDirectoryService directoryService) { - if (status.ItemDateModified.HasValue) + if (item.DateModifiedDuringLastRefresh.HasValue) { - if (status.ItemDateModified.Value != item.DateModified) + if (item.DateModifiedDuringLastRefresh.Value != item.DateModified) { return true; } diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs index 5f556bffb..621510028 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs @@ -1,8 +1,6 @@ using DvdLib.Ifo; using MediaBrowser.Common.Configuration; using MediaBrowser.Model.Dlna; -using MediaBrowser.Model.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Chapters; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; @@ -534,6 +532,7 @@ namespace MediaBrowser.Providers.MediaInfo currentStreams.Concat(externalSubtitleStreams).ToList(), subtitleOptions.SkipIfEmbeddedSubtitlesPresent, subtitleOptions.SkipIfAudioTrackMatches, + subtitleOptions.RequirePerfectMatch, subtitleOptions.DownloadLanguages, cancellationToken).ConfigureAwait(false); diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs b/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs index d82289032..9ae8413d1 100644 --- a/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs +++ b/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs @@ -28,6 +28,7 @@ namespace MediaBrowser.Providers.MediaInfo List<MediaStream> mediaStreams, bool skipIfEmbeddedSubtitlesPresent, bool skipIfAudioTrackMatches, + bool requirePerfectMatch, IEnumerable<string> languages, CancellationToken cancellationToken) { @@ -59,7 +60,7 @@ namespace MediaBrowser.Providers.MediaInfo { try { - var downloaded = await DownloadSubtitles(video, mediaStreams, skipIfEmbeddedSubtitlesPresent, skipIfAudioTrackMatches, lang, mediaType, cancellationToken) + var downloaded = await DownloadSubtitles(video, mediaStreams, skipIfEmbeddedSubtitlesPresent, skipIfAudioTrackMatches, requirePerfectMatch, lang, mediaType, cancellationToken) .ConfigureAwait(false); if (downloaded) @@ -80,6 +81,7 @@ namespace MediaBrowser.Providers.MediaInfo List<MediaStream> mediaStreams, bool skipIfEmbeddedSubtitlesPresent, bool skipIfAudioTrackMatches, + bool requirePerfectMatch, string language, VideoContentType mediaType, CancellationToken cancellationToken) @@ -125,7 +127,9 @@ namespace MediaBrowser.Providers.MediaInfo ProviderIds = video.ProviderIds, // Stop as soon as we find something - SearchAllProviders = false + SearchAllProviders = false, + + IsPerfectMatch = requirePerfectMatch }; var episode = video as Episode; diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs b/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs index 2c748d2b7..d2c0feabe 100644 --- a/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs +++ b/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs @@ -1,5 +1,4 @@ using MediaBrowser.Model.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Localization; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs index b8b17cefe..79da291b7 100644 --- a/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs +++ b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs @@ -116,6 +116,7 @@ namespace MediaBrowser.Providers.MediaInfo mediaStreams, options.SkipIfEmbeddedSubtitlesPresent, options.SkipIfAudioTrackMatches, + options.RequirePerfectMatch, options.DownloadLanguages, cancellationToken).ConfigureAwait(false); diff --git a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs index 6b035ed81..ff6eef167 100644 --- a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs @@ -10,10 +10,11 @@ using MediaBrowser.Model.Logging; using MediaBrowser.Model.MediaInfo; using System; using System.Collections.Generic; +using System.IO; +using System.Linq; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Providers.MediaInfo { @@ -94,20 +95,59 @@ namespace MediaBrowser.Providers.MediaInfo try { - // If we know the duration, grab it from 10% into the video. Otherwise just 10 seconds in. - // Always use 10 seconds for dvd because our duration could be out of whack - var imageOffset = item.VideoType != VideoType.Dvd && item.RunTimeTicks.HasValue && - item.RunTimeTicks.Value > 0 - ? TimeSpan.FromTicks(Convert.ToInt64(item.RunTimeTicks.Value * .1)) - : TimeSpan.FromSeconds(10); - var protocol = item.LocationType == LocationType.Remote ? MediaProtocol.Http : MediaProtocol.File; var inputPath = MediaEncoderHelpers.GetInputArgument(_fileSystem, item.Path, protocol, isoMount, item.PlayableStreamFileNames); - var stream = await _mediaEncoder.ExtractVideoImage(inputPath, protocol, item.Video3DFormat, imageOffset, cancellationToken).ConfigureAwait(false); + var mediaStreams = + item.GetMediaSources(false) + .Take(1) + .SelectMany(i => i.MediaStreams) + .ToList(); + + var imageStreams = + mediaStreams + .Where(i => i.Type == MediaStreamType.EmbeddedImage) + .ToList(); + + var imageStream = imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("front", StringComparison.OrdinalIgnoreCase) != -1) ?? + imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("cover", StringComparison.OrdinalIgnoreCase) != -1) ?? + imageStreams.FirstOrDefault(); + + Stream stream; + + if (imageStream != null) + { + // Instead of using the raw stream index, we need to use nth video/embedded image stream + var videoIndex = -1; + foreach (var mediaStream in mediaStreams) + { + if (mediaStream.Type == MediaStreamType.Video || + mediaStream.Type == MediaStreamType.EmbeddedImage) + { + videoIndex++; + } + if (mediaStream == imageStream) + { + break; + } + } + + stream = await _mediaEncoder.ExtractVideoImage(inputPath, protocol, videoIndex, cancellationToken).ConfigureAwait(false); + } + else + { + // If we know the duration, grab it from 10% into the video. Otherwise just 10 seconds in. + // Always use 10 seconds for dvd because our duration could be out of whack + var imageOffset = item.VideoType != VideoType.Dvd && item.RunTimeTicks.HasValue && + item.RunTimeTicks.Value > 0 + ? TimeSpan.FromTicks(Convert.ToInt64(item.RunTimeTicks.Value * .1)) + : TimeSpan.FromSeconds(10); + + stream = await _mediaEncoder.ExtractVideoImage(inputPath, protocol, item.Video3DFormat, imageOffset, cancellationToken).ConfigureAwait(false); + } return new DynamicImageResponse { @@ -152,11 +192,11 @@ namespace MediaBrowser.Providers.MediaInfo } } - public bool HasChanged(IHasMetadata item, MetadataStatus status, IDirectoryService directoryService) + public bool HasChanged(IHasMetadata item, IDirectoryService directoryService) { - if (status.ItemDateModified.HasValue) + if (item.DateModifiedDuringLastRefresh.HasValue) { - if (status.ItemDateModified.Value != item.DateModified) + if (item.DateModifiedDuringLastRefresh.Value != item.DateModified) { return true; } diff --git a/MediaBrowser.Providers/Movies/FanArtMovieUpdatesPostScanTask.cs b/MediaBrowser.Providers/Movies/FanArtMovieUpdatesPostScanTask.cs index 50b6d3c22..d207e6e7c 100644 --- a/MediaBrowser.Providers/Movies/FanArtMovieUpdatesPostScanTask.cs +++ b/MediaBrowser.Providers/Movies/FanArtMovieUpdatesPostScanTask.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Configuration; diff --git a/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs b/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs index d2e9b160d..a1dbc1967 100644 --- a/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs +++ b/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs @@ -1,6 +1,5 @@ using System.Net; using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; @@ -20,9 +19,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Controller.Channels; -using MediaBrowser.Controller.LiveTv; -using MediaBrowser.Model.Channels; using MediaBrowser.Providers.TV; namespace MediaBrowser.Providers.Movies diff --git a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs index 157704240..6c6f6f0eb 100644 --- a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs +++ b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs @@ -14,7 +14,6 @@ using System.Net; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Providers.Movies { diff --git a/MediaBrowser.Providers/Movies/MovieDbImageProvider.cs b/MediaBrowser.Providers/Movies/MovieDbImageProvider.cs index 6bfd9b7fa..e091cddc6 100644 --- a/MediaBrowser.Providers/Movies/MovieDbImageProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbImageProvider.cs @@ -1,11 +1,9 @@ using System.Globalization; using MediaBrowser.Common.Net; -using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Channels; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Providers; diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs index 58efc9534..51051e41d 100644 --- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; @@ -16,14 +15,12 @@ using System; using System.Collections.Generic; using System.Globalization; using System.IO; -using System.Linq; using System.Net; using System.Threading; using System.Threading.Tasks; using CommonIO; using MediaBrowser.Common; using MediaBrowser.Model.Net; -using MediaBrowser.Model.Extensions; namespace MediaBrowser.Providers.Movies { diff --git a/MediaBrowser.Providers/Movies/MovieDbTrailerProvider.cs b/MediaBrowser.Providers/Movies/MovieDbTrailerProvider.cs index 2b8686d5d..336968a84 100644 --- a/MediaBrowser.Providers/Movies/MovieDbTrailerProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbTrailerProvider.cs @@ -1,9 +1,6 @@ using MediaBrowser.Common.Net; -using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Channels; -using MediaBrowser.Model.Entities; using MediaBrowser.Model.Providers; using System; using System.Collections.Generic; diff --git a/MediaBrowser.Providers/Movies/MovieExternalIds.cs b/MediaBrowser.Providers/Movies/MovieExternalIds.cs index adaff5e77..02c330267 100644 --- a/MediaBrowser.Providers/Movies/MovieExternalIds.cs +++ b/MediaBrowser.Providers/Movies/MovieExternalIds.cs @@ -1,10 +1,8 @@ -using MediaBrowser.Controller.Channels; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Channels; using MediaBrowser.Model.Entities; namespace MediaBrowser.Providers.Movies diff --git a/MediaBrowser.Providers/Movies/MovieUpdatesPrescanTask.cs b/MediaBrowser.Providers/Movies/MovieUpdatesPrescanTask.cs index 278d728de..7fa7e0d15 100644 --- a/MediaBrowser.Providers/Movies/MovieUpdatesPrescanTask.cs +++ b/MediaBrowser.Providers/Movies/MovieUpdatesPrescanTask.cs @@ -1,7 +1,5 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; -using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Entities; diff --git a/MediaBrowser.Providers/Music/AlbumMetadataService.cs b/MediaBrowser.Providers/Music/AlbumMetadataService.cs index 0993e7398..8f951723e 100644 --- a/MediaBrowser.Providers/Music/AlbumMetadataService.cs +++ b/MediaBrowser.Providers/Music/AlbumMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/Music/ArtistMetadataService.cs b/MediaBrowser.Providers/Music/ArtistMetadataService.cs index 9939ab797..0c0339e12 100644 --- a/MediaBrowser.Providers/Music/ArtistMetadataService.cs +++ b/MediaBrowser.Providers/Music/ArtistMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/Music/AudioDbAlbumImageProvider.cs b/MediaBrowser.Providers/Music/AudioDbAlbumImageProvider.cs index 3de85593a..efaa730b2 100644 --- a/MediaBrowser.Providers/Music/AudioDbAlbumImageProvider.cs +++ b/MediaBrowser.Providers/Music/AudioDbAlbumImageProvider.cs @@ -7,7 +7,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs b/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs index 47c2fb8de..2f4df1ea4 100644 --- a/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs +++ b/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs @@ -1,6 +1,5 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.Audio; diff --git a/MediaBrowser.Providers/Music/AudioDbArtistImageProvider.cs b/MediaBrowser.Providers/Music/AudioDbArtistImageProvider.cs index 10a197b37..2fcc14c83 100644 --- a/MediaBrowser.Providers/Music/AudioDbArtistImageProvider.cs +++ b/MediaBrowser.Providers/Music/AudioDbArtistImageProvider.cs @@ -7,7 +7,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.Providers/Music/AudioDbArtistProvider.cs b/MediaBrowser.Providers/Music/AudioDbArtistProvider.cs index cd4f2d502..5356174e0 100644 --- a/MediaBrowser.Providers/Music/AudioDbArtistProvider.cs +++ b/MediaBrowser.Providers/Music/AudioDbArtistProvider.cs @@ -1,6 +1,5 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.Audio; diff --git a/MediaBrowser.Providers/Music/AudioMetadataService.cs b/MediaBrowser.Providers/Music/AudioMetadataService.cs index 8e872e403..161a16193 100644 --- a/MediaBrowser.Providers/Music/AudioMetadataService.cs +++ b/MediaBrowser.Providers/Music/AudioMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs b/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs index e72378d5d..444046208 100644 --- a/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs +++ b/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; @@ -13,10 +12,8 @@ using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; -using System.Text; using System.Threading; using System.Threading.Tasks; -using System.Xml; using CommonIO; using MediaBrowser.Model.Serialization; diff --git a/MediaBrowser.Providers/Music/FanArtArtistProvider.cs b/MediaBrowser.Providers/Music/FanArtArtistProvider.cs index d785593d9..b715803ea 100644 --- a/MediaBrowser.Providers/Music/FanArtArtistProvider.cs +++ b/MediaBrowser.Providers/Music/FanArtArtistProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; @@ -15,10 +14,8 @@ using System.Globalization; using System.IO; using System.Linq; using System.Net; -using System.Text; using System.Threading; using System.Threading.Tasks; -using System.Xml; using CommonIO; using MediaBrowser.Model.Net; using MediaBrowser.Model.Serialization; diff --git a/MediaBrowser.Providers/Music/FanArtUpdatesPostScanTask.cs b/MediaBrowser.Providers/Music/FanArtUpdatesPostScanTask.cs index 425799384..30507b891 100644 --- a/MediaBrowser.Providers/Music/FanArtUpdatesPostScanTask.cs +++ b/MediaBrowser.Providers/Music/FanArtUpdatesPostScanTask.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Configuration; diff --git a/MediaBrowser.Providers/Music/MusicVideoMetadataService.cs b/MediaBrowser.Providers/Music/MusicVideoMetadataService.cs index 4a1fd2f3e..b309ce906 100644 --- a/MediaBrowser.Providers/Music/MusicVideoMetadataService.cs +++ b/MediaBrowser.Providers/Music/MusicVideoMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/MusicGenres/MusicGenreImageProvider.cs b/MediaBrowser.Providers/MusicGenres/MusicGenreImageProvider.cs index f59f3f6c8..43495aaea 100644 --- a/MediaBrowser.Providers/MusicGenres/MusicGenreImageProvider.cs +++ b/MediaBrowser.Providers/MusicGenres/MusicGenreImageProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; diff --git a/MediaBrowser.Providers/MusicGenres/MusicGenreMetadataService.cs b/MediaBrowser.Providers/MusicGenres/MusicGenreMetadataService.cs index 2f1983d70..adffdfca6 100644 --- a/MediaBrowser.Providers/MusicGenres/MusicGenreMetadataService.cs +++ b/MediaBrowser.Providers/MusicGenres/MusicGenreMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/Omdb/OmdbImageProvider.cs b/MediaBrowser.Providers/Omdb/OmdbImageProvider.cs index 345ed8adb..ae563b287 100644 --- a/MediaBrowser.Providers/Omdb/OmdbImageProvider.cs +++ b/MediaBrowser.Providers/Omdb/OmdbImageProvider.cs @@ -1,16 +1,12 @@ using MediaBrowser.Common.Net; -using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Channels; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Net; using MediaBrowser.Model.Providers; using System.Collections.Generic; -using System.Net; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs b/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs index 0b092397f..894750c81 100644 --- a/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs +++ b/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs @@ -1,12 +1,10 @@ using MediaBrowser.Common.Net; -using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Channels; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Providers; @@ -62,9 +60,8 @@ namespace MediaBrowser.Providers.Omdb return GetSearchResultsInternal(searchInfo, type, true, cancellationToken); } - private async Task<IEnumerable<RemoteSearchResult>> GetSearchResultsInternal(ItemLookupInfo searchInfo, string type, bool enableMultipleResults, CancellationToken cancellationToken) + private async Task<IEnumerable<RemoteSearchResult>> GetSearchResultsInternal(ItemLookupInfo searchInfo, string type, bool isSearch, CancellationToken cancellationToken) { - bool isSearch = false; var episodeSearchInfo = searchInfo as EpisodeInfo; var list = new List<RemoteSearchResult>(); @@ -97,10 +94,9 @@ namespace MediaBrowser.Providers.Omdb } // &s means search and returns a list of results as opposed to t - if (enableMultipleResults) + if (isSearch) { url += "&s=" + WebUtility.UrlEncode(name); - isSearch = true; } else { diff --git a/MediaBrowser.Providers/People/MovieDbPersonProvider.cs b/MediaBrowser.Providers/People/MovieDbPersonProvider.cs index 43302dd89..2b37d0462 100644 --- a/MediaBrowser.Providers/People/MovieDbPersonProvider.cs +++ b/MediaBrowser.Providers/People/MovieDbPersonProvider.cs @@ -1,6 +1,5 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; @@ -10,7 +9,6 @@ using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; using MediaBrowser.Providers.Movies; using System; -using System.Collections.Concurrent; using System.Collections.Generic; using System.Globalization; using System.IO; @@ -99,7 +97,7 @@ namespace MediaBrowser.Providers.People var requestCount = _requestCount; - if (requestCount >= 20) + if (requestCount >= 30) { //_logger.Debug("Throttling Tmdb people"); diff --git a/MediaBrowser.Providers/People/PersonMetadataService.cs b/MediaBrowser.Providers/People/PersonMetadataService.cs index 88ce38950..13a370bc5 100644 --- a/MediaBrowser.Providers/People/PersonMetadataService.cs +++ b/MediaBrowser.Providers/People/PersonMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; @@ -7,8 +6,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Providers.Manager; using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; using CommonIO; namespace MediaBrowser.Providers.People diff --git a/MediaBrowser.Providers/Photos/PhotoAlbumMetadataService.cs b/MediaBrowser.Providers/Photos/PhotoAlbumMetadataService.cs index 05dcafbe7..262480885 100644 --- a/MediaBrowser.Providers/Photos/PhotoAlbumMetadataService.cs +++ b/MediaBrowser.Providers/Photos/PhotoAlbumMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/Photos/PhotoMetadataService.cs b/MediaBrowser.Providers/Photos/PhotoMetadataService.cs index f378c3175..0836c5ede 100644 --- a/MediaBrowser.Providers/Photos/PhotoMetadataService.cs +++ b/MediaBrowser.Providers/Photos/PhotoMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/Photos/PhotoProvider.cs b/MediaBrowser.Providers/Photos/PhotoProvider.cs index ef3144958..882363b2f 100644 --- a/MediaBrowser.Providers/Photos/PhotoProvider.cs +++ b/MediaBrowser.Providers/Photos/PhotoProvider.cs @@ -152,11 +152,11 @@ namespace MediaBrowser.Providers.Photos get { return "Embedded Information"; } } - public bool HasChanged(IHasMetadata item, MetadataStatus status, IDirectoryService directoryService) + public bool HasChanged(IHasMetadata item, IDirectoryService directoryService) { - if (status.ItemDateModified.HasValue) + if (item.DateModifiedDuringLastRefresh.HasValue) { - return status.ItemDateModified.Value != item.DateModified; + return item.DateModifiedDuringLastRefresh.Value != item.DateModified; } return false; diff --git a/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs b/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs index 30e15808f..89ca8da25 100644 --- a/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs +++ b/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Playlists; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/Properties/AssemblyInfo.cs b/MediaBrowser.Providers/Properties/AssemblyInfo.cs index a11011569..7676a4c5f 100644 --- a/MediaBrowser.Providers/Properties/AssemblyInfo.cs +++ b/MediaBrowser.Providers/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/MediaBrowser.Providers/Studios/StudioMetadataService.cs b/MediaBrowser.Providers/Studios/StudioMetadataService.cs index feede5dbe..eef1e8e07 100644 --- a/MediaBrowser.Providers/Studios/StudioMetadataService.cs +++ b/MediaBrowser.Providers/Studios/StudioMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; @@ -7,8 +6,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Providers.Manager; using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; using CommonIO; namespace MediaBrowser.Providers.Studios diff --git a/MediaBrowser.Providers/Studios/StudiosImageProvider.cs b/MediaBrowser.Providers/Studios/StudiosImageProvider.cs index 95b8d9bc8..62109243d 100644 --- a/MediaBrowser.Providers/Studios/StudiosImageProvider.cs +++ b/MediaBrowser.Providers/Studios/StudiosImageProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/Subtitles/OpenSubtitleDownloader.cs b/MediaBrowser.Providers/Subtitles/OpenSubtitleDownloader.cs index 90b281e8a..271f8170f 100644 --- a/MediaBrowser.Providers/Subtitles/OpenSubtitleDownloader.cs +++ b/MediaBrowser.Providers/Subtitles/OpenSubtitleDownloader.cs @@ -18,7 +18,6 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Model.Net; namespace MediaBrowser.Providers.Subtitles { @@ -309,8 +308,8 @@ namespace MediaBrowser.Providers.Subtitles // Avoid implicitly captured closure var hasCopy = hash; - return results.Where(x => x.SubBad == "0" && mediaFilter(x)) - .OrderBy(x => (x.MovieHash == hash ? 0 : 1)) + return results.Where(x => x.SubBad == "0" && mediaFilter(x) && (!request.IsPerfectMatch || string.Equals(x.MovieHash, hash, StringComparison.OrdinalIgnoreCase))) + .OrderBy(x => (string.Equals(x.MovieHash, hash, StringComparison.OrdinalIgnoreCase) ? 0 : 1)) .ThenBy(x => Math.Abs(long.Parse(x.MovieByteSize, _usCulture) - movieByteSize)) .ThenByDescending(x => int.Parse(x.SubDownloadsCnt, _usCulture)) .ThenByDescending(x => double.Parse(x.SubRating, _usCulture)) diff --git a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs index a575daacb..764cb7317 100644 --- a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs +++ b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs @@ -1,6 +1,5 @@ using MediaBrowser.Common.Events; using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.TV; @@ -15,7 +14,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; using System.Threading; using System.Threading.Tasks; using CommonIO; diff --git a/MediaBrowser.Providers/TV/DummySeasonProvider.cs b/MediaBrowser.Providers/TV/DummySeasonProvider.cs index 3a1e05704..5cf9966e8 100644 --- a/MediaBrowser.Providers/TV/DummySeasonProvider.cs +++ b/MediaBrowser.Providers/TV/DummySeasonProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.Extensions; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Localization; @@ -11,7 +10,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Providers.TV { diff --git a/MediaBrowser.Providers/TV/EpisodeMetadataService.cs b/MediaBrowser.Providers/TV/EpisodeMetadataService.cs index dde7ade74..c848fcd0e 100644 --- a/MediaBrowser.Providers/TV/EpisodeMetadataService.cs +++ b/MediaBrowser.Providers/TV/EpisodeMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/TV/FanArt/FanArtSeasonProvider.cs b/MediaBrowser.Providers/TV/FanArt/FanArtSeasonProvider.cs index 35129987d..e683907c4 100644 --- a/MediaBrowser.Providers/TV/FanArt/FanArtSeasonProvider.cs +++ b/MediaBrowser.Providers/TV/FanArt/FanArtSeasonProvider.cs @@ -1,5 +1,4 @@ using System.Net; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; diff --git a/MediaBrowser.Providers/TV/FanArt/FanArtTvUpdatesPostScanTask.cs b/MediaBrowser.Providers/TV/FanArt/FanArtTvUpdatesPostScanTask.cs index 71f02e028..049ffd7d8 100644 --- a/MediaBrowser.Providers/TV/FanArt/FanArtTvUpdatesPostScanTask.cs +++ b/MediaBrowser.Providers/TV/FanArt/FanArtTvUpdatesPostScanTask.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Configuration; diff --git a/MediaBrowser.Providers/TV/FanArt/FanartSeriesProvider.cs b/MediaBrowser.Providers/TV/FanArt/FanartSeriesProvider.cs index 5600c165a..517951cb8 100644 --- a/MediaBrowser.Providers/TV/FanArt/FanartSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/FanArt/FanartSeriesProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; diff --git a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs index 248be675d..ad55c186a 100644 --- a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.Extensions; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Localization; @@ -16,7 +15,6 @@ using System.Threading; using System.Threading.Tasks; using System.Xml; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Providers.TV { diff --git a/MediaBrowser.Providers/TV/Omdb/OmdbEpisodeProvider.cs b/MediaBrowser.Providers/TV/Omdb/OmdbEpisodeProvider.cs index 5a920c37f..785efc3b6 100644 --- a/MediaBrowser.Providers/TV/Omdb/OmdbEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/Omdb/OmdbEpisodeProvider.cs @@ -7,10 +7,8 @@ using MediaBrowser.Model.Logging; using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; using MediaBrowser.Providers.Omdb; -using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.Providers/TV/SeasonMetadataService.cs b/MediaBrowser.Providers/TV/SeasonMetadataService.cs index 22cc19f0c..1af116289 100644 --- a/MediaBrowser.Providers/TV/SeasonMetadataService.cs +++ b/MediaBrowser.Providers/TV/SeasonMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/TV/SeriesMetadataService.cs b/MediaBrowser.Providers/TV/SeriesMetadataService.cs index 453f106ae..dfa8e30f3 100644 --- a/MediaBrowser.Providers/TV/SeriesMetadataService.cs +++ b/MediaBrowser.Providers/TV/SeriesMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Localization; diff --git a/MediaBrowser.Providers/TV/SeriesPostScanTask.cs b/MediaBrowser.Providers/TV/SeriesPostScanTask.cs index 003665f1c..5428e6c92 100644 --- a/MediaBrowser.Providers/TV/SeriesPostScanTask.cs +++ b/MediaBrowser.Providers/TV/SeriesPostScanTask.cs @@ -11,7 +11,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Providers.TV { diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeasonProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeasonProvider.cs index 0033c8a2f..fe0bda828 100644 --- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeasonProvider.cs +++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeasonProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Localization; @@ -14,7 +13,6 @@ using System; using System.Collections.Generic; using System.Globalization; using System.IO; -using System.Linq; using System.Net; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs index ad2cfa12b..05b1ebc80 100644 --- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeImageProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeImageProvider.cs index 50ecc6bbf..49d41e06c 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeImageProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeImageProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.TV; @@ -10,9 +9,7 @@ using MediaBrowser.Model.Providers; using System; using System.Collections.Generic; using System.Globalization; -using System.IO; using System.Linq; -using System.Text; using System.Threading; using System.Threading.Tasks; using System.Xml; diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbPrescanTask.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbPrescanTask.cs index d362ca722..1c83d73fb 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbPrescanTask.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbPrescanTask.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs index cbbfe61ac..5e7ce9f7e 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.TV; diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesImageProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesImageProvider.cs index eae389dfb..d1cdc717e 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesImageProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesImageProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.TV; @@ -333,7 +332,7 @@ namespace MediaBrowser.Providers.TV }); } - public bool HasChanged(IHasMetadata item, MetadataStatus status, IDirectoryService directoryService) + public bool HasChanged(IHasMetadata item, IDirectoryService directoryService) { if (!TvdbSeriesProvider.Current.GetTvDbOptions().EnableAutomaticUpdates) { @@ -347,7 +346,7 @@ namespace MediaBrowser.Providers.TV var fileInfo = _fileSystem.GetFileInfo(imagesXmlPath); - return fileInfo.Exists && _fileSystem.GetLastWriteTimeUtc(fileInfo) > (status.DateLastMetadataRefresh ?? DateTime.MinValue); + return fileInfo.Exists && _fileSystem.GetLastWriteTimeUtc(fileInfo) > item.DateLastRefreshed; } return false; diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs index 593507fb2..f66e9254e 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; diff --git a/MediaBrowser.Providers/Users/UserMetadataService.cs b/MediaBrowser.Providers/Users/UserMetadataService.cs index 7c74e23f2..90a874191 100644 --- a/MediaBrowser.Providers/Users/UserMetadataService.cs +++ b/MediaBrowser.Providers/Users/UserMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; @@ -7,8 +6,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Providers.Manager; using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; using CommonIO; namespace MediaBrowser.Providers.Users diff --git a/MediaBrowser.Providers/Videos/VideoMetadataService.cs b/MediaBrowser.Providers/Videos/VideoMetadataService.cs index 561ac8323..fb2a7638e 100644 --- a/MediaBrowser.Providers/Videos/VideoMetadataService.cs +++ b/MediaBrowser.Providers/Videos/VideoMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Providers/Years/YearMetadataService.cs b/MediaBrowser.Providers/Years/YearMetadataService.cs index 131411756..3c348b2de 100644 --- a/MediaBrowser.Providers/Years/YearMetadataService.cs +++ b/MediaBrowser.Providers/Years/YearMetadataService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; @@ -7,8 +6,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Providers.Manager; using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; using CommonIO; namespace MediaBrowser.Providers.Years diff --git a/MediaBrowser.Server.Implementations/Activity/ActivityRepository.cs b/MediaBrowser.Server.Implementations/Activity/ActivityRepository.cs index 3a89d6928..85ab76182 100644 --- a/MediaBrowser.Server.Implementations/Activity/ActivityRepository.cs +++ b/MediaBrowser.Server.Implementations/Activity/ActivityRepository.cs @@ -9,7 +9,6 @@ using System.Collections.Generic; using System.Data; using System.Globalization; using System.IO; -using System.Threading; using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.Activity diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelImageProvider.cs b/MediaBrowser.Server.Implementations/Channels/ChannelImageProvider.cs index f13c71c6d..c98f71ce2 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelImageProvider.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelImageProvider.cs @@ -47,7 +47,7 @@ namespace MediaBrowser.Server.Implementations.Channels return ((ChannelManager)_channelManager).GetChannelProvider(channel); } - public bool HasChanged(IHasMetadata item, MetadataStatus status, IDirectoryService directoryService) + public bool HasChanged(IHasMetadata item, IDirectoryService directoryService) { return GetSupportedImages(item).Any(i => !item.HasImage(i)); } diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index d849ce7bd..c9956c68a 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Configuration; @@ -122,7 +121,7 @@ namespace MediaBrowser.Server.Implementations.Channels { try { - return (GetChannelProvider(i) is ISupportsLatestMedia) == val; + return GetChannelProvider(i) is ISupportsLatestMedia == val; } catch { @@ -403,7 +402,7 @@ namespace MediaBrowser.Server.Implementations.Channels var val = width.Value; var res = list - .OrderBy(i => (i.Width.HasValue && i.Width.Value <= val ? 0 : 1)) + .OrderBy(i => i.Width.HasValue && i.Width.Value <= val ? 0 : 1) .ThenBy(i => Math.Abs((i.Width ?? 0) - val)) .ThenByDescending(i => i.Width ?? 0) .ThenBy(list.IndexOf) @@ -1407,7 +1406,8 @@ namespace MediaBrowser.Server.Implementations.Channels throw new ArgumentNullException("channel"); } - var result = GetAllChannels().FirstOrDefault(i => string.Equals(GetInternalChannelId(i.Name).ToString("N"), channel.ChannelId, StringComparison.OrdinalIgnoreCase) || string.Equals(i.Name, channel.Name, StringComparison.OrdinalIgnoreCase)); + var result = GetAllChannels() + .FirstOrDefault(i => string.Equals(GetInternalChannelId(i.Name).ToString("N"), channel.ChannelId, StringComparison.OrdinalIgnoreCase) || string.Equals(i.Name, channel.Name, StringComparison.OrdinalIgnoreCase)); if (result == null) { diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelPostScanTask.cs b/MediaBrowser.Server.Implementations/Channels/ChannelPostScanTask.cs index 08783ae8d..b25c9c818 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelPostScanTask.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelPostScanTask.cs @@ -44,7 +44,7 @@ namespace MediaBrowser.Server.Implementations.Channels var startingPercent = numComplete * percentPerUser * 100; var innerProgress = new ActionableProgress<double>(); - innerProgress.RegisterAction(p => progress.Report(startingPercent + (percentPerUser * p))); + innerProgress.RegisterAction(p => progress.Report(startingPercent + percentPerUser * p)); await DownloadContent(user, cancellationToken, innerProgress).ConfigureAwait(false); @@ -97,7 +97,7 @@ namespace MediaBrowser.Server.Implementations.Channels innerProgress.RegisterAction(p => { double innerPercent = startingNumberComplete; - innerPercent += (p / 100); + innerPercent += p / 100; innerPercent /= numItems; progress.Report(innerPercent * 100); }); @@ -232,9 +232,9 @@ namespace MediaBrowser.Server.Implementations.Channels innerProgress.RegisterAction(p => { double innerPercent = startingNumberComplete; - innerPercent += (p / 100); + innerPercent += p / 100; innerPercent /= numItems; - progress.Report((innerPercent * 50) + 50); + progress.Report(innerPercent * 50 + 50); }); await GetAllItems(user, channelId, folder, currentRefreshLevel + 1, maxRefreshLevel, innerProgress, cancellationToken).ConfigureAwait(false); @@ -247,7 +247,7 @@ namespace MediaBrowser.Server.Implementations.Channels numComplete++; double percent = numComplete; percent /= numItems; - progress.Report((percent * 50) + 50); + progress.Report(percent * 50 + 50); } } diff --git a/MediaBrowser.Server.Implementations/Collections/CollectionImageProvider.cs b/MediaBrowser.Server.Implementations/Collections/CollectionImageProvider.cs index 7ed0d43b1..25393d30f 100644 --- a/MediaBrowser.Server.Implementations/Collections/CollectionImageProvider.cs +++ b/MediaBrowser.Server.Implementations/Collections/CollectionImageProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; @@ -10,7 +9,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Server.Implementations.Photos; using MoreLinq; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Threading.Tasks; using CommonIO; diff --git a/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs b/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs index 4e742ca7a..1b6c44c5e 100644 --- a/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs +++ b/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Events; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Collections; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; diff --git a/MediaBrowser.Server.Implementations/Collections/CollectionsDynamicFolder.cs b/MediaBrowser.Server.Implementations/Collections/CollectionsDynamicFolder.cs index 85b143a40..cb95bfd14 100644 --- a/MediaBrowser.Server.Implementations/Collections/CollectionsDynamicFolder.cs +++ b/MediaBrowser.Server.Implementations/Collections/CollectionsDynamicFolder.cs @@ -2,7 +2,6 @@ using MediaBrowser.Controller.Entities; using System.IO; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Server.Implementations.Collections { diff --git a/MediaBrowser.Server.Implementations/Collections/ManualCollectionsFolder.cs b/MediaBrowser.Server.Implementations/Collections/ManualCollectionsFolder.cs index 7a1d86047..561d46229 100644 --- a/MediaBrowser.Server.Implementations/Collections/ManualCollectionsFolder.cs +++ b/MediaBrowser.Server.Implementations/Collections/ManualCollectionsFolder.cs @@ -1,5 +1,4 @@ using MediaBrowser.Controller.Entities; -using System.Linq; namespace MediaBrowser.Server.Implementations.Collections { diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs index 1b951374e..ea12e332d 100644 --- a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs +++ b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs @@ -10,10 +10,8 @@ using System.IO; using System.Net; using System.Net.Sockets; using System.Text; -using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Threading; namespace MediaBrowser.Server.Implementations.Connect diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs index ac0d2c569..f3d545492 100644 --- a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs +++ b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs @@ -24,6 +24,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using CommonIO; +using MediaBrowser.Common.Extensions; namespace MediaBrowser.Server.Implementations.Connect { @@ -62,6 +63,17 @@ namespace MediaBrowser.Server.Implementations.Connect { var address = _config.Configuration.WanDdns; + if (!string.IsNullOrWhiteSpace(address)) + { + try + { + address = new Uri(address).Host; + } + catch + { + } + } + if (string.IsNullOrWhiteSpace(address) && DiscoveredWanIpAddress != null) { if (DiscoveredWanIpAddress.AddressFamily == AddressFamily.InterNetworkV6) @@ -237,8 +249,8 @@ namespace MediaBrowser.Server.Implementations.Connect var postData = new Dictionary<string, string> { - {"name", _appHost.FriendlyName}, - {"url", wanApiAddress}, + {"name", _appHost.FriendlyName}, + {"url", wanApiAddress}, {"systemId", _appHost.SystemId} }; @@ -544,9 +556,22 @@ namespace MediaBrowser.Server.Implementations.Connect } catch (HttpException ex) { - if (!ex.StatusCode.HasValue || - ex.StatusCode.Value != HttpStatusCode.NotFound || - !Validator.EmailIsValid(connectUsername)) + if (!ex.StatusCode.HasValue) + { + throw; + } + + // If they entered a username, then whatever the error is just throw it, for example, user not found + if (!Validator.EmailIsValid(connectUsername)) + { + if (ex.StatusCode.Value == HttpStatusCode.NotFound) + { + throw new ResourceNotFoundException(); + } + throw; + } + + if (ex.StatusCode.Value != HttpStatusCode.NotFound) { throw; } @@ -891,8 +916,7 @@ namespace MediaBrowser.Server.Implementations.Connect private async Task RefreshGuestNames(List<ServerUserAuthorizationResponse> list, bool refreshImages) { var users = _userManager.Users - .Where(i => !string.IsNullOrEmpty(i.ConnectUserId) && - (i.ConnectLinkType.HasValue && i.ConnectLinkType.Value == UserLinkType.Guest)) + .Where(i => !string.IsNullOrEmpty(i.ConnectUserId) && i.ConnectLinkType.HasValue && i.ConnectLinkType.Value == UserLinkType.Guest) .ToList(); foreach (var user in users) diff --git a/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs b/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs index 9e4a45253..368d21322 100644 --- a/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs +++ b/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs @@ -1,13 +1,11 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Devices; using MediaBrowser.Model.Devices; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Session; using System; -using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index 61465e1d7..50ae19580 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Devices; @@ -1150,10 +1149,10 @@ namespace MediaBrowser.Server.Implementations.Dto if (fields.Contains(ItemFields.ParentId)) { - var displayParent = item.DisplayParent; - if (displayParent != null) + var displayParentId = item.DisplayParentId; + if (displayParentId.HasValue) { - dto.ParentId = GetDtoId(displayParent); + dto.ParentId = displayParentId.Value.ToString("N"); } } diff --git a/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs b/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs index dfaedbc9d..46ddf3dd8 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs @@ -5,11 +5,9 @@ using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Common.Updates; using MediaBrowser.Controller; using MediaBrowser.Controller.Activity; -using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.Localization; using MediaBrowser.Controller.Plugins; using MediaBrowser.Controller.Session; @@ -206,7 +204,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints Name = name, Type = "SessionEnded", ShortOverview = string.Format(_localization.GetLocalizedString("LabelIpAddressValue"), session.RemoteEndPoint), - UserId = (session.UserId.HasValue ? session.UserId.Value.ToString("N") : null) + UserId = session.UserId.HasValue ? session.UserId.Value.ToString("N") : null }); } @@ -336,7 +334,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints Name = name, Type = "SessionStarted", ShortOverview = string.Format(_localization.GetLocalizedString("LabelIpAddressValue"), session.RemoteEndPoint), - UserId = (session.UserId.HasValue ? session.UserId.Value.ToString("N") : null) + UserId = session.UserId.HasValue ? session.UserId.Value.ToString("N") : null }); } @@ -518,16 +516,16 @@ namespace MediaBrowser.Server.Implementations.EntryPoints int days = span.Days; if (days >= DaysInYear) { - int years = (days / DaysInYear); + int years = days / DaysInYear; values.Add(CreateValueString(years, "year")); - days = (days % DaysInYear); + days = days % DaysInYear; } // Number of months if (days >= DaysInMonth) { - int months = (days / DaysInMonth); + int months = days / DaysInMonth; values.Add(CreateValueString(months, "month")); - days = (days % DaysInMonth); + days = days % DaysInMonth; } // Number of days if (days >= 1) @@ -547,7 +545,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints for (int i = 0; i < values.Count; i++) { if (builder.Length > 0) - builder.Append((i == (values.Count - 1)) ? " and " : ", "); + builder.Append(i == values.Count - 1 ? " and " : ", "); builder.Append(values[i]); } // Return result @@ -562,7 +560,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints private static string CreateValueString(int value, string description) { return String.Format("{0:#,##0} {1}", - value, (value == 1) ? description : String.Format("{0}s", description)); + value, value == 1 ? description : String.Format("{0}s", description)); } } } diff --git a/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs index 2b2c338dd..5777a0af7 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs @@ -10,7 +10,6 @@ using System.Globalization; using System.IO; using System.Net; using System.Text; -using System.Threading; using MediaBrowser.Common.Threading; namespace MediaBrowser.Server.Implementations.EntryPoints @@ -51,8 +50,6 @@ namespace MediaBrowser.Server.Implementations.EntryPoints void _config_ConfigurationUpdated(object sender, EventArgs e) { - _config.ConfigurationUpdated -= _config_ConfigurationUpdated; - if (!string.Equals(_lastConfigIdentifier, GetConfigIdentifier(), StringComparison.OrdinalIgnoreCase)) { if (_isStarted) @@ -227,30 +224,5 @@ namespace MediaBrowser.Server.Implementations.EntryPoints _isStarted = false; } } - - private class LogWriter : TextWriter - { - private readonly ILogger _logger; - - public LogWriter(ILogger logger) - { - _logger = logger; - } - - public override Encoding Encoding - { - get { return Encoding.UTF8; } - } - - public override void WriteLine(string format, params object[] arg) - { - _logger.Debug(format, arg); - } - - public override void WriteLine(string value) - { - _logger.Debug(value); - } - } } -} +}
\ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs index 237c7157b..afc4e9702 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Controller.Channels; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Plugins; using MediaBrowser.Controller.Session; @@ -11,7 +10,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using MediaBrowser.Controller.Entities.Audio; -using MediaBrowser.Controller.LiveTv; namespace MediaBrowser.Server.Implementations.EntryPoints { diff --git a/MediaBrowser.Server.Implementations/EntryPoints/LoadRegistrations.cs b/MediaBrowser.Server.Implementations/EntryPoints/LoadRegistrations.cs index efda36821..f41d81137 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/LoadRegistrations.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/LoadRegistrations.cs @@ -2,7 +2,6 @@ using MediaBrowser.Controller.Plugins; using MediaBrowser.Model.Logging; using System; -using System.Threading; using System.Threading.Tasks; using MediaBrowser.Common.Threading; diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs index ca430eda9..71019e0ad 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs @@ -22,8 +22,7 @@ using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Controller.Channels; -using MediaBrowser.Controller.LiveTv; +using MediaBrowser.Controller.Entities.TV; namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications { @@ -337,12 +336,17 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications private bool FilterItem(BaseItem item) { - if (!item.IsFolder && item.LocationType == LocationType.Virtual) + if (item.IsFolder) { return false; } - if (item is IItemByName && !(item is MusicArtist)) + if (item.LocationType == LocationType.Virtual) + { + return false; + } + + if (item is IItemByName) { return false; } @@ -390,6 +394,18 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications public static string GetItemName(BaseItem item) { var name = item.Name; + var episode = item as Episode; + if (episode != null) + { + if (episode.IndexNumber.HasValue) + { + name = string.Format("Ep{0} - {1}", episode.IndexNumber.Value.ToString(CultureInfo.InvariantCulture), name); + } + if (episode.ParentIndexNumber.HasValue) + { + name = string.Format("S{0}, {1}", episode.ParentIndexNumber.Value.ToString(CultureInfo.InvariantCulture), name); + } + } var hasSeries = item as IHasSeries; diff --git a/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs b/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs index cbec91679..7b3a7a30d 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs @@ -8,7 +8,6 @@ using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Controller.Configuration; using MediaBrowser.Model.Logging; namespace MediaBrowser.Server.Implementations.EntryPoints @@ -19,7 +18,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints private readonly IHttpClient _httpClient; private readonly IUserManager _userManager; private readonly ILogger _logger; - private const string MbAdminUrl = "http://www.mb3admin.com/admin/"; + private const string MbAdminUrl = "https://www.mb3admin.com/admin/"; public UsageReporter(IApplicationHost applicationHost, IHttpClient httpClient, IUserManager userManager, ILogger logger) { diff --git a/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs b/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs index 349e31907..e45df3f4a 100644 --- a/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs +++ b/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.FileOrganization; using MediaBrowser.Controller.Library; diff --git a/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs b/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs index cf1387b0e..0e8a60612 100644 --- a/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs +++ b/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.FileOrganization; @@ -10,7 +9,6 @@ using MediaBrowser.Model.FileOrganization; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Querying; using System; -using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.Server.Implementations/FileOrganization/OrganizerScheduledTask.cs b/MediaBrowser.Server.Implementations/FileOrganization/OrganizerScheduledTask.cs index ace3b5af7..de98b83ef 100644 --- a/MediaBrowser.Server.Implementations/FileOrganization/OrganizerScheduledTask.cs +++ b/MediaBrowser.Server.Implementations/FileOrganization/OrganizerScheduledTask.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.ScheduledTasks; +using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.FileOrganization; using MediaBrowser.Controller.Library; diff --git a/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs b/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs index 43bd2f29c..4f42d8a20 100644 --- a/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs +++ b/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.FileOrganization; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; @@ -91,7 +90,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization double percent = numComplete; percent /= eligibleFiles.Count; - progress.Report(10 + (89 * percent)); + progress.Report(10 + 89 * percent); } } diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs index 4252d7aa8..6cedaa6a9 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Net; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Serialization; diff --git a/MediaBrowser.Server.Implementations/HttpServer/LoggerUtils.cs b/MediaBrowser.Server.Implementations/HttpServer/LoggerUtils.cs index 0b8caaa6e..ce8100025 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/LoggerUtils.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/LoggerUtils.cs @@ -1,7 +1,6 @@ using MediaBrowser.Model.Logging; using System; using System.Globalization; -using System.IO; using SocketHttpListener.Net; namespace MediaBrowser.Server.Implementations.HttpServer @@ -17,12 +16,12 @@ namespace MediaBrowser.Server.Implementations.HttpServer { var url = request.Url.ToString(); - logger.Info("{0} {1}. UserAgent: {2}", (request.IsWebSocketRequest ? "WS" : "HTTP " + request.HttpMethod), url, request.UserAgent ?? string.Empty); + logger.Info("{0} {1}. UserAgent: {2}", request.IsWebSocketRequest ? "WS" : "HTTP " + request.HttpMethod, url, request.UserAgent ?? string.Empty); } public static void LogRequest(ILogger logger, string url, string method, string userAgent) { - logger.Info("{0} {1}. UserAgent: {2}", ("HTTP " + method), url, userAgent ?? string.Empty); + logger.Info("{0} {1}. UserAgent: {2}", "HTTP " + method, url, userAgent ?? string.Empty); } /// <summary> diff --git a/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs b/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs index 9106fa059..020856886 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs @@ -5,8 +5,6 @@ using System.Collections.Generic; using System.Globalization; using System.IO; using System.Net; -using System.Threading; -using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.HttpServer { diff --git a/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/RequestMono.cs b/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/RequestMono.cs index 2c8413f5e..ed9e17b6b 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/RequestMono.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/RequestMono.cs @@ -26,7 +26,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp int end = header.IndexOf(ending, ap + 1); if (end == -1) - return (ending == '"') ? null : header.Substring(ap); + return ending == '"' ? null : header.Substring(ap); return header.Substring(ap + 1, end - ap - 1); } @@ -529,7 +529,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp { get { - return (content_type); + return content_type; } } @@ -545,7 +545,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp { get { - return (name); + return name; } } @@ -553,7 +553,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp { get { - return (stream); + return stream; } } } @@ -582,7 +582,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp if (l2 > l1) return false; - return (0 == String.Compare(str1, 0, str2, 0, l2, ignore_case, Helpers.InvariantCulture)); + return 0 == String.Compare(str1, 0, str2, 0, l2, ignore_case, Helpers.InvariantCulture); } public static bool EndsWith(string str1, string str2) @@ -600,7 +600,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp if (l2 > l1) return false; - return (0 == String.Compare(str1, l1 - l2, str2, 0, l2, ignore_case, Helpers.InvariantCulture)); + return 0 == String.Compare(str1, l1 - l2, str2, 0, l2, ignore_case, Helpers.InvariantCulture); } } @@ -676,7 +676,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp { break; } - got_cr = (b == CR); + got_cr = b == CR; sb.Append((char)b); } @@ -781,7 +781,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp } else if (state == 0) { - got_cr = (c == CR); + got_cr = c == CR; c = data.ReadByte(); } else if (state == 1 && c == '-') diff --git a/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs b/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs index a8b3bc10b..d363c4de6 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs @@ -2,7 +2,6 @@ using MediaBrowser.Controller.Net; using MediaBrowser.Model.Logging; using System; -using System.IO; using System.Threading; using System.Threading.Tasks; using WebSocketState = MediaBrowser.Model.Net.WebSocketState; diff --git a/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs b/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs index a029e0955..bcc081eb1 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs @@ -7,9 +7,7 @@ using ServiceStack.Web; using SocketHttpListener.Net; using System; using System.Collections.Generic; -using System.IO; using System.Linq; -using System.Text; using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp diff --git a/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpRequest.cs b/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpRequest.cs index 5df37118d..30849d441 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpRequest.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpRequest.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.IO; using System.Text; -using System.Web; using Funq; using MediaBrowser.Model.Logging; using ServiceStack; @@ -137,7 +136,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp return remoteIp ?? (remoteIp = XForwardedFor ?? (NormalizeIp(XRealIp) ?? - ((request.RemoteEndPoint != null) ? NormalizeIp(request.RemoteEndPoint.Address.ToString()) : null))); + (request.RemoteEndPoint != null ? NormalizeIp(request.RemoteEndPoint.Address.ToString()) : null))); } } diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs index 0559e08ea..13a06afc2 100644 --- a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs +++ b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.ScheduledTasks; +using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; @@ -252,7 +251,7 @@ namespace MediaBrowser.Server.Implementations.IO /// <exception cref="System.ArgumentNullException">path</exception> private static bool ContainsParentFolder(IEnumerable<string> lst, string path) { - if (string.IsNullOrEmpty(path)) + if (string.IsNullOrWhiteSpace(path)) { throw new ArgumentNullException("path"); } @@ -264,7 +263,7 @@ namespace MediaBrowser.Server.Implementations.IO //this should be a little quicker than examining each actual parent folder... var compare = str.TrimEnd(Path.DirectorySeparatorChar); - return (path.Equals(compare, StringComparison.OrdinalIgnoreCase) || (path.StartsWith(compare, StringComparison.OrdinalIgnoreCase) && path[compare.Length] == Path.DirectorySeparatorChar)); + return path.Equals(compare, StringComparison.OrdinalIgnoreCase) || (path.StartsWith(compare, StringComparison.OrdinalIgnoreCase) && path[compare.Length] == Path.DirectorySeparatorChar); }); } diff --git a/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs b/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs index 2755a476c..9ebae5d91 100644 --- a/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs +++ b/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs @@ -1,22 +1,18 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Security; -using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Localization; -using MediaBrowser.Model.Channels; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; using MoreLinq; namespace MediaBrowser.Server.Implementations.Intros @@ -106,10 +102,15 @@ namespace MediaBrowser.Server.Implementations.Intros if (trailerTypes.Count > 0) { + var excludeTrailerTypes = Enum.GetNames(typeof(TrailerType)) + .Select(i => (TrailerType)Enum.Parse(typeof(TrailerType), i, true)) + .Except(trailerTypes) + .ToArray(); + var trailerResult = _libraryManager.GetItemList(new InternalItemsQuery { IncludeItemTypes = new[] { typeof(Trailer).Name }, - TrailerTypes = trailerTypes.ToArray() + ExcludeTrailerTypes = excludeTrailerTypes }); candidates.AddRange(trailerResult.Select(i => new ItemWithTrailer @@ -156,7 +157,7 @@ namespace MediaBrowser.Server.Implementations.Intros }) .OrderByDescending(i => i.Score) .ThenBy(i => Guid.NewGuid()) - .ThenByDescending(i => (i.IsPlayed ? 0 : 1)) + .ThenByDescending(i => i.IsPlayed ? 0 : 1) .Select(i => i.IntroInfo) .Take(trailerLimit) .Concat(customIntros.Take(1)) diff --git a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs index 402fa439d..ba7e33890 100644 --- a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs +++ b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs @@ -1,5 +1,4 @@ using MediaBrowser.Model.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Resolvers; diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index 0e61f2969..ccba293a3 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -1,16 +1,13 @@ using Interfaces.IO; using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Progress; using MediaBrowser.Common.ScheduledTasks; -using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.IO; using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Resolvers; @@ -27,7 +24,6 @@ using MediaBrowser.Server.Implementations.Library.Validators; using MediaBrowser.Server.Implementations.Logging; using MediaBrowser.Server.Implementations.ScheduledTasks; using System; -using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Globalization; @@ -1183,7 +1179,7 @@ namespace MediaBrowser.Server.Implementations.Library innerProgress.RegisterAction(pct => { - double innerPercent = (currentNumComplete * 100) + pct; + double innerPercent = currentNumComplete * 100 + pct; innerPercent /= numTasks; progress.Report(innerPercent); }); @@ -1395,7 +1391,7 @@ namespace MediaBrowser.Server.Implementations.Library { if (parents.All(i => { - if ((i is ICollectionFolder) || (i is UserView)) + if (i is ICollectionFolder || i is UserView) { return true; } @@ -1498,7 +1494,7 @@ namespace MediaBrowser.Server.Implementations.Library public async Task<IEnumerable<Video>> GetIntros(BaseItem item, User user) { var tasks = IntroProviders - .OrderBy(i => (i.GetType().Name.IndexOf("Default", StringComparison.OrdinalIgnoreCase) == -1 ? 0 : 1)) + .OrderBy(i => i.GetType().Name.IndexOf("Default", StringComparison.OrdinalIgnoreCase) == -1 ? 0 : 1) .Take(1) .Select(i => GetIntros(i, item, user)); @@ -1926,7 +1922,7 @@ namespace MediaBrowser.Server.Implementations.Library if (!refresh) { - refresh = (DateTime.UtcNow - item.DateLastRefreshed) >= _viewRefreshInterval; + refresh = DateTime.UtcNow - item.DateLastRefreshed >= _viewRefreshInterval; } if (!refresh && item.DisplayParentId != Guid.Empty) @@ -1991,7 +1987,7 @@ namespace MediaBrowser.Server.Implementations.Library isNew = true; } - var refresh = isNew || (DateTime.UtcNow - item.DateLastRefreshed) >= _viewRefreshInterval; + var refresh = isNew || DateTime.UtcNow - item.DateLastRefreshed >= _viewRefreshInterval; if (!refresh && item.DisplayParentId != Guid.Empty) { @@ -2055,7 +2051,7 @@ namespace MediaBrowser.Server.Implementations.Library isNew = true; } - var refresh = isNew || (DateTime.UtcNow - item.DateLastRefreshed) >= _viewRefreshInterval; + var refresh = isNew || DateTime.UtcNow - item.DateLastRefreshed >= _viewRefreshInterval; if (!refresh && item.DisplayParentId != Guid.Empty) { @@ -2131,7 +2127,7 @@ namespace MediaBrowser.Server.Implementations.Library await item.UpdateToRepository(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false); } - var refresh = isNew || (DateTime.UtcNow - item.DateLastRefreshed) >= _viewRefreshInterval; + var refresh = isNew || DateTime.UtcNow - item.DateLastRefreshed >= _viewRefreshInterval; if (!refresh && item.DisplayParentId != Guid.Empty) { @@ -2336,7 +2332,7 @@ namespace MediaBrowser.Server.Implementations.Library var videos = videoListResolver.Resolve(fileSystemChildren.Select(i => new FileMetadata { Id = i.FullName, - IsFolder = ((i.Attributes & FileAttributes.Directory) == FileAttributes.Directory) + IsFolder = (i.Attributes & FileAttributes.Directory) == FileAttributes.Directory }).ToList()); @@ -2365,6 +2361,7 @@ namespace MediaBrowser.Server.Implementations.Library } video.ExtraType = ExtraType.Trailer; + video.TrailerTypes = new List<TrailerType> { TrailerType.LocalTrailer }; return video; @@ -2384,7 +2381,7 @@ namespace MediaBrowser.Server.Implementations.Library var videos = videoListResolver.Resolve(fileSystemChildren.Select(i => new FileMetadata { Id = i.FullName, - IsFolder = ((i.Attributes & FileAttributes.Directory) == FileAttributes.Directory) + IsFolder = (i.Attributes & FileAttributes.Directory) == FileAttributes.Directory }).ToList()); diff --git a/MediaBrowser.Server.Implementations/Library/LocalTrailerPostScanTask.cs b/MediaBrowser.Server.Implementations/Library/LocalTrailerPostScanTask.cs index 4e23b5e93..96d570ef9 100644 --- a/MediaBrowser.Server.Implementations/Library/LocalTrailerPostScanTask.cs +++ b/MediaBrowser.Server.Implementations/Library/LocalTrailerPostScanTask.cs @@ -1,10 +1,8 @@ using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; -using MediaBrowser.Model.Channels; using MediaBrowser.Model.Entities; using System; -using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs b/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs index dfc6fc125..95f5cb0e1 100644 --- a/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs +++ b/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs @@ -11,12 +11,10 @@ using MediaBrowser.Model.Serialization; using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; using MediaBrowser.Model.Configuration; namespace MediaBrowser.Server.Implementations.Library @@ -536,7 +534,7 @@ namespace MediaBrowser.Server.Implementations.Library { var infos = _openStreams .Values - .Where(i => i.EnableCloseTimer && (DateTime.UtcNow - i.Date) > _openStreamMaxAge) + .Where(i => i.EnableCloseTimer && DateTime.UtcNow - i.Date > _openStreamMaxAge) .ToList(); foreach (var info in infos) diff --git a/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs b/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs index 83fdd3da2..60e7e2df3 100644 --- a/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs +++ b/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using System; diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs index 26e767c20..9f8293cb5 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Entities.Audio; +using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Resolvers; diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs index 97a31990e..e3c991e7e 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs @@ -1,7 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Entities.Audio; -using MediaBrowser.Controller.Entities.Movies; -using MediaBrowser.Controller.Entities.TV; +using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Resolvers; using MediaBrowser.Model.Entities; diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs index c73470b51..37d1e163f 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs @@ -14,7 +14,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies { diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs index cde44122e..144f788a7 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller; +using MediaBrowser.Controller; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Resolvers; diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs index 19bd4a1a3..45ba2ddbb 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Entities.TV; +using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Resolvers; diff --git a/MediaBrowser.Server.Implementations/Library/SearchEngine.cs b/MediaBrowser.Server.Implementations/Library/SearchEngine.cs index 276fc329f..61a5d98a3 100644 --- a/MediaBrowser.Server.Implementations/Library/SearchEngine.cs +++ b/MediaBrowser.Server.Implementations/Library/SearchEngine.cs @@ -92,7 +92,7 @@ namespace MediaBrowser.Server.Implementations.Library throw new ArgumentNullException("searchTerm"); } - searchTerm = searchTerm.RemoveDiacritics(); + searchTerm = searchTerm.Trim().RemoveDiacritics(); var terms = GetWords(searchTerm); diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.cs index bf09a8205..5ba83d6c7 100644 --- a/MediaBrowser.Server.Implementations/Library/UserManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs @@ -1,6 +1,4 @@ using MediaBrowser.Common.Events; -using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller; using MediaBrowser.Controller.Configuration; @@ -18,7 +16,6 @@ using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Events; using MediaBrowser.Model.Logging; -using MediaBrowser.Model.Querying; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Users; using System; @@ -263,7 +260,7 @@ namespace MediaBrowser.Server.Implementations.Library await UpdateInvalidLoginAttemptCount(user, user.Policy.InvalidLoginAttemptCount + 1).ConfigureAwait(false); } - _logger.Info("Authentication request for {0} {1}.", user.Name, (success ? "has succeeded" : "has been denied")); + _logger.Info("Authentication request for {0} {1}.", user.Name, success ? "has succeeded" : "has been denied"); return success; } diff --git a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs index de9bec2d7..1bba20ec5 100644 --- a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs @@ -1,16 +1,13 @@ using MediaBrowser.Controller.Channels; -using MediaBrowser.Controller.Collections; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.Localization; -using MediaBrowser.Controller.Playlists; using MediaBrowser.Model.Channels; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Library; using MediaBrowser.Model.Querying; -using MoreLinq; using System; using System.Collections.Generic; using System.Linq; @@ -124,7 +121,7 @@ namespace MediaBrowser.Server.Implementations.Library var channels = channelResult.Items; - if (!user.Configuration.DisplayChannelsInline && channels.Length > 0) + if (user.Configuration.EnableChannelView && channels.Length > 0) { list.Add(await _channelManager.GetInternalChannelFolder(cancellationToken).ConfigureAwait(false)); } diff --git a/MediaBrowser.Server.Implementations/Library/Validators/ArtistsValidator.cs b/MediaBrowser.Server.Implementations/Library/Validators/ArtistsValidator.cs index 68d351b44..2b68f98ca 100644 --- a/MediaBrowser.Server.Implementations/Library/Validators/ArtistsValidator.cs +++ b/MediaBrowser.Server.Implementations/Library/Validators/ArtistsValidator.cs @@ -44,7 +44,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators public async Task Run(IProgress<double> progress, CancellationToken cancellationToken) { var allSongs = _libraryManager.RootFolder - .GetRecursiveChildren(i => !i.IsFolder && (i is IHasArtist)) + .GetRecursiveChildren(i => !i.IsFolder && i is IHasArtist) .Cast<IHasArtist>() .ToList(); diff --git a/MediaBrowser.Server.Implementations/Library/Validators/GameGenresValidator.cs b/MediaBrowser.Server.Implementations/Library/Validators/GameGenresValidator.cs index b57e128d3..826154fac 100644 --- a/MediaBrowser.Server.Implementations/Library/Validators/GameGenresValidator.cs +++ b/MediaBrowser.Server.Implementations/Library/Validators/GameGenresValidator.cs @@ -35,7 +35,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators /// <returns>Task.</returns> public async Task Run(IProgress<double> progress, CancellationToken cancellationToken) { - var items = _libraryManager.RootFolder.GetRecursiveChildren(i => (i is Game)) + var items = _libraryManager.RootFolder.GetRecursiveChildren(i => i is Game) .SelectMany(i => i.Genres) .DistinctNames() .ToList(); diff --git a/MediaBrowser.Server.Implementations/Library/Validators/MusicGenresValidator.cs b/MediaBrowser.Server.Implementations/Library/Validators/MusicGenresValidator.cs index 0a66b4b41..0c8c56f5a 100644 --- a/MediaBrowser.Server.Implementations/Library/Validators/MusicGenresValidator.cs +++ b/MediaBrowser.Server.Implementations/Library/Validators/MusicGenresValidator.cs @@ -36,7 +36,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators /// <returns>Task.</returns> public async Task Run(IProgress<double> progress, CancellationToken cancellationToken) { - var items = _libraryManager.RootFolder.GetRecursiveChildren(i => (i is IHasMusicGenres)) + var items = _libraryManager.RootFolder.GetRecursiveChildren(i => i is IHasMusicGenres) .SelectMany(i => i.Genres) .DistinctNames() .ToList(); diff --git a/MediaBrowser.Server.Implementations/Library/Validators/PeopleValidator.cs b/MediaBrowser.Server.Implementations/Library/Validators/PeopleValidator.cs index 884e1e322..5c43f2e13 100644 --- a/MediaBrowser.Server.Implementations/Library/Validators/PeopleValidator.cs +++ b/MediaBrowser.Server.Implementations/Library/Validators/PeopleValidator.cs @@ -12,7 +12,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Server.Implementations.Library.Validators { diff --git a/MediaBrowser.Server.Implementations/LiveTv/ChannelImageProvider.cs b/MediaBrowser.Server.Implementations/LiveTv/ChannelImageProvider.cs index 24d38a63e..dccc7aa93 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/ChannelImageProvider.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/ChannelImageProvider.cs @@ -77,7 +77,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv get { return 0; } } - public bool HasChanged(IHasMetadata item, MetadataStatus status, IDirectoryService directoryService) + public bool HasChanged(IHasMetadata item, IDirectoryService directoryService) { return GetSupportedImages(item).Any(i => !item.HasImage(i)); } diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 75186c1e1..60ff23b04 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -1,6 +1,5 @@ using MediaBrowser.Common; using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Common.Security; using MediaBrowser.Controller.Configuration; @@ -10,7 +9,6 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Events; diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs index 69cc8ebf7..442f151dd 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs @@ -175,9 +175,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV //process.Kill(); _process.StandardInput.WriteLine("q"); - - // Need to wait because killing is asynchronous - _process.WaitForExit(5000); } catch (Exception ex) { diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs index 6d88c7c0a..40e532c4e 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs @@ -3,7 +3,6 @@ using MediaBrowser.Model.Logging; using MediaBrowser.Model.Serialization; using System; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV { diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs index 70638a8bd..ae2a85090 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs @@ -302,7 +302,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings } if (string.IsNullOrWhiteSpace(channelNumber)) { - channelNumber = (map.atscMajor + "." + map.atscMinor); + channelNumber = map.atscMajor + "." + map.atscMinor; } channelNumber = channelNumber.TrimStart('0'); @@ -343,7 +343,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings DateTime endAt = startAt.AddSeconds(programInfo.duration); ProgramAudio audioType = ProgramAudio.Stereo; - bool repeat = (programInfo.@new == null); + bool repeat = programInfo.@new == null; string newID = programInfo.programID + "T" + startAt.Ticks + "C" + channel; if (programInfo.audioProperties != null) @@ -633,7 +633,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings if (long.TryParse(savedToken.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out ticks)) { // If it's under 24 hours old we can still use it - if ((DateTime.UtcNow.Ticks - ticks) < TimeSpan.FromHours(20).Ticks) + if (DateTime.UtcNow.Ticks - ticks < TimeSpan.FromHours(20).Ticks) { return savedToken.Name; } diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs index 7fe486de7..683377c61 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs @@ -8,10 +8,8 @@ using MediaBrowser.Controller.LiveTv; using MediaBrowser.Model.Entities; using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.Logging; -using MediaBrowser.Model.Querying; using System; using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 526de62c8..d40f2a141 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -1,7 +1,6 @@ using MediaBrowser.Common; using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Progress; using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Controller.Configuration; @@ -14,7 +13,6 @@ using MediaBrowser.Controller.Localization; using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Sorting; -using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.LiveTv; @@ -514,6 +512,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv { // We can't trust that we'll be able to direct stream it through emby server, no matter what the provider says mediaSource.SupportsDirectStream = true; + mediaSource.SupportsTranscoding = true; } } @@ -1001,7 +1000,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv var channelUserdata = _userDataManager.GetUserData(userId, channel.GetUserDataKey()); - if ((channelUserdata.Likes ?? false)) + if (channelUserdata.Likes ?? false) { score += 2; } @@ -1032,7 +1031,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv { var genreUserdata = _userDataManager.GetUserData(userId, genre.GetUserDataKey()); - if ((genreUserdata.Likes ?? false)) + if (genreUserdata.Likes ?? false) { score++; } @@ -1311,7 +1310,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv const int maxPrograms = 24000; - var days = Math.Round(((double)maxPrograms) / programsPerDay); + var days = Math.Round((double)maxPrograms / programsPerDay); return Math.Max(3, Math.Min(days, MaxGuideDays)); } @@ -1415,13 +1414,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv if (query.IsInProgress.HasValue) { var val = query.IsInProgress.Value; - recordings = recordings.Where(i => (i.Status == RecordingStatus.InProgress) == val); + recordings = recordings.Where(i => i.Status == RecordingStatus.InProgress == val); } if (query.Status.HasValue) { var val = query.Status.Value; - recordings = recordings.Where(i => (i.Status == val)); + recordings = recordings.Where(i => i.Status == val); } if (!string.IsNullOrEmpty(query.SeriesTimerId)) @@ -2451,7 +2450,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv public List<NameValuePair> GetSatIniMappings() { - var names = GetType().Assembly.GetManifestResourceNames().Where(i => i.IndexOf("SatIp.ini.satellite", StringComparison.OrdinalIgnoreCase) != -1).ToList(); + var names = GetType().Assembly.GetManifestResourceNames().Where(i => i.IndexOf("SatIp.ini", StringComparison.OrdinalIgnoreCase) != -1).ToList(); return names.Select(GetSatIniMappings).Where(i => i != null).DistinctBy(i => i.Value.Split('|')[0]).ToList(); } @@ -2473,13 +2472,21 @@ namespace MediaBrowser.Server.Implementations.LiveTv return null; } + var srch = "SatIp.ini."; + var filename = Path.GetFileName(resource); + return new NameValuePair { Name = satType1 + " " + satType2, - Value = satType2 + "|" + Path.GetFileName(resource) + Value = satType2 + "|" + filename.Substring(filename.IndexOf(srch) + srch.Length) }; } } } + + public Task<List<ChannelInfo>> GetSatChannelScanResult(TunerHostInfo info, CancellationToken cancellationToken) + { + return new TunerHosts.SatIp.ChannelScan(_logger).Scan(info, cancellationToken); + } } }
\ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/LiveTv/ProgramImageProvider.cs b/MediaBrowser.Server.Implementations/LiveTv/ProgramImageProvider.cs index ab8ec720b..3f0538bd0 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/ProgramImageProvider.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/ProgramImageProvider.cs @@ -74,7 +74,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv } } - public bool HasChanged(IHasMetadata item, MetadataStatus status, IDirectoryService directoryService) + public bool HasChanged(IHasMetadata item, IDirectoryService directoryService) { var liveTvItem = item as LiveTvProgram; diff --git a/MediaBrowser.Server.Implementations/LiveTv/RecordingImageProvider.cs b/MediaBrowser.Server.Implementations/LiveTv/RecordingImageProvider.cs index fce3223ea..25678c29d 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/RecordingImageProvider.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/RecordingImageProvider.cs @@ -68,7 +68,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv get { return 0; } } - public bool HasChanged(IHasMetadata item, MetadataStatus status, IDirectoryService directoryService) + public bool HasChanged(IHasMetadata item, IDirectoryService directoryService) { var liveTvItem = item as ILiveTvRecording; diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs index fb27631e5..02a8d6938 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs @@ -43,7 +43,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts if (enableCache && !string.IsNullOrWhiteSpace(key) && _channelCache.TryGetValue(key, out cache)) { - if ((DateTime.UtcNow - cache.Date) < TimeSpan.FromMinutes(60)) + if (DateTime.UtcNow - cache.Date < TimeSpan.FromMinutes(60)) { return cache.Channels.ToList(); } diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs index 1995fc311..4c140602d 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs @@ -17,7 +17,6 @@ using System.Threading.Tasks; using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Dlna; namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun { @@ -60,7 +59,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun return id; } - protected override async Task<IEnumerable<ChannelInfo>> GetChannelsInternal(TunerHostInfo info, CancellationToken cancellationToken) + private async Task<IEnumerable<Channels>> GetLineup(TunerHostInfo info, CancellationToken cancellationToken) { var options = new HttpRequestOptions { @@ -69,29 +68,32 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun }; using (var stream = await _httpClient.Get(options)) { - var root = JsonSerializer.DeserializeFromStream<List<Channels>>(stream); + var lineup = JsonSerializer.DeserializeFromStream<List<Channels>>(stream) ?? new List<Channels>(); - if (root != null) + if (info.ImportFavoritesOnly) { - var result = root.Select(i => new ChannelInfo - { - Name = i.GuideName, - Number = i.GuideNumber.ToString(CultureInfo.InvariantCulture), - Id = GetChannelId(info, i), - IsFavorite = i.Favorite, - TunerHostId = info.Id + lineup = lineup.Where(i => i.Favorite).ToList(); + } - }); + return lineup.Where(i => !i.DRM).ToList(); + } + } - if (info.ImportFavoritesOnly) - { - result = result.Where(i => (i.IsFavorite ?? true)).ToList(); - } + protected override async Task<IEnumerable<ChannelInfo>> GetChannelsInternal(TunerHostInfo info, CancellationToken cancellationToken) + { + var lineup = await GetLineup(info, cancellationToken).ConfigureAwait(false); - return result; - } - return new List<ChannelInfo>(); - } + return lineup.Select(i => new ChannelInfo + { + Name = i.GuideName, + Number = i.GuideNumber.ToString(CultureInfo.InvariantCulture), + Id = GetChannelId(info, i), + IsFavorite = i.Favorite, + TunerHostId = info.Id, + IsHD = i.HD == 1, + AudioCodec = i.AudioCodec, + VideoCodec = i.VideoCodec + }); } private async Task<string> GetModelInfo(TunerHostInfo info, CancellationToken cancellationToken) @@ -227,19 +229,24 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun { public string GuideNumber { get; set; } public string GuideName { get; set; } + public string VideoCodec { get; set; } + public string AudioCodec { get; set; } public string URL { get; set; } public bool Favorite { get; set; } public bool DRM { get; set; } + public int HD { get; set; } } - private MediaSourceInfo GetMediaSource(TunerHostInfo info, string channelId, string profile) + private async Task<MediaSourceInfo> GetMediaSource(TunerHostInfo info, string channelId, string profile) { int? width = null; int? height = null; bool isInterlaced = true; - var videoCodec = !string.IsNullOrWhiteSpace(GetEncodingOptions().HardwareAccelerationType) ? null : "mpeg2video"; + string videoCodec = null; + string audioCodec = "ac3"; int? videoBitrate = null; + int? audioBitrate = null; if (string.Equals(profile, "mobile", StringComparison.OrdinalIgnoreCase)) { @@ -257,18 +264,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun videoCodec = "h264"; videoBitrate = 15000000; } - else if (string.Equals(profile, "internet720", StringComparison.OrdinalIgnoreCase)) - { - width = 1280; - height = 720; - isInterlaced = false; - videoCodec = "h264"; - videoBitrate = 8000000; - } else if (string.Equals(profile, "internet540", StringComparison.OrdinalIgnoreCase)) { - width = 1280; - height = 720; + width = 960; + height = 546; isInterlaced = false; videoCodec = "h264"; videoBitrate = 2500000; @@ -298,6 +297,26 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun videoBitrate = 1000000; } + if (string.IsNullOrWhiteSpace(videoCodec)) + { + var channels = await GetChannels(info, true, CancellationToken.None).ConfigureAwait(false); + var channel = channels.FirstOrDefault(i => string.Equals(i.Number, channelId, StringComparison.OrdinalIgnoreCase)); + if (channel != null) + { + videoCodec = channel.VideoCodec; + audioCodec = channel.AudioCodec; + + videoBitrate = (channel.IsHD ?? true) ? 15000000 : 2000000; + audioBitrate = (channel.IsHD ?? true) ? 448000 : 192000; + } + } + + // normalize + if (string.Equals(videoCodec, "mpeg2", StringComparison.OrdinalIgnoreCase)) + { + videoCodec = "mpeg2video"; + } + var url = GetApiUrl(info, true) + "/auto/v" + channelId; if (!string.IsNullOrWhiteSpace(profile) && !string.Equals(profile, "native", StringComparison.OrdinalIgnoreCase)) @@ -321,15 +340,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun Width = width, Height = height, BitRate = videoBitrate - + }, new MediaStream { Type = MediaStreamType.Audio, // Set the index to -1 because we don't know the exact index of the audio stream within the container Index = -1, - Codec = "ac3", - BitRate = 192000 + Codec = audioCodec, + BitRate = audioBitrate } }, RequiresOpening = false, @@ -338,7 +357,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun Container = "ts", Id = profile, SupportsDirectPlay = true, - SupportsDirectStream = true, + SupportsDirectStream = false, SupportsTranscoding = true }; @@ -365,21 +384,22 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun } var hdhrId = GetHdHrIdFromChannelId(channelId); - list.Add(GetMediaSource(info, hdhrId, "native")); + list.Add(await GetMediaSource(info, hdhrId, "native").ConfigureAwait(false)); try { string model = await GetModelInfo(info, cancellationToken).ConfigureAwait(false); model = model ?? string.Empty; - if (model.IndexOf("hdtc", StringComparison.OrdinalIgnoreCase) != -1) + if (info.AllowHWTranscoding && (model.IndexOf("hdtc", StringComparison.OrdinalIgnoreCase) != -1)) { - list.Insert(0, GetMediaSource(info, hdhrId, "heavy")); + list.Add(await GetMediaSource(info, hdhrId, "heavy").ConfigureAwait(false)); - list.Add(GetMediaSource(info, hdhrId, "internet480")); - list.Add(GetMediaSource(info, hdhrId, "internet360")); - list.Add(GetMediaSource(info, hdhrId, "internet240")); - list.Add(GetMediaSource(info, hdhrId, "mobile")); + list.Add(await GetMediaSource(info, hdhrId, "internet540").ConfigureAwait(false)); + list.Add(await GetMediaSource(info, hdhrId, "internet480").ConfigureAwait(false)); + list.Add(await GetMediaSource(info, hdhrId, "internet360").ConfigureAwait(false)); + list.Add(await GetMediaSource(info, hdhrId, "internet240").ConfigureAwait(false)); + list.Add(await GetMediaSource(info, hdhrId, "mobile").ConfigureAwait(false)); } } catch (Exception ex) @@ -410,7 +430,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun } var hdhrId = GetHdHrIdFromChannelId(channelId); - return GetMediaSource(info, hdhrId, streamId); + return await GetMediaSource(info, hdhrId, streamId).ConfigureAwait(false); } public async Task Validate(TunerHostInfo info) diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/ChannelScan.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/ChannelScan.cs new file mode 100644 index 000000000..fdeae25b0 --- /dev/null +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/ChannelScan.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using IniParser; +using IniParser.Model; +using MediaBrowser.Controller.LiveTv; +using MediaBrowser.Model.LiveTv; +using MediaBrowser.Model.Logging; +using MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp.Rtsp; + +namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp +{ + public class ChannelScan + { + private readonly ILogger _logger; + + public ChannelScan(ILogger logger) + { + _logger = logger; + } + + public async Task<List<ChannelInfo>> Scan(TunerHostInfo info, CancellationToken cancellationToken) + { + var ini = info.SourceA.Split('|')[1]; + var resource = GetType().Assembly.GetManifestResourceNames().FirstOrDefault(i => i.EndsWith(ini, StringComparison.OrdinalIgnoreCase)); + + _logger.Info("Opening ini file {0}", resource); + var list = new List<ChannelInfo>(); + + using (var stream = GetType().Assembly.GetManifestResourceStream(resource)) + { + using (var reader = new StreamReader(stream)) + { + var parser = new StreamIniDataParser(); + var data = parser.ReadData(reader); + + var count = GetInt(data, "DVB", "0", 0); + + _logger.Info("DVB Count: {0}", count); + + var index = 1; + var source = "1"; + + while (index <= count) + { + cancellationToken.ThrowIfCancellationRequested(); + + using (var rtspSession = new RtspSession(info.Url, _logger)) + { + float percent = count == 0 ? 0 : (float)(index) / count; + percent = Math.Max(percent * 100, 100); + + //SetControlPropertyThreadSafe(pgbSearchResult, "Value", (int)percent); + var strArray = data["DVB"][index.ToString(CultureInfo.InvariantCulture)].Split(','); + + string tuning; + if (strArray[4] == "S2") + { + tuning = string.Format("src={0}&freq={1}&pol={2}&sr={3}&fec={4}&msys=dvbs2&mtype={5}&plts=on&ro=0.35&pids=0,16,17,18,20", source, strArray[0], strArray[1].ToLower(), strArray[2].ToLower(), strArray[3], strArray[5].ToLower()); + } + else + { + tuning = string.Format("src={0}&freq={1}&pol={2}&sr={3}&fec={4}&msys=dvbs&mtype={5}&pids=0,16,17,18,20", source, strArray[0], strArray[1].ToLower(), strArray[2], strArray[3], strArray[5].ToLower()); + } + + rtspSession.Setup(tuning, "unicast"); + + rtspSession.Play(string.Empty); + + int signallevel; + int signalQuality; + rtspSession.Describe(out signallevel, out signalQuality); + + await Task.Delay(500).ConfigureAwait(false); + index++; + } + } + } + } + + return list; + } + + private int GetInt(IniData data, string s1, string s2, int defaultValue) + { + var value = data[s1][s2]; + int numericValue; + if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out numericValue)) + { + return numericValue; + } + + return defaultValue; + } + } + + public class SatChannel + { + // TODO: Add properties + } +} diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspMethod.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspMethod.cs new file mode 100644 index 000000000..5f286f1db --- /dev/null +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspMethod.cs @@ -0,0 +1,88 @@ +/* + Copyright (C) <2007-2016> <Kay Diefenthal> + + SatIp.RtspSample is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + SatIp.RtspSample is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with SatIp.RtspSample. If not, see <http://www.gnu.org/licenses/>. +*/ + +using System.Collections.Generic; + +namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp.Rtsp +{ + /// <summary> + /// Standard RTSP request methods. + /// </summary> + public sealed class RtspMethod + { + public override int GetHashCode() + { + return (_name != null ? _name.GetHashCode() : 0); + } + + private readonly string _name; + private static readonly IDictionary<string, RtspMethod> _values = new Dictionary<string, RtspMethod>(); + + public static readonly RtspMethod Describe = new RtspMethod("DESCRIBE"); + public static readonly RtspMethod Announce = new RtspMethod("ANNOUNCE"); + public static readonly RtspMethod GetParameter = new RtspMethod("GET_PARAMETER"); + public static readonly RtspMethod Options = new RtspMethod("OPTIONS"); + public static readonly RtspMethod Pause = new RtspMethod("PAUSE"); + public static readonly RtspMethod Play = new RtspMethod("PLAY"); + public static readonly RtspMethod Record = new RtspMethod("RECORD"); + public static readonly RtspMethod Redirect = new RtspMethod("REDIRECT"); + public static readonly RtspMethod Setup = new RtspMethod("SETUP"); + public static readonly RtspMethod SetParameter = new RtspMethod("SET_PARAMETER"); + public static readonly RtspMethod Teardown = new RtspMethod("TEARDOWN"); + + private RtspMethod(string name) + { + _name = name; + _values.Add(name, this); + } + + public override string ToString() + { + return _name; + } + + public override bool Equals(object obj) + { + var method = obj as RtspMethod; + if (method != null && this == method) + { + return true; + } + return false; + } + + public static ICollection<RtspMethod> Values + { + get { return _values.Values; } + } + + public static explicit operator RtspMethod(string name) + { + RtspMethod value; + if (!_values.TryGetValue(name, out value)) + { + return null; + } + return value; + } + + public static implicit operator string(RtspMethod method) + { + return method._name; + } + } +} diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspRequest.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspRequest.cs new file mode 100644 index 000000000..600eda02d --- /dev/null +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspRequest.cs @@ -0,0 +1,140 @@ +/* + Copyright (C) <2007-2016> <Kay Diefenthal> + + SatIp.RtspSample is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + SatIp.RtspSample is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with SatIp.RtspSample. If not, see <http://www.gnu.org/licenses/>. +*/ + +using System.Collections.Generic; +using System.Text; + +namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp.Rtsp +{ + /// <summary> + /// A simple class that can be used to serialise RTSP requests. + /// </summary> + public class RtspRequest + { + private readonly RtspMethod _method; + private readonly string _uri; + private readonly int _majorVersion; + private readonly int _minorVersion; + private IDictionary<string, string> _headers = new Dictionary<string, string>(); + private string _body = string.Empty; + + /// <summary> + /// Initialise a new instance of the <see cref="RtspRequest"/> class. + /// </summary> + /// <param name="method">The request method.</param> + /// <param name="uri">The request URI</param> + /// <param name="majorVersion">The major version number.</param> + /// <param name="minorVersion">The minor version number.</param> + public RtspRequest(RtspMethod method, string uri, int majorVersion, int minorVersion) + { + _method = method; + _uri = uri; + _majorVersion = majorVersion; + _minorVersion = minorVersion; + } + + /// <summary> + /// Get the request method. + /// </summary> + public RtspMethod Method + { + get + { + return _method; + } + } + + /// <summary> + /// Get the request URI. + /// </summary> + public string Uri + { + get + { + return _uri; + } + } + + /// <summary> + /// Get the request major version number. + /// </summary> + public int MajorVersion + { + get + { + return _majorVersion; + } + } + + /// <summary> + /// Get the request minor version number. + /// </summary> + public int MinorVersion + { + get + { + return _minorVersion; + } + } + + /// <summary> + /// Get or set the request headers. + /// </summary> + public IDictionary<string, string> Headers + { + get + { + return _headers; + } + set + { + _headers = value; + } + } + + /// <summary> + /// Get or set the request body. + /// </summary> + public string Body + { + get + { + return _body; + } + set + { + _body = value; + } + } + + /// <summary> + /// Serialise this request. + /// </summary> + /// <returns>raw request bytes</returns> + public byte[] Serialise() + { + var request = new StringBuilder(); + request.AppendFormat("{0} {1} RTSP/{2}.{3}\r\n", _method, _uri, _majorVersion, _minorVersion); + foreach (var header in _headers) + { + request.AppendFormat("{0}: {1}\r\n", header.Key, header.Value); + } + request.AppendFormat("\r\n{0}", _body); + return Encoding.UTF8.GetBytes(request.ToString()); + } + } +} diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspResponse.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspResponse.cs new file mode 100644 index 000000000..97290623b --- /dev/null +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspResponse.cs @@ -0,0 +1,149 @@ +/* + Copyright (C) <2007-2016> <Kay Diefenthal> + + SatIp.RtspSample is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + SatIp.RtspSample is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with SatIp.RtspSample. If not, see <http://www.gnu.org/licenses/>. +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; + +namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp.Rtsp +{ + /// <summary> + /// A simple class that can be used to deserialise RTSP responses. + /// </summary> + public class RtspResponse + { + private static readonly Regex RegexStatusLine = new Regex(@"RTSP/(\d+)\.(\d+)\s+(\d+)\s+([^.]+?)\r\n(.*)", RegexOptions.Singleline); + + private int _majorVersion = 1; + private int _minorVersion; + private RtspStatusCode _statusCode; + private string _reasonPhrase; + private IDictionary<string, string> _headers; + private string _body; + + /// <summary> + /// Initialise a new instance of the <see cref="RtspResponse"/> class. + /// </summary> + private RtspResponse() + { + } + + /// <summary> + /// Get the response major version number. + /// </summary> + public int MajorVersion + { + get + { + return _majorVersion; + } + } + + /// <summary> + /// Get the response minor version number. + /// </summary> + public int MinorVersion + { + get + { + return _minorVersion; + } + } + + /// <summary> + /// Get the response status code. + /// </summary> + public RtspStatusCode StatusCode + { + get + { + return _statusCode; + } + } + + /// <summary> + /// Get the response reason phrase. + /// </summary> + public string ReasonPhrase + { + get + { + return _reasonPhrase; + } + } + + /// <summary> + /// Get the response headers. + /// </summary> + public IDictionary<string, string> Headers + { + get + { + return _headers; + } + } + + /// <summary> + /// Get the response body. + /// </summary> + public string Body + { + get + { + return _body; + } + set + { + _body = value; + } + } + + /// <summary> + /// Deserialise/parse an RTSP response. + /// </summary> + /// <param name="responseBytes">The raw response bytes.</param> + /// <param name="responseByteCount">The number of valid bytes in the response.</param> + /// <returns>a response object</returns> + public static RtspResponse Deserialise(byte[] responseBytes, int responseByteCount) + { + var response = new RtspResponse(); + var responseString = Encoding.UTF8.GetString(responseBytes, 0, responseByteCount); + + var m = RegexStatusLine.Match(responseString); + if (m.Success) + { + response._majorVersion = int.Parse(m.Groups[1].Captures[0].Value); + response._minorVersion = int.Parse(m.Groups[2].Captures[0].Value); + response._statusCode = (RtspStatusCode)int.Parse(m.Groups[3].Captures[0].Value); + response._reasonPhrase = m.Groups[4].Captures[0].Value; + responseString = m.Groups[5].Captures[0].Value; + } + + var sections = responseString.Split(new[] { "\r\n\r\n" }, StringSplitOptions.None); + response._body = sections[1]; + var headers = sections[0].Split(new[] { "\r\n" }, StringSplitOptions.None); + response._headers = new Dictionary<string, string>(); + foreach (var headerInfo in headers.Select(header => header.Split(':'))) + { + response._headers.Add(headerInfo[0], headerInfo[1].Trim()); + } + return response; + } + } +} diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspSession.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspSession.cs new file mode 100644 index 000000000..71b3f8a18 --- /dev/null +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspSession.cs @@ -0,0 +1,688 @@ +/* + Copyright (C) <2007-2016> <Kay Diefenthal> + + SatIp.RtspSample is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + SatIp.RtspSample is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with SatIp.RtspSample. If not, see <http://www.gnu.org/licenses/>. +*/ + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Net; +using System.Net.NetworkInformation; +using System.Net.Sockets; +using System.Text.RegularExpressions; +using MediaBrowser.Model.Logging; + +namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp.Rtsp +{ + public class RtspSession : IDisposable + { + #region Private Fields + private static readonly Regex RegexRtspSessionHeader = new Regex(@"\s*([^\s;]+)(;timeout=(\d+))?"); + private const int DefaultRtspSessionTimeout = 30; // unit = s + private static readonly Regex RegexDescribeResponseSignalInfo = new Regex(@";tuner=\d+,(\d+),(\d+),(\d+),", RegexOptions.Singleline | RegexOptions.IgnoreCase); + private string _address; + private string _rtspSessionId; + + public string RtspSessionId + { + get { return _rtspSessionId; } + set { _rtspSessionId = value; } + } + private int _rtspSessionTimeToLive = 0; + private string _rtspStreamId; + private int _clientRtpPort; + private int _clientRtcpPort; + private int _serverRtpPort; + private int _serverRtcpPort; + private int _rtpPort; + private int _rtcpPort; + private string _rtspStreamUrl; + private string _destination; + private string _source; + private string _transport; + private int _signalLevel; + private int _signalQuality; + private Socket _rtspSocket; + private int _rtspSequenceNum = 1; + private bool _disposed = false; + private readonly ILogger _logger; + #endregion + + #region Constructor + + public RtspSession(string address, ILogger logger) + { + if (string.IsNullOrWhiteSpace(address)) + { + throw new ArgumentNullException("address"); + } + + _address = address; + _logger = logger; + + _logger.Info("Creating RtspSession with url {0}", address); + } + ~RtspSession() + { + Dispose(false); + } + #endregion + + #region Properties + + #region Rtsp + + public string RtspStreamId + { + get { return _rtspStreamId; } + set { if (_rtspStreamId != value) { _rtspStreamId = value; OnPropertyChanged("RtspStreamId"); } } + } + public string RtspStreamUrl + { + get { return _rtspStreamUrl; } + set { if (_rtspStreamUrl != value) { _rtspStreamUrl = value; OnPropertyChanged("RtspStreamUrl"); } } + } + + public int RtspSessionTimeToLive + { + get + { + if (_rtspSessionTimeToLive == 0) + _rtspSessionTimeToLive = DefaultRtspSessionTimeout; + return _rtspSessionTimeToLive * 1000 - 20; + } + set { if (_rtspSessionTimeToLive != value) { _rtspSessionTimeToLive = value; OnPropertyChanged("RtspSessionTimeToLive"); } } + } + + #endregion + + #region Rtp Rtcp + + /// <summary> + /// The LocalEndPoint Address + /// </summary> + public string Destination + { + get + { + if (string.IsNullOrEmpty(_destination)) + { + var result = ""; + var host = Dns.GetHostName(); + var hostentry = Dns.GetHostEntry(host); + foreach (var ip in hostentry.AddressList.Where(ip => ip.AddressFamily == AddressFamily.InterNetwork)) + { + result = ip.ToString(); + } + + _destination = result; + } + return _destination; + } + set + { + if (_destination != value) + { + _destination = value; + OnPropertyChanged("Destination"); + } + } + } + + /// <summary> + /// The RemoteEndPoint Address + /// </summary> + public string Source + { + get { return _source; } + set + { + if (_source != value) + { + _source = value; + OnPropertyChanged("Source"); + } + } + } + + /// <summary> + /// The Media Data Delivery RemoteEndPoint Port if we use Unicast + /// </summary> + public int ServerRtpPort + { + get + { + return _serverRtpPort; + } + set { if (_serverRtpPort != value) { _serverRtpPort = value; OnPropertyChanged("ServerRtpPort"); } } + } + + /// <summary> + /// The Media Metadata Delivery RemoteEndPoint Port if we use Unicast + /// </summary> + public int ServerRtcpPort + { + get { return _serverRtcpPort; } + set { if (_serverRtcpPort != value) { _serverRtcpPort = value; OnPropertyChanged("ServerRtcpPort"); } } + } + + /// <summary> + /// The Media Data Delivery LocalEndPoint Port if we use Unicast + /// </summary> + public int ClientRtpPort + { + get { return _clientRtpPort; } + set { if (_clientRtpPort != value) { _clientRtpPort = value; OnPropertyChanged("ClientRtpPort"); } } + } + + /// <summary> + /// The Media Metadata Delivery LocalEndPoint Port if we use Unicast + /// </summary> + public int ClientRtcpPort + { + get { return _clientRtcpPort; } + set { if (_clientRtcpPort != value) { _clientRtcpPort = value; OnPropertyChanged("ClientRtcpPort"); } } + } + + /// <summary> + /// The Media Data Delivery RemoteEndPoint Port if we use Multicast + /// </summary> + public int RtpPort + { + get { return _rtpPort; } + set { if (_rtpPort != value) { _rtpPort = value; OnPropertyChanged("RtpPort"); } } + } + + /// <summary> + /// The Media Meta Delivery RemoteEndPoint Port if we use Multicast + /// </summary> + public int RtcpPort + { + get { return _rtcpPort; } + set { if (_rtcpPort != value) { _rtcpPort = value; OnPropertyChanged("RtcpPort"); } } + } + + #endregion + + public string Transport + { + get + { + if (string.IsNullOrEmpty(_transport)) + { + _transport = "unicast"; + } + return _transport; + } + set + { + if (_transport != value) + { + _transport = value; + OnPropertyChanged("Transport"); + } + } + } + public int SignalLevel + { + get { return _signalLevel; } + set { if (_signalLevel != value) { _signalLevel = value; OnPropertyChanged("SignalLevel"); } } + } + public int SignalQuality + { + get { return _signalQuality; } + set { if (_signalQuality != value) { _signalQuality = value; OnPropertyChanged("SignalQuality"); } } + } + + #endregion + + #region Private Methods + + private void ProcessSessionHeader(string sessionHeader, string response) + { + if (!string.IsNullOrEmpty(sessionHeader)) + { + var m = RegexRtspSessionHeader.Match(sessionHeader); + if (!m.Success) + { + _logger.Error("Failed to tune, RTSP {0} response session header {1} format not recognised", response, sessionHeader); + } + _rtspSessionId = m.Groups[1].Captures[0].Value; + _rtspSessionTimeToLive = m.Groups[3].Captures.Count == 1 ? int.Parse(m.Groups[3].Captures[0].Value) : DefaultRtspSessionTimeout; + } + } + private void ProcessTransportHeader(string transportHeader) + { + if (!string.IsNullOrEmpty(transportHeader)) + { + var transports = transportHeader.Split(','); + foreach (var transport in transports) + { + if (transport.Trim().StartsWith("RTP/AVP")) + { + var sections = transport.Split(';'); + foreach (var section in sections) + { + var parts = section.Split('='); + if (parts[0].Equals("server_port")) + { + var ports = parts[1].Split('-'); + _serverRtpPort = int.Parse(ports[0]); + _serverRtcpPort = int.Parse(ports[1]); + } + else if (parts[0].Equals("destination")) + { + _destination = parts[1]; + } + else if (parts[0].Equals("port")) + { + var ports = parts[1].Split('-'); + _rtpPort = int.Parse(ports[0]); + _rtcpPort = int.Parse(ports[1]); + } + else if (parts[0].Equals("ttl")) + { + _rtspSessionTimeToLive = int.Parse(parts[1]); + } + else if (parts[0].Equals("source")) + { + _source = parts[1]; + } + else if (parts[0].Equals("client_port")) + { + var ports = parts[1].Split('-'); + var rtp = int.Parse(ports[0]); + var rtcp = int.Parse(ports[1]); + //if (!rtp.Equals(_rtpPort)) + //{ + // Logger.Error("SAT>IP base: server specified RTP client port {0} instead of {1}", rtp, _rtpPort); + //} + //if (!rtcp.Equals(_rtcpPort)) + //{ + // Logger.Error("SAT>IP base: server specified RTCP client port {0} instead of {1}", rtcp, _rtcpPort); + //} + _rtpPort = rtp; + _rtcpPort = rtcp; + } + } + } + } + } + } + private void Connect() + { + _rtspSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + var ip = IPAddress.Parse(_address); + var rtspEndpoint = new IPEndPoint(ip, 554); + _rtspSocket.Connect(rtspEndpoint); + } + private void Disconnect() + { + if (_rtspSocket != null && _rtspSocket.Connected) + { + _rtspSocket.Shutdown(SocketShutdown.Both); + _rtspSocket.Close(); + } + } + private void SendRequest(RtspRequest request) + { + if (_rtspSocket == null) + { + Connect(); + } + try + { + request.Headers.Add("CSeq", _rtspSequenceNum.ToString()); + _rtspSequenceNum++; + byte[] requestBytes = request.Serialise(); + if (_rtspSocket != null) + { + var requestBytesCount = _rtspSocket.Send(requestBytes, requestBytes.Length, SocketFlags.None); + if (requestBytesCount < 1) + { + + } + } + } + catch (Exception e) + { + _logger.Error(e.Message); + } + } + private void ReceiveResponse(out RtspResponse response) + { + response = null; + var responseBytesCount = 0; + byte[] responseBytes = new byte[1024]; + try + { + responseBytesCount = _rtspSocket.Receive(responseBytes, responseBytes.Length, SocketFlags.None); + response = RtspResponse.Deserialise(responseBytes, responseBytesCount); + string contentLengthString; + int contentLength = 0; + if (response.Headers.TryGetValue("Content-Length", out contentLengthString)) + { + contentLength = int.Parse(contentLengthString); + if ((string.IsNullOrEmpty(response.Body) && contentLength > 0) || response.Body.Length < contentLength) + { + if (response.Body == null) + { + response.Body = string.Empty; + } + while (responseBytesCount > 0 && response.Body.Length < contentLength) + { + responseBytesCount = _rtspSocket.Receive(responseBytes, responseBytes.Length, SocketFlags.None); + response.Body += System.Text.Encoding.UTF8.GetString(responseBytes, 0, responseBytesCount); + } + } + } + } + catch (SocketException) + { + } + } + + #endregion + + #region Public Methods + + public RtspStatusCode Setup(string query, string transporttype) + { + + RtspRequest request; + RtspResponse response; + //_rtspClient = new RtspClient(_rtspDevice.ServerAddress); + if ((_rtspSocket == null)) + { + Connect(); + } + if (string.IsNullOrEmpty(_rtspSessionId)) + { + request = new RtspRequest(RtspMethod.Setup, string.Format("rtsp://{0}:{1}/?{2}", _address, 554, query), 1, 0); + switch (transporttype) + { + case "multicast": + request.Headers.Add("Transport", string.Format("RTP/AVP;multicast")); + break; + case "unicast": + var activeTcpConnections = IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpConnections(); + var usedPorts = new HashSet<int>(); + foreach (var connection in activeTcpConnections) + { + usedPorts.Add(connection.LocalEndPoint.Port); + } + for (var port = 40000; port <= 65534; port += 2) + { + if (!usedPorts.Contains(port) && !usedPorts.Contains(port + 1)) + { + + _clientRtpPort = port; + _clientRtcpPort = port + 1; + break; + } + } + request.Headers.Add("Transport", string.Format("RTP/AVP;unicast;client_port={0}-{1}", _clientRtpPort, _clientRtcpPort)); + break; + } + } + else + { + request = new RtspRequest(RtspMethod.Setup, string.Format("rtsp://{0}:{1}/?{2}", _address, 554, query), 1, 0); + switch (transporttype) + { + case "multicast": + request.Headers.Add("Transport", string.Format("RTP/AVP;multicast")); + break; + case "unicast": + request.Headers.Add("Transport", string.Format("RTP/AVP;unicast;client_port={0}-{1}", _clientRtpPort, _clientRtcpPort)); + break; + } + + } + SendRequest(request); + ReceiveResponse(out response); + + //if (_rtspClient.SendRequest(request, out response) != RtspStatusCode.Ok) + //{ + // Logger.Error("Failed to tune, non-OK RTSP SETUP status code {0} {1}", response.StatusCode, response.ReasonPhrase); + //} + if (!response.Headers.TryGetValue("com.ses.streamID", out _rtspStreamId)) + { + _logger.Error(string.Format("Failed to tune, not able to locate Stream ID header in RTSP SETUP response")); + } + string sessionHeader; + if (!response.Headers.TryGetValue("Session", out sessionHeader)) + { + _logger.Error(string.Format("Failed to tune, not able to locate Session header in RTSP SETUP response")); + } + ProcessSessionHeader(sessionHeader, "Setup"); + string transportHeader; + if (!response.Headers.TryGetValue("Transport", out transportHeader)) + { + _logger.Error(string.Format("Failed to tune, not able to locate Transport header in RTSP SETUP response")); + } + ProcessTransportHeader(transportHeader); + return response.StatusCode; + } + + public RtspStatusCode Play(string query) + { + if ((_rtspSocket == null)) + { + Connect(); + } + //_rtspClient = new RtspClient(_rtspDevice.ServerAddress); + RtspResponse response; + string data; + if (string.IsNullOrEmpty(query)) + { + data = string.Format("rtsp://{0}:{1}/stream={2}", _address, + 554, _rtspStreamId); + } + else + { + data = string.Format("rtsp://{0}:{1}/stream={2}?{3}", _address, + 554, _rtspStreamId, query); + } + var request = new RtspRequest(RtspMethod.Play, data, 1, 0); + request.Headers.Add("Session", _rtspSessionId); + SendRequest(request); + ReceiveResponse(out response); + //if (_rtspClient.SendRequest(request, out response) != RtspStatusCode.Ok) + //{ + // Logger.Error("Failed to tune, non-OK RTSP SETUP status code {0} {1}", response.StatusCode, response.ReasonPhrase); + //} + //Logger.Info("RtspSession-Play : \r\n {0}", response); + string sessionHeader; + if (!response.Headers.TryGetValue("Session", out sessionHeader)) + { + _logger.Error(string.Format("Failed to tune, not able to locate Session header in RTSP Play response")); + } + ProcessSessionHeader(sessionHeader, "Play"); + string rtpinfoHeader; + if (!response.Headers.TryGetValue("RTP-Info", out rtpinfoHeader)) + { + _logger.Error(string.Format("Failed to tune, not able to locate Rtp-Info header in RTSP Play response")); + } + return response.StatusCode; + } + + public RtspStatusCode Options() + { + if ((_rtspSocket == null)) + { + Connect(); + } + //_rtspClient = new RtspClient(_rtspDevice.ServerAddress); + RtspRequest request; + RtspResponse response; + + + if (string.IsNullOrEmpty(_rtspSessionId)) + { + request = new RtspRequest(RtspMethod.Options, string.Format("rtsp://{0}:{1}/", _address, 554), 1, 0); + } + else + { + request = new RtspRequest(RtspMethod.Options, string.Format("rtsp://{0}:{1}/", _address, 554), 1, 0); + request.Headers.Add("Session", _rtspSessionId); + } + SendRequest(request); + ReceiveResponse(out response); + //if (_rtspClient.SendRequest(request, out response) != RtspStatusCode.Ok) + //{ + // Logger.Error("Failed to tune, non-OK RTSP SETUP status code {0} {1}", response.StatusCode, response.ReasonPhrase); + //} + //Logger.Info("RtspSession-Options : \r\n {0}", response); + string sessionHeader; + if (!response.Headers.TryGetValue("Session", out sessionHeader)) + { + _logger.Error(string.Format("Failed to tune, not able to locate session header in RTSP Options response")); + } + ProcessSessionHeader(sessionHeader, "Options"); + string optionsHeader; + if (!response.Headers.TryGetValue("Public", out optionsHeader)) + { + _logger.Error(string.Format("Failed to tune, not able to Options header in RTSP Options response")); + } + return response.StatusCode; + } + + public RtspStatusCode Describe(out int level, out int quality) + { + if ((_rtspSocket == null)) + { + Connect(); + } + //_rtspClient = new RtspClient(_rtspDevice.ServerAddress); + RtspRequest request; + RtspResponse response; + level = 0; + quality = 0; + + if (string.IsNullOrEmpty(_rtspSessionId)) + { + request = new RtspRequest(RtspMethod.Describe, string.Format("rtsp://{0}:{1}/", _address, 554), 1, 0); + request.Headers.Add("Accept", "application/sdp"); + + } + else + { + request = new RtspRequest(RtspMethod.Describe, string.Format("rtsp://{0}:{1}/stream={2}", _address, 554, _rtspStreamId), 1, 0); + request.Headers.Add("Accept", "application/sdp"); + request.Headers.Add("Session", _rtspSessionId); + } + SendRequest(request); + ReceiveResponse(out response); + //if (_rtspClient.SendRequest(request, out response) != RtspStatusCode.Ok) + //{ + // Logger.Error("Failed to tune, non-OK RTSP Describe status code {0} {1}", response.StatusCode, response.ReasonPhrase); + //} + //Logger.Info("RtspSession-Describe : \r\n {0}", response); + string sessionHeader; + if (!response.Headers.TryGetValue("Session", out sessionHeader)) + { + _logger.Error(string.Format("Failed to tune, not able to locate session header in RTSP Describe response")); + } + ProcessSessionHeader(sessionHeader, "Describe"); + var m = RegexDescribeResponseSignalInfo.Match(response.Body); + if (m.Success) + { + + //isSignalLocked = m.Groups[2].Captures[0].Value.Equals("1"); + level = int.Parse(m.Groups[1].Captures[0].Value) * 100 / 255; // level: 0..255 => 0..100 + quality = int.Parse(m.Groups[3].Captures[0].Value) * 100 / 15; // quality: 0..15 => 0..100 + + } + /* + v=0 + o=- 1378633020884883 1 IN IP4 192.168.2.108 + s=SatIPServer:1 4 + t=0 0 + a=tool:idl4k + m=video 52780 RTP/AVP 33 + c=IN IP4 0.0.0.0 + b=AS:5000 + a=control:stream=4 + a=fmtp:33 ver=1.0;tuner=1,0,0,0,12344,h,dvbs2,,off,,22000,34;pids=0,100,101,102,103,106 + =sendonly + */ + + + return response.StatusCode; + } + + public RtspStatusCode TearDown() + { + if ((_rtspSocket == null)) + { + Connect(); + } + //_rtspClient = new RtspClient(_rtspDevice.ServerAddress); + RtspResponse response; + + var request = new RtspRequest(RtspMethod.Teardown, string.Format("rtsp://{0}:{1}/stream={2}", _address, 554, _rtspStreamId), 1, 0); + request.Headers.Add("Session", _rtspSessionId); + SendRequest(request); + ReceiveResponse(out response); + //if (_rtspClient.SendRequest(request, out response) != RtspStatusCode.Ok) + //{ + // Logger.Error("Failed to tune, non-OK RTSP Teardown status code {0} {1}", response.StatusCode, response.ReasonPhrase); + //} + return response.StatusCode; + } + + #endregion + + #region Public Events + + public event PropertyChangedEventHandler PropertyChanged; + + #endregion + + #region Protected Methods + + protected void OnPropertyChanged(string name) + { + //var handler = PropertyChanged; + //if (handler != null) + //{ + // handler(this, new PropertyChangedEventArgs(name)); + //} + } + + #endregion + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this);//Disconnect(); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (disposing) + { + TearDown(); + Disconnect(); + } + } + _disposed = true; + } + } +} diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspStatusCode.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspStatusCode.cs new file mode 100644 index 000000000..6d6d50623 --- /dev/null +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspStatusCode.cs @@ -0,0 +1,251 @@ +/* + Copyright (C) <2007-2016> <Kay Diefenthal> + + SatIp.RtspSample is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + SatIp.RtspSample is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with SatIp.RtspSample. If not, see <http://www.gnu.org/licenses/>. +*/ + +using System.ComponentModel; + +namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp.Rtsp +{ + /// <summary> + /// Standard RTSP status codes. + /// </summary> + public enum RtspStatusCode + { + /// <summary> + /// 100 continue + /// </summary> + Continue = 100, + + /// <summary> + /// 200 OK + /// </summary> + [Description("Okay")] + Ok = 200, + /// <summary> + /// 201 created + /// </summary> + Created = 201, + + /// <summary> + /// 250 low on storage space + /// </summary> + [Description("Low On Storage Space")] + LowOnStorageSpace = 250, + + /// <summary> + /// 300 multiple choices + /// </summary> + [Description("Multiple Choices")] + MultipleChoices = 300, + /// <summary> + /// 301 moved permanently + /// </summary> + [Description("Moved Permanently")] + MovedPermanently = 301, + /// <summary> + /// 302 moved temporarily + /// </summary> + [Description("Moved Temporarily")] + MovedTemporarily = 302, + /// <summary> + /// 303 see other + /// </summary> + [Description("See Other")] + SeeOther = 303, + /// <summary> + /// 304 not modified + /// </summary> + [Description("Not Modified")] + NotModified = 304, + /// <summary> + /// 305 use proxy + /// </summary> + [Description("Use Proxy")] + UseProxy = 305, + + /// <summary> + /// 400 bad request + /// </summary> + [Description("Bad Request")] + BadRequest = 400, + /// <summary> + /// 401 unauthorised + /// </summary> + Unauthorised = 401, + /// <summary> + /// 402 payment required + /// </summary> + [Description("Payment Required")] + PaymentRequired = 402, + /// <summary> + /// 403 forbidden + /// </summary> + Forbidden = 403, + /// <summary> + /// 404 not found + /// </summary> + [Description("Not Found")] + NotFound = 404, + /// <summary> + /// 405 method not allowed + /// </summary> + [Description("Method Not Allowed")] + MethodNotAllowed = 405, + /// <summary> + /// 406 not acceptable + /// </summary> + [Description("Not Acceptable")] + NotAcceptable = 406, + /// <summary> + /// 407 proxy authentication required + /// </summary> + [Description("Proxy Authentication Required")] + ProxyAuthenticationRequred = 407, + /// <summary> + /// 408 request time-out + /// </summary> + [Description("Request Time-Out")] + RequestTimeOut = 408, + + /// <summary> + /// 410 gone + /// </summary> + Gone = 410, + /// <summary> + /// 411 length required + /// </summary> + [Description("Length Required")] + LengthRequired = 411, + /// <summary> + /// 412 precondition failed + /// </summary> + [Description("Precondition Failed")] + PreconditionFailed = 412, + /// <summary> + /// 413 request entity too large + /// </summary> + [Description("Request Entity Too Large")] + RequestEntityTooLarge = 413, + /// <summary> + /// 414 request URI too large + /// </summary> + [Description("Request URI Too Large")] + RequestUriTooLarge = 414, + /// <summary> + /// 415 unsupported media type + /// </summary> + [Description("Unsupported Media Type")] + UnsupportedMediaType = 415, + + /// <summary> + /// 451 parameter not understood + /// </summary> + [Description("Parameter Not Understood")] + ParameterNotUnderstood = 451, + /// <summary> + /// 452 conference not found + /// </summary> + [Description("Conference Not Found")] + ConferenceNotFound = 452, + /// <summary> + /// 453 not enough bandwidth + /// </summary> + [Description("Not Enough Bandwidth")] + NotEnoughBandwidth = 453, + /// <summary> + /// 454 session not found + /// </summary> + [Description("Session Not Found")] + SessionNotFound = 454, + /// <summary> + /// 455 method not valid in this state + /// </summary> + [Description("Method Not Valid In This State")] + MethodNotValidInThisState = 455, + /// <summary> + /// 456 header field not valid for this resource + /// </summary> + [Description("Header Field Not Valid For This Resource")] + HeaderFieldNotValidForThisResource = 456, + /// <summary> + /// 457 invalid range + /// </summary> + [Description("Invalid Range")] + InvalidRange = 457, + /// <summary> + /// 458 parameter is read-only + /// </summary> + [Description("Parameter Is Read-Only")] + ParameterIsReadOnly = 458, + /// <summary> + /// 459 aggregate operation not allowed + /// </summary> + [Description("Aggregate Operation Not Allowed")] + AggregateOperationNotAllowed = 459, + /// <summary> + /// 460 only aggregate operation allowed + /// </summary> + [Description("Only Aggregate Operation Allowed")] + OnlyAggregateOperationAllowed = 460, + /// <summary> + /// 461 unsupported transport + /// </summary> + [Description("Unsupported Transport")] + UnsupportedTransport = 461, + /// <summary> + /// 462 destination unreachable + /// </summary> + [Description("Destination Unreachable")] + DestinationUnreachable = 462, + + /// <summary> + /// 500 internal server error + /// </summary> + [Description("Internal Server Error")] + InternalServerError = 500, + /// <summary> + /// 501 not implemented + /// </summary> + [Description("Not Implemented")] + NotImplemented = 501, + /// <summary> + /// 502 bad gateway + /// </summary> + [Description("Bad Gateway")] + BadGateway = 502, + /// <summary> + /// 503 service unavailable + /// </summary> + [Description("Service Unavailable")] + ServiceUnavailable = 503, + /// <summary> + /// 504 gateway time-out + /// </summary> + [Description("Gateway Time-Out")] + GatewayTimeOut = 504, + /// <summary> + /// 505 RTSP version not supported + /// </summary> + [Description("RTSP Version Not Supported")] + RtspVersionNotSupported = 505, + + /// <summary> + /// 551 option not supported + /// </summary> + [Description("Option Not Supported")] + OptionNotSupported = 551 + } +} diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs index cdeb6dfa8..d0a55966f 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs @@ -1,14 +1,11 @@ using System; -using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; -using System.Text; using System.Threading; using System.Threading.Tasks; using System.Xml; using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Dlna; @@ -18,6 +15,7 @@ using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Extensions; +using System.Xml.Linq; namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp { @@ -98,10 +96,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp if (existing == null) { - if (string.IsNullOrWhiteSpace(info.M3UUrl)) - { - return; - } + //if (string.IsNullOrWhiteSpace(info.M3UUrl)) + //{ + // return; + //} await _liveTvManager.SaveTunerHost(new TunerHostInfo { @@ -174,58 +172,86 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp public async Task<SatIpTunerHostInfo> GetInfo(string url, CancellationToken cancellationToken) { + Uri locationUri = new Uri(url); + string devicetype = ""; + string friendlyname = ""; + string uniquedevicename = ""; + string manufacturer = ""; + string manufacturerurl = ""; + string modelname = ""; + string modeldescription = ""; + string modelnumber = ""; + string modelurl = ""; + string serialnumber = ""; + string presentationurl = ""; + string capabilities = ""; + string m3u = ""; + var document = XDocument.Load(locationUri.AbsoluteUri); + var xnm = new XmlNamespaceManager(new NameTable()); + XNamespace n1 = "urn:ses-com:satip"; + XNamespace n0 = "urn:schemas-upnp-org:device-1-0"; + xnm.AddNamespace("root", n0.NamespaceName); + xnm.AddNamespace("satip:", n1.NamespaceName); + if (document.Root != null) + { + var deviceElement = document.Root.Element(n0 + "device"); + if (deviceElement != null) + { + var devicetypeElement = deviceElement.Element(n0 + "deviceType"); + if (devicetypeElement != null) + devicetype = devicetypeElement.Value; + var friendlynameElement = deviceElement.Element(n0 + "friendlyName"); + if (friendlynameElement != null) + friendlyname = friendlynameElement.Value; + var manufactureElement = deviceElement.Element(n0 + "manufacturer"); + if (manufactureElement != null) + manufacturer = manufactureElement.Value; + var manufactureurlElement = deviceElement.Element(n0 + "manufacturerURL"); + if (manufactureurlElement != null) + manufacturerurl = manufactureurlElement.Value; + var modeldescriptionElement = deviceElement.Element(n0 + "modelDescription"); + if (modeldescriptionElement != null) + modeldescription = modeldescriptionElement.Value; + var modelnameElement = deviceElement.Element(n0 + "modelName"); + if (modelnameElement != null) + modelname = modelnameElement.Value; + var modelnumberElement = deviceElement.Element(n0 + "modelNumber"); + if (modelnumberElement != null) + modelnumber = modelnumberElement.Value; + var modelurlElement = deviceElement.Element(n0 + "modelURL"); + if (modelurlElement != null) + modelurl = modelurlElement.Value; + var serialnumberElement = deviceElement.Element(n0 + "serialNumber"); + if (serialnumberElement != null) + serialnumber = serialnumberElement.Value; + var uniquedevicenameElement = deviceElement.Element(n0 + "UDN"); + if (uniquedevicenameElement != null) uniquedevicename = uniquedevicenameElement.Value; + var presentationUrlElement = deviceElement.Element(n0 + "presentationURL"); + if (presentationUrlElement != null) presentationurl = presentationUrlElement.Value; + var capabilitiesElement = deviceElement.Element(n1 + "X_SATIPCAP"); + if (capabilitiesElement != null) capabilities = capabilitiesElement.Value; + var m3uElement = deviceElement.Element(n1 + "X_SATIPM3U"); + if (m3uElement != null) m3u = m3uElement.Value; + } + } + var result = new SatIpTunerHostInfo { Url = url, + Id = uniquedevicename, IsEnabled = true, Type = SatIpHost.DeviceType, Tuners = 1, - TunersAvailable = 1 + TunersAvailable = 1, + M3UUrl = m3u }; - using (var stream = await _httpClient.Get(url, cancellationToken).ConfigureAwait(false)) - { - using (var streamReader = new StreamReader(stream)) - { - // Use XmlReader for best performance - using (var reader = XmlReader.Create(streamReader)) - { - reader.MoveToContent(); - - // Loop through each element - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.Element) - { - switch (reader.Name) - { - case "device": - using (var subtree = reader.ReadSubtree()) - { - FillFromDeviceNode(result, subtree); - } - break; - default: - reader.Skip(); - break; - } - } - } - } - } - } - - if (string.IsNullOrWhiteSpace(result.DeviceId)) + result.FriendlyName = friendlyname; + if (string.IsNullOrWhiteSpace(result.Id)) { throw new NotImplementedException(); } - // Device hasn't implemented an m3u list - if (string.IsNullOrWhiteSpace(result.M3UUrl)) - { - result.IsEnabled = false; - } - else if (!result.M3UUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase)) { var fullM3uUrl = url.Substring(0, url.LastIndexOf('/')); @@ -236,66 +262,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp return result; } - - private void FillFromDeviceNode(SatIpTunerHostInfo info, XmlReader reader) - { - reader.MoveToContent(); - - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.Element) - { - switch (reader.LocalName) - { - case "UDN": - { - info.DeviceId = reader.ReadElementContentAsString(); - break; - } - - case "friendlyName": - { - info.FriendlyName = reader.ReadElementContentAsString(); - break; - } - - case "satip:X_SATIPCAP": - case "X_SATIPCAP": - { - // <satip:X_SATIPCAP xmlns:satip="urn:ses-com:satip">DVBS2-2</satip:X_SATIPCAP> - var value = reader.ReadElementContentAsString() ?? string.Empty; - var parts = value.Split(new[] { '-' }, StringSplitOptions.RemoveEmptyEntries); - if (parts.Length == 2) - { - int intValue; - if (int.TryParse(parts[1], NumberStyles.Any, CultureInfo.InvariantCulture, out intValue)) - { - info.TunersAvailable = intValue; - } - - if (int.TryParse(parts[0].Substring(parts[0].Length - 1), NumberStyles.Any, CultureInfo.InvariantCulture, out intValue)) - { - info.Tuners = intValue; - } - } - break; - } - - case "satip:X_SATIPM3U": - case "X_SATIPM3U": - { - // <satip:X_SATIPM3U xmlns:satip="urn:ses-com:satip">/channellist.lua?select=m3u</satip:X_SATIPM3U> - info.M3UUrl = reader.ReadElementContentAsString(); - break; - } - - default: - reader.Skip(); - break; - } - } - } - } } public class SatIpTunerHostInfo : TunerHostInfo diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpHost.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpHost.cs index 46a2a8524..ffd85fd18 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpHost.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpHost.cs @@ -40,7 +40,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp return await new M3uParser(Logger, _fileSystem, _httpClient).Parse(tuner.M3UUrl, ChannelIdPrefix, tuner.Id, cancellationToken).ConfigureAwait(false); } - return new List<ChannelInfo>(); + var channels = await new ChannelScan(Logger).Scan(tuner, cancellationToken).ConfigureAwait(false); + return channels; } public static string DeviceType diff --git a/MediaBrowser.Server.Implementations/Localization/Core/ca.json b/MediaBrowser.Server.Implementations/Localization/Core/ca.json index 7cec213d3..7ca8e1553 100644 --- a/MediaBrowser.Server.Implementations/Localization/Core/ca.json +++ b/MediaBrowser.Server.Implementations/Localization/Core/ca.json @@ -1,5 +1,5 @@ { - "DbUpgradeMessage": "Please wait while your Emby Server database is upgraded. {0}% complete.", + "DbUpgradeMessage": "Si et plau espera mentre la teva base de dades del Servidor Emby \u00e9s actualitzada. {0}% completat.", "AppDeviceValues": "App: {0}, Dispositiu: {1}", "UserDownloadingItemWithValues": "{0} est\u00e0 descarregant {1}", "FolderTypeMixed": "Contingut barrejat", @@ -19,11 +19,11 @@ "LabelChapterName": "Cap\u00edtol {0}", "NameSeasonNumber": "Temporada {0}", "LabelExit": "Sortir", - "LabelVisitCommunity": "Visita la comunitat", + "LabelVisitCommunity": "Visita la Comunitat", "LabelGithub": "Github", "LabelApiDocumentation": "Documentaci\u00f3 de l'API", - "LabelDeveloperResources": "Recursos per a programadors", - "LabelBrowseLibrary": "Examina la biblioteca", + "LabelDeveloperResources": "Recursos per a Desenvolupadors", + "LabelBrowseLibrary": "Examina la Biblioteca", "LabelConfigureServer": "Configura Emby", "LabelRestartServer": "Reiniciar Servidor", "CategorySync": "Sync", @@ -131,7 +131,7 @@ "HeaderType": "Type", "HeaderSeverity": "Severity", "HeaderUser": "Usuari", - "HeaderName": "Name", + "HeaderName": "Nom", "HeaderDate": "Data", "HeaderPremiereDate": "Premiere Date", "HeaderDateAdded": "Data afegida", diff --git a/MediaBrowser.Server.Implementations/Localization/Core/es.json b/MediaBrowser.Server.Implementations/Localization/Core/es.json index 2a715a5b3..d1a56240d 100644 --- a/MediaBrowser.Server.Implementations/Localization/Core/es.json +++ b/MediaBrowser.Server.Implementations/Localization/Core/es.json @@ -1,7 +1,7 @@ { - "DbUpgradeMessage": "Please wait while your Emby Server database is upgraded. {0}% complete.", - "AppDeviceValues": "App: {0}, Device: {1}", - "UserDownloadingItemWithValues": "{0} is downloading {1}", + "DbUpgradeMessage": "Por favor espere mientras la base de datos de su servidor Emby se actualiza. {0}% completado.", + "AppDeviceValues": "Aplicaci\u00f3n: {0}, Dispositivo: {1}", + "UserDownloadingItemWithValues": "{0} est\u00e1 descargando {1}", "FolderTypeMixed": "Contenido mezclado", "FolderTypeMovies": "Peliculas", "FolderTypeMusic": "Musica", @@ -14,10 +14,10 @@ "FolderTypeTvShows": "TV", "FolderTypeInherit": "Heredado", "HeaderCastCrew": "Reparto y equipo t\u00e9cnico", - "HeaderPeople": "People", - "ValueSpecialEpisodeName": "Special - {0}", + "HeaderPeople": "Gente", + "ValueSpecialEpisodeName": "Especial - {0}", "LabelChapterName": "Cap\u00edtulo {0}", - "NameSeasonNumber": "Season {0}", + "NameSeasonNumber": "Temporada {0}", "LabelExit": "Salir", "LabelVisitCommunity": "Visitar la comunidad", "LabelGithub": "Github", @@ -50,77 +50,77 @@ "NotificationOptionCameraImageUploaded": "Imagen de camara se a carcado", "NotificationOptionUserLockedOut": "Usuario bloqueado", "NotificationOptionServerRestartRequired": "Se requiere el reinicio del servidor", - "ViewTypePlaylists": "Playlists", + "ViewTypePlaylists": "Listas de reproducci\u00f3n", "ViewTypeMovies": "Pel\u00edculas", "ViewTypeTvShows": "TV", "ViewTypeGames": "Juegos", "ViewTypeMusic": "M\u00fasica", - "ViewTypeMusicGenres": "Genres", - "ViewTypeMusicArtists": "Artists", + "ViewTypeMusicGenres": "G\u00e9neros", + "ViewTypeMusicArtists": "Artistas", "ViewTypeBoxSets": "Colecciones", "ViewTypeChannels": "Canales", "ViewTypeLiveTV": "Tv en vivo", - "ViewTypeLiveTvNowPlaying": "Now Airing", - "ViewTypeLatestGames": "Latest Games", - "ViewTypeRecentlyPlayedGames": "Recently Played", - "ViewTypeGameFavorites": "Favorites", - "ViewTypeGameSystems": "Game Systems", - "ViewTypeGameGenres": "Genres", - "ViewTypeTvResume": "Resume", - "ViewTypeTvNextUp": "Next Up", - "ViewTypeTvLatest": "Latest", + "ViewTypeLiveTvNowPlaying": "Transmiti\u00e9ndose ahora", + "ViewTypeLatestGames": "\u00daltimos juegos", + "ViewTypeRecentlyPlayedGames": "Reproducido recientemente", + "ViewTypeGameFavorites": "Favoritos", + "ViewTypeGameSystems": "Sistemas de juego", + "ViewTypeGameGenres": "G\u00e9neros", + "ViewTypeTvResume": "Reanudar", + "ViewTypeTvNextUp": "Pr\u00f3ximamente", + "ViewTypeTvLatest": "\u00daltimas", "ViewTypeTvShowSeries": "Series", - "ViewTypeTvGenres": "Genres", - "ViewTypeTvFavoriteSeries": "Favorite Series", - "ViewTypeTvFavoriteEpisodes": "Favorite Episodes", - "ViewTypeMovieResume": "Resume", - "ViewTypeMovieLatest": "Latest", - "ViewTypeMovieMovies": "Movies", - "ViewTypeMovieCollections": "Collections", - "ViewTypeMovieFavorites": "Favorites", - "ViewTypeMovieGenres": "Genres", - "ViewTypeMusicLatest": "Latest", - "ViewTypeMusicPlaylists": "Playlists", - "ViewTypeMusicAlbums": "Albums", - "ViewTypeMusicAlbumArtists": "Album Artists", + "ViewTypeTvGenres": "G\u00e9neros", + "ViewTypeTvFavoriteSeries": "Series favoritas", + "ViewTypeTvFavoriteEpisodes": "Episodios favoritos", + "ViewTypeMovieResume": "Reanudar", + "ViewTypeMovieLatest": "\u00daltimas", + "ViewTypeMovieMovies": "Pel\u00edculas", + "ViewTypeMovieCollections": "Colecciones", + "ViewTypeMovieFavorites": "Favoritos", + "ViewTypeMovieGenres": "G\u00e9neros", + "ViewTypeMusicLatest": "\u00daltimas", + "ViewTypeMusicPlaylists": "Lista", + "ViewTypeMusicAlbums": "\u00c1lbumes", + "ViewTypeMusicAlbumArtists": "\u00c1lbumes de artistas", "HeaderOtherDisplaySettings": "Configuraci\u00f3n de pantalla", - "ViewTypeMusicSongs": "Songs", - "ViewTypeMusicFavorites": "Favorites", - "ViewTypeMusicFavoriteAlbums": "Favorite Albums", - "ViewTypeMusicFavoriteArtists": "Favorite Artists", - "ViewTypeMusicFavoriteSongs": "Favorite Songs", - "ViewTypeFolders": "Folders", - "ViewTypeLiveTvRecordingGroups": "Recordings", - "ViewTypeLiveTvChannels": "Channels", - "ScheduledTaskFailedWithName": "{0} failed", - "LabelRunningTimeValue": "Running time: {0}", - "ScheduledTaskStartedWithName": "{0} started", + "ViewTypeMusicSongs": "Canciones", + "ViewTypeMusicFavorites": "Favoritos", + "ViewTypeMusicFavoriteAlbums": "\u00c1lbumes favoritos", + "ViewTypeMusicFavoriteArtists": "Artistas favoritos", + "ViewTypeMusicFavoriteSongs": "Canciones favoritas", + "ViewTypeFolders": "Carpetas", + "ViewTypeLiveTvRecordingGroups": "Grabaciones", + "ViewTypeLiveTvChannels": "Canales", + "ScheduledTaskFailedWithName": "{0} fall\u00f3", + "LabelRunningTimeValue": "Tiempo de ejecuci\u00f3n: {0}", + "ScheduledTaskStartedWithName": "{0} iniciado", "VersionNumber": "Versi\u00f3n {0}", - "PluginInstalledWithName": "{0} was installed", - "PluginUpdatedWithName": "{0} was updated", - "PluginUninstalledWithName": "{0} was uninstalled", - "ItemAddedWithName": "{0} was added to the library", - "ItemRemovedWithName": "{0} was removed from the library", - "LabelIpAddressValue": "Ip address: {0}", - "DeviceOnlineWithName": "{0} is connected", - "UserOnlineFromDevice": "{0} is online from {1}", - "ProviderValue": "Provider: {0}", - "SubtitlesDownloadedForItem": "Subtitles downloaded for {0}", - "UserConfigurationUpdatedWithName": "User configuration has been updated for {0}", - "UserCreatedWithName": "User {0} has been created", - "UserPasswordChangedWithName": "Password has been changed for user {0}", - "UserDeletedWithName": "User {0} has been deleted", - "MessageServerConfigurationUpdated": "Server configuration has been updated", - "MessageNamedServerConfigurationUpdatedWithValue": "Server configuration section {0} has been updated", - "MessageApplicationUpdated": "Emby Server has been updated", - "FailedLoginAttemptWithUserName": "Failed login attempt from {0}", - "AuthenticationSucceededWithUserName": "{0} successfully authenticated", - "DeviceOfflineWithName": "{0} has disconnected", - "UserLockedOutWithName": "User {0} has been locked out", - "UserOfflineFromDevice": "{0} has disconnected from {1}", - "UserStartedPlayingItemWithValues": "{0} has started playing {1}", - "UserStoppedPlayingItemWithValues": "{0} has stopped playing {1}", - "SubtitleDownloadFailureForItem": "Subtitles failed to download for {0}", + "PluginInstalledWithName": "{0} ha sido instalado", + "PluginUpdatedWithName": "{0} ha sido actualizado", + "PluginUninstalledWithName": "{0} ha sido desinstalado", + "ItemAddedWithName": "{0} ha sido a\u00f1adido a la biblioteca", + "ItemRemovedWithName": "{0} se ha eliminado de la biblioteca", + "LabelIpAddressValue": "Direcci\u00f3n IP: {0}", + "DeviceOnlineWithName": "{0} est\u00e1 conectado", + "UserOnlineFromDevice": "{0} est\u00e1 conectado desde {1}", + "ProviderValue": "Proveedor: {0}", + "SubtitlesDownloadedForItem": "Subt\u00edtulos descargados para {0}", + "UserConfigurationUpdatedWithName": "Se ha actualizado la configuraci\u00f3n de usuario para {0}", + "UserCreatedWithName": "Se ha creado el usuario {0}", + "UserPasswordChangedWithName": "Contrase\u00f1a cambiada al usuario {0}", + "UserDeletedWithName": "El usuario {0} ha sido eliminado", + "MessageServerConfigurationUpdated": "Se ha actualizado la configuraci\u00f3n del servidor", + "MessageNamedServerConfigurationUpdatedWithValue": "Se ha actualizado la secci\u00f3n {0} de la configuraci\u00f3n del servidor", + "MessageApplicationUpdated": "Se ha actualizado el servidor Emby", + "FailedLoginAttemptWithUserName": "Intento de inicio de sesi\u00f3n fallido desde {0}", + "AuthenticationSucceededWithUserName": "{0} se ha autenticado satisfactoriamente", + "DeviceOfflineWithName": "{0} se ha desconectado", + "UserLockedOutWithName": "El usuario {0} ha sido bloqueado", + "UserOfflineFromDevice": "{0} se ha desconectado de {1}", + "UserStartedPlayingItemWithValues": "{0} ha empezado a reproducir {1}", + "UserStoppedPlayingItemWithValues": "{0} ha parado de reproducir {1}", + "SubtitleDownloadFailureForItem": "Fallo en la descarga de subt\u00edtulos para {0}", "HeaderUnidentified": "Unidentified", "HeaderImagePrimary": "Primary", "HeaderImageBackdrop": "Backdrop", @@ -159,20 +159,20 @@ "HeaderEmbeddedImage": "Embedded image", "HeaderResolution": "Resolution", "HeaderSubtitles": "Subt\u00edtulos", - "HeaderGenres": "Genres", - "HeaderCountries": "Countries", + "HeaderGenres": "G\u00e9neros", + "HeaderCountries": "Paises", "HeaderStatus": "Estado", "HeaderTracks": "Tracks", "HeaderMusicArtist": "Music artist", "HeaderLocked": "Locked", - "HeaderStudios": "Studios", + "HeaderStudios": "Estudios", "HeaderActor": "Actors", "HeaderComposer": "Composers", "HeaderDirector": "Directors", "HeaderGuestStar": "Guest star", "HeaderProducer": "Producers", "HeaderWriter": "Writers", - "HeaderParentalRatings": "Parental Ratings", + "HeaderParentalRatings": "Clasificaci\u00f3n parental", "HeaderCommunityRatings": "Community ratings", "StartupEmbyServerIsLoading": "Emby Server is loading. Please try again shortly." }
\ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/Localization/Core/hu.json b/MediaBrowser.Server.Implementations/Localization/Core/hu.json index b175ae6c1..2b9d28d8c 100644 --- a/MediaBrowser.Server.Implementations/Localization/Core/hu.json +++ b/MediaBrowser.Server.Implementations/Localization/Core/hu.json @@ -33,10 +33,10 @@ "CategoryPlugin": "B\u0151v\u00edtm\u00e9ny", "NotificationOptionPluginError": "B\u0151v\u00edtm\u00e9ny hiba", "NotificationOptionApplicationUpdateAvailable": "Friss\u00edt\u00e9s el\u00e9rhet\u0151", - "NotificationOptionApplicationUpdateInstalled": "Friss\u00edt\u00e9s telep\u00edtve", - "NotificationOptionPluginUpdateInstalled": "B\u0151v\u00edtm\u00e9ny friss\u00edtve", + "NotificationOptionApplicationUpdateInstalled": "Program friss\u00edt\u00e9s telep\u00edtve", + "NotificationOptionPluginUpdateInstalled": "B\u0151v\u00edtm\u00e9ny friss\u00edt\u00e9s telep\u00edtve", "NotificationOptionPluginInstalled": "B\u0151v\u00edtm\u00e9ny telep\u00edtve", - "NotificationOptionPluginUninstalled": "B\u0151v\u00edtm\u00e9ny t\u00f6r\u00f6lve", + "NotificationOptionPluginUninstalled": "B\u0151v\u00edtm\u00e9ny elt\u00e1vol\u00edtva", "NotificationOptionVideoPlayback": "Vide\u00f3 elind\u00edtva", "NotificationOptionAudioPlayback": "Zene elind\u00edtva", "NotificationOptionGamePlayback": "J\u00e1t\u00e9k elind\u00edtva", @@ -169,8 +169,8 @@ "HeaderActor": "Sz\u00edn\u00e9szek", "HeaderComposer": "Zeneszerz\u0151k", "HeaderDirector": "Rendez\u0151k", - "HeaderGuestStar": "Guest star", - "HeaderProducer": "Producers", + "HeaderGuestStar": "Vend\u00e9g szt\u00e1r", + "HeaderProducer": "Producerek", "HeaderWriter": "\u00cdr\u00f3k", "HeaderParentalRatings": "Korhat\u00e1r besorol\u00e1s", "HeaderCommunityRatings": "K\u00f6z\u00f6ss\u00e9gi \u00e9rt\u00e9kel\u00e9sek", diff --git a/MediaBrowser.Server.Implementations/Localization/Core/nl.json b/MediaBrowser.Server.Implementations/Localization/Core/nl.json index a83182ee8..2818fbf6a 100644 --- a/MediaBrowser.Server.Implementations/Localization/Core/nl.json +++ b/MediaBrowser.Server.Implementations/Localization/Core/nl.json @@ -1,5 +1,5 @@ { - "DbUpgradeMessage": "Even geduld svp terwijl de Emby Server database ge-upgrade wordt. {0}% gereed.", + "DbUpgradeMessage": "Een ogenblik geduld terwijl uw Emby Server-database wordt bijgewerkt. {0}% voltooid.", "AppDeviceValues": "App: {0}, Apparaat: {1}", "UserDownloadingItemWithValues": "{0} download {1}", "FolderTypeMixed": "Gemengde inhoud", diff --git a/MediaBrowser.Server.Implementations/Localization/Core/ru.json b/MediaBrowser.Server.Implementations/Localization/Core/ru.json index fa68aadb9..62fe3b496 100644 --- a/MediaBrowser.Server.Implementations/Localization/Core/ru.json +++ b/MediaBrowser.Server.Implementations/Localization/Core/ru.json @@ -2,17 +2,17 @@ "DbUpgradeMessage": "\u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435, \u043f\u043e\u043a\u0430 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0432\u0430\u0448\u0435\u043c Emby Server \u043c\u043e\u0434\u0435\u0440\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f. {0} % \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e.", "AppDeviceValues": "\u041f\u0440\u0438\u043b.: {0}, \u0423\u0441\u0442\u0440.: {1}", "UserDownloadingItemWithValues": "{0} \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 {1}", - "FolderTypeMixed": "\u0420\u0430\u0437\u043d\u043e\u0442\u0438\u043f\u043d\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435", + "FolderTypeMixed": "\u0421\u043c\u0435\u0448\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435", "FolderTypeMovies": "\u041a\u0438\u043d\u043e", "FolderTypeMusic": "\u041c\u0443\u0437\u044b\u043a\u0430", - "FolderTypeAdultVideos": "\u0412\u0438\u0434\u0435\u043e \u0434\u043b\u044f \u0432\u0437\u0440\u043e\u0441\u043b\u044b\u0445", - "FolderTypePhotos": "\u0424\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438", - "FolderTypeMusicVideos": "\u041c\u0443\u0437\u044b\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u0438\u0434\u0435\u043e", - "FolderTypeHomeVideos": "\u0414\u043e\u043c\u0430\u0448\u043d\u0438\u0435 \u0432\u0438\u0434\u0435\u043e", + "FolderTypeAdultVideos": "\u0414\u043b\u044f \u0432\u0437\u0440\u043e\u0441\u043b\u044b\u0445", + "FolderTypePhotos": "\u0424\u043e\u0442\u043e", + "FolderTypeMusicVideos": "\u041c\u0443\u0437. \u0432\u0438\u0434\u0435\u043e", + "FolderTypeHomeVideos": "\u0414\u043e\u043c. \u0432\u0438\u0434\u0435\u043e", "FolderTypeGames": "\u0418\u0433\u0440\u044b", - "FolderTypeBooks": "\u041a\u043d\u0438\u0433\u0438", + "FolderTypeBooks": "\u041b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0430", "FolderTypeTvShows": "\u0422\u0412", - "FolderTypeInherit": "\u041d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435", + "FolderTypeInherit": "\u041d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u044b\u0439", "HeaderCastCrew": "\u0421\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u044c \u0438 \u0441\u043d\u0438\u043c\u0430\u043b\u0438", "HeaderPeople": "\u041b\u044e\u0434\u0438", "ValueSpecialEpisodeName": "\u0421\u043f\u0435\u0446\u044d\u043f\u0438\u0437\u043e\u0434 - {0}", @@ -163,7 +163,7 @@ "HeaderCountries": "\u0421\u0442\u0440\u0430\u043d\u044b", "HeaderStatus": "\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435", "HeaderTracks": "\u0414\u043e\u0440-\u043a\u0438", - "HeaderMusicArtist": "\u0418\u0441\u043f. \u043c\u0443\u0437\u044b\u043a\u0438", + "HeaderMusicArtist": "\u041c\u0443\u0437. \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c", "HeaderLocked": "\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e", "HeaderStudios": "\u0421\u0442\u0443\u0434\u0438\u0438", "HeaderActor": "\u0410\u043a\u0442\u0451\u0440\u044b", diff --git a/MediaBrowser.Server.Implementations/Localization/Core/sv.json b/MediaBrowser.Server.Implementations/Localization/Core/sv.json index f52f656d4..4a6565aff 100644 --- a/MediaBrowser.Server.Implementations/Localization/Core/sv.json +++ b/MediaBrowser.Server.Implementations/Localization/Core/sv.json @@ -1,7 +1,7 @@ { - "DbUpgradeMessage": "Please wait while your Emby Server database is upgraded. {0}% complete.", + "DbUpgradeMessage": "V\u00e4nligen v\u00e4nta medan databasen p\u00e5 din Emby Server uppgraderas. {0}% klar", "AppDeviceValues": "App: {0}, enhet: {1}", - "UserDownloadingItemWithValues": "{0} is downloading {1}", + "UserDownloadingItemWithValues": "{0} laddar ned {1}", "FolderTypeMixed": "Blandat inneh\u00e5ll", "FolderTypeMovies": "Filmer", "FolderTypeMusic": "Musik", @@ -15,18 +15,18 @@ "FolderTypeInherit": "\u00c4rv", "HeaderCastCrew": "Rollista & bes\u00e4ttning", "HeaderPeople": "Personer", - "ValueSpecialEpisodeName": "Special - {0}", + "ValueSpecialEpisodeName": "Specialavsnitt - {0}", "LabelChapterName": "Kapitel {0}", - "NameSeasonNumber": "Season {0}", + "NameSeasonNumber": "S\u00e4song {0}", "LabelExit": "Avsluta", "LabelVisitCommunity": "Bes\u00f6k v\u00e5rt diskussionsforum", "LabelGithub": "Github", - "LabelApiDocumentation": "Api Dokumentation", + "LabelApiDocumentation": "Api-dokumentation", "LabelDeveloperResources": "Resurser f\u00f6r utvecklare", "LabelBrowseLibrary": "Bl\u00e4ddra i biblioteket", - "LabelConfigureServer": "Configure Emby", + "LabelConfigureServer": "Konfigurera Emby", "LabelRestartServer": "Starta om servern", - "CategorySync": "Sync", + "CategorySync": "Synkronisera", "CategoryUser": "Anv\u00e4ndare", "CategorySystem": "System", "CategoryApplication": "App", @@ -47,10 +47,10 @@ "NotificationOptionInstallationFailed": "Fel vid installation", "NotificationOptionNewLibraryContent": "Nytt inneh\u00e5ll har tillkommit", "NotificationOptionNewLibraryContentMultiple": "Nytillkommet inneh\u00e5ll finns (flera objekt)", - "NotificationOptionCameraImageUploaded": "Camera image uploaded", - "NotificationOptionUserLockedOut": "User locked out", + "NotificationOptionCameraImageUploaded": "Kaberabild uppladdad", + "NotificationOptionUserLockedOut": "Anv\u00e4ndare har l\u00e5sts ute", "NotificationOptionServerRestartRequired": "Servern m\u00e5ste startas om", - "ViewTypePlaylists": "Playlists", + "ViewTypePlaylists": "Spellistor", "ViewTypeMovies": "Filmer", "ViewTypeTvShows": "TV", "ViewTypeGames": "Spel", @@ -80,10 +80,10 @@ "ViewTypeMovieFavorites": "Favoriter", "ViewTypeMovieGenres": "Genrer", "ViewTypeMusicLatest": "Nytillkommet", - "ViewTypeMusicPlaylists": "Playlists", + "ViewTypeMusicPlaylists": "Spellistor", "ViewTypeMusicAlbums": "Album", "ViewTypeMusicAlbumArtists": "Albumartister", - "HeaderOtherDisplaySettings": "Visningsinst\u00e4llningar", + "HeaderOtherDisplaySettings": "Visningsalternativ", "ViewTypeMusicSongs": "L\u00e5tar", "ViewTypeMusicFavorites": "Favoriter", "ViewTypeMusicFavoriteAlbums": "Favoritalbum", @@ -112,45 +112,45 @@ "UserDeletedWithName": "Anv\u00e4ndaren {0} har tagits bort", "MessageServerConfigurationUpdated": "Server konfigurationen har uppdaterats", "MessageNamedServerConfigurationUpdatedWithValue": "Serverinst\u00e4llningarnas del {0} ar uppdaterats", - "MessageApplicationUpdated": "Emby Server has been updated", + "MessageApplicationUpdated": "Emby Server har uppdaterats", "FailedLoginAttemptWithUserName": "Misslyckat inloggningsf\u00f6rs\u00f6k fr\u00e5n {0}", "AuthenticationSucceededWithUserName": "{0} har autentiserats", "DeviceOfflineWithName": "{0} har avbrutit anslutningen", - "UserLockedOutWithName": "User {0} has been locked out", - "UserOfflineFromDevice": "{0} har kopplats bort fr\u00e5n {1}", + "UserLockedOutWithName": "Anv\u00e4ndare {0} har l\u00e5sts ute", + "UserOfflineFromDevice": "{0} har avbrutit anslutningen fr\u00e5n {1}", "UserStartedPlayingItemWithValues": "{0} har p\u00e5b\u00f6rjat uppspelning av {1}", "UserStoppedPlayingItemWithValues": "{0} har avslutat uppspelning av {1}", "SubtitleDownloadFailureForItem": "Nerladdning av undertexter f\u00f6r {0} misslyckades", - "HeaderUnidentified": "Unidentified", - "HeaderImagePrimary": "Primary", - "HeaderImageBackdrop": "Backdrop", - "HeaderImageLogo": "Logo", - "HeaderUserPrimaryImage": "User Image", - "HeaderOverview": "Overview", - "HeaderShortOverview": "Short Overview", - "HeaderType": "Type", + "HeaderUnidentified": "Oidentifierad", + "HeaderImagePrimary": "Huvudbild", + "HeaderImageBackdrop": "Bakgrundsbild", + "HeaderImageLogo": "Logotyp", + "HeaderUserPrimaryImage": "Anv\u00e4ndarbild", + "HeaderOverview": "\u00d6versikt", + "HeaderShortOverview": "Kort \u00f6versikt", + "HeaderType": "Typ", "HeaderSeverity": "Severity", "HeaderUser": "Anv\u00e4ndare", "HeaderName": "Namn", "HeaderDate": "Datum", - "HeaderPremiereDate": "Premiere Date", + "HeaderPremiereDate": "Premi\u00e4rdatum", "HeaderDateAdded": "Date Added", "HeaderReleaseDate": "Premi\u00e4rdatum:", "HeaderRuntime": "Speltid", - "HeaderPlayCount": "Play Count", + "HeaderPlayCount": "Antal spelningar", "HeaderSeason": "S\u00e4song", "HeaderSeasonNumber": "S\u00e4songsnummer:", - "HeaderSeries": "Series:", + "HeaderSeries": "Serie:", "HeaderNetwork": "TV-bolag", - "HeaderYear": "Year:", - "HeaderYears": "Years:", + "HeaderYear": "\u00c5r:", + "HeaderYears": "\u00c5r:", "HeaderParentalRating": "Parental Rating", "HeaderCommunityRating": "Anv\u00e4ndaromd\u00f6me", "HeaderTrailers": "Trailers", - "HeaderSpecials": "Specialer", + "HeaderSpecials": "Specialavsnitt", "HeaderGameSystems": "Game Systems", - "HeaderPlayers": "Players:", - "HeaderAlbumArtists": "Album Artists", + "HeaderPlayers": "Spelare:", + "HeaderAlbumArtists": "Albumartister", "HeaderAlbums": "Album", "HeaderDisc": "Skiva", "HeaderTrack": "Sp\u00e5r", @@ -163,16 +163,16 @@ "HeaderCountries": "L\u00e4nder", "HeaderStatus": "Status", "HeaderTracks": "Sp\u00e5r", - "HeaderMusicArtist": "Music artist", - "HeaderLocked": "Locked", + "HeaderMusicArtist": "Musikartist", + "HeaderLocked": "L\u00e5st", "HeaderStudios": "Studior", - "HeaderActor": "Actors", - "HeaderComposer": "Composers", - "HeaderDirector": "Directors", - "HeaderGuestStar": "Guest star", - "HeaderProducer": "Producers", - "HeaderWriter": "Writers", + "HeaderActor": "Sk\u00e5despelare", + "HeaderComposer": "Komposit\u00f6rer", + "HeaderDirector": "Regiss\u00f6r", + "HeaderGuestStar": "G\u00e4startist", + "HeaderProducer": "Producenter", + "HeaderWriter": "F\u00f6rfattare", "HeaderParentalRatings": "Parental Ratings", "HeaderCommunityRatings": "Community ratings", - "StartupEmbyServerIsLoading": "Emby Server is loading. Please try again shortly." + "StartupEmbyServerIsLoading": "Emby Server startar. V\u00e4nligen f\u00f6rs\u00f6k igen om en kort stund." }
\ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/Localization/Core/zh-TW.json b/MediaBrowser.Server.Implementations/Localization/Core/zh-TW.json index 7f289fc1f..b711aab1f 100644 --- a/MediaBrowser.Server.Implementations/Localization/Core/zh-TW.json +++ b/MediaBrowser.Server.Implementations/Localization/Core/zh-TW.json @@ -1,5 +1,5 @@ { - "DbUpgradeMessage": "Please wait while your Emby Server database is upgraded. {0}% complete.", + "DbUpgradeMessage": "\u8acb\u7a0d\u5019\uff0cEmby\u4f3a\u670d\u5668\u8cc7\u6599\u5eab\u6b63\u5728\u66f4\u65b0...\uff08\u5df2\u5b8c\u6210{0}%\uff09", "AppDeviceValues": "App: {0}, Device: {1}", "UserDownloadingItemWithValues": "{0} is downloading {1}", "FolderTypeMixed": "Mixed content", @@ -19,13 +19,13 @@ "LabelChapterName": "Chapter {0}", "NameSeasonNumber": "Season {0}", "LabelExit": "\u96e2\u958b", - "LabelVisitCommunity": "\u8a2a\u554f\u793e\u5340", - "LabelGithub": "Github", - "LabelApiDocumentation": "Api Documentation", - "LabelDeveloperResources": "Developer Resources", - "LabelBrowseLibrary": "\u700f\u89bd\u5a92\u9ad4\u5eab", - "LabelConfigureServer": "Configure Emby", - "LabelRestartServer": "\u91cd\u65b0\u555f\u52d5\u4f3a\u5668\u670d", + "LabelVisitCommunity": "\u8a2a\u554f\u793e\u7fa4", + "LabelGithub": "GitHub", + "LabelApiDocumentation": "API\u8aaa\u660e\u6587\u4ef6", + "LabelDeveloperResources": "\u958b\u767c\u4eba\u54e1\u5c08\u5340", + "LabelBrowseLibrary": "\u700f\u89bd\u5a92\u9ad4\u6ac3", + "LabelConfigureServer": "Emby\u8a2d\u5b9a", + "LabelRestartServer": "\u91cd\u65b0\u555f\u52d5\u4f3a\u670d\u5668", "CategorySync": "Sync", "CategoryUser": "User", "CategorySystem": "System", @@ -59,7 +59,7 @@ "ViewTypeMusicArtists": "Artists", "ViewTypeBoxSets": "Collections", "ViewTypeChannels": "Channels", - "ViewTypeLiveTV": "Live TV", + "ViewTypeLiveTV": "\u96fb\u8996", "ViewTypeLiveTvNowPlaying": "Now Airing", "ViewTypeLatestGames": "Latest Games", "ViewTypeRecentlyPlayedGames": "Recently Played", diff --git a/MediaBrowser.Server.Implementations/Localization/LocalizationManager.cs b/MediaBrowser.Server.Implementations/Localization/LocalizationManager.cs index 40c1ac003..0c627d751 100644 --- a/MediaBrowser.Server.Implementations/Localization/LocalizationManager.cs +++ b/MediaBrowser.Server.Implementations/Localization/LocalizationManager.cs @@ -1,5 +1,4 @@ using MediaBrowser.Model.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Localization; using MediaBrowser.Model.Entities; diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index 97f090ab2..60d8f737f 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -99,6 +99,7 @@ <Reference Include="ServiceStack.Text"> <HintPath>..\ThirdParty\ServiceStack.Text\ServiceStack.Text.dll</HintPath> </Reference> + <Reference Include="System.Xml.Linq" /> <Reference Include="UniversalDetector"> <HintPath>..\ThirdParty\UniversalDetector\UniversalDetector.dll</HintPath> </Reference> @@ -242,6 +243,12 @@ <Compile Include="LiveTv\ProgramImageProvider.cs" /> <Compile Include="LiveTv\RecordingImageProvider.cs" /> <Compile Include="LiveTv\RefreshChannelsScheduledTask.cs" /> + <Compile Include="LiveTv\TunerHosts\SatIp\ChannelScan.cs" /> + <Compile Include="LiveTv\TunerHosts\SatIp\Rtsp\RtspMethod.cs" /> + <Compile Include="LiveTv\TunerHosts\SatIp\Rtsp\RtspRequest.cs" /> + <Compile Include="LiveTv\TunerHosts\SatIp\Rtsp\RtspResponse.cs" /> + <Compile Include="LiveTv\TunerHosts\SatIp\Rtsp\RtspSession.cs" /> + <Compile Include="LiveTv\TunerHosts\SatIp\Rtsp\RtspStatusCode.cs" /> <Compile Include="LiveTv\TunerHosts\SatIp\SatIpHost.cs" /> <Compile Include="LiveTv\TunerHosts\SatIp\SatIpDiscovery.cs" /> <Compile Include="Localization\LocalizationManager.cs" /> diff --git a/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs b/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs index ac0f2c69d..a7b0d61c7 100644 --- a/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs +++ b/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Chapters; +using MediaBrowser.Controller.Chapters; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.TV; @@ -153,7 +152,7 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder } catch (Exception ex) { - _logger.ErrorException("Error extraching chapter images for {0}", ex, string.Join(",", inputPath)); + _logger.ErrorException("Error extracting chapter images for {0}", ex, string.Join(",", inputPath)); success = false; break; } diff --git a/MediaBrowser.Server.Implementations/Notifications/IConfigurableNotificationService.cs b/MediaBrowser.Server.Implementations/Notifications/IConfigurableNotificationService.cs index 5c4f400b0..cdfd0f640 100644 --- a/MediaBrowser.Server.Implementations/Notifications/IConfigurableNotificationService.cs +++ b/MediaBrowser.Server.Implementations/Notifications/IConfigurableNotificationService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MediaBrowser.Server.Implementations.Notifications +namespace MediaBrowser.Server.Implementations.Notifications { public interface IConfigurableNotificationService { diff --git a/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs b/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs index bec105b0a..031333f2c 100644 --- a/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs +++ b/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs @@ -3,7 +3,6 @@ using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; @@ -33,7 +32,7 @@ namespace MediaBrowser.Server.Implementations.Persistence private readonly ILocalizationManager _localization; private readonly ITaskManager _taskManager; - public const int MigrationVersion = 20; + public const int MigrationVersion = 23; public static bool EnableUnavailableMessage = false; public CleanDatabaseScheduledTask(ILibraryManager libraryManager, IItemRepository itemRepo, ILogger logger, IServerConfigurationManager config, IFileSystem fileSystem, IHttpServer httpServer, ILocalizationManager localization, ITaskManager taskManager) @@ -86,7 +85,7 @@ namespace MediaBrowser.Server.Implementations.Persistence innerProgress = new ActionableProgress<double>(); innerProgress.RegisterAction(p => { - double newPercentCommplete = 40 + (.05 * p); + double newPercentCommplete = 40 + .05 * p; OnProgress(newPercentCommplete); progress.Report(newPercentCommplete); }); @@ -96,7 +95,7 @@ namespace MediaBrowser.Server.Implementations.Persistence innerProgress = new ActionableProgress<double>(); innerProgress.RegisterAction(p => { - double newPercentCommplete = 45 + (.55 * p); + double newPercentCommplete = 45 + .55 * p; OnProgress(newPercentCommplete); progress.Report(newPercentCommplete); }); diff --git a/MediaBrowser.Server.Implementations/Persistence/MediaStreamColumns.cs b/MediaBrowser.Server.Implementations/Persistence/MediaStreamColumns.cs index 7e46db5a7..211c77107 100644 --- a/MediaBrowser.Server.Implementations/Persistence/MediaStreamColumns.cs +++ b/MediaBrowser.Server.Implementations/Persistence/MediaStreamColumns.cs @@ -1,9 +1,6 @@ using System; -using System.Collections.Generic; using System.Data; -using System.Linq; using System.Text; -using System.Threading.Tasks; using MediaBrowser.Model.Logging; namespace MediaBrowser.Server.Implementations.Persistence diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index 3264abd22..212be2849 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -78,8 +78,9 @@ namespace MediaBrowser.Server.Implementations.Persistence private IDbCommand _saveAncestorCommand; private IDbCommand _updateInheritedRatingCommand; + private IDbCommand _updateInheritedTagsCommand; - private const int LatestSchemaVersion = 55; + private const int LatestSchemaVersion = 62; /// <summary> /// Initializes a new instance of the <see cref="SqliteItemRepository"/> class. @@ -135,7 +136,7 @@ namespace MediaBrowser.Server.Implementations.Persistence "create table if not exists AncestorIds (ItemId GUID, AncestorId GUID, AncestorIdText TEXT, PRIMARY KEY (ItemId, AncestorId))", "create index if not exists idx_AncestorIds1 on AncestorIds(AncestorId)", "create index if not exists idx_AncestorIds2 on AncestorIds(AncestorIdText)", - + "create table if not exists People (ItemId GUID, Name TEXT NOT NULL, Role TEXT, PersonType TEXT, SortOrder int, ListOrder int)", "create index if not exists idxPeopleItemId on People(ItemId)", "create index if not exists idxPeopleName on People(Name)", @@ -223,6 +224,8 @@ namespace MediaBrowser.Server.Implementations.Persistence _connection.AddColumn(Logger, "TypedBaseItems", "TrailerTypes", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "CriticRating", "Float"); _connection.AddColumn(Logger, "TypedBaseItems", "CriticRatingSummary", "Text"); + _connection.AddColumn(Logger, "TypedBaseItems", "DateModifiedDuringLastRefresh", "DATETIME"); + _connection.AddColumn(Logger, "TypedBaseItems", "InheritedTags", "Text"); PrepareStatements(); @@ -355,7 +358,8 @@ namespace MediaBrowser.Server.Implementations.Persistence "Studios", "Tags", "SourceType", - "TrailerTypes" + "TrailerTypes", + "DateModifiedDuringLastRefresh" }; private readonly string[] _mediaStreamSaveColumns = @@ -400,7 +404,7 @@ namespace MediaBrowser.Server.Implementations.Persistence "guid", "type", "data", - "Path", + "Path", "StartDate", "EndDate", "ChannelId", @@ -459,7 +463,9 @@ namespace MediaBrowser.Server.Implementations.Persistence "SourceType", "TrailerTypes", "CriticRating", - "CriticRatingSummary" + "CriticRatingSummary", + "DateModifiedDuringLastRefresh", + "InheritedTags" }; _saveItemCommand = _connection.CreateCommand(); _saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values ("; @@ -537,8 +543,13 @@ namespace MediaBrowser.Server.Implementations.Persistence _updateInheritedRatingCommand = _connection.CreateCommand(); _updateInheritedRatingCommand.CommandText = "Update TypedBaseItems set InheritedParentalRatingValue=@InheritedParentalRatingValue where Guid=@Guid"; - _updateInheritedRatingCommand.Parameters.Add(_updateInheritedRatingCommand, "@InheritedParentalRatingValue"); _updateInheritedRatingCommand.Parameters.Add(_updateInheritedRatingCommand, "@Guid"); + _updateInheritedRatingCommand.Parameters.Add(_updateInheritedRatingCommand, "@InheritedParentalRatingValue"); + + _updateInheritedTagsCommand = _connection.CreateCommand(); + _updateInheritedTagsCommand.CommandText = "Update TypedBaseItems set InheritedTags=@InheritedTags where Guid=@Guid"; + _updateInheritedTagsCommand.Parameters.Add(_updateInheritedTagsCommand, "@Guid"); + _updateInheritedTagsCommand.Parameters.Add(_updateInheritedTagsCommand, "@InheritedTags"); } /// <summary> @@ -712,7 +723,15 @@ namespace MediaBrowser.Server.Implementations.Persistence _saveItemCommand.GetParameter(index++).Value = item.ServiceName; - _saveItemCommand.GetParameter(index++).Value = string.Join("|", item.Tags.ToArray()); + if (item.Tags.Count > 0) + { + _saveItemCommand.GetParameter(index++).Value = string.Join("|", item.Tags.ToArray()); + } + else + { + _saveItemCommand.GetParameter(index++).Value = null; + } + _saveItemCommand.GetParameter(index++).Value = item.IsFolder; _saveItemCommand.GetParameter(index++).Value = item.GetBlockUnratedType().ToString(); @@ -752,7 +771,26 @@ namespace MediaBrowser.Server.Implementations.Persistence _saveItemCommand.GetParameter(index++).Value = item.CriticRating; _saveItemCommand.GetParameter(index++).Value = item.CriticRatingSummary; - + + if (!item.DateModifiedDuringLastRefresh.HasValue || item.DateModifiedDuringLastRefresh.Value == default(DateTime)) + { + _saveItemCommand.GetParameter(index++).Value = null; + } + else + { + _saveItemCommand.GetParameter(index++).Value = item.DateModifiedDuringLastRefresh.Value; + } + + var inheritedTags = item.GetInheritedTags(); + if (inheritedTags.Count > 0) + { + _saveItemCommand.GetParameter(index++).Value = string.Join("|", inheritedTags.ToArray()); + } + else + { + _saveItemCommand.GetParameter(index++).Value = null; + } + _saveItemCommand.Transaction = transaction; _saveItemCommand.ExecuteNonQuery(); @@ -1125,6 +1163,11 @@ namespace MediaBrowser.Server.Implementations.Persistence } } + if (!reader.IsDBNull(51)) + { + item.DateModifiedDuringLastRefresh = reader.GetDateTime(51).ToUniversalTime(); + } + return item; } @@ -2148,6 +2191,14 @@ namespace MediaBrowser.Server.Implementations.Persistence excludeTagIndex++; } + excludeTagIndex = 0; + foreach (var excludeTag in query.ExcludeInheritedTags) + { + whereClauses.Add("InheritedTags not like @excludeInheritedTag" + excludeTagIndex); + cmd.Parameters.Add(cmd, "@excludeInheritedTag" + excludeTagIndex, DbType.String).Value = "%" + excludeTag + "%"; + excludeTagIndex++; + } + if (addPaging) { if (query.StartIndex.HasValue && query.StartIndex.Value > 0) @@ -2208,6 +2259,88 @@ namespace MediaBrowser.Server.Implementations.Persistence public async Task UpdateInheritedValues(CancellationToken cancellationToken) { + await UpdateInheritedParentalRating(cancellationToken).ConfigureAwait(false); + await UpdateInheritedTags(cancellationToken).ConfigureAwait(false); + } + + private async Task UpdateInheritedTags(CancellationToken cancellationToken) + { + var newValues = new List<Tuple<Guid, string>>(); + + using (var cmd = _connection.CreateCommand()) + { + cmd.CommandText = "select Guid,InheritedTags,(select group_concat(Tags, '|') from TypedBaseItems where (guid=outer.guid) OR (guid in (Select AncestorId from AncestorIds where ItemId=Outer.guid))) as NewInheritedTags from typedbaseitems as Outer where NewInheritedTags <> InheritedTags"; + + using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult)) + { + while (reader.Read()) + { + var id = reader.GetGuid(0); + string value = reader.IsDBNull(2) ? null : reader.GetString(2); + + newValues.Add(new Tuple<Guid, string>(id, value)); + } + } + } + + Logger.Debug("UpdateInheritedTags - {0} rows", newValues.Count); + if (newValues.Count == 0) + { + return; + } + + await WriteLock.WaitAsync(cancellationToken).ConfigureAwait(false); + + IDbTransaction transaction = null; + + try + { + transaction = _connection.BeginTransaction(); + + foreach (var item in newValues) + { + _updateInheritedTagsCommand.GetParameter(0).Value = item.Item1; + _updateInheritedTagsCommand.GetParameter(1).Value = item.Item2; + + _updateInheritedTagsCommand.Transaction = transaction; + _updateInheritedTagsCommand.ExecuteNonQuery(); + } + + transaction.Commit(); + } + catch (OperationCanceledException) + { + if (transaction != null) + { + transaction.Rollback(); + } + + throw; + } + catch (Exception e) + { + Logger.ErrorException("Error running query:", e); + + if (transaction != null) + { + transaction.Rollback(); + } + + throw; + } + finally + { + if (transaction != null) + { + transaction.Dispose(); + } + + WriteLock.Release(); + } + } + + private async Task UpdateInheritedParentalRating(CancellationToken cancellationToken) + { var newValues = new List<Tuple<Guid, int>>(); using (var cmd = _connection.CreateCommand()) @@ -2226,6 +2359,7 @@ namespace MediaBrowser.Server.Implementations.Persistence } } + Logger.Debug("UpdateInheritedParentalRatings - {0} rows", newValues.Count); if (newValues.Count == 0) { return; @@ -2755,7 +2889,7 @@ namespace MediaBrowser.Server.Implementations.Persistence _saveStreamCommand.GetParameter(index++).Value = stream.BitDepth; _saveStreamCommand.GetParameter(index++).Value = stream.IsAnamorphic; _saveStreamCommand.GetParameter(index++).Value = stream.RefFrames; - _saveStreamCommand.GetParameter(index++).Value = stream.IsCabac; + _saveStreamCommand.GetParameter(index++).Value = null; _saveStreamCommand.GetParameter(index++).Value = stream.CodecTag; _saveStreamCommand.GetParameter(index++).Value = stream.Comment; @@ -2907,10 +3041,7 @@ namespace MediaBrowser.Server.Implementations.Persistence item.RefFrames = reader.GetInt32(24); } - if (!reader.IsDBNull(25)) - { - item.IsCabac = reader.GetBoolean(25); - } + // cabac no longer used if (!reader.IsDBNull(26)) { diff --git a/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs b/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs index 56a174756..fafb2f268 100644 --- a/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs +++ b/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs @@ -3,7 +3,6 @@ using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Threading.Tasks; using CommonIO; diff --git a/MediaBrowser.Server.Implementations/Playlists/ManualPlaylistsFolder.cs b/MediaBrowser.Server.Implementations/Playlists/ManualPlaylistsFolder.cs index fbf514423..20324215b 100644 --- a/MediaBrowser.Server.Implementations/Playlists/ManualPlaylistsFolder.cs +++ b/MediaBrowser.Server.Implementations/Playlists/ManualPlaylistsFolder.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Server.Implementations.Playlists { diff --git a/MediaBrowser.Server.Implementations/Playlists/PlaylistImageProvider.cs b/MediaBrowser.Server.Implementations/Playlists/PlaylistImageProvider.cs index 4413a7ddf..bdb73ea38 100644 --- a/MediaBrowser.Server.Implementations/Playlists/PlaylistImageProvider.cs +++ b/MediaBrowser.Server.Implementations/Playlists/PlaylistImageProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; diff --git a/MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs b/MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs index 048e2bf8d..06ef05951 100644 --- a/MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs +++ b/MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Playlists; diff --git a/MediaBrowser.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs b/MediaBrowser.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs index e5249d4f2..e50de7bac 100644 --- a/MediaBrowser.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs +++ b/MediaBrowser.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs @@ -12,7 +12,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Server.Implementations.ScheduledTasks { diff --git a/MediaBrowser.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs b/MediaBrowser.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs index 457f5a33d..ff0960259 100644 --- a/MediaBrowser.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs +++ b/MediaBrowser.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs @@ -98,7 +98,7 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks double percent = numComplete; percent /= packagesToInstall.Count; - progress.Report((90 * percent) + 10); + progress.Report(90 * percent + 10); } })); diff --git a/MediaBrowser.Server.Implementations/ScheduledTasks/RefreshIntrosTask.cs b/MediaBrowser.Server.Implementations/ScheduledTasks/RefreshIntrosTask.cs index 90682d5b0..3192c91f4 100644 --- a/MediaBrowser.Server.Implementations/ScheduledTasks/RefreshIntrosTask.cs +++ b/MediaBrowser.Server.Implementations/ScheduledTasks/RefreshIntrosTask.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Library; using MediaBrowser.Model.Logging; using System; using System.Linq; diff --git a/MediaBrowser.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs b/MediaBrowser.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs index fa3cd6be7..0ba9d4f32 100644 --- a/MediaBrowser.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs +++ b/MediaBrowser.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs @@ -96,7 +96,7 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks { Logger.Info("Update Revision {0} available. Updating...", updateInfo.AvailableVersion); - innerProgressHandler = (sender, e) => progress.Report((e * .9) + .1); + innerProgressHandler = (sender, e) => progress.Report(e * .9 + .1); innerProgress = new Progress<double>(); innerProgress.ProgressChanged += innerProgressHandler; diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 98127d39a..88f11c368 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -547,9 +547,9 @@ namespace MediaBrowser.Server.Implementations.Session await OnPlaybackStopped(new PlaybackStopInfo { Item = session.NowPlayingItem, - ItemId = (session.NowPlayingItem == null ? null : session.NowPlayingItem.Id), + ItemId = session.NowPlayingItem == null ? null : session.NowPlayingItem.Id, SessionId = session.Id, - MediaSourceId = (session.PlayState == null ? null : session.PlayState.MediaSourceId), + MediaSourceId = session.PlayState == null ? null : session.PlayState.MediaSourceId, PositionTicks = session.PlayState == null ? null : session.PlayState.PositionTicks }); } diff --git a/MediaBrowser.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs b/MediaBrowser.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs index c7bbca060..70cf805cf 100644 --- a/MediaBrowser.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs +++ b/MediaBrowser.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs @@ -142,8 +142,8 @@ namespace MediaBrowser.Server.Implementations.Sorting private int CompareEpisodes(Episode x, Episode y) { - var xValue = ((x.PhysicalSeasonNumber ?? -1) * 1000) + (x.IndexNumber ?? -1); - var yValue = ((y.PhysicalSeasonNumber ?? -1) * 1000) + (y.IndexNumber ?? -1); + var xValue = (x.PhysicalSeasonNumber ?? -1) * 1000 + (x.IndexNumber ?? -1); + var yValue = (y.PhysicalSeasonNumber ?? -1) * 1000 + (y.IndexNumber ?? -1); return xValue.CompareTo(yValue); } diff --git a/MediaBrowser.Server.Implementations/Sorting/OfficialRatingComparer.cs b/MediaBrowser.Server.Implementations/Sorting/OfficialRatingComparer.cs index e9ba3b5d3..dd31109da 100644 --- a/MediaBrowser.Server.Implementations/Sorting/OfficialRatingComparer.cs +++ b/MediaBrowser.Server.Implementations/Sorting/OfficialRatingComparer.cs @@ -1,5 +1,4 @@ -using System; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Localization; using MediaBrowser.Controller.Sorting; using MediaBrowser.Model.Querying; diff --git a/MediaBrowser.Server.Implementations/Sorting/PlayCountComparer.cs b/MediaBrowser.Server.Implementations/Sorting/PlayCountComparer.cs index 0d10c459f..1bc5261b4 100644 --- a/MediaBrowser.Server.Implementations/Sorting/PlayCountComparer.cs +++ b/MediaBrowser.Server.Implementations/Sorting/PlayCountComparer.cs @@ -1,6 +1,5 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Sorting; using MediaBrowser.Model.Querying; diff --git a/MediaBrowser.Server.Implementations/Sync/MediaSync.cs b/MediaBrowser.Server.Implementations/Sync/MediaSync.cs index 1a02fcd3a..3218ac5e7 100644 --- a/MediaBrowser.Server.Implementations/Sync/MediaSync.cs +++ b/MediaBrowser.Server.Implementations/Sync/MediaSync.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Progress; using MediaBrowser.Controller; using MediaBrowser.Controller.IO; diff --git a/MediaBrowser.Server.Implementations/Sync/MultiProviderSync.cs b/MediaBrowser.Server.Implementations/Sync/MultiProviderSync.cs index dca831f73..97b2b1eb8 100644 --- a/MediaBrowser.Server.Implementations/Sync/MultiProviderSync.cs +++ b/MediaBrowser.Server.Implementations/Sync/MultiProviderSync.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Progress; using MediaBrowser.Controller; using MediaBrowser.Controller.Sync; diff --git a/MediaBrowser.Server.Implementations/Sync/ServerSyncScheduledTask.cs b/MediaBrowser.Server.Implementations/Sync/ServerSyncScheduledTask.cs index 52c9f9cee..28813c715 100644 --- a/MediaBrowser.Server.Implementations/Sync/ServerSyncScheduledTask.cs +++ b/MediaBrowser.Server.Implementations/Sync/ServerSyncScheduledTask.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Controller; using MediaBrowser.Controller.Sync; diff --git a/MediaBrowser.Server.Implementations/Sync/SyncConvertScheduledTask.cs b/MediaBrowser.Server.Implementations/Sync/SyncConvertScheduledTask.cs index 2efed7992..3f9eb7691 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncConvertScheduledTask.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncConvertScheduledTask.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; diff --git a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs index f553c8ea8..33874b4d4 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs @@ -98,7 +98,7 @@ namespace MediaBrowser.Server.Implementations.Sync var index = jobItems.Count == 0 ? 0 : - (jobItems.Select(i => i.JobItemIndex).Max() + 1); + jobItems.Select(i => i.JobItemIndex).Max() + 1; jobItem = new SyncJobItem { @@ -149,16 +149,6 @@ namespace MediaBrowser.Server.Implementations.Sync { var job = _syncRepo.GetJob(id); - return UpdateJobStatus(job); - } - - private Task UpdateJobStatus(SyncJob job) - { - if (job == null) - { - throw new ArgumentNullException("job"); - } - var result = _syncManager.GetJobItems(new SyncJobItemQuery { JobId = job.Id, @@ -469,21 +459,19 @@ namespace MediaBrowser.Server.Implementations.Sync var startingPercent = numComplete * percentPerItem * 100; var innerProgress = new ActionableProgress<double>(); - innerProgress.RegisterAction(p => progress.Report(startingPercent + (percentPerItem * p))); + innerProgress.RegisterAction(p => progress.Report(startingPercent + percentPerItem * p)); // Pull it fresh from the db just to make sure it wasn't deleted or cancelled while another item was converting var jobItem = enableConversion ? _syncRepo.GetJobItem(item.Id) : item; if (jobItem != null) { - var job = _syncRepo.GetJob(jobItem.JobId); if (jobItem.Status != SyncJobItemStatus.Cancelled) { - await ProcessJobItem(job, jobItem, enableConversion, innerProgress, cancellationToken).ConfigureAwait(false); + await ProcessJobItem(jobItem, enableConversion, innerProgress, cancellationToken).ConfigureAwait(false); } - job = _syncRepo.GetJob(jobItem.JobId); - await UpdateJobStatus(job).ConfigureAwait(false); + await UpdateJobStatus(jobItem.JobId).ConfigureAwait(false); } numComplete++; @@ -493,7 +481,7 @@ namespace MediaBrowser.Server.Implementations.Sync } } - private async Task ProcessJobItem(SyncJob job, SyncJobItem jobItem, bool enableConversion, IProgress<double> progress, CancellationToken cancellationToken) + private async Task ProcessJobItem(SyncJobItem jobItem, bool enableConversion, IProgress<double> progress, CancellationToken cancellationToken) { var item = _libraryManager.GetItemById(jobItem.ItemId); if (item == null) @@ -507,6 +495,7 @@ namespace MediaBrowser.Server.Implementations.Sync jobItem.Progress = 0; var syncOptions = _config.GetSyncOptions(); + var job = _syncManager.GetJob(jobItem.JobId); var user = _userManager.GetUserById(job.UserId); if (user == null) { @@ -521,7 +510,7 @@ namespace MediaBrowser.Server.Implementations.Sync { AddMetadata = false, ItemId = jobItem.ItemId, - TargetId = job.TargetId, + TargetId = jobItem.TargetId, Statuses = new[] { SyncJobItemStatus.Converting, SyncJobItemStatus.Queued, SyncJobItemStatus.ReadyToTransfer, SyncJobItemStatus.Synced, SyncJobItemStatus.Transferring } }); @@ -531,7 +520,7 @@ namespace MediaBrowser.Server.Implementations.Sync if (duplicateJobItems.Count > 0) { - var syncProvider = _syncManager.GetSyncProvider(jobItem, job) as IHasDuplicateCheck; + var syncProvider = _syncManager.GetSyncProvider(jobItem) as IHasDuplicateCheck; if (!duplicateJobItems.Any(i => AllowDuplicateJobItem(syncProvider, i, jobItem))) { @@ -545,12 +534,12 @@ namespace MediaBrowser.Server.Implementations.Sync var video = item as Video; if (video != null) { - await Sync(jobItem, job, video, user, enableConversion, syncOptions, progress, cancellationToken).ConfigureAwait(false); + await Sync(jobItem, video, user, enableConversion, syncOptions, progress, cancellationToken).ConfigureAwait(false); } else if (item is Audio) { - await Sync(jobItem, job, (Audio)item, user, enableConversion, syncOptions, progress, cancellationToken).ConfigureAwait(false); + await Sync(jobItem, (Audio)item, user, enableConversion, syncOptions, progress, cancellationToken).ConfigureAwait(false); } else if (item is Photo) @@ -574,8 +563,9 @@ namespace MediaBrowser.Server.Implementations.Sync return true; } - private async Task Sync(SyncJobItem jobItem, SyncJob job, Video item, User user, bool enableConversion, SyncOptions syncOptions, IProgress<double> progress, CancellationToken cancellationToken) + private async Task Sync(SyncJobItem jobItem, Video item, User user, bool enableConversion, SyncOptions syncOptions, IProgress<double> progress, CancellationToken cancellationToken) { + var job = _syncManager.GetJob(jobItem.JobId); var jobOptions = _syncManager.GetVideoOptions(jobItem, job); var conversionOptions = new VideoOptions { @@ -616,7 +606,7 @@ namespace MediaBrowser.Server.Implementations.Sync { // Save the job item now since conversion could take a while await _syncManager.UpdateSyncJobItemInternal(jobItem).ConfigureAwait(false); - await UpdateJobStatus(job).ConfigureAwait(false); + await UpdateJobStatus(jobItem.JobId).ConfigureAwait(false); try { @@ -630,7 +620,7 @@ namespace MediaBrowser.Server.Implementations.Sync { jobItem.Progress = pct / 2; await _syncManager.UpdateSyncJobItemInternal(jobItem).ConfigureAwait(false); - await UpdateJobStatus(job).ConfigureAwait(false); + await UpdateJobStatus(jobItem.JobId).ConfigureAwait(false); } }); @@ -642,7 +632,7 @@ namespace MediaBrowser.Server.Implementations.Sync }, innerProgress, cancellationToken); - _syncManager.OnConversionComplete(jobItem, job); + _syncManager.OnConversionComplete(jobItem); } catch (OperationCanceledException) { @@ -716,7 +706,7 @@ namespace MediaBrowser.Server.Implementations.Sync var startingIndex = mediaStreams.Count == 0 ? 0 : - (mediaStreams.Select(i => i.Index).Max() + 1); + mediaStreams.Select(i => i.Index).Max() + 1; foreach (var subtitle in subtitles) { @@ -775,8 +765,9 @@ namespace MediaBrowser.Server.Implementations.Sync private const int DatabaseProgressUpdateIntervalSeconds = 2; - private async Task Sync(SyncJobItem jobItem, SyncJob job, Audio item, User user, bool enableConversion, SyncOptions syncOptions, IProgress<double> progress, CancellationToken cancellationToken) + private async Task Sync(SyncJobItem jobItem, Audio item, User user, bool enableConversion, SyncOptions syncOptions, IProgress<double> progress, CancellationToken cancellationToken) { + var job = _syncManager.GetJob(jobItem.JobId); var jobOptions = _syncManager.GetAudioOptions(jobItem, job); var conversionOptions = new AudioOptions { @@ -803,7 +794,7 @@ namespace MediaBrowser.Server.Implementations.Sync jobItem.Status = SyncJobItemStatus.Converting; await _syncManager.UpdateSyncJobItemInternal(jobItem).ConfigureAwait(false); - await UpdateJobStatus(job).ConfigureAwait(false); + await UpdateJobStatus(jobItem.JobId).ConfigureAwait(false); try { @@ -817,7 +808,7 @@ namespace MediaBrowser.Server.Implementations.Sync { jobItem.Progress = pct / 2; await _syncManager.UpdateSyncJobItemInternal(jobItem).ConfigureAwait(false); - await UpdateJobStatus(job).ConfigureAwait(false); + await UpdateJobStatus(jobItem.JobId).ConfigureAwait(false); } }); @@ -828,7 +819,7 @@ namespace MediaBrowser.Server.Implementations.Sync }, innerProgress, cancellationToken); - _syncManager.OnConversionComplete(jobItem, job); + _syncManager.OnConversionComplete(jobItem); } catch (OperationCanceledException) { diff --git a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs index fbbc6082a..044c8b93a 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs @@ -1,17 +1,14 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Events; using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Controller; -using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.Playlists; using MediaBrowser.Controller.Sync; @@ -486,7 +483,7 @@ namespace MediaBrowser.Server.Implementations.Sync private string GetSyncProviderId(ISyncProvider provider) { - return (provider.GetType().Name).GetMD5().ToString("N"); + return provider.GetType().Name.GetMD5().ToString("N"); } public bool SupportsSync(BaseItem item) @@ -1120,7 +1117,7 @@ namespace MediaBrowser.Server.Implementations.Sync public SyncJobOptions GetAudioOptions(SyncJobItem jobItem, SyncJob job) { var options = GetSyncJobOptions(jobItem.TargetId, null, null); - + if (job.Bitrate.HasValue) { options.DeviceProfile.MaxStaticBitrate = job.Bitrate.Value; @@ -1129,7 +1126,7 @@ namespace MediaBrowser.Server.Implementations.Sync return options; } - public ISyncProvider GetSyncProvider(SyncJobItem jobItem, SyncJob job) + public ISyncProvider GetSyncProvider(SyncJobItem jobItem) { foreach (var provider in _providers) { @@ -1326,9 +1323,9 @@ namespace MediaBrowser.Server.Implementations.Sync return list; } - protected internal void OnConversionComplete(SyncJobItem item, SyncJob job) + protected internal void OnConversionComplete(SyncJobItem item) { - var syncProvider = GetSyncProvider(item, job); + var syncProvider = GetSyncProvider(item); if (syncProvider is AppSyncProvider) { return; diff --git a/MediaBrowser.Server.Implementations/Sync/SyncRepository.cs b/MediaBrowser.Server.Implementations/Sync/SyncRepository.cs index 7a1f276f9..464e8aa58 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncRepository.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncRepository.cs @@ -12,7 +12,6 @@ using System.Data; using System.Globalization; using System.IO; using System.Linq; -using System.Threading; using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.Sync @@ -105,7 +104,7 @@ namespace MediaBrowser.Server.Implementations.Sync // _updateJobCommand _updateJobCommand = _connection.CreateCommand(); - _updateJobCommand.CommandText = "update SyncJobs set TargetId=@TargetId,Name=@Name,Profile=@Profile,Quality=@Quality,Bitrate=@Bitrate,Status=@Status,Progress=@Progress,UserId=@UserId,ItemIds=@ItemIds,Category=@Category,ParentId=@ParentId,UnwatchedOnly=@UnwatchedOnly,ItemLimit=@ItemLimit,SyncNewContent=@SyncNewContent,DateCreated=@DateCreated,DateLastModified=@DateLastModified,ItemCount=@ItemCount where Id=@ID"; + _updateJobCommand.CommandText = "update SyncJobs set TargetId=@TargetId,Name=@Name,Profile=@Profile,Quality=@Quality,Bitrate=@Bitrate,Status=@Status,Progress=@Progress,UserId=@UserId,ItemIds=@ItemIds,Category=@Category,ParentId=@ParentId,UnwatchedOnly=@UnwatchedOnly,ItemLimit=@ItemLimit,SyncNewContent=@SyncNewContent,DateCreated=@DateCreated,DateLastModified=@DateLastModified,ItemCount=@ItemCount where Id=@Id"; _updateJobCommand.Parameters.Add(_updateJobCommand, "@Id"); _updateJobCommand.Parameters.Add(_updateJobCommand, "@TargetId"); diff --git a/MediaBrowser.Server.Implementations/Sync/SyncedMediaSourceProvider.cs b/MediaBrowser.Server.Implementations/Sync/SyncedMediaSourceProvider.cs index 456a1fcc1..efd37fa00 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncedMediaSourceProvider.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncedMediaSourceProvider.cs @@ -11,7 +11,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.Server.Implementations.Sync { diff --git a/MediaBrowser.Server.Implementations/Sync/TargetDataProvider.cs b/MediaBrowser.Server.Implementations/Sync/TargetDataProvider.cs index 24c62a58f..106dc9115 100644 --- a/MediaBrowser.Server.Implementations/Sync/TargetDataProvider.cs +++ b/MediaBrowser.Server.Implementations/Sync/TargetDataProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Controller; using MediaBrowser.Controller.Sync; using MediaBrowser.Model.Logging; diff --git a/MediaBrowser.Server.Implementations/UserViews/CollectionFolderImageProvider.cs b/MediaBrowser.Server.Implementations/UserViews/CollectionFolderImageProvider.cs index de0b0e758..a66884f89 100644 --- a/MediaBrowser.Server.Implementations/UserViews/CollectionFolderImageProvider.cs +++ b/MediaBrowser.Server.Implementations/UserViews/CollectionFolderImageProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; diff --git a/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs b/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs index 167b5706e..911dbb0cb 100644 --- a/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs +++ b/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; @@ -70,7 +69,7 @@ namespace MediaBrowser.Server.Implementations.UserViews var result = await view.GetItems(new InternalItemsQuery { - User = (view.UserId.HasValue ? _userManager.GetUserById(view.UserId.Value) : null), + User = view.UserId.HasValue ? _userManager.GetUserById(view.UserId.Value) : null, CollapseBoxSetItems = false, Recursive = recursive, ExcludeItemTypes = new[] { "UserView", "CollectionFolder" } @@ -135,7 +134,7 @@ namespace MediaBrowser.Server.Implementations.UserViews var view = item as UserView; if (view != null) { - return (IsUsingCollectionStrip(view)); + return IsUsingCollectionStrip(view); } return false; diff --git a/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs b/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs index e54bc0b4a..6d19c3275 100644 --- a/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs +++ b/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs @@ -9,6 +9,8 @@ using System.Collections.Generic; using System.Reflection; using System.Text.RegularExpressions; using MediaBrowser.Controller.Power; +using MediaBrowser.Server.Startup.Common.FFMpeg; +using OperatingSystem = MediaBrowser.Server.Startup.Common.OperatingSystem; namespace MediaBrowser.Server.Mono.Native { @@ -209,6 +211,99 @@ namespace MediaBrowser.Server.Mono.Native { return new NullPowerManagement(); } + + public FFMpegInstallInfo GetFfmpegInstallInfo() + { + return GetInfo(Environment); + } + + public static FFMpegInstallInfo GetInfo(NativeEnvironment environment) + { + var info = new FFMpegInstallInfo(); + + // Windows builds: http://ffmpeg.zeranoe.com/builds/ + // Linux builds: http://johnvansickle.com/ffmpeg/ + // OS X builds: http://ffmpegmac.net/ + // OS X x64: http://www.evermeet.cx/ffmpeg/ + + switch (environment.OperatingSystem) + { + case OperatingSystem.Bsd: + break; + case OperatingSystem.Linux: + + info.ArchiveType = "7z"; + info.Version = "20160215"; + break; + case OperatingSystem.Osx: + + info.ArchiveType = "7z"; + + switch (environment.SystemArchitecture) + { + case Architecture.X86_X64: + info.Version = "20160124"; + break; + case Architecture.X86: + info.Version = "20150110"; + break; + } + break; + } + + info.DownloadUrls = GetDownloadUrls(environment); + + return info; + } + + private static string[] GetDownloadUrls(NativeEnvironment environment) + { + switch (environment.OperatingSystem) + { + case OperatingSystem.Osx: + + switch (environment.SystemArchitecture) + { + case Architecture.X86_X64: + return new[] + { + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x64-2.8.5.7z" + }; + case Architecture.X86: + return new[] + { + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x86-2.5.3.7z" + }; + } + break; + + case OperatingSystem.Linux: + + switch (environment.SystemArchitecture) + { + case Architecture.X86_X64: + return new[] + { + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-64bit-static.7z" + }; + case Architecture.X86: + return new[] + { + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-32bit-static.7z" + }; + case Architecture.Arm: + return new[] + { + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-arm.7z" + }; + } + break; + } + + // No version available + return new string[] { }; + } + } public class NullPowerManagement : IPowerManagement diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs index bccf6487a..2a0609449 100644 --- a/MediaBrowser.Server.Mono/Program.cs +++ b/MediaBrowser.Server.Mono/Program.cs @@ -1,4 +1,3 @@ -using MediaBrowser.Common.Implementations.IO; using MediaBrowser.Common.Implementations.Logging; using MediaBrowser.Model.Logging; using MediaBrowser.Server.Implementations; diff --git a/MediaBrowser.Server.Mono/Properties/AssemblyInfo.cs b/MediaBrowser.Server.Mono/Properties/AssemblyInfo.cs index 15cff7fc3..d4856bd01 100644 --- a/MediaBrowser.Server.Mono/Properties/AssemblyInfo.cs +++ b/MediaBrowser.Server.Mono/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index 210e0abbd..93dbe2945 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -48,7 +48,6 @@ using MediaBrowser.Dlna.ContentDirectory; using MediaBrowser.Dlna.Main; using MediaBrowser.Dlna.MediaReceiverRegistrar; using MediaBrowser.Dlna.Ssdp; -using MediaBrowser.LocalMetadata.Providers; using MediaBrowser.LocalMetadata.Savers; using MediaBrowser.MediaEncoding.BdInfo; using MediaBrowser.MediaEncoding.Encoder; @@ -619,7 +618,7 @@ namespace MediaBrowser.Server.Startup.Common /// <returns>Task.</returns> private async Task RegisterMediaEncoder(IProgress<double> progress) { - var info = await new FFMpegDownloader(Logger, ApplicationPaths, HttpClient, ZipClient, FileSystemManager, NativeApp.Environment) + var info = await new FFMpegLoader(Logger, ApplicationPaths, HttpClient, ZipClient, FileSystemManager, NativeApp.Environment, NativeApp.GetType().Assembly, NativeApp.GetFfmpegInstallInfo()) .GetFFMpegInfo(NativeApp.Environment, _startupOptions, progress).ConfigureAwait(false); var mediaEncoder = new MediaEncoder(LogManager.GetLogger("MediaEncoder"), diff --git a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs deleted file mode 100644 index 60cb50e30..000000000 --- a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs +++ /dev/null @@ -1,142 +0,0 @@ - -namespace MediaBrowser.Server.Startup.Common.FFMpeg -{ - public class FFMpegDownloadInfo - { - public string Version { get; set; } - public string FFMpegFilename { get; set; } - public string FFProbeFilename { get; set; } - public string ArchiveType { get; set; } - public string[] DownloadUrls { get; set; } - - public FFMpegDownloadInfo() - { - DownloadUrls = new string[] { }; - Version = "Path"; - FFMpegFilename = "ffmpeg"; - FFProbeFilename = "ffprobe"; - } - - public static FFMpegDownloadInfo GetInfo(NativeEnvironment environment) - { - var info = new FFMpegDownloadInfo(); - - // Windows builds: http://ffmpeg.zeranoe.com/builds/ - // Linux builds: http://johnvansickle.com/ffmpeg/ - // OS X builds: http://ffmpegmac.net/ - // OS X x64: http://www.evermeet.cx/ffmpeg/ - - switch (environment.OperatingSystem) - { - case OperatingSystem.Bsd: - break; - case OperatingSystem.Linux: - - info.ArchiveType = "7z"; - info.Version = "20160215"; - break; - case OperatingSystem.Osx: - - info.ArchiveType = "7z"; - - switch (environment.SystemArchitecture) - { - case Architecture.X86_X64: - info.Version = "20160124"; - break; - case Architecture.X86: - info.Version = "20150110"; - break; - } - break; - - case OperatingSystem.Windows: - - info.FFMpegFilename = "ffmpeg.exe"; - info.FFProbeFilename = "ffprobe.exe"; - info.Version = "20160131"; - info.ArchiveType = "7z"; - - switch (environment.SystemArchitecture) - { - case Architecture.X86_X64: - break; - case Architecture.X86: - break; - } - break; - } - - info.DownloadUrls = GetDownloadUrls(environment); - - return info; - } - - private static string[] GetDownloadUrls(NativeEnvironment environment) - { - switch (environment.OperatingSystem) - { - case OperatingSystem.Windows: - - switch (environment.SystemArchitecture) - { - case Architecture.X86_X64: - return new[] - { - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160131-win64.7z", - "http://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20151109-git-480bad7-win64-static.7z" - }; - case Architecture.X86: - return new[] - { - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160131-win32.7z", - "http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20151109-git-480bad7-win32-static.7z" - }; - } - break; - - case OperatingSystem.Osx: - - switch (environment.SystemArchitecture) - { - case Architecture.X86_X64: - return new[] - { - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x64-2.8.5.7z" - }; - case Architecture.X86: - return new[] - { - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x86-2.5.3.7z" - }; - } - break; - - case OperatingSystem.Linux: - - switch (environment.SystemArchitecture) - { - case Architecture.X86_X64: - return new[] - { - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-64bit-static.7z" - }; - case Architecture.X86: - return new[] - { - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-32bit-static.7z" - }; - case Architecture.Arm: - return new[] - { - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-arm.7z" - }; - } - break; - } - - // No version available - return new string[] { }; - } - } -}
\ No newline at end of file diff --git a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegInstallInfo.cs b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegInstallInfo.cs new file mode 100644 index 000000000..1ce1b55c2 --- /dev/null +++ b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegInstallInfo.cs @@ -0,0 +1,21 @@ + +namespace MediaBrowser.Server.Startup.Common.FFMpeg +{ + public class FFMpegInstallInfo + { + public string Version { get; set; } + public string FFMpegFilename { get; set; } + public string FFProbeFilename { get; set; } + public string ArchiveType { get; set; } + public string[] DownloadUrls { get; set; } + public bool IsEmbedded { get; set; } + + public FFMpegInstallInfo() + { + DownloadUrls = new string[] { }; + Version = "Path"; + FFMpegFilename = "ffmpeg"; + FFProbeFilename = "ffprobe"; + } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloader.cs b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegLoader.cs index 7a83ddc7e..ee284fdc5 100644 --- a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloader.cs +++ b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegLoader.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; @@ -9,6 +8,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -16,7 +16,7 @@ using CommonIO; namespace MediaBrowser.Server.Startup.Common.FFMpeg { - public class FFMpegDownloader + public class FFMpegLoader { private readonly IHttpClient _httpClient; private readonly IApplicationPaths _appPaths; @@ -24,13 +24,15 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg private readonly IZipClient _zipClient; private readonly IFileSystem _fileSystem; private readonly NativeEnvironment _environment; + private readonly Assembly _ownerAssembly; + private readonly FFMpegInstallInfo _ffmpegInstallInfo; private readonly string[] _fontUrls = { "https://github.com/MediaBrowser/MediaBrowser.Resources/raw/master/ffmpeg/ARIALUNI.7z" }; - public FFMpegDownloader(ILogger logger, IApplicationPaths appPaths, IHttpClient httpClient, IZipClient zipClient, IFileSystem fileSystem, NativeEnvironment environment) + public FFMpegLoader(ILogger logger, IApplicationPaths appPaths, IHttpClient httpClient, IZipClient zipClient, IFileSystem fileSystem, NativeEnvironment environment, Assembly ownerAssembly, FFMpegInstallInfo ffmpegInstallInfo) { _logger = logger; _appPaths = appPaths; @@ -38,6 +40,8 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg _zipClient = zipClient; _fileSystem = fileSystem; _environment = environment; + _ownerAssembly = ownerAssembly; + _ffmpegInstallInfo = ffmpegInstallInfo; } public async Task<FFMpegInfo> GetFFMpegInfo(NativeEnvironment environment, StartupOptions options, IProgress<double> progress) @@ -55,7 +59,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg }; } - var downloadInfo = FFMpegDownloadInfo.GetInfo(environment); + var downloadInfo = _ffmpegInstallInfo; var version = downloadInfo.Version; @@ -79,11 +83,11 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg Version = version }; - _fileSystem.CreateDirectory(versionedDirectoryPath); + _fileSystem.CreateDirectory(versionedDirectoryPath); var excludeFromDeletions = new List<string> { versionedDirectoryPath }; - if (!_fileSystem.FileExists(info.ProbePath) || !_fileSystem.FileExists(info.EncoderPath)) + if (!_fileSystem.FileExists(info.ProbePath) || !_fileSystem.FileExists(info.EncoderPath)) { // ffmpeg not present. See if there's an older version we can start with var existingVersion = GetExistingVersion(info, rootEncoderPath); @@ -107,7 +111,10 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg } } - await DownloadFonts(versionedDirectoryPath).ConfigureAwait(false); + if (_environment.OperatingSystem == OperatingSystem.Windows) + { + await DownloadFonts(versionedDirectoryPath).ConfigureAwait(false); + } DeleteOlderFolders(Path.GetDirectoryName(versionedDirectoryPath), excludeFromDeletions); @@ -176,7 +183,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg return null; } - private async void DownloadFFMpegInBackground(FFMpegDownloadInfo downloadinfo, string directory) + private async void DownloadFFMpegInBackground(FFMpegInstallInfo downloadinfo, string directory) { try { @@ -188,8 +195,24 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg } } - private async Task DownloadFFMpeg(FFMpegDownloadInfo downloadinfo, string directory, IProgress<double> progress) + private async Task DownloadFFMpeg(FFMpegInstallInfo downloadinfo, string directory, IProgress<double> progress) { + if (downloadinfo.IsEmbedded) + { + var tempFile = Path.Combine(_appPaths.TempDirectory, Guid.NewGuid().ToString()); + _fileSystem.CreateDirectory(Path.GetDirectoryName(tempFile)); + + using (var stream = _ownerAssembly.GetManifestResourceStream(downloadinfo.DownloadUrls[0])) + { + using (var fs = _fileSystem.GetFileStream(tempFile, FileMode.Create, FileAccess.Write, FileShare.Read, true)) + { + await stream.CopyToAsync(fs).ConfigureAwait(false); + } + } + ExtractFFMpeg(downloadinfo, tempFile, directory); + return; + } + foreach (var url in downloadinfo.DownloadUrls) { progress.Report(0); @@ -217,19 +240,17 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg { throw new ApplicationException("ffmpeg unvailable. Please install it and start the server with two command line arguments: -ffmpeg \"{PATH}\" and -ffprobe \"{PATH}\""); } - else - { - throw new ApplicationException("Unable to download required components. Please try again later."); - } + + throw new ApplicationException("Unable to download required components. Please try again later."); } - private void ExtractFFMpeg(FFMpegDownloadInfo downloadinfo, string tempFile, string targetFolder) + private void ExtractFFMpeg(FFMpegInstallInfo downloadinfo, string tempFile, string targetFolder) { _logger.Info("Extracting ffmpeg from {0}", tempFile); var tempFolder = Path.Combine(_appPaths.TempDirectory, Guid.NewGuid().ToString()); - _fileSystem.CreateDirectory(tempFolder); + _fileSystem.CreateDirectory(tempFolder); try { @@ -248,7 +269,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg })) { var targetFile = Path.Combine(targetFolder, Path.GetFileName(file)); - _fileSystem.CopyFile(file, targetFile, true); + _fileSystem.CopyFile(file, targetFile, true); SetFilePermissions(targetFile); } } @@ -269,7 +290,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg } } - private void ExtractArchive(FFMpegDownloadInfo downloadinfo, string archivePath, string targetPath) + private void ExtractArchive(FFMpegInstallInfo downloadinfo, string archivePath, string targetPath) { _logger.Info("Extracting {0} to {1}", archivePath, targetPath); @@ -312,13 +333,13 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg { var fontsDirectory = Path.Combine(targetPath, "fonts"); - _fileSystem.CreateDirectory(fontsDirectory); + _fileSystem.CreateDirectory(fontsDirectory); const string fontFilename = "ARIALUNI.TTF"; var fontFile = Path.Combine(fontsDirectory, fontFilename); - if (_fileSystem.FileExists(fontFile)) + if (_fileSystem.FileExists(fontFile)) { await WriteFontConfigFile(fontsDirectory).ConfigureAwait(false); } @@ -361,7 +382,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg { try { - _fileSystem.CopyFile(existingFile, Path.Combine(fontsDirectory, fontFilename), true); + _fileSystem.CopyFile(existingFile, Path.Combine(fontsDirectory, fontFilename), true); return; } catch (IOException ex) @@ -423,7 +444,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg const string fontConfigFilename = "fonts.conf"; var fontConfigFile = Path.Combine(fontsDirectory, fontConfigFilename); - if (!_fileSystem.FileExists(fontConfigFile)) + if (!_fileSystem.FileExists(fontConfigFile)) { var contents = string.Format("<?xml version=\"1.0\"?><fontconfig><dir>{0}</dir><alias><family>Arial</family><prefer>Arial Unicode MS</prefer></alias></fontconfig>", fontsDirectory); diff --git a/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs b/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs index 5854a5804..5ba5fb44a 100644 --- a/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs +++ b/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs @@ -1,12 +1,8 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.Extensions; using MediaBrowser.Model.Logging; using System; using System.Diagnostics; -using System.Globalization; using System.IO; -using System.Text; -using MediaBrowser.Common.IO; using System.Collections.Generic; using CommonIO; diff --git a/MediaBrowser.Server.Startup.Common/INativeApp.cs b/MediaBrowser.Server.Startup.Common/INativeApp.cs index 9df670bda..121d4192e 100644 --- a/MediaBrowser.Server.Startup.Common/INativeApp.cs +++ b/MediaBrowser.Server.Startup.Common/INativeApp.cs @@ -3,6 +3,7 @@ using MediaBrowser.Model.Logging; using System.Collections.Generic; using System.Reflection; using MediaBrowser.Controller.Power; +using MediaBrowser.Server.Startup.Common.FFMpeg; namespace MediaBrowser.Server.Startup.Common { @@ -97,5 +98,7 @@ namespace MediaBrowser.Server.Startup.Common /// </summary> /// <returns>IPowerManagement.</returns> IPowerManagement GetPowerManagement(); + + FFMpegInstallInfo GetFfmpegInstallInfo(); } } diff --git a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj index 80ce88fa3..19ce9ed9e 100644 --- a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj +++ b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj @@ -65,8 +65,8 @@ <Compile Include="Browser\BrowserLauncher.cs" /> <Compile Include="EntryPoints\KeepServerAwake.cs" /> <Compile Include="EntryPoints\StartupWizard.cs" /> - <Compile Include="FFMpeg\FFMpegDownloader.cs" /> - <Compile Include="FFMpeg\FFMpegDownloadInfo.cs" /> + <Compile Include="FFMpeg\FFMpegLoader.cs" /> + <Compile Include="FFMpeg\FFMpegInstallInfo.cs" /> <Compile Include="FFMpeg\FFMpegInfo.cs" /> <Compile Include="FFMpeg\FFmpegValidator.cs" /> <Compile Include="INativeApp.cs" /> diff --git a/MediaBrowser.Server.Startup.Common/Migrations/MovieDbEpisodeProviderMigration.cs b/MediaBrowser.Server.Startup.Common/Migrations/MovieDbEpisodeProviderMigration.cs index c2ed0c981..3ad5f577f 100644 --- a/MediaBrowser.Server.Startup.Common/Migrations/MovieDbEpisodeProviderMigration.cs +++ b/MediaBrowser.Server.Startup.Common/Migrations/MovieDbEpisodeProviderMigration.cs @@ -1,9 +1,5 @@ using MediaBrowser.Controller.Configuration; -using System; -using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace MediaBrowser.Server.Startup.Common.Migrations { diff --git a/MediaBrowser.Server.Startup.Common/Migrations/OmdbEpisodeProviderMigration.cs b/MediaBrowser.Server.Startup.Common/Migrations/OmdbEpisodeProviderMigration.cs index 00f6a692b..ebc0e67de 100644 --- a/MediaBrowser.Server.Startup.Common/Migrations/OmdbEpisodeProviderMigration.cs +++ b/MediaBrowser.Server.Startup.Common/Migrations/OmdbEpisodeProviderMigration.cs @@ -1,9 +1,5 @@ using MediaBrowser.Controller.Configuration; -using System; -using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace MediaBrowser.Server.Startup.Common.Migrations { diff --git a/MediaBrowser.Server.Startup.Common/Properties/AssemblyInfo.cs b/MediaBrowser.Server.Startup.Common/Properties/AssemblyInfo.cs index e29fa7fa7..c8e037804 100644 --- a/MediaBrowser.Server.Startup.Common/Properties/AssemblyInfo.cs +++ b/MediaBrowser.Server.Startup.Common/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/MediaBrowser.ServerApplication/App.config b/MediaBrowser.ServerApplication/App.config index 14ce35a96..a92d92300 100644 --- a/MediaBrowser.ServerApplication/App.config +++ b/MediaBrowser.ServerApplication/App.config @@ -1,80 +1,80 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> - <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" /> + <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/> - <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/> </configSections> <system.diagnostics> - <assert assertuienabled="false" /> + <assert assertuienabled="false"/> </system.diagnostics> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <targets async="true"></targets> </nlog> <appSettings> - <add key="DebugProgramDataPath" value="..\..\..\ProgramData-Server" /> - <add key="ReleaseProgramDataPath" value=".." /> - <add key="ClientSettingsProvider.ServiceUri" value="" /> + <add key="DebugProgramDataPath" value="..\..\..\ProgramData-Server"/> + <add key="ReleaseProgramDataPath" value=".."/> + <add key="ClientSettingsProvider.ServiceUri" value=""/> </appSettings> <startup useLegacyV2RuntimeActivationPolicy="true"> - <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/> </startup> <runtime> - <gcAllowVeryLargeObjects enabled="true" /> - <gcServer enabled="true" /> + <gcAllowVeryLargeObjects enabled="true"/> + <gcServer enabled="true"/> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> - <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> + <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/> </dependentAssembly> <dependentAssembly> - <assemblyIdentity name="System.Reactive.Core" publicKeyToken="f300afd708cefcd3" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-2.0.20823.0" newVersion="2.0.20823.0" /> + <assemblyIdentity name="System.Reactive.Core" publicKeyToken="f300afd708cefcd3" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-2.0.20823.0" newVersion="2.0.20823.0"/> </dependentAssembly> <dependentAssembly> - <assemblyIdentity name="System.Reactive.Interfaces" publicKeyToken="f300afd708cefcd3" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-2.0.20823.0" newVersion="2.0.20823.0" /> + <assemblyIdentity name="System.Reactive.Interfaces" publicKeyToken="f300afd708cefcd3" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-2.0.20823.0" newVersion="2.0.20823.0"/> </dependentAssembly> <dependentAssembly> - <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-1.5.11.0" newVersion="1.5.11.0" /> + <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-1.5.11.0" newVersion="1.5.11.0"/> </dependentAssembly> <dependentAssembly> - <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-1.5.11.0" newVersion="1.5.11.0" /> + <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-1.5.11.0" newVersion="1.5.11.0"/> </dependentAssembly> <dependentAssembly> - <assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-1.0.94.0" newVersion="1.0.94.0" /> + <assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-1.0.94.0" newVersion="1.0.94.0"/> </dependentAssembly> <dependentAssembly> - <assemblyIdentity name="SimpleInjector" publicKeyToken="984cb50dea722e99" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-2.3.6.0" newVersion="2.3.6.0" /> + <assemblyIdentity name="SimpleInjector" publicKeyToken="984cb50dea722e99" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-2.3.6.0" newVersion="2.3.6.0"/> </dependentAssembly> </assemblyBinding> </runtime> <system.web> <membership defaultProvider="ClientAuthenticationMembershipProvider"> <providers> - <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" /> + <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri=""/> </providers> </membership> <roleManager defaultProvider="ClientRoleProvider" enabled="true"> <providers> - <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" /> + <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400"/> </providers> </roleManager> </system.web> <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> <parameters> - <parameter value="v11.0" /> + <parameter value="v11.0"/> </parameters> </defaultConnectionFactory> <providers> - <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> - <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" /> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/> + <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6"/> </providers> </entityFramework> -</configuration>
\ No newline at end of file +</configuration> diff --git a/MediaBrowser.ServerApplication/BackgroundService.cs b/MediaBrowser.ServerApplication/BackgroundService.cs index c091c08ee..e90251ae6 100644 --- a/MediaBrowser.ServerApplication/BackgroundService.cs +++ b/MediaBrowser.ServerApplication/BackgroundService.cs @@ -1,5 +1,4 @@ using MediaBrowser.Model.Logging; -using System.Linq; using System.ServiceProcess; namespace MediaBrowser.ServerApplication diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index 5f528926b..ac1b7ca99 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -217,6 +217,7 @@ namespace MediaBrowser.ServerApplication { var fileSystem = new WindowsFileSystem(new PatternsLogger(logManager.GetLogger("FileSystem"))); fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem)); + //fileSystem.AddShortcutHandler(new LnkShortcutHandler(fileSystem)); var nativeApp = new WindowsApp(fileSystem, _logger) { diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 6ba91c06f..291e63dac 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> @@ -9,9 +9,10 @@ <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>MediaBrowser.ServerApplication</RootNamespace> <AssemblyName>MediaBrowser.ServerApplication</AssemblyName> - <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir> + <TargetFrameworkProfile /> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PlatformTarget>AnyCPU</PlatformTarget> @@ -69,16 +70,10 @@ <SpecificVersion>False</SpecificVersion> <HintPath>..\packages\ImageMagickSharp.1.0.0.18\lib\net45\ImageMagickSharp.dll</HintPath> </Reference> - <Reference Include="MediaBrowser.IsoMounter"> - <HintPath>..\packages\MediaBrowser.IsoMounting.3.0.69\lib\net45\MediaBrowser.IsoMounter.dll</HintPath> - </Reference> <Reference Include="Patterns.Logging, Version=1.0.5494.41209, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll</HintPath> </Reference> - <Reference Include="pfmclrapi"> - <HintPath>..\packages\MediaBrowser.IsoMounting.3.0.69\lib\net45\pfmclrapi.dll</HintPath> - </Reference> <Reference Include="ServiceStack.Interfaces"> <HintPath>..\ThirdParty\ServiceStack\ServiceStack.Interfaces.dll</HintPath> </Reference> @@ -116,7 +111,7 @@ <DependentUpon>MainForm.cs</DependentUpon> </Compile> <Compile Include="MainStartup.cs" /> - <Compile Include="Native\Autorun.cs" /> + <Compile Include="Native\LnkShortcutHandler.cs" /> <Compile Include="Native\Standby.cs" /> <Compile Include="Native\ServerAuthorization.cs" /> <Compile Include="Native\WindowsApp.cs" /> @@ -144,6 +139,8 @@ <None Include="App.config" /> <None Include="app.manifest" /> <EmbeddedResource Include="Native\RegisterServer.bat" /> + <EmbeddedResource Include="ffmpeg\ffmpegx64.7z" /> + <EmbeddedResource Include="ffmpeg\ffmpegx86.7z" /> <None Include="packages.config" /> </ItemGroup> <ItemGroup> diff --git a/MediaBrowser.ServerApplication/Native/Autorun.cs b/MediaBrowser.ServerApplication/Native/Autorun.cs deleted file mode 100644 index c384d0460..000000000 --- a/MediaBrowser.ServerApplication/Native/Autorun.cs +++ /dev/null @@ -1,36 +0,0 @@ -using MediaBrowser.Common.IO; -using System; -using System.IO; -using CommonIO; - -namespace MediaBrowser.ServerApplication.Native -{ - /// <summary> - /// Class Autorun - /// </summary> - public static class Autorun - { - /// <summary> - /// Configures the specified autorun. - /// </summary> - /// <param name="autorun">if set to <c>true</c> [autorun].</param> - /// <param name="fileSystem">The file system.</param> - public static void Configure(bool autorun, IFileSystem fileSystem) - { - var shortcutPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "Emby", "Emby Server.lnk"); - - var startupPath = Environment.GetFolderPath(Environment.SpecialFolder.Startup); - - if (autorun) - { - //Copy our shortut into the startup folder for this user - File.Copy(shortcutPath, Path.Combine(startupPath, Path.GetFileName(shortcutPath) ?? "Emby Server.lnk"), true); - } - else - { - //Remove our shortcut from the startup folder for this user - fileSystem.DeleteFile(Path.Combine(startupPath, Path.GetFileName(shortcutPath) ?? "Emby Server.lnk")); - } - } - } -} diff --git a/MediaBrowser.ServerApplication/Native/LnkShortcutHandler.cs b/MediaBrowser.ServerApplication/Native/LnkShortcutHandler.cs new file mode 100644 index 000000000..67d2e83f0 --- /dev/null +++ b/MediaBrowser.ServerApplication/Native/LnkShortcutHandler.cs @@ -0,0 +1,402 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Security; +using System.Text; +using System.Threading.Tasks; +using CommonIO; + +namespace MediaBrowser.ServerApplication.Native +{ + public class LnkShortcutHandler : IShortcutHandler + { + public string Extension + { + get { return ".lnk"; } + } + + public string Resolve(string shortcutPath) + { + var link = new ShellLink(); + ((IPersistFile)link).Load(shortcutPath, NativeMethods.STGM_READ); + // ((IShellLinkW)link).Resolve(hwnd, 0) + var sb = new StringBuilder(NativeMethods.MAX_PATH); + WIN32_FIND_DATA data; + ((IShellLinkW)link).GetPath(sb, sb.Capacity, out data, 0); + return sb.ToString(); + } + + public void Create(string shortcutPath, string targetPath) + { + throw new NotImplementedException(); + } + } + + /// <summary> + /// Class NativeMethods + /// </summary> + [SuppressUnmanagedCodeSecurity] + public static class NativeMethods + { + /// <summary> + /// The MA x_ PATH + /// </summary> + public const int MAX_PATH = 260; + /// <summary> + /// The MA x_ ALTERNATE + /// </summary> + public const int MAX_ALTERNATE = 14; + /// <summary> + /// The INVALI d_ HANDL e_ VALUE + /// </summary> + public static IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1); + /// <summary> + /// The STG m_ READ + /// </summary> + public const uint STGM_READ = 0; + } + + /// <summary> + /// Struct FILETIME + /// </summary> + [StructLayout(LayoutKind.Sequential)] + public struct FILETIME + { + /// <summary> + /// The dw low date time + /// </summary> + public uint dwLowDateTime; + /// <summary> + /// The dw high date time + /// </summary> + public uint dwHighDateTime; + } + + /// <summary> + /// Struct WIN32_FIND_DATA + /// </summary> + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct WIN32_FIND_DATA + { + /// <summary> + /// The dw file attributes + /// </summary> + public FileAttributes dwFileAttributes; + /// <summary> + /// The ft creation time + /// </summary> + public FILETIME ftCreationTime; + /// <summary> + /// The ft last access time + /// </summary> + public FILETIME ftLastAccessTime; + /// <summary> + /// The ft last write time + /// </summary> + public FILETIME ftLastWriteTime; + /// <summary> + /// The n file size high + /// </summary> + public int nFileSizeHigh; + /// <summary> + /// The n file size low + /// </summary> + public int nFileSizeLow; + /// <summary> + /// The dw reserved0 + /// </summary> + public int dwReserved0; + /// <summary> + /// The dw reserved1 + /// </summary> + public int dwReserved1; + + /// <summary> + /// The c file name + /// </summary> + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = NativeMethods.MAX_PATH)] + public string cFileName; + + /// <summary> + /// This will always be null when FINDEX_INFO_LEVELS = basic + /// </summary> + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = NativeMethods.MAX_ALTERNATE)] + public string cAlternate; + + /// <summary> + /// Gets or sets the path. + /// </summary> + /// <value>The path.</value> + public string Path { get; set; } + + /// <summary> + /// Returns a <see cref="System.String" /> that represents this instance. + /// </summary> + /// <returns>A <see cref="System.String" /> that represents this instance.</returns> + public override string ToString() + { + return Path ?? string.Empty; + } + } + + /// <summary> + /// Enum SLGP_FLAGS + /// </summary> + [Flags] + public enum SLGP_FLAGS + { + /// <summary> + /// Retrieves the standard short (8.3 format) file name + /// </summary> + SLGP_SHORTPATH = 0x1, + /// <summary> + /// Retrieves the Universal Naming Convention (UNC) path name of the file + /// </summary> + SLGP_UNCPRIORITY = 0x2, + /// <summary> + /// Retrieves the raw path name. A raw path is something that might not exist and may include environment variables that need to be expanded + /// </summary> + SLGP_RAWPATH = 0x4 + } + /// <summary> + /// Enum SLR_FLAGS + /// </summary> + [Flags] + public enum SLR_FLAGS + { + /// <summary> + /// Do not display a dialog box if the link cannot be resolved. When SLR_NO_UI is set, + /// the high-order word of fFlags can be set to a time-out value that specifies the + /// maximum amount of time to be spent resolving the link. The function returns if the + /// link cannot be resolved within the time-out duration. If the high-order word is set + /// to zero, the time-out duration will be set to the default value of 3,000 milliseconds + /// (3 seconds). To specify a value, set the high word of fFlags to the desired time-out + /// duration, in milliseconds. + /// </summary> + SLR_NO_UI = 0x1, + /// <summary> + /// Obsolete and no longer used + /// </summary> + SLR_ANY_MATCH = 0x2, + /// <summary> + /// If the link object has changed, update its path and list of identifiers. + /// If SLR_UPDATE is set, you do not need to call IPersistFile::IsDirty to determine + /// whether or not the link object has changed. + /// </summary> + SLR_UPDATE = 0x4, + /// <summary> + /// Do not update the link information + /// </summary> + SLR_NOUPDATE = 0x8, + /// <summary> + /// Do not execute the search heuristics + /// </summary> + SLR_NOSEARCH = 0x10, + /// <summary> + /// Do not use distributed link tracking + /// </summary> + SLR_NOTRACK = 0x20, + /// <summary> + /// Disable distributed link tracking. By default, distributed link tracking tracks + /// removable media across multiple devices based on the volume name. It also uses the + /// Universal Naming Convention (UNC) path to track remote file systems whose drive letter + /// has changed. Setting SLR_NOLINKINFO disables both types of tracking. + /// </summary> + SLR_NOLINKINFO = 0x40, + /// <summary> + /// Call the Microsoft Windows Installer + /// </summary> + SLR_INVOKE_MSI = 0x80 + } + + /// <summary> + /// The IShellLink interface allows Shell links to be created, modified, and resolved + /// </summary> + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("000214F9-0000-0000-C000-000000000046")] + public interface IShellLinkW + { + /// <summary> + /// Retrieves the path and file name of a Shell link object + /// </summary> + /// <param name="pszFile">The PSZ file.</param> + /// <param name="cchMaxPath">The CCH max path.</param> + /// <param name="pfd">The PFD.</param> + /// <param name="fFlags">The f flags.</param> + void GetPath([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile, int cchMaxPath, out WIN32_FIND_DATA pfd, SLGP_FLAGS fFlags); + /// <summary> + /// Retrieves the list of item identifiers for a Shell link object + /// </summary> + /// <param name="ppidl">The ppidl.</param> + void GetIDList(out IntPtr ppidl); + /// <summary> + /// Sets the pointer to an item identifier list (PIDL) for a Shell link object. + /// </summary> + /// <param name="pidl">The pidl.</param> + void SetIDList(IntPtr pidl); + /// <summary> + /// Retrieves the description string for a Shell link object + /// </summary> + /// <param name="pszName">Name of the PSZ.</param> + /// <param name="cchMaxName">Name of the CCH max.</param> + void GetDescription([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszName, int cchMaxName); + /// <summary> + /// Sets the description for a Shell link object. The description can be any application-defined string + /// </summary> + /// <param name="pszName">Name of the PSZ.</param> + void SetDescription([MarshalAs(UnmanagedType.LPWStr)] string pszName); + /// <summary> + /// Retrieves the name of the working directory for a Shell link object + /// </summary> + /// <param name="pszDir">The PSZ dir.</param> + /// <param name="cchMaxPath">The CCH max path.</param> + void GetWorkingDirectory([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszDir, int cchMaxPath); + /// <summary> + /// Sets the name of the working directory for a Shell link object + /// </summary> + /// <param name="pszDir">The PSZ dir.</param> + void SetWorkingDirectory([MarshalAs(UnmanagedType.LPWStr)] string pszDir); + /// <summary> + /// Retrieves the command-line arguments associated with a Shell link object + /// </summary> + /// <param name="pszArgs">The PSZ args.</param> + /// <param name="cchMaxPath">The CCH max path.</param> + void GetArguments([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszArgs, int cchMaxPath); + /// <summary> + /// Sets the command-line arguments for a Shell link object + /// </summary> + /// <param name="pszArgs">The PSZ args.</param> + void SetArguments([MarshalAs(UnmanagedType.LPWStr)] string pszArgs); + /// <summary> + /// Retrieves the hot key for a Shell link object + /// </summary> + /// <param name="pwHotkey">The pw hotkey.</param> + void GetHotkey(out short pwHotkey); + /// <summary> + /// Sets a hot key for a Shell link object + /// </summary> + /// <param name="wHotkey">The w hotkey.</param> + void SetHotkey(short wHotkey); + /// <summary> + /// Retrieves the show command for a Shell link object + /// </summary> + /// <param name="piShowCmd">The pi show CMD.</param> + void GetShowCmd(out int piShowCmd); + /// <summary> + /// Sets the show command for a Shell link object. The show command sets the initial show state of the window. + /// </summary> + /// <param name="iShowCmd">The i show CMD.</param> + void SetShowCmd(int iShowCmd); + /// <summary> + /// Retrieves the location (path and index) of the icon for a Shell link object + /// </summary> + /// <param name="pszIconPath">The PSZ icon path.</param> + /// <param name="cchIconPath">The CCH icon path.</param> + /// <param name="piIcon">The pi icon.</param> + void GetIconLocation([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszIconPath, + int cchIconPath, out int piIcon); + /// <summary> + /// Sets the location (path and index) of the icon for a Shell link object + /// </summary> + /// <param name="pszIconPath">The PSZ icon path.</param> + /// <param name="iIcon">The i icon.</param> + void SetIconLocation([MarshalAs(UnmanagedType.LPWStr)] string pszIconPath, int iIcon); + /// <summary> + /// Sets the relative path to the Shell link object + /// </summary> + /// <param name="pszPathRel">The PSZ path rel.</param> + /// <param name="dwReserved">The dw reserved.</param> + void SetRelativePath([MarshalAs(UnmanagedType.LPWStr)] string pszPathRel, int dwReserved); + /// <summary> + /// Attempts to find the target of a Shell link, even if it has been moved or renamed + /// </summary> + /// <param name="hwnd">The HWND.</param> + /// <param name="fFlags">The f flags.</param> + void Resolve(IntPtr hwnd, SLR_FLAGS fFlags); + /// <summary> + /// Sets the path and file name of a Shell link object + /// </summary> + /// <param name="pszFile">The PSZ file.</param> + void SetPath([MarshalAs(UnmanagedType.LPWStr)] string pszFile); + + } + + /// <summary> + /// Interface IPersist + /// </summary> + [ComImport, Guid("0000010c-0000-0000-c000-000000000046"), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IPersist + { + /// <summary> + /// Gets the class ID. + /// </summary> + /// <param name="pClassID">The p class ID.</param> + [PreserveSig] + void GetClassID(out Guid pClassID); + } + + /// <summary> + /// Interface IPersistFile + /// </summary> + [ComImport, Guid("0000010b-0000-0000-C000-000000000046"), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IPersistFile : IPersist + { + /// <summary> + /// Gets the class ID. + /// </summary> + /// <param name="pClassID">The p class ID.</param> + new void GetClassID(out Guid pClassID); + /// <summary> + /// Determines whether this instance is dirty. + /// </summary> + [PreserveSig] + int IsDirty(); + + /// <summary> + /// Loads the specified PSZ file name. + /// </summary> + /// <param name="pszFileName">Name of the PSZ file.</param> + /// <param name="dwMode">The dw mode.</param> + [PreserveSig] + void Load([In, MarshalAs(UnmanagedType.LPWStr)] + string pszFileName, uint dwMode); + + /// <summary> + /// Saves the specified PSZ file name. + /// </summary> + /// <param name="pszFileName">Name of the PSZ file.</param> + /// <param name="remember">if set to <c>true</c> [remember].</param> + [PreserveSig] + void Save([In, MarshalAs(UnmanagedType.LPWStr)] string pszFileName, + [In, MarshalAs(UnmanagedType.Bool)] bool remember); + + /// <summary> + /// Saves the completed. + /// </summary> + /// <param name="pszFileName">Name of the PSZ file.</param> + [PreserveSig] + void SaveCompleted([In, MarshalAs(UnmanagedType.LPWStr)] string pszFileName); + + /// <summary> + /// Gets the cur file. + /// </summary> + /// <param name="ppszFileName">Name of the PPSZ file.</param> + [PreserveSig] + void GetCurFile([In, MarshalAs(UnmanagedType.LPWStr)] string ppszFileName); + } + + // CLSID_ShellLink from ShlGuid.h + /// <summary> + /// Class ShellLink + /// </summary> + [ + ComImport, + Guid("00021401-0000-0000-C000-000000000046") + ] + public class ShellLink + { + } +} diff --git a/MediaBrowser.ServerApplication/Native/WindowsApp.cs b/MediaBrowser.ServerApplication/Native/WindowsApp.cs index ac07a369d..146a4372b 100644 --- a/MediaBrowser.ServerApplication/Native/WindowsApp.cs +++ b/MediaBrowser.ServerApplication/Native/WindowsApp.cs @@ -1,12 +1,13 @@ using MediaBrowser.Common.Net; -using MediaBrowser.IsoMounter; using MediaBrowser.Model.Logging; using MediaBrowser.Server.Startup.Common; using MediaBrowser.ServerApplication.Networking; using System.Collections.Generic; +using System.IO; using System.Reflection; using CommonIO; using MediaBrowser.Controller.Power; +using MediaBrowser.Server.Startup.Common.FFMpeg; namespace MediaBrowser.ServerApplication.Native { @@ -31,7 +32,7 @@ namespace MediaBrowser.ServerApplication.Native } list.Add(GetType().Assembly); - + return list; } @@ -108,7 +109,22 @@ namespace MediaBrowser.ServerApplication.Native public void ConfigureAutoRun(bool autorun) { - Autorun.Configure(autorun, _fileSystem); + var shortcutPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.StartMenu), "Emby", "Emby Server.lnk"); + + var startupPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Startup); + + if (autorun) + { + //Copy our shortut into the startup folder for this user + var targetPath = Path.Combine(startupPath, Path.GetFileName(shortcutPath) ?? "Emby Server.lnk"); + _fileSystem.CreateDirectory(Path.GetDirectoryName(targetPath)); + File.Copy(shortcutPath, targetPath, true); + } + else + { + //Remove our shortcut from the startup folder for this user + _fileSystem.DeleteFile(Path.Combine(startupPath, Path.GetFileName(shortcutPath) ?? "Emby Server.lnk")); + } } public INetworkManager CreateNetworkManager(ILogger logger) @@ -125,5 +141,32 @@ namespace MediaBrowser.ServerApplication.Native { return new WindowsPowerManagement(_logger); } + + public FFMpegInstallInfo GetFfmpegInstallInfo() + { + var info = new FFMpegInstallInfo(); + + info.FFMpegFilename = "ffmpeg.exe"; + info.FFProbeFilename = "ffprobe.exe"; + info.Version = "20160401"; + info.ArchiveType = "7z"; + info.IsEmbedded = true; + info.DownloadUrls = GetDownloadUrls(); + + return info; + } + + private string[] GetDownloadUrls() + { + switch (Environment.SystemArchitecture) + { + case Architecture.X86_X64: + return new[] { "MediaBrowser.ServerApplication.ffmpeg.ffmpegx64.7z" }; + case Architecture.X86: + return new[] { "MediaBrowser.ServerApplication.ffmpeg.ffmpegx86.7z" }; + } + + return new string[] { }; + } } } diff --git a/MediaBrowser.ServerApplication/Properties/AssemblyInfo.cs b/MediaBrowser.ServerApplication/Properties/AssemblyInfo.cs index cd31fb953..95113e0ed 100644 --- a/MediaBrowser.ServerApplication/Properties/AssemblyInfo.cs +++ b/MediaBrowser.ServerApplication/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/MediaBrowser.ServerApplication/Properties/Resources.Designer.cs b/MediaBrowser.ServerApplication/Properties/Resources.Designer.cs index 6323af6fd..e166f35d0 100644 --- a/MediaBrowser.ServerApplication/Properties/Resources.Designer.cs +++ b/MediaBrowser.ServerApplication/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:4.0.30319.34011
+// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
diff --git a/MediaBrowser.ServerApplication/ffmpeg/ffmpegx64.7z.REMOVED.git-id b/MediaBrowser.ServerApplication/ffmpeg/ffmpegx64.7z.REMOVED.git-id new file mode 100644 index 000000000..b0542b75f --- /dev/null +++ b/MediaBrowser.ServerApplication/ffmpeg/ffmpegx64.7z.REMOVED.git-id @@ -0,0 +1 @@ +9dc10b022537738edce7eb71aa8dd4adbfee2c7b
\ No newline at end of file diff --git a/MediaBrowser.ServerApplication/ffmpeg/ffmpegx86.7z.REMOVED.git-id b/MediaBrowser.ServerApplication/ffmpeg/ffmpegx86.7z.REMOVED.git-id new file mode 100644 index 000000000..3939ec44d --- /dev/null +++ b/MediaBrowser.ServerApplication/ffmpeg/ffmpegx86.7z.REMOVED.git-id @@ -0,0 +1 @@ +00fa1afa35fbd0a7e97ad7956e42ae17f6882f64
\ No newline at end of file diff --git a/MediaBrowser.ServerApplication/packages.config b/MediaBrowser.ServerApplication/packages.config index 5187a1db3..1c86a02ae 100644 --- a/MediaBrowser.ServerApplication/packages.config +++ b/MediaBrowser.ServerApplication/packages.config @@ -2,7 +2,6 @@ <packages> <package id="CommonIO" version="1.0.0.9" targetFramework="net45" /> <package id="ImageMagickSharp" version="1.0.0.18" targetFramework="net45" /> - <package id="MediaBrowser.IsoMounting" version="3.0.69" targetFramework="net45" /> <package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" /> - <package id="System.Data.SQLite.Core" version="1.0.94.0" targetFramework="net45" /> + <package id="System.Data.SQLite.Core" version="1.0.94.0" targetFramework="net45" requireReinstallation="true" /> </packages>
\ No newline at end of file diff --git a/MediaBrowser.Tests/MediaEncoding/Subtitles/SrtParserTests.cs b/MediaBrowser.Tests/MediaEncoding/Subtitles/SrtParserTests.cs index 07717a328..af34e13e7 100644 --- a/MediaBrowser.Tests/MediaEncoding/Subtitles/SrtParserTests.cs +++ b/MediaBrowser.Tests/MediaEncoding/Subtitles/SrtParserTests.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; using System.Threading; using MediaBrowser.MediaEncoding.Subtitles; diff --git a/MediaBrowser.Tests/Properties/AssemblyInfo.cs b/MediaBrowser.Tests/Properties/AssemblyInfo.cs index 16bdaf31a..8efecf8e2 100644 --- a/MediaBrowser.Tests/Properties/AssemblyInfo.cs +++ b/MediaBrowser.Tests/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index ab8b2a673..3a69c9666 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Localization; diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index 55c3afd9d..b633d1590 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Localization; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Serialization; @@ -416,6 +415,7 @@ namespace MediaBrowser.WebDashboard.Api sb.Append("<link rel=\"shortcut icon\" href=\"css/images/favicon.ico\">"); sb.Append("<meta name=\"msapplication-TileImage\" content=\"css/images/touchicon144.png\">"); sb.Append("<meta name=\"msapplication-TileColor\" content=\"#333333\">"); + sb.Append("<meta name=\"theme-color\" content=\"#43A047\">"); return sb.ToString(); } @@ -478,7 +478,7 @@ namespace MediaBrowser.WebDashboard.Api var tags = files.Select(s => { - if (s.IndexOf("require", StringComparison.OrdinalIgnoreCase) == -1) + if (s.IndexOf("require", StringComparison.OrdinalIgnoreCase) == -1 && s.IndexOf("alameda", StringComparison.OrdinalIgnoreCase) == -1) { return string.Format("<script src=\"{0}\" async></script>", s); } diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 0cc25098f..f7b550a13 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -107,6 +107,12 @@ <Content Include="dashboard-ui\bower_components\fastclick\lib\fastclick.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
+ <Content Include="dashboard-ui\components\favoriteitems.js">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="dashboard-ui\components\filedownloader.js">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
<Content Include="dashboard-ui\components\filterdialog\filterdialog.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -140,9 +146,15 @@ <Content Include="dashboard-ui\components\remotecontrolautoplay.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
+ <Content Include="dashboard-ui\components\servertestermessage.js">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
<Content Include="dashboard-ui\components\viewcontainer-lite.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
+ <Content Include="dashboard-ui\css\images\logo.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
<Content Include="dashboard-ui\devices\windowsphone\wp.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -269,9 +281,6 @@ <Content Include="dashboard-ui\legacy\dashboard.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="dashboard-ui\legacy\objectassign.js">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
<Content Include="dashboard-ui\legacy\selectmenu.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -302,6 +311,9 @@ <Content Include="dashboard-ui\scripts\autobackdrops.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
+ <Content Include="dashboard-ui\scripts\homefavorites.js">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
<Content Include="dashboard-ui\scripts\homenextup.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -577,9 +589,6 @@ <Content Include="dashboard-ui\channels.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="dashboard-ui\channelsettings.html">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
<Content Include="dashboard-ui\cinemamodeconfiguration.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -715,9 +724,6 @@ <Content Include="dashboard-ui\dlnaprofiles.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="dashboard-ui\dlnaserversettings.html">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
<Content Include="dashboard-ui\dlnasettings.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -790,9 +796,6 @@ <Content Include="dashboard-ui\css\images\editor\missingprimaryimage.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="dashboard-ui\css\images\editor\missingtrailer.png">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
<Content Include="dashboard-ui\css\metadataeditor.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -883,9 +886,6 @@ <Content Include="dashboard-ui\scripts\channels.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="dashboard-ui\scripts\channelsettings.js">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
<Content Include="dashboard-ui\scripts\channelslatest.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -919,9 +919,6 @@ <Content Include="dashboard-ui\scripts\dlnaprofiles.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="dashboard-ui\scripts\dlnaserversettings.js">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
<Content Include="dashboard-ui\scripts\dlnasettings.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -1158,11 +1155,6 @@ </Content>
</ItemGroup>
<ItemGroup>
- <Content Include="dashboard-ui\advanced.html">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- </ItemGroup>
- <ItemGroup>
<Content Include="dashboard-ui\dashboard.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -1381,9 +1373,6 @@ </Content>
</ItemGroup>
<ItemGroup>
- <Content Include="dashboard-ui\scripts\advancedconfigurationpage.js">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
<Content Include="dashboard-ui\scripts\useredit.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -1395,16 +1384,6 @@ </Content>
</ItemGroup>
<ItemGroup>
- <Content Include="dashboard-ui\metadataadvanced.html">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- </ItemGroup>
- <ItemGroup>
- <Content Include="dashboard-ui\scripts\metadataadvanced.js">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- </ItemGroup>
- <ItemGroup>
<Content Include="dashboard-ui\addplugin.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -1535,11 +1514,6 @@ </Content>
</ItemGroup>
<ItemGroup>
- <Content Include="dashboard-ui\support.html">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- </ItemGroup>
- <ItemGroup>
<Content Include="dashboard-ui\css\images\supporter\supporterbadge.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -1711,9 +1685,6 @@ <Content Include="dashboard-ui\strings\ru.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="dashboard-ui\strings\server.json">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
<Content Include="dashboard-ui\strings\sl-SI.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
diff --git a/MediaBrowser.WebDashboard/packages.config b/MediaBrowser.WebDashboard/packages.config index eecb6bec2..a2d13fdf5 100644 --- a/MediaBrowser.WebDashboard/packages.config +++ b/MediaBrowser.WebDashboard/packages.config @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="CommonIO" version="1.0.0.9" targetFramework="net45" /> - <package id="MediaBrowser.ApiClient.Javascript" version="3.0.249" targetFramework="net45" /> <package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" /> <package id="WebMarkupMin.Core" version="1.0.1" targetFramework="net45" /> </packages>
\ No newline at end of file diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs index cb74d4dd7..75b5498c5 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs @@ -85,8 +85,6 @@ namespace MediaBrowser.XbmcMetadata.Parsers /// <param name="cancellationToken">The cancellation token.</param> private void Fetch(MetadataResult<T> item, string metadataFile, XmlReaderSettings settings, CancellationToken cancellationToken) { - item.ResetPeople(); - if (!SupportsUrlAfterClosingXmlTag) { using (var streamReader = BaseNfoSaver.GetStreamReader(metadataFile)) @@ -94,6 +92,8 @@ namespace MediaBrowser.XbmcMetadata.Parsers // Use XmlReader for best performance using (var reader = XmlReader.Create(streamReader, settings)) { + item.ResetPeople(); + reader.MoveToContent(); // Loop through each element @@ -113,6 +113,8 @@ namespace MediaBrowser.XbmcMetadata.Parsers using (var streamReader = BaseNfoSaver.GetStreamReader(metadataFile)) { + item.ResetPeople(); + // Need to handle a url after the xml data // http://kodi.wiki/view/NFO_files/movies diff --git a/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs index 6dd70f298..100ce7af9 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Logging; diff --git a/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs index f27f0a191..dfe88cd3f 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs @@ -4,7 +4,6 @@ using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; -using System.Collections.Generic; using System.Xml; namespace MediaBrowser.XbmcMetadata.Parsers diff --git a/MediaBrowser.XbmcMetadata/Properties/AssemblyInfo.cs b/MediaBrowser.XbmcMetadata/Properties/AssemblyInfo.cs index 7df6e5967..078136371 100644 --- a/MediaBrowser.XbmcMetadata/Properties/AssemblyInfo.cs +++ b/MediaBrowser.XbmcMetadata/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/MediaBrowser.XbmcMetadata/Providers/AlbumNfoProvider.cs b/MediaBrowser.XbmcMetadata/Providers/AlbumNfoProvider.cs index d9c85b92e..d0b1b142c 100644 --- a/MediaBrowser.XbmcMetadata/Providers/AlbumNfoProvider.cs +++ b/MediaBrowser.XbmcMetadata/Providers/AlbumNfoProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Logging; diff --git a/MediaBrowser.XbmcMetadata/Providers/ArtistNfoProvider.cs b/MediaBrowser.XbmcMetadata/Providers/ArtistNfoProvider.cs index fe4906636..81c6b1c28 100644 --- a/MediaBrowser.XbmcMetadata/Providers/ArtistNfoProvider.cs +++ b/MediaBrowser.XbmcMetadata/Providers/ArtistNfoProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Logging; diff --git a/MediaBrowser.XbmcMetadata/Providers/BaseNfoProvider.cs b/MediaBrowser.XbmcMetadata/Providers/BaseNfoProvider.cs index abac7f544..5ce8d30ad 100644 --- a/MediaBrowser.XbmcMetadata/Providers/BaseNfoProvider.cs +++ b/MediaBrowser.XbmcMetadata/Providers/BaseNfoProvider.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; using MediaBrowser.XbmcMetadata.Savers; using System; diff --git a/MediaBrowser.XbmcMetadata/Providers/BaseVideoNfoProvider.cs b/MediaBrowser.XbmcMetadata/Providers/BaseVideoNfoProvider.cs index 605a09709..26ffc9a19 100644 --- a/MediaBrowser.XbmcMetadata/Providers/BaseVideoNfoProvider.cs +++ b/MediaBrowser.XbmcMetadata/Providers/BaseVideoNfoProvider.cs @@ -1,11 +1,9 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Logging; using MediaBrowser.XbmcMetadata.Parsers; using MediaBrowser.XbmcMetadata.Savers; -using System.IO; using System.Linq; using System.Threading; using CommonIO; diff --git a/MediaBrowser.XbmcMetadata/Providers/EpisodeNfoProvider.cs b/MediaBrowser.XbmcMetadata/Providers/EpisodeNfoProvider.cs index 470a40f09..5587c7515 100644 --- a/MediaBrowser.XbmcMetadata/Providers/EpisodeNfoProvider.cs +++ b/MediaBrowser.XbmcMetadata/Providers/EpisodeNfoProvider.cs @@ -1,8 +1,6 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.XbmcMetadata.Parsers; using System.Collections.Generic; diff --git a/MediaBrowser.XbmcMetadata/Providers/MovieNfoProvider.cs b/MediaBrowser.XbmcMetadata/Providers/MovieNfoProvider.cs index 62a8c6047..bba4010dc 100644 --- a/MediaBrowser.XbmcMetadata/Providers/MovieNfoProvider.cs +++ b/MediaBrowser.XbmcMetadata/Providers/MovieNfoProvider.cs @@ -1,6 +1,5 @@ using CommonIO; using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Model.Logging; diff --git a/MediaBrowser.XbmcMetadata/Providers/SeasonNfoProvider.cs b/MediaBrowser.XbmcMetadata/Providers/SeasonNfoProvider.cs index 777f2f847..3dac0a531 100644 --- a/MediaBrowser.XbmcMetadata/Providers/SeasonNfoProvider.cs +++ b/MediaBrowser.XbmcMetadata/Providers/SeasonNfoProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Logging; diff --git a/MediaBrowser.XbmcMetadata/Providers/SeriesNfoProvider.cs b/MediaBrowser.XbmcMetadata/Providers/SeriesNfoProvider.cs index 50649fbc0..4bab8d75b 100644 --- a/MediaBrowser.XbmcMetadata/Providers/SeriesNfoProvider.cs +++ b/MediaBrowser.XbmcMetadata/Providers/SeriesNfoProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Logging; diff --git a/MediaBrowser.XbmcMetadata/Savers/AlbumNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/AlbumNfoSaver.cs index 660322c61..7f7606f8e 100644 --- a/MediaBrowser.XbmcMetadata/Savers/AlbumNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/AlbumNfoSaver.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; diff --git a/MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs index f1d4366b7..f0f9df434 100644 --- a/MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs index 53a7926ca..ba8a3bdf5 100644 --- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; diff --git a/MediaBrowser.XbmcMetadata/Savers/EpisodeNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/EpisodeNfoSaver.cs index 5363efcdf..60d024072 100644 --- a/MediaBrowser.XbmcMetadata/Savers/EpisodeNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/EpisodeNfoSaver.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; diff --git a/MediaBrowser.XbmcMetadata/Savers/MovieNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/MovieNfoSaver.cs index 0b8ce9712..18423f59e 100644 --- a/MediaBrowser.XbmcMetadata/Savers/MovieNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/MovieNfoSaver.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.TV; diff --git a/MediaBrowser.XbmcMetadata/Savers/SeasonNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/SeasonNfoSaver.cs index edb468d64..9d9b2e94c 100644 --- a/MediaBrowser.XbmcMetadata/Savers/SeasonNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/SeasonNfoSaver.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; diff --git a/MediaBrowser.XbmcMetadata/Savers/SeriesNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/SeriesNfoSaver.cs index 11df3ae6f..3fb3a8e9d 100644 --- a/MediaBrowser.XbmcMetadata/Savers/SeriesNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/SeriesNfoSaver.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 10a898785..0ae08c4ad 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>MediaBrowser.Common.Internal</id> - <version>3.0.644</version> + <version>3.0.645</version> <title>MediaBrowser.Common.Internal</title> <authors>Luke</authors> <owners>ebr,Luke,scottisafool</owners> @@ -12,7 +12,7 @@ <description>Contains common components shared by Emby Theater and Emby Server. Not intended for plugin developer consumption.</description> <copyright>Copyright © Emby 2013</copyright> <dependencies> - <dependency id="MediaBrowser.Common" version="3.0.644" /> + <dependency id="MediaBrowser.Common" version="3.0.645" /> <dependency id="NLog" version="4.2.3" /> <dependency id="SimpleInjector" version="3.1.2" /> </dependencies> diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 616f0ca2a..b9bce00d0 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>MediaBrowser.Common</id> - <version>3.0.644</version> + <version>3.0.645</version> <title>MediaBrowser.Common</title> <authors>Emby Team</authors> <owners>ebr,Luke,scottisafool</owners> diff --git a/Nuget/MediaBrowser.Model.Signed.nuspec b/Nuget/MediaBrowser.Model.Signed.nuspec index d17ff16b6..3af1b91e2 100644 --- a/Nuget/MediaBrowser.Model.Signed.nuspec +++ b/Nuget/MediaBrowser.Model.Signed.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>MediaBrowser.Model.Signed</id> - <version>3.0.644</version> + <version>3.0.645</version> <title>MediaBrowser.Model - Signed Edition</title> <authors>Emby Team</authors> <owners>ebr,Luke,scottisafool</owners> diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 2098bbcfe..d48b421c5 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <metadata> <id>MediaBrowser.Server.Core</id> - <version>3.0.644</version> + <version>3.0.645</version> <title>Media Browser.Server.Core</title> <authors>Emby Team</authors> <owners>ebr,Luke,scottisafool</owners> @@ -12,7 +12,7 @@ <description>Contains core components required to build plugins for Emby Server.</description> <copyright>Copyright © Emby 2013</copyright> <dependencies> - <dependency id="MediaBrowser.Common" version="3.0.644" /> + <dependency id="MediaBrowser.Common" version="3.0.645" /> <dependency id="Interfaces.IO" version="1.0.0.5" /> </dependencies> </metadata> diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseAutoUpdate.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseAutoUpdate.cs index 26edf8b0e..5007cc6bb 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseAutoUpdate.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseAutoUpdate.cs @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; + using System.ComponentModel; namespace OpenSubtitlesHandler diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseCheckMovieHash.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseCheckMovieHash.cs index 30ef075b9..d837f2523 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseCheckMovieHash.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseCheckMovieHash.cs @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; + using System.Collections.Generic; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseCheckMovieHash2.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseCheckMovieHash2.cs index 78cdef0c4..a74aacd50 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseCheckMovieHash2.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseCheckMovieHash2.cs @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; + using System.Collections.Generic; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseCheckSubHash.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseCheckSubHash.cs index 45c73631c..6c7dc9d2d 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseCheckSubHash.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseCheckSubHash.cs @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; + using System.Collections.Generic; namespace OpenSubtitlesHandler diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseError.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseError.cs index 273dfb1ad..fa566ee59 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseError.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseError.cs @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; + namespace OpenSubtitlesHandler { /// <summary> diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseGetAvailableTranslations.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseGetAvailableTranslations.cs index 1ee4ea6c0..d727a8614 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseGetAvailableTranslations.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseGetAvailableTranslations.cs @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; + using System.Collections.Generic; namespace OpenSubtitlesHandler diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseGetComments.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseGetComments.cs index 6a586d5ce..8570ebabb 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseGetComments.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseGetComments.cs @@ -16,10 +16,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; + using System.Collections.Generic; -using System.Linq; -using System.Text; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseGetSubLanguages.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseGetSubLanguages.cs index dc8100c92..688de17d0 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseGetSubLanguages.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseGetSubLanguages.cs @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; + using System.Collections.Generic; namespace OpenSubtitlesHandler diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseGetTranslation.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseGetTranslation.cs index 548246887..f024bbc32 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseGetTranslation.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseGetTranslation.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseInsertMovie.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseInsertMovie.cs index b53aad5a9..f5caa351a 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseInsertMovie.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseInsertMovie.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseLogIn.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseLogIn.cs index e7c23f61c..4122433b3 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseLogIn.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseLogIn.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseMovieDetails.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseMovieDetails.cs index 29e19245c..02e6a1e75 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseMovieDetails.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseMovieDetails.cs @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; + using System.Collections.Generic; namespace OpenSubtitlesHandler diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseMovieSearch.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseMovieSearch.cs index c1beeeeea..cd5e4387d 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseMovieSearch.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseMovieSearch.cs @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; + using System.Collections.Generic; namespace OpenSubtitlesHandler diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseNoOperation.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseNoOperation.cs index 0b5b2f1aa..eeaaa5fdd 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseNoOperation.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseNoOperation.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseReportWrongMovieHash.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseReportWrongMovieHash.cs index 94788b2c6..95d2a99b5 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseReportWrongMovieHash.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseReportWrongMovieHash.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseServerInfo.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseServerInfo.cs index fce5b4245..d41ac8e82 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseServerInfo.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseServerInfo.cs @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; + using System.Collections.Generic; using System.ComponentModel; namespace OpenSubtitlesHandler diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseSubtitleDownload.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseSubtitleDownload.cs index 7ad9f38ec..e203cbfa6 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseSubtitleDownload.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseSubtitleDownload.cs @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; + using System.Collections.Generic; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseSubtitleSearch.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseSubtitleSearch.cs index c359c0ffd..29233ee81 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseSubtitleSearch.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseSubtitleSearch.cs @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; + using System.Collections.Generic; namespace OpenSubtitlesHandler diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseSubtitlesVote.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseSubtitlesVote.cs index 1f5364f0c..d06d302cd 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseSubtitlesVote.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseSubtitlesVote.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseTryUploadSubtitles.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseTryUploadSubtitles.cs index 9dbf1576d..a08d50226 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseTryUploadSubtitles.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseTryUploadSubtitles.cs @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; + using System.Collections.Generic; namespace OpenSubtitlesHandler diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseUploadSubtitles.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseUploadSubtitles.cs index 3b2320db2..8f8540f15 100644 --- a/OpenSubtitlesHandler/MethodResponses/MethodResponseUploadSubtitles.cs +++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseUploadSubtitles.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/MovieHasher.cs b/OpenSubtitlesHandler/MovieHasher.cs index 8d11d8267..89301191f 100644 --- a/OpenSubtitlesHandler/MovieHasher.cs +++ b/OpenSubtitlesHandler/MovieHasher.cs @@ -1,9 +1,6 @@ using System; -using System.Collections.Generic; using System.IO; -using System.Linq; using System.Text; -using System.Threading.Tasks; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/Movies/CheckMovieHash2Result.cs b/OpenSubtitlesHandler/Movies/CheckMovieHash2Result.cs index e91541c3c..b18a7386a 100644 --- a/OpenSubtitlesHandler/Movies/CheckMovieHash2Result.cs +++ b/OpenSubtitlesHandler/Movies/CheckMovieHash2Result.cs @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; + using System.Collections.Generic; namespace OpenSubtitlesHandler diff --git a/OpenSubtitlesHandler/Movies/CheckMovieHashResult.cs b/OpenSubtitlesHandler/Movies/CheckMovieHashResult.cs index b51181f23..9c1aa5b61 100644 --- a/OpenSubtitlesHandler/Movies/CheckMovieHashResult.cs +++ b/OpenSubtitlesHandler/Movies/CheckMovieHashResult.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/Movies/MovieSearchResult.cs b/OpenSubtitlesHandler/Movies/MovieSearchResult.cs index fe085acc4..aa057cc89 100644 --- a/OpenSubtitlesHandler/Movies/MovieSearchResult.cs +++ b/OpenSubtitlesHandler/Movies/MovieSearchResult.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/OtherTypes/GetCommentsResult.cs b/OpenSubtitlesHandler/OtherTypes/GetCommentsResult.cs index 2eedd2538..80ca51725 100644 --- a/OpenSubtitlesHandler/OtherTypes/GetCommentsResult.cs +++ b/OpenSubtitlesHandler/OtherTypes/GetCommentsResult.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/Properties/AssemblyInfo.cs b/OpenSubtitlesHandler/Properties/AssemblyInfo.cs index 9fad43d74..349e289b3 100644 --- a/OpenSubtitlesHandler/Properties/AssemblyInfo.cs +++ b/OpenSubtitlesHandler/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/OpenSubtitlesHandler/SubtitleTypes/CheckSubHashResult.cs b/OpenSubtitlesHandler/SubtitleTypes/CheckSubHashResult.cs index 0e77601ba..82c95ebd3 100644 --- a/OpenSubtitlesHandler/SubtitleTypes/CheckSubHashResult.cs +++ b/OpenSubtitlesHandler/SubtitleTypes/CheckSubHashResult.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/SubtitleTypes/SubtitleDownloadResult.cs b/OpenSubtitlesHandler/SubtitleTypes/SubtitleDownloadResult.cs index 35bf796e6..bb1c3f98c 100644 --- a/OpenSubtitlesHandler/SubtitleTypes/SubtitleDownloadResult.cs +++ b/OpenSubtitlesHandler/SubtitleTypes/SubtitleDownloadResult.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/SubtitleTypes/SubtitleSearchParameters.cs b/OpenSubtitlesHandler/SubtitleTypes/SubtitleSearchParameters.cs index 46af6215b..101d7f7df 100644 --- a/OpenSubtitlesHandler/SubtitleTypes/SubtitleSearchParameters.cs +++ b/OpenSubtitlesHandler/SubtitleTypes/SubtitleSearchParameters.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/SubtitleTypes/SubtitleSearchResult.cs b/OpenSubtitlesHandler/SubtitleTypes/SubtitleSearchResult.cs index a56a6edab..34fef0365 100644 --- a/OpenSubtitlesHandler/SubtitleTypes/SubtitleSearchResult.cs +++ b/OpenSubtitlesHandler/SubtitleTypes/SubtitleSearchResult.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/SubtitleTypes/TryUploadSubtitlesParameters.cs b/OpenSubtitlesHandler/SubtitleTypes/TryUploadSubtitlesParameters.cs index a95d151eb..31549227a 100644 --- a/OpenSubtitlesHandler/SubtitleTypes/TryUploadSubtitlesParameters.cs +++ b/OpenSubtitlesHandler/SubtitleTypes/TryUploadSubtitlesParameters.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/SubtitleTypes/UploadSubtitleInfoParameter.cs b/OpenSubtitlesHandler/SubtitleTypes/UploadSubtitleInfoParameter.cs index 8e147878b..a815a6bce 100644 --- a/OpenSubtitlesHandler/SubtitleTypes/UploadSubtitleInfoParameter.cs +++ b/OpenSubtitlesHandler/SubtitleTypes/UploadSubtitleInfoParameter.cs @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; + using System.Collections.Generic; namespace OpenSubtitlesHandler diff --git a/OpenSubtitlesHandler/SubtitleTypes/UploadSubtitleParameters.cs b/OpenSubtitlesHandler/SubtitleTypes/UploadSubtitleParameters.cs index 90a273959..87921ddca 100644 --- a/OpenSubtitlesHandler/SubtitleTypes/UploadSubtitleParameters.cs +++ b/OpenSubtitlesHandler/SubtitleTypes/UploadSubtitleParameters.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; namespace OpenSubtitlesHandler { diff --git a/OpenSubtitlesHandler/Utilities.cs b/OpenSubtitlesHandler/Utilities.cs index 4340d4c3f..2ae116521 100644 --- a/OpenSubtitlesHandler/Utilities.cs +++ b/OpenSubtitlesHandler/Utilities.cs @@ -18,11 +18,8 @@ */ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.IO; -using System.IO.Compression; -using System.Net; using System.Security.Cryptography; using System.Threading; using System.Threading.Tasks; diff --git a/OpenSubtitlesHandler/XML-RPC/Types/XmlRpcMethodCall.cs b/OpenSubtitlesHandler/XML-RPC/Types/XmlRpcMethodCall.cs index 1ec3622b2..12bcc52f2 100644 --- a/OpenSubtitlesHandler/XML-RPC/Types/XmlRpcMethodCall.cs +++ b/OpenSubtitlesHandler/XML-RPC/Types/XmlRpcMethodCall.cs @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; + using System.Collections.Generic; namespace XmlRpcHandler diff --git a/OpenSubtitlesHandler/XML-RPC/Values/IXmlRpcValue.cs b/OpenSubtitlesHandler/XML-RPC/Values/IXmlRpcValue.cs index 19bc60347..359f4002a 100644 --- a/OpenSubtitlesHandler/XML-RPC/Values/IXmlRpcValue.cs +++ b/OpenSubtitlesHandler/XML-RPC/Values/IXmlRpcValue.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; namespace XmlRpcHandler { diff --git a/OpenSubtitlesHandler/XML-RPC/Values/XmlRpcStructMember.cs b/OpenSubtitlesHandler/XML-RPC/Values/XmlRpcStructMember.cs index 12c86fdbf..224b544aa 100644 --- a/OpenSubtitlesHandler/XML-RPC/Values/XmlRpcStructMember.cs +++ b/OpenSubtitlesHandler/XML-RPC/Values/XmlRpcStructMember.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; namespace XmlRpcHandler { diff --git a/OpenSubtitlesHandler/XML-RPC/Values/XmlRpcValueBasic.cs b/OpenSubtitlesHandler/XML-RPC/Values/XmlRpcValueBasic.cs index 2827283ff..015179336 100644 --- a/OpenSubtitlesHandler/XML-RPC/Values/XmlRpcValueBasic.cs +++ b/OpenSubtitlesHandler/XML-RPC/Values/XmlRpcValueBasic.cs @@ -17,7 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ using System; -using System.Collections.Generic; namespace XmlRpcHandler { diff --git a/OpenSubtitlesHandler/XML-RPC/Values/XmlRpcValueStruct.cs b/OpenSubtitlesHandler/XML-RPC/Values/XmlRpcValueStruct.cs index 9e4cf6056..78b802891 100644 --- a/OpenSubtitlesHandler/XML-RPC/Values/XmlRpcValueStruct.cs +++ b/OpenSubtitlesHandler/XML-RPC/Values/XmlRpcValueStruct.cs @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -using System; + using System.Collections.Generic; namespace XmlRpcHandler |
