aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-10-11 02:24:22 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-10-11 02:24:22 -0400
commit851c62a9401919780f9413659eb13e8d2a556679 (patch)
tree310d7c76826f4a46b25b9e41c2e4cee64c4885a9
parent3e0cfd3af36f024b685ed512d4fa5f8c9b3fbe59 (diff)
update image magick orientation function
-rw-r--r--Emby.Drawing.ImageMagick/ImageMagickEncoder.cs2
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs66
-rw-r--r--MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs2
-rw-r--r--MediaBrowser.Providers/Manager/ItemImageProvider.cs24
4 files changed, 35 insertions, 59 deletions
diff --git a/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs b/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs
index 04f916eb1..38e2879ea 100644
--- a/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs
+++ b/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs
@@ -149,7 +149,7 @@ namespace Emby.Drawing.ImageMagick
var originalImageSize = new ImageSize(originalImage.CurrentImage.Width, originalImage.CurrentImage.Height);
- if (!options.CropWhiteSpace && options.HasDefaultOptions(inputPath, originalImageSize))
+ if (!options.CropWhiteSpace && options.HasDefaultOptions(inputPath, originalImageSize) && !autoOrient)
{
// Just spit out the original file if all the options are default
return inputPath;
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs
index 604aa74f0..5e3923972 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs
@@ -33,7 +33,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
OriginalStreamId = originalStreamId;
}
- protected override Task OpenInternal(CancellationToken openCancellationToken)
+ protected override Task OpenInternal(CancellationToken openCancellationToken)
{
_liveStreamCancellationTokenSource.Token.ThrowIfCancellationRequested();
@@ -77,56 +77,38 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{
return Task.Run(async () =>
{
- var isFirstAttempt = true;
-
- while (!cancellationToken.IsCancellationRequested)
+ try
{
- try
+ using (var response = await _httpClient.SendAsync(new HttpRequestOptions
{
- using (var response = await _httpClient.SendAsync(new HttpRequestOptions
- {
- Url = url,
- CancellationToken = cancellationToken,
- BufferContent = false,
+ Url = url,
+ CancellationToken = cancellationToken,
+ BufferContent = false,
- // Increase a little bit
- TimeoutMs = 30000,
+ // Increase a little bit
+ TimeoutMs = 30000,
- EnableHttpCompression = false
+ EnableHttpCompression = false
- }, "GET").ConfigureAwait(false))
- {
- Logger.Info("Opened HDHR stream from {0}", url);
-
- if (!cancellationToken.IsCancellationRequested)
- {
- Logger.Info("Beginning multicastStream.CopyUntilCancelled");
-
- FileSystem.CreateDirectory(FileSystem.GetDirectoryName(TempFilePath));
- using (var fileStream = FileSystem.GetFileStream(TempFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, FileOpenOptions.None))
- {
- StreamHelper.CopyTo(response.Content, fileStream, 81920, () => Resolve(openTaskCompletionSource), cancellationToken);
- }
- }
- }
- }
- catch (OperationCanceledException)
- {
- break;
- }
- catch (Exception ex)
+ }, "GET").ConfigureAwait(false))
{
- if (isFirstAttempt)
+ Logger.Info("Opened HDHR stream from {0}", url);
+
+ Logger.Info("Beginning multicastStream.CopyUntilCancelled");
+
+ FileSystem.CreateDirectory(FileSystem.GetDirectoryName(TempFilePath));
+ using (var fileStream = FileSystem.GetFileStream(TempFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, FileOpenOptions.None))
{
- Logger.ErrorException("Error opening live stream:", ex);
- openTaskCompletionSource.TrySetException(ex);
- break;
+ StreamHelper.CopyTo(response.Content, fileStream, 81920, () => Resolve(openTaskCompletionSource), cancellationToken);
}
-
- Logger.ErrorException("Error copying live stream, will reopen", ex);
}
-
- isFirstAttempt = false;
+ }
+ catch (OperationCanceledException)
+ {
+ }
+ catch (Exception ex)
+ {
+ Logger.ErrorException("Error copying live stream.", ex);
}
_liveStreamTaskCompletionSource.TrySetResult(true);
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
index 004748a76..e7c768c3b 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
@@ -1638,7 +1638,7 @@ namespace MediaBrowser.Controller.MediaEncoding
if (state.InputProtocol == MediaProtocol.Rtsp)
{
- inputModifier += " -rtsp_transport tcp";
+ inputModifier += " -rtsp_transport tcp -rtsp_transport udp -rtsp_flags prefer_tcp";
}
if (!string.IsNullOrEmpty(state.InputAudioSync))
diff --git a/MediaBrowser.Providers/Manager/ItemImageProvider.cs b/MediaBrowser.Providers/Manager/ItemImageProvider.cs
index 00fd54271..4419b48cb 100644
--- a/MediaBrowser.Providers/Manager/ItemImageProvider.cs
+++ b/MediaBrowser.Providers/Manager/ItemImageProvider.cs
@@ -517,21 +517,11 @@ namespace MediaBrowser.Providers.Manager
return true;
}
- if (libraryOptions.DownloadImagesInAdvance)
- {
- return false;
- }
-
if (item.LocationType == LocationType.Remote || item.LocationType == LocationType.Virtual)
{
return true;
}
- if (!item.IsSaveLocalMetadataEnabled())
- {
- return true;
- }
-
if (item is IItemByName && !(item is MusicArtist))
{
var hasDualAccess = item as IHasDualAccess;
@@ -541,13 +531,17 @@ namespace MediaBrowser.Providers.Manager
}
}
- switch (type)
+ if (libraryOptions.DownloadImagesInAdvance)
{
- case ImageType.Primary:
- return true;
- default:
- return true;
+ return false;
}
+
+ //if (!item.IsSaveLocalMetadataEnabled())
+ //{
+ // return true;
+ //}
+
+ return true;
}
private void SaveImageStub(IHasMetadata item, ImageType imageType, IEnumerable<string> urls)