diff --git a/BDInfo/BDInfo.csproj b/BDInfo/BDInfo.csproj
index e7013f341..97abe7484 100644
--- a/BDInfo/BDInfo.csproj
+++ b/BDInfo/BDInfo.csproj
@@ -33,10 +33,6 @@
prompt
4
-
-
-
-
diff --git a/BDInfo/project.json b/BDInfo/project.json
deleted file mode 100644
index fbbe9eaf3..000000000
--- a/BDInfo/project.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "frameworks":{
- "netstandard1.6":{
- "dependencies":{
- "NETStandard.Library":"1.6.0",
- }
- },
- ".NETPortable,Version=v4.5,Profile=Profile7":{
- "buildOptions": {
- "define": [ ]
- },
- "frameworkAssemblies":{
-
- }
- }
- }
-}
\ No newline at end of file
diff --git a/DvdLib/DvdLib.csproj b/DvdLib/DvdLib.csproj
index ba63e77f0..9ed197c59 100644
--- a/DvdLib/DvdLib.csproj
+++ b/DvdLib/DvdLib.csproj
@@ -33,10 +33,6 @@
prompt
4
-
-
-
-
diff --git a/DvdLib/project.json b/DvdLib/project.json
deleted file mode 100644
index fbbe9eaf3..000000000
--- a/DvdLib/project.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "frameworks":{
- "netstandard1.6":{
- "dependencies":{
- "NETStandard.Library":"1.6.0",
- }
- },
- ".NETPortable,Version=v4.5,Profile=Profile7":{
- "buildOptions": {
- "define": [ ]
- },
- "frameworkAssemblies":{
-
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Emby.Common.Implementations/Emby.Common.Implementations.csproj b/Emby.Common.Implementations/Emby.Common.Implementations.csproj
index bf52ff0c7..50d0d05ec 100644
--- a/Emby.Common.Implementations/Emby.Common.Implementations.csproj
+++ b/Emby.Common.Implementations/Emby.Common.Implementations.csproj
@@ -32,7 +32,7 @@
- ..\packages\NLog.4.4.9\lib\net45\NLog.dll
+ ..\packages\NLog.4.4.10\lib\net45\NLog.dll
..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll
@@ -42,9 +42,8 @@
..\packages\SharpCompress.0.14.0\lib\net45\SharpCompress.dll
True
-
- ..\packages\SimpleInjector.4.0.7\lib\net45\SimpleInjector.dll
- True
+
+ ..\packages\SimpleInjector.4.0.8\lib\net45\SimpleInjector.dll
diff --git a/Emby.Common.Implementations/TextEncoding/TextEncoding.cs b/Emby.Common.Implementations/TextEncoding/TextEncoding.cs
index f47b88fb5..49b424d5f 100644
--- a/Emby.Common.Implementations/TextEncoding/TextEncoding.cs
+++ b/Emby.Common.Implementations/TextEncoding/TextEncoding.cs
@@ -157,6 +157,7 @@ namespace Emby.Common.Implementations.TextEncoding
case "ota":
case "tur":
return "windows-1254";
+ case "bgr":
case "rus":
return "windows-1251";
case "vie":
diff --git a/Emby.Common.Implementations/packages.config b/Emby.Common.Implementations/packages.config
index ec0fc45bc..1e6b10c01 100644
--- a/Emby.Common.Implementations/packages.config
+++ b/Emby.Common.Implementations/packages.config
@@ -1,7 +1,7 @@
-
+
-
+
\ No newline at end of file
diff --git a/Emby.Dlna/Profiles/DefaultProfile.cs b/Emby.Dlna/Profiles/DefaultProfile.cs
index 70d08f9a9..06ce93640 100644
--- a/Emby.Dlna/Profiles/DefaultProfile.cs
+++ b/Emby.Dlna/Profiles/DefaultProfile.cs
@@ -70,7 +70,7 @@ namespace Emby.Dlna.Profiles
new DirectPlayProfile
{
- Container = "aac,mp3,mpa,wav,wma,mp2,ogg,oga,webma,ape,opus,flac",
+ Container = "aac,mp3,mpa,wav,wma,mp2,ogg,oga,webma,ape,opus,flac,m4a",
Type = DlnaProfileType.Audio
}
};
diff --git a/Emby.Dlna/Profiles/MediaMonkeyProfile.cs b/Emby.Dlna/Profiles/MediaMonkeyProfile.cs
index 66bde1045..dc1c0c237 100644
--- a/Emby.Dlna/Profiles/MediaMonkeyProfile.cs
+++ b/Emby.Dlna/Profiles/MediaMonkeyProfile.cs
@@ -31,42 +31,7 @@ namespace Emby.Dlna.Profiles
{
new DirectPlayProfile
{
- Container = "mp3",
- AudioCodec = "mp2,mp3",
- Type = DlnaProfileType.Audio
- },
-
- new DirectPlayProfile
- {
- Container = "mp4",
- AudioCodec = "mp4",
- Type = DlnaProfileType.Audio
- },
-
- new DirectPlayProfile
- {
- Container = "aac,wav",
- Type = DlnaProfileType.Audio
- },
-
- new DirectPlayProfile
- {
- Container = "flac",
- AudioCodec = "flac",
- Type = DlnaProfileType.Audio
- },
-
- new DirectPlayProfile
- {
- Container = "asf",
- AudioCodec = "wmav2,wmapro,wmavoice",
- Type = DlnaProfileType.Audio
- },
-
- new DirectPlayProfile
- {
- Container = "ogg",
- AudioCodec = "vorbis",
+ Container = "aac,mp3,mpa,wav,wma,mp2,ogg,oga,webma,ape,opus,flac,m4a",
Type = DlnaProfileType.Audio
}
};
diff --git a/Emby.Dlna/Profiles/Xml/Default.xml b/Emby.Dlna/Profiles/Xml/Default.xml
index fe783e005..b07a2f7c2 100644
--- a/Emby.Dlna/Profiles/Xml/Default.xml
+++ b/Emby.Dlna/Profiles/Xml/Default.xml
@@ -30,7 +30,7 @@
-
+
diff --git a/Emby.Dlna/Profiles/Xml/MediaMonkey.xml b/Emby.Dlna/Profiles/Xml/MediaMonkey.xml
index d51cae988..94606a93c 100644
--- a/Emby.Dlna/Profiles/Xml/MediaMonkey.xml
+++ b/Emby.Dlna/Profiles/Xml/MediaMonkey.xml
@@ -35,12 +35,7 @@
false
-
-
-
-
-
-
+
diff --git a/Emby.Dlna/project.json b/Emby.Dlna/project.json
deleted file mode 100644
index fbbe9eaf3..000000000
--- a/Emby.Dlna/project.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "frameworks":{
- "netstandard1.6":{
- "dependencies":{
- "NETStandard.Library":"1.6.0",
- }
- },
- ".NETPortable,Version=v4.5,Profile=Profile7":{
- "buildOptions": {
- "define": [ ]
- },
- "frameworkAssemblies":{
-
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs b/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs
index 4c911cc7a..958ca85fd 100644
--- a/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs
+++ b/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs
@@ -130,7 +130,7 @@ namespace Emby.Drawing.ImageMagick
string.Equals(ext, ".webp", StringComparison.OrdinalIgnoreCase);
}
- public string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, int quality, ImageProcessingOptions options, ImageFormat selectedOutputFormat)
+ public string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, ImageOrientation? orientation, int quality, ImageProcessingOptions options, ImageFormat selectedOutputFormat)
{
// Even if the caller specified 100, don't use it because it takes forever
quality = Math.Min(quality, 99);
diff --git a/Emby.Drawing.Skia/SkiaEncoder.cs b/Emby.Drawing.Skia/SkiaEncoder.cs
index 222ecf733..2c7dc58c2 100644
--- a/Emby.Drawing.Skia/SkiaEncoder.cs
+++ b/Emby.Drawing.Skia/SkiaEncoder.cs
@@ -126,11 +126,11 @@ namespace Emby.Drawing.Skia
for (int row = 0; row < bitmap.Height; ++row)
{
if (IsAllWhiteRow(bitmap, row))
- topmost = row;
+ topmost = row + 1;
else break;
}
- int bottommost = 0;
+ int bottommost = bitmap.Height;
for (int row = bitmap.Height - 1; row >= 0; --row)
{
if (IsAllWhiteRow(bitmap, row))
@@ -138,11 +138,11 @@ namespace Emby.Drawing.Skia
else break;
}
- int leftmost = 0, rightmost = 0;
+ int leftmost = 0, rightmost = bitmap.Width;
for (int col = 0; col < bitmap.Width; ++col)
{
if (IsAllWhiteColumn(bitmap, col))
- leftmost = col;
+ leftmost = col + 1;
else
break;
}
@@ -162,13 +162,6 @@ namespace Emby.Drawing.Skia
using (var subset = image.Subset(newRect))
{
return SKBitmap.FromImage(subset);
- //using (var data = subset.Encode(StripCollageBuilder.GetEncodedFormat(outputPath), 90))
- //{
- // using (var fileStream = _fileSystem.GetFileStream(outputPath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
- // {
- // data.AsStream().CopyTo(fileStream);
- // }
- //}
}
}
}
@@ -191,7 +184,7 @@ namespace Emby.Drawing.Skia
}
private string[] TransparentImageTypes = new string[] { ".png", ".gif", ".webp" };
- private SKBitmap Decode(string path, bool forceCleanBitmap = false)
+ private SKBitmap Decode(string path, bool forceCleanBitmap, out SKCodecOrigin origin)
{
var requiresTransparencyHack = TransparentImageTypes.Contains(Path.GetExtension(path) ?? string.Empty);
@@ -206,6 +199,8 @@ namespace Emby.Drawing.Skia
// decode
codec.GetPixels(bitmap.Info, bitmap.GetPixels());
+ origin = codec.Origin;
+
return bitmap;
}
}
@@ -214,7 +209,7 @@ namespace Emby.Drawing.Skia
if (resultBitmap == null)
{
- return Decode(path, true);
+ return Decode(path, true, out origin);
}
// If we have to resize these they often end up distorted
@@ -222,27 +217,128 @@ namespace Emby.Drawing.Skia
{
using (resultBitmap)
{
- return Decode(path, true);
+ return Decode(path, true, out origin);
}
}
+ origin = SKCodecOrigin.TopLeft;
return resultBitmap;
}
- private SKBitmap GetBitmap(string path, bool cropWhitespace)
+ private SKBitmap GetBitmap(string path, bool cropWhitespace, bool forceAnalyzeBitmap, out SKCodecOrigin origin)
{
if (cropWhitespace)
{
- using (var bitmap = Decode(path))
+ using (var bitmap = Decode(path, forceAnalyzeBitmap, out origin))
{
return CropWhiteSpace(bitmap);
}
}
- return Decode(path);
+ return Decode(path, forceAnalyzeBitmap, out origin);
}
- public string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, int quality, ImageProcessingOptions options, ImageFormat selectedOutputFormat)
+ private SKBitmap GetBitmap(string path, bool cropWhitespace, bool autoOrient, ImageOrientation? orientation)
+ {
+ SKCodecOrigin origin;
+
+ if (autoOrient)
+ {
+ var bitmap = GetBitmap(path, cropWhitespace, true, out origin);
+
+ if (origin != SKCodecOrigin.TopLeft)
+ {
+ using (bitmap)
+ {
+ return RotateAndFlip(bitmap, origin);
+ }
+ }
+
+ return bitmap;
+ }
+
+ return GetBitmap(path, cropWhitespace, false, out origin);
+ }
+
+ private SKBitmap RotateAndFlip(SKBitmap original, SKCodecOrigin origin)
+ {
+ // these are the origins that represent a 90 degree turn in some fashion
+ var differentOrientations = new SKCodecOrigin[]
+ {
+ SKCodecOrigin.LeftBottom,
+ SKCodecOrigin.LeftTop,
+ SKCodecOrigin.RightBottom,
+ SKCodecOrigin.RightTop
+ };
+
+ // check if we need to turn the image
+ bool isDifferentOrientation = differentOrientations.Any(o => o == origin);
+
+ // define new width/height
+ var width = isDifferentOrientation ? original.Height : original.Width;
+ var height = isDifferentOrientation ? original.Width : original.Height;
+
+ var bitmap = new SKBitmap(width, height, true);
+
+ // todo: the stuff in this switch statement should be rewritten to use pointers
+ switch (origin)
+ {
+ case SKCodecOrigin.LeftBottom:
+
+ for (var x = 0; x < original.Width; x++)
+ for (var y = 0; y < original.Height; y++)
+ bitmap.SetPixel(y, original.Width - 1 - x, original.GetPixel(x, y));
+ break;
+
+ case SKCodecOrigin.RightTop:
+
+ for (var x = 0; x < original.Width; x++)
+ for (var y = 0; y < original.Height; y++)
+ bitmap.SetPixel(original.Height - 1 - y, x, original.GetPixel(x, y));
+ break;
+
+ case SKCodecOrigin.RightBottom:
+
+ for (var x = 0; x < original.Width; x++)
+ for (var y = 0; y < original.Height; y++)
+ bitmap.SetPixel(original.Height - 1 - y, original.Width - 1 - x, original.GetPixel(x, y));
+
+ break;
+
+ case SKCodecOrigin.LeftTop:
+
+ for (var x = 0; x < original.Width; x++)
+ for (var y = 0; y < original.Height; y++)
+ bitmap.SetPixel(y, x, original.GetPixel(x, y));
+ break;
+
+ case SKCodecOrigin.BottomLeft:
+
+ for (var x = 0; x < original.Width; x++)
+ for (var y = 0; y < original.Height; y++)
+ bitmap.SetPixel(x, original.Height - 1 - y, original.GetPixel(x, y));
+ break;
+
+ case SKCodecOrigin.BottomRight:
+
+ for (var x = 0; x < original.Width; x++)
+ for (var y = 0; y < original.Height; y++)
+ bitmap.SetPixel(original.Width - 1 - x, original.Height - 1 - y, original.GetPixel(x, y));
+ break;
+
+ case SKCodecOrigin.TopRight:
+
+ for (var x = 0; x < original.Width; x++)
+ for (var y = 0; y < original.Height; y++)
+ bitmap.SetPixel(original.Width - 1 - x, y, original.GetPixel(x, y));
+ break;
+
+ }
+
+ return bitmap;
+ }
+
+ public string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, ImageOrientation? orientation, int quality, ImageProcessingOptions options, ImageFormat selectedOutputFormat)
{
if (string.IsNullOrWhiteSpace(inputPath))
{
@@ -260,7 +356,7 @@ namespace Emby.Drawing.Skia
var blur = options.Blur ?? 0;
var hasIndicator = options.AddPlayedIndicator || options.UnplayedCount.HasValue || !options.PercentPlayed.Equals(0);
- using (var bitmap = GetBitmap(inputPath, options.CropWhiteSpace))
+ using (var bitmap = GetBitmap(inputPath, options.CropWhiteSpace, autoOrient, orientation))
{
if (bitmap == null)
{
@@ -272,7 +368,7 @@ namespace Emby.Drawing.Skia
var originalImageSize = new ImageSize(bitmap.Width, bitmap.Height);
ImageHelper.SaveImageSize(inputPath, dateModified, originalImageSize);
- 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.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs
index a1543382f..eb5e0d82a 100644
--- a/Emby.Drawing/ImageProcessor.cs
+++ b/Emby.Drawing/ImageProcessor.cs
@@ -217,14 +217,23 @@ namespace Emby.Drawing
dateModified = tuple.Item2;
}
- if (options.HasDefaultOptions(originalImagePath))
+ var photo = item as Photo;
+ var autoOrient = false;
+ ImageOrientation? orientation = null;
+ if (photo != null && photo.Orientation.HasValue && photo.Orientation.Value != ImageOrientation.TopLeft)
+ {
+ autoOrient = true;
+ orientation = photo.Orientation;
+ }
+
+ if (options.HasDefaultOptions(originalImagePath) && !autoOrient)
{
// Just spit out the original file if all the options are default
return new Tuple(originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified);
}
ImageSize? originalImageSize = GetSavedImageSize(originalImagePath, dateModified);
- if (originalImageSize.HasValue && options.HasDefaultOptions(originalImagePath, originalImageSize.Value))
+ if (originalImageSize.HasValue && options.HasDefaultOptions(originalImagePath, originalImageSize.Value) && !autoOrient)
{
// Just spit out the original file if all the options are default
_logger.Info("Returning original image {0}", originalImagePath);
@@ -243,7 +252,6 @@ namespace Emby.Drawing
if (!_fileSystem.FileExists(cacheFilePath))
{
- _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(cacheFilePath));
var tmpPath = Path.ChangeExtension(Path.Combine(_appPaths.TempDirectory, Guid.NewGuid().ToString("N")), Path.GetExtension(cacheFilePath));
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(tmpPath));
@@ -252,13 +260,14 @@ namespace Emby.Drawing
item = _libraryManager().GetItemById(options.ItemId);
}
- var resultPath =_imageEncoder.EncodeImage(originalImagePath, dateModified, tmpPath, AutoOrient(item), quality, options, outputFormat);
+ var resultPath = _imageEncoder.EncodeImage(originalImagePath, dateModified, tmpPath, autoOrient, orientation, quality, options, outputFormat);
if (string.Equals(resultPath, originalImagePath, StringComparison.OrdinalIgnoreCase))
{
return new Tuple(originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified);
}
+ _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(cacheFilePath));
CopyFile(tmpPath, cacheFilePath);
return new Tuple(tmpPath, GetMimeType(outputFormat, cacheFilePath), _fileSystem.GetLastWriteTimeUtc(tmpPath));
@@ -288,17 +297,6 @@ namespace Emby.Drawing
}
}
- private bool AutoOrient(IHasImages item)
- {
- var photo = item as Photo;
- if (photo != null && photo.Orientation.HasValue)
- {
- return true;
- }
-
- return false;
- }
-
//private static int[][] OPERATIONS = new int[][] {
// TopLeft
//new int[] { 0, NONE},
diff --git a/Emby.Drawing/NullImageEncoder.cs b/Emby.Drawing/NullImageEncoder.cs
index 2241c5a86..f04e8aaf1 100644
--- a/Emby.Drawing/NullImageEncoder.cs
+++ b/Emby.Drawing/NullImageEncoder.cs
@@ -32,7 +32,7 @@ namespace Emby.Drawing
throw new NotImplementedException();
}
- public string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, int quality, ImageProcessingOptions options, ImageFormat selectedOutputFormat)
+ public string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, ImageOrientation? orientation, int quality, ImageProcessingOptions options, ImageFormat selectedOutputFormat)
{
throw new NotImplementedException();
}
diff --git a/Emby.Drawing/project.json b/Emby.Drawing/project.json
deleted file mode 100644
index fbbe9eaf3..000000000
--- a/Emby.Drawing/project.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "frameworks":{
- "netstandard1.6":{
- "dependencies":{
- "NETStandard.Library":"1.6.0",
- }
- },
- ".NETPortable,Version=v4.5,Profile=Profile7":{
- "buildOptions": {
- "define": [ ]
- },
- "frameworkAssemblies":{
-
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Emby.Photos/project.json b/Emby.Photos/project.json
deleted file mode 100644
index fbbe9eaf3..000000000
--- a/Emby.Photos/project.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "frameworks":{
- "netstandard1.6":{
- "dependencies":{
- "NETStandard.Library":"1.6.0",
- }
- },
- ".NETPortable,Version=v4.5,Profile=Profile7":{
- "buildOptions": {
- "define": [ ]
- },
- "frameworkAssemblies":{
-
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Emby.Server.Core/Emby.Server.Core.csproj b/Emby.Server.Core/Emby.Server.Core.csproj
index 01193bb6c..063ef6eb9 100644
--- a/Emby.Server.Core/Emby.Server.Core.csproj
+++ b/Emby.Server.Core/Emby.Server.Core.csproj
@@ -41,9 +41,8 @@
..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll
True
-
- ..\packages\SimpleInjector.4.0.7\lib\net45\SimpleInjector.dll
- True
+
+ ..\packages\SimpleInjector.4.0.8\lib\net45\SimpleInjector.dll
diff --git a/Emby.Server.Core/IO/LibraryMonitor.cs b/Emby.Server.Core/IO/LibraryMonitor.cs
index 0f0640a38..ebc5e5e55 100644
--- a/Emby.Server.Core/IO/LibraryMonitor.cs
+++ b/Emby.Server.Core/IO/LibraryMonitor.cs
@@ -332,7 +332,13 @@ namespace Emby.Server.Core.IO
NotifyFilters.Attributes;
newWatcher.Created += watcher_Changed;
- newWatcher.Deleted += watcher_Changed;
+
+ // Seeing mono crashes on background threads we can't catch, testing if this might help
+ if (_environmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows)
+ {
+ newWatcher.Deleted += watcher_Changed;
+ }
+
newWatcher.Renamed += watcher_Changed;
newWatcher.Changed += watcher_Changed;
diff --git a/Emby.Server.Core/packages.config b/Emby.Server.Core/packages.config
index 24e8a26b6..6311b55eb 100644
--- a/Emby.Server.Core/packages.config
+++ b/Emby.Server.Core/packages.config
@@ -2,5 +2,5 @@
-
+
\ No newline at end of file
diff --git a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
index d3b2ef7ef..567f139fd 100644
--- a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
+++ b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
@@ -123,7 +123,7 @@ namespace Emby.Server.Implementations.Activity
return;
}
- if (item.IsThemeMedia)
+ if (e.Item != null && e.Item.IsThemeMedia)
{
// Don't report theme song or local trailer playback
return;
@@ -155,7 +155,7 @@ namespace Emby.Server.Implementations.Activity
return;
}
- if (item.IsThemeMedia)
+ if (e.Item != null && e.Item.IsThemeMedia)
{
// Don't report theme song or local trailer playback
return;
diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs
index 809771b04..73878160c 100644
--- a/Emby.Server.Implementations/Channels/ChannelManager.cs
+++ b/Emby.Server.Implementations/Channels/ChannelManager.cs
@@ -176,7 +176,9 @@ namespace Emby.Server.Implementations.Channels
var internalResult = await GetChannelsInternal(query, cancellationToken).ConfigureAwait(false);
- var dtoOptions = new DtoOptions();
+ var dtoOptions = new DtoOptions()
+ {
+ };
var returnItems = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user).ConfigureAwait(false))
.ToArray();
@@ -558,7 +560,10 @@ namespace Emby.Server.Implementations.Channels
totalRecordCount = items.Length;
}
- var dtoOptions = new DtoOptions();
+ var dtoOptions = new DtoOptions()
+ {
+ Fields = query.Fields.ToList()
+ };
var returnItems = (await _dtoService.GetBaseItemDtos(items, dtoOptions, user).ConfigureAwait(false))
.ToArray();
@@ -825,7 +830,10 @@ namespace Emby.Server.Implementations.Channels
RefreshIfNeeded(internalResult.Items);
- var dtoOptions = new DtoOptions();
+ var dtoOptions = new DtoOptions()
+ {
+ Fields = query.Fields.ToList()
+ };
var returnItems = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user).ConfigureAwait(false))
.ToArray();
@@ -974,7 +982,10 @@ namespace Emby.Server.Implementations.Channels
var internalResult = await GetChannelItemsInternal(query, new Progress(), cancellationToken).ConfigureAwait(false);
- var dtoOptions = new DtoOptions();
+ var dtoOptions = new DtoOptions()
+ {
+ Fields = query.Fields.ToList()
+ };
var returnItems = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user).ConfigureAwait(false))
.ToArray();
@@ -1378,12 +1389,6 @@ namespace Emby.Server.Implementations.Channels
item.SetImagePath(ImageType.Primary, info.ImageUrl);
}
- if (item.SourceType != SourceType.Channel)
- {
- item.SourceType = SourceType.Channel;
- forceUpdate = true;
- }
-
if (isNew)
{
await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
index 49ba6c9f3..df3cecbf9 100644
--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
@@ -199,10 +199,11 @@ namespace Emby.Server.Implementations.Data
AddColumn(db, "TypedBaseItems", "ParentId", "GUID", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Genres", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "SortName", "Text", existingColumnNames);
+ AddColumn(db, "TypedBaseItems", "ForcedSortName", "Text", existingColumnNames);
+
AddColumn(db, "TypedBaseItems", "RunTimeTicks", "BIGINT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "HomePageUrl", "Text", existingColumnNames);
- AddColumn(db, "TypedBaseItems", "VoteCount", "INT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "DisplayMediaType", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "DateCreated", "DATETIME", existingColumnNames);
AddColumn(db, "TypedBaseItems", "DateModified", "DATETIME", existingColumnNames);
@@ -233,7 +234,6 @@ namespace Emby.Server.Implementations.Data
AddColumn(db, "TypedBaseItems", "UnratedType", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "TopParentId", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsItemByName", "BIT", existingColumnNames);
- AddColumn(db, "TypedBaseItems", "SourceType", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "TrailerTypes", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "CriticRating", "Float", existingColumnNames);
AddColumn(db, "TypedBaseItems", "InheritedTags", "Text", existingColumnNames);
@@ -424,9 +424,8 @@ namespace Emby.Server.Implementations.Data
"OfficialRating",
"HomePageUrl",
"DisplayMediaType",
- "SortName",
+ "ForcedSortName",
"RunTimeTicks",
- "VoteCount",
"DateCreated",
"DateModified",
"guid",
@@ -439,7 +438,6 @@ namespace Emby.Server.Implementations.Data
"LockedFields",
"Studios",
"Tags",
- "SourceType",
"TrailerTypes",
"OriginalTitle",
"PrimaryVersionId",
@@ -541,9 +539,9 @@ namespace Emby.Server.Implementations.Data
"Genres",
"InheritedParentalRatingValue",
"SortName",
+ "ForcedSortName",
"RunTimeTicks",
"HomePageUrl",
- "VoteCount",
"DisplayMediaType",
"DateCreated",
"DateModified",
@@ -563,7 +561,6 @@ namespace Emby.Server.Implementations.Data
"UnratedType",
"TopParentId",
"IsItemByName",
- "SourceType",
"TrailerTypes",
"CriticRating",
"InheritedTags",
@@ -815,10 +812,12 @@ namespace Emby.Server.Implementations.Data
saveItemStatement.TryBind("@InheritedParentalRatingValue", item.InheritedParentalRatingValue);
saveItemStatement.TryBind("@SortName", item.SortName);
+
+ saveItemStatement.TryBind("@ForcedSortName", item.ForcedSortName);
+
saveItemStatement.TryBind("@RunTimeTicks", item.RunTimeTicks);
saveItemStatement.TryBind("@HomePageUrl", item.HomePageUrl);
- saveItemStatement.TryBind("@VoteCount", item.VoteCount);
saveItemStatement.TryBind("@DisplayMediaType", item.DisplayMediaType);
saveItemStatement.TryBind("@DateCreated", item.DateCreated);
saveItemStatement.TryBind("@DateModified", item.DateModified);
@@ -909,7 +908,6 @@ namespace Emby.Server.Implementations.Data
isByName = dualAccess == null || dualAccess.IsAccessedByName;
}
saveItemStatement.TryBind("@IsItemByName", isByName);
- saveItemStatement.TryBind("@SourceType", item.SourceType.ToString());
var trailer = item as Trailer;
if (trailer != null && trailer.TrailerTypes.Count > 0)
@@ -1624,7 +1622,7 @@ namespace Emby.Server.Implementations.Data
{
if (!reader.IsDBNull(index))
{
- item.SortName = reader.GetString(index);
+ item.ForcedSortName = reader.GetString(index);
}
index++;
}
@@ -1635,15 +1633,6 @@ namespace Emby.Server.Implementations.Data
}
index++;
- if (HasField(query, ItemFields.VoteCount))
- {
- if (!reader.IsDBNull(index))
- {
- item.VoteCount = reader.GetInt32(index);
- }
- index++;
- }
-
if (HasField(query, ItemFields.DateCreated))
{
if (!reader.IsDBNull(index))
@@ -1733,12 +1722,6 @@ namespace Emby.Server.Implementations.Data
index++;
}
- if (!reader.IsDBNull(index))
- {
- item.SourceType = (SourceType)Enum.Parse(typeof(SourceType), reader.GetString(index), true);
- }
- index++;
-
if (hasTrailerTypes)
{
var trailer = item as Trailer;
@@ -2283,7 +2266,7 @@ namespace Emby.Server.Implementations.Data
}
if (field == ItemFields.SortName)
{
- return new[] { "SortName" };
+ return new[] { "ForcedSortName" };
}
if (field == ItemFields.Taglines)
{
@@ -2306,7 +2289,6 @@ namespace Emby.Server.Implementations.Data
case ItemFields.HomePageUrl:
case ItemFields.Keywords:
case ItemFields.DisplayMediaType:
- case ItemFields.VoteCount:
case ItemFields.CustomRating:
case ItemFields.ProductionLocations:
case ItemFields.Settings:
@@ -3872,34 +3854,6 @@ namespace Emby.Server.Implementations.Data
}
}
- if (query.SourceTypes.Length == 1)
- {
- whereClauses.Add("SourceType=@SourceType");
- if (statement != null)
- {
- statement.TryBind("@SourceType", query.SourceTypes[0].ToString());
- }
- }
- else if (query.SourceTypes.Length > 1)
- {
- var inClause = string.Join(",", query.SourceTypes.Select(i => "'" + i + "'").ToArray());
- whereClauses.Add(string.Format("SourceType in ({0})", inClause));
- }
-
- if (query.ExcludeSourceTypes.Length == 1)
- {
- whereClauses.Add("SourceType<>@ExcludeSourceTypes");
- if (statement != null)
- {
- statement.TryBind("@ExcludeSourceTypes", query.ExcludeSourceTypes[0].ToString());
- }
- }
- else if (query.ExcludeSourceTypes.Length > 1)
- {
- var inClause = string.Join(",", query.ExcludeSourceTypes.Select(i => "'" + i + "'").ToArray());
- whereClauses.Add(string.Format("SourceType not in ({0})", inClause));
- }
-
if (query.TrailerTypes.Length > 0)
{
var clauses = new List();
@@ -5017,14 +4971,6 @@ namespace Emby.Server.Implementations.Data
statement.TryBind("@NameContains", "%" + query.NameContains + "%");
}
}
- if (query.SourceTypes.Length == 1)
- {
- whereClauses.Add("(select sourcetype from typedbaseitems where guid=ItemId) = @SourceTypes");
- if (statement != null)
- {
- statement.TryBind("@SourceTypes", query.SourceTypes[0].ToString());
- }
- }
return whereClauses;
}
diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs
index 45fbd69dc..6bf58455f 100644
--- a/Emby.Server.Implementations/Dto/DtoService.cs
+++ b/Emby.Server.Implementations/Dto/DtoService.cs
@@ -1058,11 +1058,6 @@ namespace Emby.Server.Implementations.Dto
dto.CommunityRating = item.CommunityRating;
}
- if (fields.Contains(ItemFields.VoteCount))
- {
- dto.VoteCount = item.VoteCount;
- }
-
//if (item.IsFolder)
//{
// var folder = (Folder)item;
@@ -1084,7 +1079,10 @@ namespace Emby.Server.Implementations.Dto
if (audio != null)
{
dto.Album = audio.Album;
- dto.ExtraType = audio.ExtraType;
+ if (audio.ExtraType.HasValue)
+ {
+ dto.ExtraType = audio.ExtraType.Value.ToString();
+ }
var albumParent = audio.AlbumEntity;
@@ -1239,7 +1237,10 @@ namespace Emby.Server.Implementations.Dto
dto.Chapters = GetChapterInfoDtos(item);
}
- dto.ExtraType = video.ExtraType;
+ if (video.ExtraType.HasValue)
+ {
+ dto.ExtraType = video.ExtraType.Value.ToString();
+ }
}
if (fields.Contains(ItemFields.MediaStreams))
@@ -1395,7 +1396,7 @@ namespace Emby.Server.Implementations.Dto
}
}
- if (fields.Contains(ItemFields.SeriesPrimaryImage))
+ //if (fields.Contains(ItemFields.SeriesPrimaryImage))
{
series = series ?? season.Series;
if (series != null)
@@ -1586,7 +1587,7 @@ namespace Emby.Server.Implementations.Dto
{
var imageInfo = item.GetImageInfo(ImageType.Primary, 0);
- if (imageInfo == null || !imageInfo.IsLocalFile)
+ if (imageInfo == null)
{
return null;
}
@@ -1610,6 +1611,11 @@ namespace Emby.Server.Implementations.Dto
}
else
{
+ if (!imageInfo.IsLocalFile)
+ {
+ return null;
+ }
+
try
{
size = _imageProcessor.GetImageSize(imageInfo);
diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj
index 14d976325..df70680f1 100644
--- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj
+++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj
@@ -31,6 +31,9 @@
4
+
+ Properties\SharedVersion.cs
+
diff --git a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
index 54f9ca392..961f9886c 100644
--- a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
+++ b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
@@ -38,7 +38,10 @@ namespace Emby.Server.Implementations.Library
// Synology
"@eaDir",
"eaDir",
- "#recycle"
+ "#recycle",
+
+ // Qnap
+ "@Recycle"
};
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs
index 42eda00b7..a08c74474 100644
--- a/Emby.Server.Implementations/Library/LibraryManager.cs
+++ b/Emby.Server.Implementations/Library/LibraryManager.cs
@@ -1292,7 +1292,7 @@ namespace Emby.Server.Implementations.Library
return item;
}
- public IEnumerable GetItemList(InternalItemsQuery query)
+ public IEnumerable GetItemList(InternalItemsQuery query, bool allowExternalContent)
{
if (query.Recursive && query.ParentId.HasValue)
{
@@ -1305,12 +1305,17 @@ namespace Emby.Server.Implementations.Library
if (query.User != null)
{
- AddUserToQuery(query, query.User);
+ AddUserToQuery(query, query.User, allowExternalContent);
}
return ItemRepository.GetItemList(query);
}
+ public IEnumerable GetItemList(InternalItemsQuery query)
+ {
+ return GetItemList(query, true);
+ }
+
public int GetCount(InternalItemsQuery query)
{
if (query.Recursive && query.ParentId.HasValue)
@@ -1548,7 +1553,7 @@ namespace Emby.Server.Implementations.Library
query.Parent = null;
}
- private void AddUserToQuery(InternalItemsQuery query, User user)
+ private void AddUserToQuery(InternalItemsQuery query, User user, bool allowExternalContent = true)
{
if (query.AncestorIds.Length == 0 &&
!query.ParentId.HasValue &&
@@ -1561,7 +1566,8 @@ namespace Emby.Server.Implementations.Library
var userViews = _userviewManager().GetUserViews(new UserViewQuery
{
UserId = user.Id.ToString("N"),
- IncludeHidden = true
+ IncludeHidden = true,
+ IncludeExternalContent = allowExternalContent
}, CancellationToken.None).Result.ToList();
diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs
index 0b9027291..8e8f8c4dc 100644
--- a/Emby.Server.Implementations/Library/UserManager.cs
+++ b/Emby.Server.Implementations/Library/UserManager.cs
@@ -202,8 +202,7 @@ namespace Emby.Server.Implementations.Library
private bool IsValidUsernameCharacter(char i)
{
- return char.IsLetterOrDigit(i) || char.Equals(i, '-') || char.Equals(i, '_') || char.Equals(i, '\'') ||
- char.Equals(i, '.');
+ return !char.Equals(i, '<') && !char.Equals(i, '>');
}
public string MakeValidUsername(string username)
diff --git a/Emby.Server.Implementations/Library/UserViewManager.cs b/Emby.Server.Implementations/Library/UserViewManager.cs
index f403ca266..a6ed84f29 100644
--- a/Emby.Server.Implementations/Library/UserViewManager.cs
+++ b/Emby.Server.Implementations/Library/UserViewManager.cs
@@ -280,7 +280,7 @@ namespace Emby.Server.Implementations.Library
} : new string[] { };
- return _libraryManager.GetItemList(new InternalItemsQuery(user)
+ var query = new InternalItemsQuery(user)
{
IncludeItemTypes = includeItemTypes,
SortOrder = SortOrder.Descending,
@@ -289,11 +289,16 @@ namespace Emby.Server.Implementations.Library
ExcludeItemTypes = excludeItemTypes,
IsVirtualItem = false,
Limit = limit * 5,
- SourceTypes = parents.Count == 0 ? new[] { SourceType.Library } : new SourceType[] { },
IsPlayed = isPlayed,
DtoOptions = options
+ };
- }, parents);
+ if (parents.Count == 0)
+ {
+ return _libraryManager.GetItemList(query, false);
+ }
+
+ return _libraryManager.GetItemList(query, parents);
}
}
}
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index 6ce2b88f1..a4c5b338e 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -2270,11 +2270,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
writer.WriteElementString("studio", studio);
}
- if (item.VoteCount.HasValue)
- {
- writer.WriteElementString("votes", item.VoteCount.Value.ToString(CultureInfo.InvariantCulture));
- }
-
writer.WriteEndElement();
writer.WriteEndDocument();
}
diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
index da6759b34..bba625cd1 100644
--- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
+++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
@@ -136,6 +136,9 @@ namespace Emby.Server.Implementations.LiveTv.Listings
var requestBody = "[\"" + string.Join("\", \"", programsID) + "\"]";
httpOptions.RequestContent = requestBody;
+ double wideAspect = 1.77777778;
+ var primaryImageCategory = "Logo";
+
using (var innerResponse = await Post(httpOptions, true, info).ConfigureAwait(false))
{
StreamReader innerReader = new StreamReader(innerResponse.Content);
@@ -167,13 +170,25 @@ namespace Emby.Server.Implementations.LiveTv.Listings
{
var programEntry = programDict[schedule.programID];
- var allImages = (images[imageIndex].data ?? new List()).OrderByDescending(GetSizeOrder).ToList();
+ var allImages = (images[imageIndex].data ?? new List()).ToList();
var imagesWithText = allImages.Where(i => string.Equals(i.text, "yes", StringComparison.OrdinalIgnoreCase)).ToList();
+ var imagesWithoutText = allImages.Where(i => string.Equals(i.text, "no", StringComparison.OrdinalIgnoreCase)).ToList();
- programEntry.primaryImage = GetProgramImage(ApiUrl, imagesWithText, "Logo", true, 600) ??
- GetProgramImage(ApiUrl, allImages, "Logo", true, 600);
+ double desiredAspect = IsMovie(programEntry) ? 0.666666667 : wideAspect;
+
+ programEntry.primaryImage = GetProgramImage(ApiUrl, imagesWithText, true, desiredAspect) ??
+ GetProgramImage(ApiUrl, allImages, true, desiredAspect);
+
+ programEntry.thumbImage = GetProgramImage(ApiUrl, imagesWithText, true, wideAspect);
+
+ // Don't supply the same image twice
+ if (string.Equals(programEntry.primaryImage, programEntry.thumbImage, StringComparison.Ordinal))
+ {
+ programEntry.thumbImage = null;
+ }
+
+ programEntry.backdropImage = GetProgramImage(ApiUrl, imagesWithoutText, true, wideAspect);
- //programEntry.thumbImage = GetProgramImage(ApiUrl, data, "Iconic", false);
//programEntry.bannerImage = GetProgramImage(ApiUrl, data, "Banner", false) ??
// GetProgramImage(ApiUrl, data, "Banner-L1", false) ??
// GetProgramImage(ApiUrl, data, "Banner-LO", false) ??
@@ -220,9 +235,14 @@ namespace Emby.Server.Implementations.LiveTv.Listings
return channelNumber;
}
+ private bool IsMovie(ScheduleDirect.ProgramDetails programInfo)
+ {
+ var showType = programInfo.showType ?? string.Empty;
+ return showType.IndexOf("movie", StringComparison.OrdinalIgnoreCase) != -1 || showType.IndexOf("film", StringComparison.OrdinalIgnoreCase) != -1;
+ }
+
private ProgramInfo GetProgram(string channelId, ScheduleDirect.Program programInfo, ScheduleDirect.ProgramDetails details)
{
- //_logger.Debug("Show type is: " + (details.showType ?? "No ShowType"));
DateTime startAt = GetDate(programInfo.airDateTime);
DateTime endAt = startAt.AddSeconds(programInfo.duration);
ProgramAudio audioType = ProgramAudio.Stereo;
@@ -276,9 +296,10 @@ namespace Emby.Server.Implementations.LiveTv.Listings
IsRepeat = repeat,
IsSeries = showType.IndexOf("series", StringComparison.OrdinalIgnoreCase) != -1,
ImageUrl = details.primaryImage,
+ ThumbImageUrl = details.thumbImage,
IsKids = string.Equals(details.audience, "children", StringComparison.OrdinalIgnoreCase),
IsSports = showType.IndexOf("sports", StringComparison.OrdinalIgnoreCase) != -1,
- IsMovie = showType.IndexOf("movie", StringComparison.OrdinalIgnoreCase) != -1 || showType.IndexOf("film", StringComparison.OrdinalIgnoreCase) != -1,
+ IsMovie = IsMovie(details),
Etag = programInfo.md5
};
@@ -378,49 +399,18 @@ namespace Emby.Server.Implementations.LiveTv.Listings
return date;
}
- private string GetProgramImage(string apiUrl, List images, string category, bool returnDefaultImage, int desiredWidth)
+ private string GetProgramImage(string apiUrl, List images, bool returnDefaultImage, double desiredAspect)
{
string url = null;
- var matches = images
- .Where(i => string.Equals(i.category, category, StringComparison.OrdinalIgnoreCase))
+ var matches = images;
+
+ matches = matches
+ .OrderBy(i => Math.Abs(desiredAspect - GetApsectRatio(i)))
+ .ThenByDescending(GetSizeOrder)
.ToList();
- if (matches.Count == 0)
- {
- if (!returnDefaultImage)
- {
- return null;
- }
- matches = images;
- }
-
- var match = matches.FirstOrDefault(i =>
- {
- if (!string.IsNullOrWhiteSpace(i.width))
- {
- int value;
- if (int.TryParse(i.width, out value))
- {
- return value <= desiredWidth;
- }
- }
-
- return false;
- });
-
- if (match == null)
- {
- // Get the second lowest quality image, when possible
- if (matches.Count > 1)
- {
- match = matches[matches.Count - 2];
- }
- else
- {
- match = matches.FirstOrDefault();
- }
- }
+ var match = matches.FirstOrDefault();
if (match == null)
{
@@ -444,6 +434,31 @@ namespace Emby.Server.Implementations.LiveTv.Listings
return url;
}
+ private double GetApsectRatio(ScheduleDirect.ImageData i)
+ {
+ int width = 0;
+ int height = 0;
+
+ if (!string.IsNullOrWhiteSpace(i.width))
+ {
+ int.TryParse(i.width, out width);
+ }
+
+ if (!string.IsNullOrWhiteSpace(i.height))
+ {
+ int.TryParse(i.height, out height);
+ }
+
+ if (height == 0 || width == 0)
+ {
+ return 0;
+ }
+
+ double result = width;
+ result /= height;
+ return result;
+ }
+
private async Task> GetImageForPrograms(
ListingsProviderInfo info,
List programIds,
@@ -1188,6 +1203,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
public bool hasImageArtwork { get; set; }
public string primaryImage { get; set; }
public string thumbImage { get; set; }
+ public string backdropImage { get; set; }
public string bannerImage { get; set; }
public string imageID { get; set; }
public string md5 { get; set; }
diff --git a/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs
index d56ddc57d..12da1464b 100644
--- a/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs
@@ -16,7 +16,7 @@ namespace Emby.Server.Implementations.LiveTv
private readonly IMediaEncoder _mediaEncoder;
private readonly ILogger _logger;
- const int AnalyzeDurationMs = 2000;
+ const int AnalyzeDurationMs = 1000;
public LiveStreamHelper(IMediaEncoder mediaEncoder, ILogger logger)
{
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
index c2f057560..4ad411c19 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -679,8 +679,7 @@ namespace Emby.Server.Implementations.LiveTv
item.SetImage(new ItemImageInfo
{
Path = info.ImagePath,
- Type = ImageType.Primary,
- IsPlaceholder = true
+ Type = ImageType.Primary
}, 0);
}
else if (!string.IsNullOrWhiteSpace(info.ImageUrl))
@@ -688,8 +687,46 @@ namespace Emby.Server.Implementations.LiveTv
item.SetImage(new ItemImageInfo
{
Path = info.ImageUrl,
- Type = ImageType.Primary,
- IsPlaceholder = true
+ Type = ImageType.Primary
+ }, 0);
+ }
+ }
+
+ if (!item.HasImage(ImageType.Thumb))
+ {
+ if (!string.IsNullOrWhiteSpace(info.ThumbImageUrl))
+ {
+ item.SetImage(new ItemImageInfo
+ {
+ Path = info.ThumbImageUrl,
+ Type = ImageType.Thumb
+
+ }, 0);
+ }
+ }
+
+ if (!item.HasImage(ImageType.Logo))
+ {
+ if (!string.IsNullOrWhiteSpace(info.LogoImageUrl))
+ {
+ item.SetImage(new ItemImageInfo
+ {
+ Path = info.LogoImageUrl,
+ Type = ImageType.Logo
+
+ }, 0);
+ }
+ }
+
+ if (!item.HasImage(ImageType.Backdrop))
+ {
+ if (!string.IsNullOrWhiteSpace(info.BackdropImageUrl))
+ {
+ item.SetImage(new ItemImageInfo
+ {
+ Path = info.BackdropImageUrl,
+ Type = ImageType.Backdrop
+
}, 0);
}
}
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
index 2afc3744f..153f86aed 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
@@ -422,6 +422,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
SupportsTranscoding = true,
IsInfiniteStream = true,
IgnoreDts = true,
+ //SupportsProbing = false,
+ //AnalyzeDurationMs = 2000000
//IgnoreIndex = true,
//ReadAtNativeFramerate = true
};
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs
index 90bbaaf3d..d2e9c8bf0 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs
@@ -117,7 +117,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
}
else
{
- await _multicastStream.CopyUntilCancelled(response.Content, () => Resolve(openTaskCompletionSource), cancellationToken).ConfigureAwait(false);
+ Resolve(openTaskCompletionSource);
+
+ await _multicastStream.CopyUntilCancelled(response.Content, null, cancellationToken).ConfigureAwait(false);
}
}
}
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
index 4c1190e0e..8d73c7e2b 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
@@ -235,10 +235,18 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
else
{
- numberString = Path.GetFileNameWithoutExtension(mediaUrl.Split('/').Last());
-
- if (!IsValidChannelNumber(numberString))
+ try
{
+ numberString = Path.GetFileNameWithoutExtension(mediaUrl.Split('/').Last());
+
+ if (!IsValidChannelNumber(numberString))
+ {
+ numberString = null;
+ }
+ }
+ catch
+ {
+ // Seeing occasional argument exception here
numberString = null;
}
}
diff --git a/Emby.Server.Implementations/Notifications/Notifications.cs b/Emby.Server.Implementations/Notifications/Notifications.cs
index 8f24dfe1a..f95b3f701 100644
--- a/Emby.Server.Implementations/Notifications/Notifications.cs
+++ b/Emby.Server.Implementations/Notifications/Notifications.cs
@@ -23,6 +23,7 @@ using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Model.Threading;
+using MediaBrowser.Model.Dto;
namespace Emby.Server.Implementations.Notifications
{
@@ -260,7 +261,7 @@ namespace Emby.Server.Implementations.Notifications
var item = e.MediaInfo;
- if ( item.IsThemeMedia)
+ if (e.Item != null && e.Item.IsThemeMedia)
{
// Don't report theme song or local trailer playback
return;
@@ -430,7 +431,7 @@ namespace Emby.Server.Implementations.Notifications
return name;
}
- public static string GetItemName(BaseItemInfo item)
+ public static string GetItemName(BaseItemDto item)
{
var name = item.Name;
diff --git a/Emby.Server.Implementations/Properties/AssemblyInfo.cs b/Emby.Server.Implementations/Properties/AssemblyInfo.cs
index ed7f9631f..28ffcbac6 100644
--- a/Emby.Server.Implementations/Properties/AssemblyInfo.cs
+++ b/Emby.Server.Implementations/Properties/AssemblyInfo.cs
@@ -25,6 +25,4 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+// [assembly: AssemblyVersion("1.0.*")]
\ No newline at end of file
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs
index 42cd5d1b1..a5582ddc5 100644
--- a/Emby.Server.Implementations/Session/SessionManager.cs
+++ b/Emby.Server.Implementations/Session/SessionManager.cs
@@ -338,7 +338,7 @@ namespace Emby.Server.Implementations.Session
}
}
- info.Item = GetItemInfo(libraryItem, libraryItem, mediaSource);
+ info.Item = GetItemInfo(libraryItem, mediaSource);
info.Item.RunTimeTicks = runtimeTicks;
}
@@ -813,7 +813,7 @@ namespace Emby.Server.Implementations.Session
mediaSource = await GetMediaSource(hasMediaSources, info.MediaSourceId, info.LiveStreamId).ConfigureAwait(false);
}
- info.Item = GetItemInfo(libraryItem, libraryItem, mediaSource);
+ info.Item = GetItemInfo(libraryItem, mediaSource);
}
else
{
@@ -1637,165 +1637,65 @@ namespace Emby.Server.Implementations.Session
return dto;
}
+ private DtoOptions _itemInfoDtoOptions;
+
///
/// Converts a BaseItem to a BaseItemInfo
///
- /// The item.
- /// The chapter owner.
- /// The media source.
- /// BaseItemInfo.
- /// item
- private BaseItemInfo GetItemInfo(BaseItem item, BaseItem chapterOwner, MediaSourceInfo mediaSource)
+ private BaseItemDto GetItemInfo(BaseItem item, MediaSourceInfo mediaSource)
{
if (item == null)
{
throw new ArgumentNullException("item");
}
- var info = new BaseItemInfo
- {
- Id = GetDtoId(item),
- Name = item.Name,
- MediaType = item.MediaType,
- Type = item.GetClientTypeName(),
- RunTimeTicks = item.RunTimeTicks,
- IndexNumber = item.IndexNumber,
- ParentIndexNumber = item.ParentIndexNumber,
- PremiereDate = item.PremiereDate,
- ProductionYear = item.ProductionYear,
- IsThemeMedia = item.IsThemeMedia
- };
+ var dtoOptions = _itemInfoDtoOptions;
- info.PrimaryImageTag = GetImageCacheTag(item, ImageType.Primary);
- if (info.PrimaryImageTag != null)
+ if (_itemInfoDtoOptions == null)
{
- info.PrimaryImageItemId = GetDtoId(item);
- }
-
- var episode = item as Episode;
- if (episode != null)
- {
- info.IndexNumberEnd = episode.IndexNumberEnd;
- }
-
- var hasSeries = item as IHasSeries;
- if (hasSeries != null)
- {
- info.SeriesName = hasSeries.SeriesName;
- }
-
- var recording = item as ILiveTvRecording;
- if (recording != null)
- {
- if (recording.IsSeries)
+ dtoOptions = new DtoOptions
{
- info.Name = recording.EpisodeTitle;
- info.SeriesName = recording.Name;
+ AddProgramRecordingInfo = false
+ };
- if (string.IsNullOrWhiteSpace(info.Name))
- {
- info.Name = recording.Name;
- }
- }
+ dtoOptions.Fields.Remove(ItemFields.BasicSyncInfo);
+ dtoOptions.Fields.Remove(ItemFields.SyncInfo);
+ dtoOptions.Fields.Remove(ItemFields.CanDelete);
+ dtoOptions.Fields.Remove(ItemFields.CanDownload);
+ dtoOptions.Fields.Remove(ItemFields.ChildCount);
+ dtoOptions.Fields.Remove(ItemFields.CustomRating);
+ dtoOptions.Fields.Remove(ItemFields.DateLastMediaAdded);
+ dtoOptions.Fields.Remove(ItemFields.DateLastRefreshed);
+ dtoOptions.Fields.Remove(ItemFields.DateLastSaved);
+ dtoOptions.Fields.Remove(ItemFields.DisplayMediaType);
+ dtoOptions.Fields.Remove(ItemFields.DisplayPreferencesId);
+ dtoOptions.Fields.Remove(ItemFields.Etag);
+ dtoOptions.Fields.Remove(ItemFields.ExternalEtag);
+ dtoOptions.Fields.Remove(ItemFields.IndexOptions);
+ dtoOptions.Fields.Remove(ItemFields.InheritedParentalRatingValue);
+ dtoOptions.Fields.Remove(ItemFields.ItemCounts);
+ dtoOptions.Fields.Remove(ItemFields.Keywords);
+ dtoOptions.Fields.Remove(ItemFields.MediaSourceCount);
+ dtoOptions.Fields.Remove(ItemFields.MediaStreams);
+ dtoOptions.Fields.Remove(ItemFields.MediaSources);
+ dtoOptions.Fields.Remove(ItemFields.People);
+ dtoOptions.Fields.Remove(ItemFields.PlayAccess);
+ dtoOptions.Fields.Remove(ItemFields.People);
+ dtoOptions.Fields.Remove(ItemFields.ProductionLocations);
+ dtoOptions.Fields.Remove(ItemFields.RecursiveItemCount);
+ dtoOptions.Fields.Remove(ItemFields.RemoteTrailers);
+ dtoOptions.Fields.Remove(ItemFields.SeasonUserData);
+ dtoOptions.Fields.Remove(ItemFields.SeriesGenres);
+ dtoOptions.Fields.Remove(ItemFields.Settings);
+ dtoOptions.Fields.Remove(ItemFields.SortName);
+ dtoOptions.Fields.Remove(ItemFields.Tags);
+ dtoOptions.Fields.Remove(ItemFields.ThemeSongIds);
+ dtoOptions.Fields.Remove(ItemFields.ThemeVideoIds);
+
+ _itemInfoDtoOptions = dtoOptions;
}
- var audio = item as Audio;
- if (audio != null)
- {
- info.Album = audio.Album;
- info.Artists = audio.Artists;
-
- if (info.PrimaryImageTag == null)
- {
- var album = audio.AlbumEntity;
-
- if (album != null && album.HasImage(ImageType.Primary))
- {
- info.PrimaryImageTag = GetImageCacheTag(album, ImageType.Primary);
- if (info.PrimaryImageTag != null)
- {
- info.PrimaryImageItemId = GetDtoId(album);
- }
- }
- }
- }
-
- var musicVideo = item as MusicVideo;
- if (musicVideo != null)
- {
- info.Album = musicVideo.Album;
- info.Artists = musicVideo.Artists.ToList();
- }
-
- var backropItem = item.HasImage(ImageType.Backdrop) ? item : null;
- var thumbItem = item.HasImage(ImageType.Thumb) ? item : null;
- var logoItem = item.HasImage(ImageType.Logo) ? item : null;
-
- if (thumbItem == null)
- {
- if (episode != null)
- {
- var series = episode.Series;
-
- if (series != null && series.HasImage(ImageType.Thumb))
- {
- thumbItem = series;
- }
- }
- }
-
- if (backropItem == null)
- {
- if (episode != null)
- {
- var series = episode.Series;
-
- if (series != null && series.HasImage(ImageType.Backdrop))
- {
- backropItem = series;
- }
- }
- }
-
- if (backropItem == null)
- {
- backropItem = item.GetParents().FirstOrDefault(i => i.HasImage(ImageType.Backdrop));
- }
-
- if (thumbItem == null)
- {
- thumbItem = item.GetParents().FirstOrDefault(i => i.HasImage(ImageType.Thumb));
- }
-
- if (logoItem == null)
- {
- logoItem = item.GetParents().FirstOrDefault(i => i.HasImage(ImageType.Logo));
- }
-
- if (thumbItem != null)
- {
- info.ThumbImageTag = GetImageCacheTag(thumbItem, ImageType.Thumb);
- info.ThumbItemId = GetDtoId(thumbItem);
- }
-
- if (backropItem != null)
- {
- info.BackdropImageTag = GetImageCacheTag(backropItem, ImageType.Backdrop);
- info.BackdropItemId = GetDtoId(backropItem);
- }
-
- if (logoItem != null)
- {
- info.LogoImageTag = GetImageCacheTag(logoItem, ImageType.Logo);
- info.LogoItemId = GetDtoId(logoItem);
- }
-
- if (chapterOwner != null)
- {
- info.ChapterImagesItemId = chapterOwner.Id.ToString("N");
-
- info.Chapters = _dtoService.GetChapterInfoDtos(chapterOwner).ToList();
- }
+ var info = _dtoService.GetBaseItemDto(item, dtoOptions);
if (mediaSource != null)
{
@@ -1837,7 +1737,7 @@ namespace Emby.Server.Implementations.Session
//ReportNowViewingItem(sessionId, info);
}
- public void ReportNowViewingItem(string sessionId, BaseItemInfo item)
+ public void ReportNowViewingItem(string sessionId, BaseItemDto item)
{
//var session = GetSession(sessionId);
diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.cs
index cdc33dfd4..8c04e979e 100644
--- a/MediaBrowser.Api/ItemUpdateService.cs
+++ b/MediaBrowser.Api/ItemUpdateService.cs
@@ -206,15 +206,16 @@ namespace MediaBrowser.Api
var newLockData = request.LockData ?? false;
var isLockedChanged = item.IsLocked != newLockData;
- UpdateItem(request, item);
-
- await item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
-
+ // Do this first so that metadata savers can pull the updates from the database.
if (request.People != null)
{
await _libraryManager.UpdatePeople(item, request.People.Select(x => new PersonInfo { Name = x.Name, Role = x.Role, Type = x.Type }).ToList());
}
+ UpdateItem(request, item);
+
+ await item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
+
if (isLockedChanged && item.IsFolder)
{
var folder = (Folder)item;
@@ -243,7 +244,6 @@ namespace MediaBrowser.Api
item.DisplayMediaType = request.DisplayMediaType;
item.CommunityRating = request.CommunityRating;
- item.VoteCount = request.VoteCount;
item.HomePageUrl = request.HomePageUrl;
item.IndexNumber = request.IndexNumber;
item.ParentIndexNumber = request.ParentIndexNumber;
diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs
index 4e0bdc8a9..d9fc7143f 100644
--- a/MediaBrowser.Api/Library/LibraryService.cs
+++ b/MediaBrowser.Api/Library/LibraryService.cs
@@ -27,6 +27,7 @@ using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Services;
+using MediaBrowser.Common.Extensions;
namespace MediaBrowser.Api.Library
{
@@ -675,7 +676,6 @@ namespace MediaBrowser.Api.Library
Limit = 0,
Recursive = true,
IsVirtualItem = false,
- SourceTypes = new[] { SourceType.Library },
IsFavorite = request.IsFavorite,
DtoOptions = new DtoOptions(false)
{
@@ -831,6 +831,11 @@ namespace MediaBrowser.Api.Library
: (Folder)_libraryManager.RootFolder)
: _libraryManager.GetItemById(request.Id);
+ if (item == null)
+ {
+ throw new ResourceNotFoundException("Item not found.");
+ }
+
while (item.ThemeSongIds.Count == 0 && request.InheritFromParent && item.GetParent() != null)
{
item = item.GetParent();
@@ -875,6 +880,11 @@ namespace MediaBrowser.Api.Library
: (Folder)_libraryManager.RootFolder)
: _libraryManager.GetItemById(request.Id);
+ if (item == null)
+ {
+ throw new ResourceNotFoundException("Item not found.");
+ }
+
while (item.ThemeVideoIds.Count == 0 && request.InheritFromParent && item.GetParent() != null)
{
item = item.GetParent();
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 3ffa26450..bbee36199 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -783,7 +783,6 @@ namespace MediaBrowser.Api.Playback
state.OutputContainer = (container ?? string.Empty).TrimStart('.');
state.OutputAudioBitrate = EncodingHelper.GetAudioBitrateParam(state.Request, state.AudioStream);
- state.OutputAudioSampleRate = request.AudioSampleRate;
state.OutputAudioCodec = state.Request.AudioCodec;
diff --git a/MediaBrowser.Api/Playback/MediaInfoService.cs b/MediaBrowser.Api/Playback/MediaInfoService.cs
index 55fe738e8..bba8094b6 100644
--- a/MediaBrowser.Api/Playback/MediaInfoService.cs
+++ b/MediaBrowser.Api/Playback/MediaInfoService.cs
@@ -106,6 +106,13 @@ namespace MediaBrowser.Api.Playback
}
public async Task
-
-
-
diff --git a/MediaBrowser.Common/Updates/GithubUpdater.cs b/MediaBrowser.Common/Updates/GithubUpdater.cs
index c5000391d..cc83e7c6e 100644
--- a/MediaBrowser.Common/Updates/GithubUpdater.cs
+++ b/MediaBrowser.Common/Updates/GithubUpdater.cs
@@ -58,7 +58,7 @@ namespace MediaBrowser.Common.Updates
}
else if (updateLevel == PackageVersionClass.Beta)
{
- obj = obj.Where(i => !i.prerelease || i.name.EndsWith("-beta", StringComparison.OrdinalIgnoreCase)).ToArray();
+ obj = obj.Where(i => i.prerelease && i.name.EndsWith("-beta", StringComparison.OrdinalIgnoreCase)).ToArray();
}
else if (updateLevel == PackageVersionClass.Dev)
{
@@ -81,7 +81,7 @@ namespace MediaBrowser.Common.Updates
{
if (updateLevel == PackageVersionClass.Beta)
{
- return !i.prerelease || i.name.EndsWith("-beta", StringComparison.OrdinalIgnoreCase);
+ return i.prerelease && i.name.EndsWith("-beta", StringComparison.OrdinalIgnoreCase);
}
if (updateLevel == PackageVersionClass.Dev)
{
diff --git a/MediaBrowser.Common/project.json b/MediaBrowser.Common/project.json
deleted file mode 100644
index fbbe9eaf3..000000000
--- a/MediaBrowser.Common/project.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "frameworks":{
- "netstandard1.6":{
- "dependencies":{
- "NETStandard.Library":"1.6.0",
- }
- },
- ".NETPortable,Version=v4.5,Profile=Profile7":{
- "buildOptions": {
- "define": [ ]
- },
- "frameworkAssemblies":{
-
- }
- }
- }
-}
\ No newline at end of file
diff --git a/MediaBrowser.Controller/Channels/Channel.cs b/MediaBrowser.Controller/Channels/Channel.cs
index 35c2ea1aa..862c8e5ac 100644
--- a/MediaBrowser.Controller/Channels/Channel.cs
+++ b/MediaBrowser.Controller/Channels/Channel.cs
@@ -35,7 +35,6 @@ namespace MediaBrowser.Controller.Channels
public override SourceType SourceType
{
get { return SourceType.Channel; }
- set { }
}
protected override QueryResult GetItemsInternal(InternalItemsQuery query)
diff --git a/MediaBrowser.Controller/Drawing/IImageEncoder.cs b/MediaBrowser.Controller/Drawing/IImageEncoder.cs
index 9b895587f..131d0bd9e 100644
--- a/MediaBrowser.Controller/Drawing/IImageEncoder.cs
+++ b/MediaBrowser.Controller/Drawing/IImageEncoder.cs
@@ -19,7 +19,7 @@ namespace MediaBrowser.Controller.Drawing
///
/// Encodes the image.
///
- string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, int quality, ImageProcessingOptions options, ImageFormat outputFormat);
+ string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, ImageOrientation? orientation, int quality, ImageProcessingOptions options, ImageFormat outputFormat);
///
/// Creates the image collage.
diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs
index fe8ac0919..e8ebbdb70 100644
--- a/MediaBrowser.Controller/Entities/AggregateFolder.cs
+++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs
@@ -87,7 +87,7 @@ namespace MediaBrowser.Controller.Entities
private List _childrenIds = null;
private readonly object _childIdsLock = new object();
- protected override IEnumerable LoadChildren()
+ protected override List LoadChildren()
{
lock (_childIdsLock)
{
diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs
index 4d35531cb..873ac3104 100644
--- a/MediaBrowser.Controller/Entities/Audio/Audio.cs
+++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs
@@ -131,7 +131,7 @@ namespace MediaBrowser.Controller.Entities.Audio
/// Creates the name of the sort.
///
/// System.String.
- protected override string CreateSortNameInternal()
+ protected override string CreateSortName()
{
return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "")
+ (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name;
diff --git a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
index b0b9493a5..4b232de49 100644
--- a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
+++ b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
@@ -90,7 +90,7 @@ namespace MediaBrowser.Controller.Entities.Audio
}
[IgnoreDataMember]
- protected override IEnumerable ActualChildren
+ public override IEnumerable Children
{
get
{
@@ -99,7 +99,7 @@ namespace MediaBrowser.Controller.Entities.Audio
return new List();
}
- return base.ActualChildren;
+ return base.Children;
}
}
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 346442f59..4efea94d8 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -54,7 +54,6 @@ namespace MediaBrowser.Controller.Entities
ImageInfos = new List();
InheritedTags = new List();
ProductionLocations = new List();
- SourceType = SourceType.Library;
}
public static readonly char[] SlugReplaceChars = { '?', '/', '&' };
@@ -187,15 +186,10 @@ namespace MediaBrowser.Controller.Entities
}
set
{
- var isSortNameDefault = IsSortNameDefault(SortName);
-
_name = value;
- if (isSortNameDefault)
- {
- // lazy load this again
- SortName = null;
- }
+ // lazy load this again
+ _sortName = null;
}
}
@@ -279,7 +273,18 @@ namespace MediaBrowser.Controller.Entities
public virtual string Path { get; set; }
[IgnoreDataMember]
- public virtual SourceType SourceType { get; set; }
+ public virtual SourceType SourceType
+ {
+ get
+ {
+ if (!string.IsNullOrWhiteSpace(ChannelId))
+ {
+ return SourceType.Channel;
+ }
+
+ return SourceType.Library;
+ }
+ }
///
/// Returns the folder containing the item.
@@ -586,6 +591,7 @@ namespace MediaBrowser.Controller.Entities
}
}
+ private string _forcedSortName;
///
/// Gets or sets the name of the forced sort.
///
@@ -593,42 +599,8 @@ namespace MediaBrowser.Controller.Entities
[IgnoreDataMember]
public string ForcedSortName
{
- get
- {
- var sortName = SortName;
-
- if (string.IsNullOrWhiteSpace(sortName))
- {
- return null;
- }
-
- if (string.Equals(sortName, CreateSortName(), StringComparison.OrdinalIgnoreCase))
- {
- return null;
- }
-
- return sortName;
- }
- set
- {
- if (string.IsNullOrWhiteSpace(value))
- {
- SortName = null;
- }
- else
- {
- var newValue = CreateSortNameFromCustomValue(value);
-
- if (string.Equals(newValue, CreateSortName(), StringComparison.OrdinalIgnoreCase))
- {
- SortName = null;
- }
- else
- {
- SortName = newValue;
- }
- }
- }
+ get { return _forcedSortName; }
+ set { _forcedSortName = value; _sortName = null; }
}
private string _sortName;
@@ -643,7 +615,15 @@ namespace MediaBrowser.Controller.Entities
{
if (_sortName == null)
{
- _sortName = CreateSortName();
+ if (!string.IsNullOrWhiteSpace(ForcedSortName))
+ {
+ // Need the ToLower because that's what CreateSortName does
+ _sortName = ModifySortChunks(ForcedSortName).ToLower();
+ }
+ else
+ {
+ _sortName = CreateSortName();
+ }
}
return _sortName;
}
@@ -653,31 +633,6 @@ namespace MediaBrowser.Controller.Entities
}
}
- private string CreateSortNameFromCustomValue(string value)
- {
- return string.IsNullOrWhiteSpace(value) ? null : NormalizeCustomSortName(value);
- }
-
- protected virtual string NormalizeCustomSortName(string value)
- {
- if (ConfigurationManager.Configuration.EnableSimpleSortNameHandling)
- {
- return value.RemoveDiacritics().ToLower();
- }
-
- return ModifySortChunks(value).ToLower();
- }
-
- public bool IsSortNameDefault(string value)
- {
- if (string.IsNullOrWhiteSpace(value))
- {
- return true;
- }
-
- return string.Equals(CreateSortNameFromCustomValue(value), CreateSortName(), StringComparison.OrdinalIgnoreCase);
- }
-
public string GetInternalMetadataPath()
{
var basePath = ConfigurationManager.ApplicationPaths.InternalMetadataPath;
@@ -699,22 +654,14 @@ namespace MediaBrowser.Controller.Entities
return System.IO.Path.Combine(basePath, idString.Substring(0, 2), idString);
}
- protected string CreateSortName()
- {
- if (string.IsNullOrWhiteSpace(Name))
- {
- return null;
- }
-
- return CreateSortNameInternal();
- }
-
///
/// Creates the name of the sort.
///
/// System.String.
- protected virtual string CreateSortNameInternal()
+ protected virtual string CreateSortName()
{
+ if (Name == null) return null; //some items may not have name filled in properly
+
if (!EnableAlphaNumericSorting)
{
return Name.TrimStart();
@@ -951,13 +898,6 @@ namespace MediaBrowser.Controller.Entities
[IgnoreDataMember]
public float? CommunityRating { get; set; }
- ///
- /// Gets or sets the community rating vote count.
- ///
- /// The community rating vote count.
- [IgnoreDataMember]
- public int? VoteCount { get; set; }
-
///
/// Gets or sets the run time ticks.
///
@@ -1367,6 +1307,7 @@ namespace MediaBrowser.Controller.Entities
public void AfterMetadataRefresh()
{
+ _sortName = null;
}
///
@@ -2253,6 +2194,8 @@ namespace MediaBrowser.Controller.Entities
///
public virtual bool BeforeMetadataRefresh()
{
+ _sortName = null;
+
var hasChanges = false;
if (string.IsNullOrEmpty(Name) && !string.IsNullOrEmpty(Path))
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs
index 0a5faa727..8bc23a581 100644
--- a/MediaBrowser.Controller/Entities/CollectionFolder.cs
+++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs
@@ -311,12 +311,12 @@ namespace MediaBrowser.Controller.Entities
///
/// The actual children.
[IgnoreDataMember]
- protected override IEnumerable ActualChildren
+ public override IEnumerable Children
{
get { return GetActualChildren(); }
}
- private IEnumerable GetActualChildren()
+ public IEnumerable GetActualChildren()
{
return GetPhysicalFolders(true).SelectMany(c => c.Children);
}
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index 7566911a1..48c9b83aa 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -185,7 +185,7 @@ namespace MediaBrowser.Controller.Entities
item.Id = LibraryManager.GetNewItemId(item.Path, item.GetType());
}
- if (ActualChildren.Any(i => i.Id == item.Id))
+ if (Children.Any(i => i.Id == item.Id))
{
throw new ArgumentException(string.Format("A child with the Id {0} already exists.", item.Id));
}
@@ -243,7 +243,7 @@ namespace MediaBrowser.Controller.Entities
///
/// The actual children.
[IgnoreDataMember]
- protected virtual IEnumerable ActualChildren
+ public virtual IEnumerable Children
{
get
{
@@ -251,16 +251,6 @@ namespace MediaBrowser.Controller.Entities
}
}
- ///
- /// thread-safe access to the actual children of this folder - without regard to user
- ///
- /// The children.
- [IgnoreDataMember]
- public IEnumerable Children
- {
- get { return ActualChildren.ToList(); }
- }
-
///
/// thread-safe access to all recursive children of this folder - without regard to user
///
@@ -301,7 +291,7 @@ namespace MediaBrowser.Controller.Entities
/// Loads our children. Validation will occur externally.
/// We want this sychronous.
///
- protected virtual IEnumerable LoadChildren()
+ protected virtual List LoadChildren()
{
//Logger.Debug("Loading children from {0} {1} {2}", GetType().Name, Id, Path);
//just load our children from the repo - the library will be validated and maintained in other processes
@@ -330,7 +320,9 @@ namespace MediaBrowser.Controller.Entities
{
var dictionary = new Dictionary();
- foreach (var child in ActualChildren)
+ var childrenList = Children.ToList();
+
+ foreach (var child in childrenList)
{
var id = child.Id;
if (dictionary.ContainsKey(id))
@@ -466,7 +458,7 @@ namespace MediaBrowser.Controller.Entities
if (recursive)
{
- await ValidateSubFolders(ActualChildren.OfType().ToList(), directoryService, progress, cancellationToken).ConfigureAwait(false);
+ await ValidateSubFolders(Children.ToList().OfType().ToList(), directoryService, progress, cancellationToken).ConfigureAwait(false);
}
progress.Report(20);
@@ -494,7 +486,7 @@ namespace MediaBrowser.Controller.Entities
private async Task RefreshMetadataRecursive(MetadataRefreshOptions refreshOptions, bool recursive, IProgress progress, CancellationToken cancellationToken)
{
- var children = ActualChildren.ToList();
+ var children = Children.ToList();
var percentages = new Dictionary(children.Count);
var numComplete = 0;
@@ -668,7 +660,7 @@ namespace MediaBrowser.Controller.Entities
/// Get our children from the repo - stubbed for now
///
/// IEnumerable{BaseItem}.
- protected IEnumerable GetCachedChildren()
+ protected List GetCachedChildren()
{
return ItemRepository.GetItemList(new InternalItemsQuery
{
diff --git a/MediaBrowser.Controller/Entities/IHasMetadata.cs b/MediaBrowser.Controller/Entities/IHasMetadata.cs
index aee58b445..62c67336c 100644
--- a/MediaBrowser.Controller/Entities/IHasMetadata.cs
+++ b/MediaBrowser.Controller/Entities/IHasMetadata.cs
@@ -26,7 +26,7 @@ namespace MediaBrowser.Controller.Entities
/// The date last saved.
DateTime DateLastSaved { get; set; }
- SourceType SourceType { get; set; }
+ SourceType SourceType { get; }
///
/// Gets or sets the date last refreshed.
diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
index 743e7642e..4d96c082f 100644
--- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
+++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
@@ -148,9 +148,8 @@ namespace MediaBrowser.Controller.Entities
}
public string[] PresetViews { get; set; }
- public SourceType[] SourceTypes { get; set; }
- public SourceType[] ExcludeSourceTypes { get; set; }
public TrailerType[] TrailerTypes { get; set; }
+ public SourceType[] SourceTypes { get; set; }
public DayOfWeek[] AirDays { get; set; }
public SeriesStatus[] SeriesStatuses { get; set; }
@@ -215,9 +214,8 @@ namespace MediaBrowser.Controller.Entities
ExcludeTags = new string[] { };
ExcludeInheritedTags = new string[] { };
PresetViews = new string[] { };
- SourceTypes = new SourceType[] { };
- ExcludeSourceTypes = new SourceType[] { };
TrailerTypes = new TrailerType[] { };
+ SourceTypes = new SourceType[] { };
AirDays = new DayOfWeek[] { };
SeriesStatuses = new SeriesStatus[] { };
OrderBy = new List>();
diff --git a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs
index 2ba6842ca..05d23d986 100644
--- a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs
+++ b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs
@@ -11,13 +11,11 @@ namespace MediaBrowser.Controller.Entities
public int? MaxListOrder { get; set; }
public Guid AppearsInItemId { get; set; }
public string NameContains { get; set; }
- public SourceType[] SourceTypes { get; set; }
public InternalPeopleQuery()
{
PersonTypes = new List();
ExcludePersonTypes = new List();
- SourceTypes = new SourceType[] { };
}
}
}
diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
index efa85f3ae..406a99f8b 100644
--- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
+++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
@@ -79,7 +79,7 @@ namespace MediaBrowser.Controller.Entities.Movies
return new List();
}
- protected override IEnumerable LoadChildren()
+ protected override List LoadChildren()
{
if (IsLegacyBoxSet)
{
diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs
index e963ab184..45b4de1b3 100644
--- a/MediaBrowser.Controller/Entities/TV/Episode.cs
+++ b/MediaBrowser.Controller/Entities/TV/Episode.cs
@@ -1,19 +1,19 @@
-using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Configuration;
-using MediaBrowser.Model.Entities;
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Serialization;
-
-namespace MediaBrowser.Controller.Entities.TV
-{
- ///
- /// Class Episode
- ///
- public class Episode : Video, IHasTrailers, IHasLookupInfo, IHasSeries
+using MediaBrowser.Controller.Providers;
+using MediaBrowser.Model.Configuration;
+using MediaBrowser.Model.Entities;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using MediaBrowser.Model.IO;
+using MediaBrowser.Model.Serialization;
+
+namespace MediaBrowser.Controller.Entities.TV
+{
+ ///
+ /// Class Episode
+ ///
+ public class Episode : Video, IHasTrailers, IHasLookupInfo, IHasSeries
{
public Episode()
{
@@ -26,35 +26,35 @@ namespace MediaBrowser.Controller.Entities.TV
public List RemoteTrailerIds { get; set; }
public List RemoteTrailers { get; set; }
- ///
- /// Gets the season in which it aired.
- ///
- /// The aired season.
- public int? AirsBeforeSeasonNumber { get; set; }
- public int? AirsAfterSeasonNumber { get; set; }
- public int? AirsBeforeEpisodeNumber { get; set; }
-
- ///
- /// Gets or sets the DVD season number.
- ///
- /// The DVD season number.
- public int? DvdSeasonNumber { get; set; }
- ///
- /// Gets or sets the DVD episode number.
- ///
- /// The DVD episode number.
- public float? DvdEpisodeNumber { get; set; }
-
- ///
- /// Gets or sets the absolute episode number.
- ///
- /// The absolute episode number.
- public int? AbsoluteEpisodeNumber { get; set; }
-
- ///
- /// This is the ending episode number for double episodes.
- ///
- /// The index number.
+ ///
+ /// Gets the season in which it aired.
+ ///
+ /// The aired season.
+ public int? AirsBeforeSeasonNumber { get; set; }
+ public int? AirsAfterSeasonNumber { get; set; }
+ public int? AirsBeforeEpisodeNumber { get; set; }
+
+ ///
+ /// Gets or sets the DVD season number.
+ ///
+ /// The DVD season number.
+ public int? DvdSeasonNumber { get; set; }
+ ///
+ /// Gets or sets the DVD episode number.
+ ///
+ /// The DVD episode number.
+ public float? DvdEpisodeNumber { get; set; }
+
+ ///
+ /// Gets or sets the absolute episode number.
+ ///
+ /// The absolute episode number.
+ public int? AbsoluteEpisodeNumber { get; set; }
+
+ ///
+ /// This is the ending episode number for double episodes.
+ ///
+ /// The index number.
public int? IndexNumberEnd { get; set; }
public string FindSeriesSortName()
@@ -62,56 +62,56 @@ namespace MediaBrowser.Controller.Entities.TV
var series = Series;
return series == null ? SeriesName : series.SortName;
}
-
- [IgnoreDataMember]
- protected override bool SupportsOwnedItems
- {
- get
- {
- return IsStacked || MediaSourceCount > 1;
- }
+
+ [IgnoreDataMember]
+ protected override bool SupportsOwnedItems
+ {
+ get
+ {
+ return IsStacked || MediaSourceCount > 1;
+ }
}
[IgnoreDataMember]
public override bool SupportsInheritedParentImages
{
get { return true; }
- }
-
- [IgnoreDataMember]
- public int? AiredSeasonNumber
- {
- get
- {
- return AirsAfterSeasonNumber ?? AirsBeforeSeasonNumber ?? ParentIndexNumber;
- }
- }
-
- [IgnoreDataMember]
- public override Folder LatestItemsIndexContainer
- {
- get
- {
- return Series;
- }
- }
-
- [IgnoreDataMember]
- public override Guid? DisplayParentId
- {
- get
- {
- return SeasonId;
- }
- }
-
- [IgnoreDataMember]
- protected override bool EnableDefaultVideoUserDataKeys
- {
- get
- {
- return false;
- }
+ }
+
+ [IgnoreDataMember]
+ public int? AiredSeasonNumber
+ {
+ get
+ {
+ return AirsAfterSeasonNumber ?? AirsBeforeSeasonNumber ?? ParentIndexNumber;
+ }
+ }
+
+ [IgnoreDataMember]
+ public override Folder LatestItemsIndexContainer
+ {
+ get
+ {
+ return Series;
+ }
+ }
+
+ [IgnoreDataMember]
+ public override Guid? DisplayParentId
+ {
+ get
+ {
+ return SeasonId;
+ }
+ }
+
+ [IgnoreDataMember]
+ protected override bool EnableDefaultVideoUserDataKeys
+ {
+ get
+ {
+ return false;
+ }
}
public override double? GetDefaultPrimaryImageAspectRatio()
@@ -120,64 +120,64 @@ namespace MediaBrowser.Controller.Entities.TV
value /= 9;
return value;
- }
-
- public override List GetUserDataKeys()
- {
- var list = base.GetUserDataKeys();
-
- var series = Series;
- if (series != null && ParentIndexNumber.HasValue && IndexNumber.HasValue)
- {
- var seriesUserDataKeys = series.GetUserDataKeys();
- var take = seriesUserDataKeys.Count;
- if (seriesUserDataKeys.Count > 1)
- {
- take--;
- }
- list.InsertRange(0, seriesUserDataKeys.Take(take).Select(i => i + ParentIndexNumber.Value.ToString("000") + IndexNumber.Value.ToString("000")));
- }
-
- return list;
- }
-
- ///
- /// This Episode's Series Instance
- ///
- /// The series.
- [IgnoreDataMember]
- public Series Series
- {
- get
- {
+ }
+
+ public override List GetUserDataKeys()
+ {
+ var list = base.GetUserDataKeys();
+
+ var series = Series;
+ if (series != null && ParentIndexNumber.HasValue && IndexNumber.HasValue)
+ {
+ var seriesUserDataKeys = series.GetUserDataKeys();
+ var take = seriesUserDataKeys.Count;
+ if (seriesUserDataKeys.Count > 1)
+ {
+ take--;
+ }
+ list.InsertRange(0, seriesUserDataKeys.Take(take).Select(i => i + ParentIndexNumber.Value.ToString("000") + IndexNumber.Value.ToString("000")));
+ }
+
+ return list;
+ }
+
+ ///
+ /// This Episode's Series Instance
+ ///
+ /// The series.
+ [IgnoreDataMember]
+ public Series Series
+ {
+ get
+ {
var seriesId = SeriesId ?? FindSeriesId();
- return seriesId.HasValue ? (LibraryManager.GetItemById(seriesId.Value) as Series) : null;
- }
- }
-
- [IgnoreDataMember]
- public Season Season
- {
- get
- {
+ return seriesId.HasValue ? (LibraryManager.GetItemById(seriesId.Value) as Series) : null;
+ }
+ }
+
+ [IgnoreDataMember]
+ public Season Season
+ {
+ get
+ {
var seasonId = SeasonId ?? FindSeasonId();
- return seasonId.HasValue ? (LibraryManager.GetItemById(seasonId.Value) as Season) : null;
- }
- }
-
- [IgnoreDataMember]
- public bool IsInSeasonFolder
- {
- get
- {
- return FindParent() != null;
- }
+ return seasonId.HasValue ? (LibraryManager.GetItemById(seasonId.Value) as Season) : null;
+ }
+ }
+
+ [IgnoreDataMember]
+ public bool IsInSeasonFolder
+ {
+ get
+ {
+ return FindParent() != null;
+ }
}
[IgnoreDataMember]
public string SeriesPresentationUniqueKey { get; set; }
-
- [IgnoreDataMember]
+
+ [IgnoreDataMember]
public string SeriesName { get; set; }
[IgnoreDataMember]
@@ -187,17 +187,17 @@ namespace MediaBrowser.Controller.Entities.TV
{
var series = Series;
return series == null ? null : series.PresentationUniqueKey;
- }
-
- public string FindSeasonName()
+ }
+
+ public string FindSeasonName()
{
- var season = Season;
-
- if (season == null)
- {
- if (ParentIndexNumber.HasValue)
- {
- return "Season " + ParentIndexNumber.Value.ToString(CultureInfo.InvariantCulture);
+ var season = Season;
+
+ if (season == null)
+ {
+ if (ParentIndexNumber.HasValue)
+ {
+ return "Season " + ParentIndexNumber.Value.ToString(CultureInfo.InvariantCulture);
}
return "Season Unknown";
}
@@ -231,92 +231,92 @@ namespace MediaBrowser.Controller.Entities.TV
}
return season == null ? (Guid?)null : season.Id;
- }
-
- ///
- /// Creates the name of the sort.
- ///
- /// System.String.
- protected override string CreateSortNameInternal()
- {
- return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("000 - ") : "")
- + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name;
- }
-
- ///
- /// Determines whether [contains episode number] [the specified number].
- ///
- /// The number.
- /// true if [contains episode number] [the specified number]; otherwise, false.
- public bool ContainsEpisodeNumber(int number)
- {
- if (IndexNumber.HasValue)
- {
- if (IndexNumberEnd.HasValue)
- {
- return number >= IndexNumber.Value && number <= IndexNumberEnd.Value;
- }
-
- return IndexNumber.Value == number;
- }
-
- return false;
- }
-
- [IgnoreDataMember]
- public override bool SupportsRemoteImageDownloading
- {
- get
- {
- if (IsMissingEpisode)
- {
- return false;
- }
-
- return true;
- }
- }
-
- [IgnoreDataMember]
- public bool IsMissingEpisode
- {
- get
- {
- return LocationType == LocationType.Virtual && !IsUnaired;
- }
- }
-
- [IgnoreDataMember]
- public bool IsVirtualUnaired
- {
- get { return LocationType == LocationType.Virtual && IsUnaired; }
- }
-
- [IgnoreDataMember]
+ }
+
+ ///
+ /// Creates the name of the sort.
+ ///
+ /// System.String.
+ protected override string CreateSortName()
+ {
+ return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("000 - ") : "")
+ + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name;
+ }
+
+ ///
+ /// Determines whether [contains episode number] [the specified number].
+ ///
+ /// The number.
+ /// true if [contains episode number] [the specified number]; otherwise, false.
+ public bool ContainsEpisodeNumber(int number)
+ {
+ if (IndexNumber.HasValue)
+ {
+ if (IndexNumberEnd.HasValue)
+ {
+ return number >= IndexNumber.Value && number <= IndexNumberEnd.Value;
+ }
+
+ return IndexNumber.Value == number;
+ }
+
+ return false;
+ }
+
+ [IgnoreDataMember]
+ public override bool SupportsRemoteImageDownloading
+ {
+ get
+ {
+ if (IsMissingEpisode)
+ {
+ return false;
+ }
+
+ return true;
+ }
+ }
+
+ [IgnoreDataMember]
+ public bool IsMissingEpisode
+ {
+ get
+ {
+ return LocationType == LocationType.Virtual && !IsUnaired;
+ }
+ }
+
+ [IgnoreDataMember]
+ public bool IsVirtualUnaired
+ {
+ get { return LocationType == LocationType.Virtual && IsUnaired; }
+ }
+
+ [IgnoreDataMember]
public Guid? SeasonId { get; set; }
[IgnoreDataMember]
public Guid? SeriesId { get; set; }
public Guid? FindSeriesId()
{
- var series = FindParent();
+ var series = FindParent();
return series == null ? (Guid?)null : series.Id;
- }
-
- public override IEnumerable GetAncestorIds()
- {
- var list = base.GetAncestorIds().ToList();
-
- var seasonId = SeasonId;
-
- if (seasonId.HasValue && !list.Contains(seasonId.Value))
- {
- list.Add(seasonId.Value);
- }
-
- return list;
- }
-
+ }
+
+ public override IEnumerable GetAncestorIds()
+ {
+ var list = base.GetAncestorIds().ToList();
+
+ var seasonId = SeasonId;
+
+ if (seasonId.HasValue && !list.Contains(seasonId.Value))
+ {
+ list.Add(seasonId.Value);
+ }
+
+ return list;
+ }
+
public override IEnumerable GetDeletePaths()
{
return new[] {
@@ -327,60 +327,60 @@ namespace MediaBrowser.Controller.Entities.TV
}
}.Concat(GetLocalMetadataFilesToDelete());
}
-
- public override UnratedItem GetBlockUnratedType()
- {
- return UnratedItem.Series;
- }
-
- public EpisodeInfo GetLookupInfo()
- {
- var id = GetItemLookupInfo();
-
- var series = Series;
-
- if (series != null)
- {
- id.SeriesProviderIds = series.ProviderIds;
- }
-
- id.IsMissingEpisode = IsMissingEpisode;
- id.IndexNumberEnd = IndexNumberEnd;
- id.IsVirtualUnaired = IsVirtualUnaired;
-
- return id;
- }
-
- public override bool BeforeMetadataRefresh()
- {
- var hasChanges = base.BeforeMetadataRefresh();
-
- try
- {
- if (LibraryManager.FillMissingEpisodeNumbersFromPath(this))
- {
- hasChanges = true;
- }
- }
- catch (Exception ex)
- {
- Logger.ErrorException("Error in FillMissingEpisodeNumbersFromPath. Episode: {0}", ex, Path ?? Name ?? Id.ToString());
- }
-
- if (!ParentIndexNumber.HasValue)
- {
- var season = Season;
- if (season != null)
- {
- if (season.ParentIndexNumber.HasValue)
- {
- ParentIndexNumber = season.ParentIndexNumber;
- hasChanges = true;
- }
- }
- }
-
- return hasChanges;
- }
- }
-}
+
+ public override UnratedItem GetBlockUnratedType()
+ {
+ return UnratedItem.Series;
+ }
+
+ public EpisodeInfo GetLookupInfo()
+ {
+ var id = GetItemLookupInfo();
+
+ var series = Series;
+
+ if (series != null)
+ {
+ id.SeriesProviderIds = series.ProviderIds;
+ }
+
+ id.IsMissingEpisode = IsMissingEpisode;
+ id.IndexNumberEnd = IndexNumberEnd;
+ id.IsVirtualUnaired = IsVirtualUnaired;
+
+ return id;
+ }
+
+ public override bool BeforeMetadataRefresh()
+ {
+ var hasChanges = base.BeforeMetadataRefresh();
+
+ try
+ {
+ if (LibraryManager.FillMissingEpisodeNumbersFromPath(this))
+ {
+ hasChanges = true;
+ }
+ }
+ catch (Exception ex)
+ {
+ Logger.ErrorException("Error in FillMissingEpisodeNumbersFromPath. Episode: {0}", ex, Path ?? Name ?? Id.ToString());
+ }
+
+ if (!ParentIndexNumber.HasValue)
+ {
+ var season = Season;
+ if (season != null)
+ {
+ if (season.ParentIndexNumber.HasValue)
+ {
+ ParentIndexNumber = season.ParentIndexNumber;
+ hasChanges = true;
+ }
+ }
+ }
+
+ return hasChanges;
+ }
+ }
+}
diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs
index 4ccf6d623..17494eb08 100644
--- a/MediaBrowser.Controller/Entities/TV/Season.cs
+++ b/MediaBrowser.Controller/Entities/TV/Season.cs
@@ -145,7 +145,7 @@ namespace MediaBrowser.Controller.Entities.TV
/// Creates the name of the sort.
///
/// System.String.
- protected override string CreateSortNameInternal()
+ protected override string CreateSortName()
{
return IndexNumber != null ? IndexNumber.Value.ToString("0000") : Name;
}
diff --git a/MediaBrowser.Controller/Entities/UserRootFolder.cs b/MediaBrowser.Controller/Entities/UserRootFolder.cs
index c93c81401..3e4931e77 100644
--- a/MediaBrowser.Controller/Entities/UserRootFolder.cs
+++ b/MediaBrowser.Controller/Entities/UserRootFolder.cs
@@ -18,7 +18,7 @@ namespace MediaBrowser.Controller.Entities
{
private List _childrenIds = null;
private readonly object _childIdsLock = new object();
- protected override IEnumerable LoadChildren()
+ protected override List LoadChildren()
{
lock (_childIdsLock)
{
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs
index fb31d9a47..b6887940e 100644
--- a/MediaBrowser.Controller/Entities/Video.cs
+++ b/MediaBrowser.Controller/Entities/Video.cs
@@ -633,14 +633,17 @@ namespace MediaBrowser.Controller.Entities
if (info.Path.StartsWith("Http", StringComparison.OrdinalIgnoreCase))
{
info.Protocol = MediaProtocol.Http;
+ info.SupportsDirectStream = false;
}
else if (info.Path.StartsWith("Rtmp", StringComparison.OrdinalIgnoreCase))
{
info.Protocol = MediaProtocol.Rtmp;
+ info.SupportsDirectStream = false;
}
else if (info.Path.StartsWith("Rtsp", StringComparison.OrdinalIgnoreCase))
{
info.Protocol = MediaProtocol.Rtsp;
+ info.SupportsDirectStream = false;
}
else
{
diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs
index 3f6b5a806..5a702b4f0 100644
--- a/MediaBrowser.Controller/Library/ILibraryManager.cs
+++ b/MediaBrowser.Controller/Library/ILibraryManager.cs
@@ -527,6 +527,8 @@ namespace MediaBrowser.Controller.Library
/// QueryResult<BaseItem>.
IEnumerable GetItemList(InternalItemsQuery query);
+ IEnumerable GetItemList(InternalItemsQuery query, bool allowExternalContent);
+
///
/// Gets the items.
///
diff --git a/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs b/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs
index 0644719b6..9f98182ba 100644
--- a/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs
+++ b/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs
@@ -1,5 +1,5 @@
using MediaBrowser.Controller.Entities;
-using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Dto;
using System;
using System.Collections.Generic;
@@ -13,7 +13,7 @@ namespace MediaBrowser.Controller.Library
public List Users { get; set; }
public long? PlaybackPositionTicks { get; set; }
public BaseItem Item { get; set; }
- public BaseItemInfo MediaInfo { get; set; }
+ public BaseItemDto MediaInfo { get; set; }
public string MediaSourceId { get; set; }
public bool IsPaused { get; set; }
public bool IsAutomated { get; set; }
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs
index 8501f1580..45786e795 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs
@@ -43,7 +43,6 @@ namespace MediaBrowser.Controller.LiveTv
public override SourceType SourceType
{
get { return SourceType.LiveTV; }
- set { }
}
[IgnoreDataMember]
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs
index 34a9103f8..898ea9ff4 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs
@@ -55,7 +55,6 @@ namespace MediaBrowser.Controller.LiveTv
public override SourceType SourceType
{
get { return SourceType.LiveTV; }
- set { }
}
[IgnoreDataMember]
@@ -89,7 +88,7 @@ namespace MediaBrowser.Controller.LiveTv
}
}
- protected override string CreateSortNameInternal()
+ protected override string CreateSortName()
{
if (!string.IsNullOrEmpty(Number))
{
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
index 5919d87fd..665640dfd 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
@@ -65,7 +65,6 @@ namespace MediaBrowser.Controller.LiveTv
public override SourceType SourceType
{
get { return SourceType.LiveTV; }
- set { }
}
///
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs
index 18894120a..2b527c4b0 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs
@@ -42,7 +42,6 @@ namespace MediaBrowser.Controller.LiveTv
public override SourceType SourceType
{
get { return SourceType.LiveTV; }
- set { }
}
[IgnoreDataMember]
diff --git a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs
index d0377fbfd..b0e636d77 100644
--- a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs
+++ b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs
@@ -107,8 +107,12 @@ namespace MediaBrowser.Controller.LiveTv
/// The image URL.
public string ImageUrl { get; set; }
+ public string ThumbImageUrl { get; set; }
+
public string LogoImageUrl { get; set; }
+ public string BackdropImageUrl { get; set; }
+
///
/// Gets or sets a value indicating whether this instance has image.
///
diff --git a/MediaBrowser.Controller/LiveTv/RecordingGroup.cs b/MediaBrowser.Controller/LiveTv/RecordingGroup.cs
index 8093b5a76..b54ca8974 100644
--- a/MediaBrowser.Controller/LiveTv/RecordingGroup.cs
+++ b/MediaBrowser.Controller/LiveTv/RecordingGroup.cs
@@ -30,7 +30,6 @@ namespace MediaBrowser.Controller.LiveTv
public override SourceType SourceType
{
get { return SourceType.LiveTV; }
- set { }
}
}
}
diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
index e15b58e77..348cfd343 100644
--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj
+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
@@ -36,10 +36,6 @@
Always
-
-
-
-
Properties\SharedVersion.cs
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
index 54a361ff7..c348ffda7 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
@@ -1604,7 +1604,7 @@ namespace MediaBrowser.Controller.MediaEncoding
}
// Only do this for video files due to sometimes unpredictable codec names coming from BDInfo
- if (state.RunTimeTicks.HasValue && state.VideoType == VideoType.VideoFile && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType))
+ if (state.VideoType == VideoType.VideoFile && state.RunTimeTicks.HasValue && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType))
{
foreach (var stream in state.MediaSource.MediaStreams)
{
@@ -1806,6 +1806,20 @@ namespace MediaBrowser.Controller.MediaEncoding
break;
}
}
+
+ else if (string.Equals(encodingOptions.HardwareAccelerationType, "nvenc", StringComparison.OrdinalIgnoreCase))
+ {
+ switch (state.MediaSource.VideoStream.Codec.ToLower())
+ {
+ case "avc":
+ case "h264":
+ if (_mediaEncoder.SupportsDecoder("h264_cuvid"))
+ {
+ return "-c:v h264_cuvid ";
+ }
+ break;
+ }
+ }
}
// leave blank so ffmpeg will decide
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
index 9b89e8f5a..57c81ddf7 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
@@ -8,6 +8,7 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.MediaInfo;
+using MediaBrowser.Model.Drawing;
namespace MediaBrowser.Controller.MediaEncoding
{
@@ -134,7 +135,6 @@ namespace MediaBrowser.Controller.MediaEncoding
public int? OutputAudioBitrate;
public int? OutputAudioChannels;
- public int? OutputAudioSampleRate;
public bool DeInterlace { get; set; }
public bool IsVideoRequest { get; set; }
public TranscodingJobType TranscodingType { get; set; }
@@ -173,6 +173,97 @@ namespace MediaBrowser.Controller.MediaEncoding
return false;
}
+ public int? TotalOutputBitrate
+ {
+ get
+ {
+ return (OutputAudioBitrate ?? 0) + (OutputVideoBitrate ?? 0);
+ }
+ }
+
+ public int? OutputWidth
+ {
+ get
+ {
+ if (VideoStream != null && VideoStream.Width.HasValue && VideoStream.Height.HasValue)
+ {
+ var size = new ImageSize
+ {
+ Width = VideoStream.Width.Value,
+ Height = VideoStream.Height.Value
+ };
+
+ var newSize = DrawingUtils.Resize(size,
+ BaseRequest.Width,
+ BaseRequest.Height,
+ BaseRequest.MaxWidth,
+ BaseRequest.MaxHeight);
+
+ return Convert.ToInt32(newSize.Width);
+ }
+
+ if (!IsVideoRequest)
+ {
+ return null;
+ }
+
+ return BaseRequest.MaxWidth ?? BaseRequest.Width;
+ }
+ }
+
+ public int? OutputHeight
+ {
+ get
+ {
+ if (VideoStream != null && VideoStream.Width.HasValue && VideoStream.Height.HasValue)
+ {
+ var size = new ImageSize
+ {
+ Width = VideoStream.Width.Value,
+ Height = VideoStream.Height.Value
+ };
+
+ var newSize = DrawingUtils.Resize(size,
+ BaseRequest.Width,
+ BaseRequest.Height,
+ BaseRequest.MaxWidth,
+ BaseRequest.MaxHeight);
+
+ return Convert.ToInt32(newSize.Height);
+ }
+
+ if (!IsVideoRequest)
+ {
+ return null;
+ }
+
+ return BaseRequest.MaxHeight ?? BaseRequest.Height;
+ }
+ }
+
+ public int? OutputAudioSampleRate
+ {
+ get
+ {
+ if (BaseRequest.Static || string.Equals(OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase))
+ {
+ if (AudioStream != null)
+ {
+ return AudioStream.SampleRate;
+ }
+ }
+
+ else if (BaseRequest.AudioSampleRate.HasValue)
+ {
+ // Don't exceed what the encoder supports
+ // Seeing issues of attempting to encode to 88200
+ return Math.Min(44100, BaseRequest.AudioSampleRate.Value);
+ }
+
+ return null;
+ }
+ }
+
///
/// Predicts the audio sample rate that will be in the output stream
///
@@ -189,6 +280,180 @@ namespace MediaBrowser.Controller.MediaEncoding
}
}
+ ///
+ /// Predicts the audio sample rate that will be in the output stream
+ ///
+ public int? TargetVideoBitDepth
+ {
+ get
+ {
+ var stream = VideoStream;
+ return stream == null || !BaseRequest.Static ? null : stream.BitDepth;
+ }
+ }
+
+ ///
+ /// Gets the target reference frames.
+ ///
+ /// The target reference frames.
+ public int? TargetRefFrames
+ {
+ get
+ {
+ var stream = VideoStream;
+ return stream == null || !BaseRequest.Static ? null : stream.RefFrames;
+ }
+ }
+
+ ///
+ /// Predicts the audio sample rate that will be in the output stream
+ ///
+ public float? TargetFramerate
+ {
+ get
+ {
+ var stream = VideoStream;
+ var requestedFramerate = BaseRequest.MaxFramerate ?? BaseRequest.Framerate;
+
+ return requestedFramerate.HasValue && !BaseRequest.Static
+ ? requestedFramerate
+ : stream == null ? null : stream.AverageFrameRate ?? stream.RealFrameRate;
+ }
+ }
+
+ public TransportStreamTimestamp TargetTimestamp
+ {
+ get
+ {
+ var defaultValue = string.Equals(OutputContainer, "m2ts", StringComparison.OrdinalIgnoreCase) ?
+ TransportStreamTimestamp.Valid :
+ TransportStreamTimestamp.None;
+
+ return !BaseRequest.Static
+ ? defaultValue
+ : InputTimestamp;
+ }
+ }
+
+ ///
+ /// Predicts the audio sample rate that will be in the output stream
+ ///
+ public int? TargetPacketLength
+ {
+ get
+ {
+ var stream = VideoStream;
+ return !BaseRequest.Static
+ ? null
+ : stream == null ? null : stream.PacketLength;
+ }
+ }
+
+ ///
+ /// Predicts the audio sample rate that will be in the output stream
+ ///
+ public string TargetVideoProfile
+ {
+ get
+ {
+ var stream = VideoStream;
+ return !string.IsNullOrEmpty(BaseRequest.Profile) && !BaseRequest.Static
+ ? BaseRequest.Profile
+ : stream == null ? null : stream.Profile;
+ }
+ }
+
+ public string TargetVideoCodecTag
+ {
+ get
+ {
+ var stream = VideoStream;
+ return !BaseRequest.Static
+ ? null
+ : stream == null ? null : stream.CodecTag;
+ }
+ }
+
+ public bool? IsTargetAnamorphic
+ {
+ get
+ {
+ if (BaseRequest.Static)
+ {
+ return VideoStream == null ? null : VideoStream.IsAnamorphic;
+ }
+
+ return false;
+ }
+ }
+
+ public bool? IsTargetInterlaced
+ {
+ get
+ {
+ if (BaseRequest.Static)
+ {
+ return VideoStream == null ? (bool?)null : VideoStream.IsInterlaced;
+ }
+
+ if (DeInterlace)
+ {
+ return false;
+ }
+
+ return VideoStream == null ? (bool?)null : VideoStream.IsInterlaced;
+ }
+ }
+
+ public bool? IsTargetAVC
+ {
+ get
+ {
+ if (BaseRequest.Static)
+ {
+ return VideoStream == null ? null : VideoStream.IsAVC;
+ }
+
+ return false;
+ }
+ }
+
+ public int? TargetVideoStreamCount
+ {
+ get
+ {
+ if (BaseRequest.Static)
+ {
+ return GetMediaStreamCount(MediaStreamType.Video, int.MaxValue);
+ }
+ return GetMediaStreamCount(MediaStreamType.Video, 1);
+ }
+ }
+
+ public int? TargetAudioStreamCount
+ {
+ get
+ {
+ if (BaseRequest.Static)
+ {
+ return GetMediaStreamCount(MediaStreamType.Audio, int.MaxValue);
+ }
+ return GetMediaStreamCount(MediaStreamType.Audio, 1);
+ }
+ }
+
+ private int? GetMediaStreamCount(MediaStreamType type, int limit)
+ {
+ var count = MediaSource.GetStreamCount(type);
+
+ if (count.HasValue)
+ {
+ count = Math.Min(count.Value, limit);
+ }
+
+ return count;
+ }
+
protected void DisposeIsoMount()
{
if (IsoMount != null)
diff --git a/MediaBrowser.Controller/Playlists/Playlist.cs b/MediaBrowser.Controller/Playlists/Playlist.cs
index 790e8e824..854f8d7a2 100644
--- a/MediaBrowser.Controller/Playlists/Playlist.cs
+++ b/MediaBrowser.Controller/Playlists/Playlist.cs
@@ -74,7 +74,7 @@ namespace MediaBrowser.Controller.Playlists
return true;
}
- protected override IEnumerable LoadChildren()
+ protected override List LoadChildren()
{
// Save a trip to the database
return new List();
diff --git a/MediaBrowser.Controller/Session/ISessionManager.cs b/MediaBrowser.Controller/Session/ISessionManager.cs
index 956d4cc95..8d77e0747 100644
--- a/MediaBrowser.Controller/Session/ISessionManager.cs
+++ b/MediaBrowser.Controller/Session/ISessionManager.cs
@@ -1,7 +1,7 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Security;
-using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Session;
using MediaBrowser.Model.Users;
@@ -249,7 +249,7 @@ namespace MediaBrowser.Controller.Session
///
/// The session identifier.
/// The item.
- void ReportNowViewingItem(string sessionId, BaseItemInfo item);
+ void ReportNowViewingItem(string sessionId, BaseItemDto item);
///
/// Authenticates the new session.
diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs
index 5cef56d1c..f590d9aec 100644
--- a/MediaBrowser.Controller/Session/SessionInfo.cs
+++ b/MediaBrowser.Controller/Session/SessionInfo.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Session;
using System;
using System.Collections.Generic;
@@ -100,13 +100,13 @@ namespace MediaBrowser.Controller.Session
/// Gets or sets the name of the now viewing item.
///
/// The name of the now viewing item.
- public BaseItemInfo NowViewingItem { get; set; }
+ public BaseItemDto NowViewingItem { get; set; }
///
/// Gets or sets the now playing item.
///
/// The now playing item.
- public BaseItemInfo NowPlayingItem { get; set; }
+ public BaseItemDto NowPlayingItem { get; set; }
public BaseItem FullNowPlayingItem { get; set; }
diff --git a/MediaBrowser.Controller/project.json b/MediaBrowser.Controller/project.json
deleted file mode 100644
index fbbe9eaf3..000000000
--- a/MediaBrowser.Controller/project.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "frameworks":{
- "netstandard1.6":{
- "dependencies":{
- "NETStandard.Library":"1.6.0",
- }
- },
- ".NETPortable,Version=v4.5,Profile=Profile7":{
- "buildOptions": {
- "define": [ ]
- },
- "frameworkAssemblies":{
-
- }
- }
- }
-}
\ No newline at end of file
diff --git a/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs
index fbb6b20f1..2b5858aec 100644
--- a/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs
+++ b/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs
@@ -40,27 +40,12 @@ namespace MediaBrowser.LocalMetadata.Images
{
var parentPath = _fileSystem.GetDirectoryName(item.Path);
- var parentPathFiles = directoryService.GetFileSystemEntries(parentPath)
+ var parentPathFiles = directoryService.GetFiles(parentPath)
.ToList();
var nameWithoutExtension = _fileSystem.GetFileNameWithoutExtension(item.Path);
- var files = GetFilesFromParentFolder(nameWithoutExtension, parentPathFiles);
-
- if (files.Count > 0)
- {
- return files;
- }
-
- var metadataPath = Path.Combine(parentPath, "metadata");
-
- if (parentPathFiles.Any(i => string.Equals(i.FullName, metadataPath, StringComparison.OrdinalIgnoreCase)))
- {
- var filesInMetadataFolder = _fileSystem.GetFiles(metadataPath, BaseItem.SupportedImageExtensions, false, false);
- return GetFilesFromParentFolder(nameWithoutExtension, filesInMetadataFolder);
- }
-
- return new List();
+ return GetFilesFromParentFolder(nameWithoutExtension, parentPathFiles);
}
private List GetFilesFromParentFolder(string filenameWithoutExtension, IEnumerable parentPathFiles)
diff --git a/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj b/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj
index f7b7fa5f2..9a7371a66 100644
--- a/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj
+++ b/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj
@@ -44,24 +44,15 @@
-
-
-
-
-
-
-
-
-
diff --git a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs
index 53327deca..2edccf8c8 100644
--- a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs
+++ b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs
@@ -598,20 +598,6 @@ namespace MediaBrowser.LocalMetadata.Parsers
break;
}
- case "VoteCount":
- {
- var val = reader.ReadElementContentAsString();
- if (!string.IsNullOrWhiteSpace(val))
- {
- int num;
-
- if (int.TryParse(val, NumberStyles.Integer, _usCulture, out num))
- {
- item.VoteCount = num;
- }
- }
- break;
- }
case "CollectionNumber":
var tmdbCollection = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(tmdbCollection))
diff --git a/MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.cs
index 9dcfa2f76..a0f0e4476 100644
--- a/MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.cs
+++ b/MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.cs
@@ -17,9 +17,16 @@ namespace MediaBrowser.LocalMetadata.Parsers
{
case "CollectionItems":
- using (var subReader = reader.ReadSubtree())
+ if (!reader.IsEmptyElement)
{
- FetchFromCollectionItemsNode(subReader, item);
+ using (var subReader = reader.ReadSubtree())
+ {
+ FetchFromCollectionItemsNode(subReader, item);
+ }
+ }
+ else
+ {
+ reader.Read();
}
break;
@@ -45,15 +52,22 @@ namespace MediaBrowser.LocalMetadata.Parsers
{
case "CollectionItem":
{
- using (var subReader = reader.ReadSubtree())
+ if (!reader.IsEmptyElement)
{
- var child = GetLinkedChild(subReader);
-
- if (child != null)
+ using (var subReader = reader.ReadSubtree())
{
- list.Add(child);
+ var child = GetLinkedChild(subReader);
+
+ if (child != null)
+ {
+ list.Add(child);
+ }
}
}
+ else
+ {
+ reader.Read();
+ }
break;
}
diff --git a/MediaBrowser.LocalMetadata/Parsers/EpisodeXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/EpisodeXmlParser.cs
deleted file mode 100644
index 6aba137eb..000000000
--- a/MediaBrowser.LocalMetadata/Parsers/EpisodeXmlParser.cs
+++ /dev/null
@@ -1,271 +0,0 @@
-using MediaBrowser.Controller.Entities.TV;
-using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Logging;
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Threading;
-using System.Xml;
-
-using MediaBrowser.Controller.IO;
-using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Xml;
-
-namespace MediaBrowser.LocalMetadata.Parsers
-{
- ///
- /// Class EpisodeXmlParser
- ///
- public class EpisodeXmlParser : BaseItemXmlParser
- {
- private List _imagesFound;
- private readonly IFileSystem _fileSystem;
-
- public EpisodeXmlParser(ILogger logger, IFileSystem fileSystem, IProviderManager providerManager, IXmlReaderSettingsFactory xmlSettings)
- : base(logger, providerManager, xmlSettings, fileSystem)
- {
- _fileSystem = fileSystem;
- }
-
- private string _xmlPath;
-
- public void Fetch(MetadataResult item,
- List images,
- string metadataFile,
- CancellationToken cancellationToken)
- {
- _imagesFound = images;
- _xmlPath = metadataFile;
-
- Fetch(item, metadataFile, cancellationToken);
- }
-
- private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
-
- ///
- /// Fetches the data from XML node.
- ///
- /// The reader.
- /// The result.
- protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult result)
- {
- var item = result.Item;
-
- switch (reader.Name)
- {
- case "Episode":
-
- //MB generated metadata is within an "Episode" node
- using (var subTree = reader.ReadSubtree())
- {
- subTree.MoveToContent();
-
- // Loop through each element
- while (subTree.Read())
- {
- if (subTree.NodeType == XmlNodeType.Element)
- {
- FetchDataFromXmlNode(subTree, result);
- }
- }
-
- }
- break;
-
- case "filename":
- {
- var filename = reader.ReadElementContentAsString();
-
- if (!string.IsNullOrWhiteSpace(filename))
- {
- // Strip off everything but the filename. Some metadata tools like MetaBrowser v1.0 will have an 'episodes' prefix
- // even though it's actually using the metadata folder.
- filename = Path.GetFileName(filename);
-
- var parentFolder = _fileSystem.GetDirectoryName(_xmlPath);
- filename = Path.Combine(parentFolder, filename);
- var file = _fileSystem.GetFileInfo(filename);
-
- if (file.Exists)
- {
- _imagesFound.Add(new LocalImageInfo
- {
- Type = ImageType.Primary,
- FileInfo = file
- });
- }
- }
- break;
- }
- case "SeasonNumber":
- {
- var number = reader.ReadElementContentAsString();
-
- if (!string.IsNullOrWhiteSpace(number))
- {
- int num;
-
- if (int.TryParse(number, out num))
- {
- item.ParentIndexNumber = num;
- }
- }
- break;
- }
-
- case "EpisodeNumber":
- {
- var number = reader.ReadElementContentAsString();
-
- if (!string.IsNullOrWhiteSpace(number))
- {
- int num;
-
- if (int.TryParse(number, out num))
- {
- item.IndexNumber = num;
- }
- }
- break;
- }
-
- case "EpisodeNumberEnd":
- {
- var number = reader.ReadElementContentAsString();
-
- if (!string.IsNullOrWhiteSpace(number))
- {
- int num;
-
- if (int.TryParse(number, out num))
- {
- item.IndexNumberEnd = num;
- }
- }
- break;
- }
-
- case "absolute_number":
- {
- var val = reader.ReadElementContentAsString();
-
- if (!string.IsNullOrWhiteSpace(val))
- {
- int rval;
-
- // int.TryParse is local aware, so it can be probamatic, force us culture
- if (int.TryParse(val, NumberStyles.Integer, UsCulture, out rval))
- {
- item.AbsoluteEpisodeNumber = rval;
- }
- }
-
- break;
- }
- case "DVD_episodenumber":
- {
- var number = reader.ReadElementContentAsString();
-
- if (!string.IsNullOrWhiteSpace(number))
- {
- float num;
-
- if (float.TryParse(number, NumberStyles.Any, UsCulture, out num))
- {
- item.DvdEpisodeNumber = num;
- }
- }
- break;
- }
-
- case "DVD_season":
- {
- var number = reader.ReadElementContentAsString();
-
- if (!string.IsNullOrWhiteSpace(number))
- {
- float num;
-
- if (float.TryParse(number, NumberStyles.Any, UsCulture, out num))
- {
- item.DvdSeasonNumber = Convert.ToInt32(num);
- }
- }
- break;
- }
-
- case "airsbefore_episode":
- {
- var val = reader.ReadElementContentAsString();
-
- if (!string.IsNullOrWhiteSpace(val))
- {
- int rval;
-
- // int.TryParse is local aware, so it can be probamatic, force us culture
- if (int.TryParse(val, NumberStyles.Integer, UsCulture, out rval))
- {
- item.AirsBeforeEpisodeNumber = rval;
- }
- }
-
- break;
- }
-
- case "airsafter_season":
- {
- var val = reader.ReadElementContentAsString();
-
- if (!string.IsNullOrWhiteSpace(val))
- {
- int rval;
-
- // int.TryParse is local aware, so it can be probamatic, force us culture
- if (int.TryParse(val, NumberStyles.Integer, UsCulture, out rval))
- {
- item.AirsAfterSeasonNumber = rval;
- }
- }
-
- break;
- }
-
- case "airsbefore_season":
- {
- var val = reader.ReadElementContentAsString();
-
- if (!string.IsNullOrWhiteSpace(val))
- {
- int rval;
-
- // int.TryParse is local aware, so it can be probamatic, force us culture
- if (int.TryParse(val, NumberStyles.Integer, UsCulture, out rval))
- {
- item.AirsBeforeSeasonNumber = rval;
- }
- }
-
- break;
- }
-
- case "EpisodeName":
- {
- var name = reader.ReadElementContentAsString();
-
- if (!string.IsNullOrWhiteSpace(name))
- {
- item.Name = name;
- }
- break;
- }
-
-
- default:
- base.FetchDataFromXmlNode(reader, result);
- break;
- }
- }
- }
-}
diff --git a/MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs
deleted file mode 100644
index 08c895c43..000000000
--- a/MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using MediaBrowser.Controller.Entities;
-using MediaBrowser.Controller.Entities.Movies;
-using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Logging;
-using System.Xml;
-using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Xml;
-
-namespace MediaBrowser.LocalMetadata.Parsers
-{
- ///
- /// Class EpisodeXmlParser
- ///
- public class BaseVideoXmlParser : BaseItemXmlParser
- where T : Video
- {
- ///
- /// Fetches the data from XML node.
- ///
- /// The reader.
- /// The result.
- protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult result)
- {
- var item = result.Item;
-
- switch (reader.Name)
- {
- case "TmdbCollectionName":
- {
- var val = reader.ReadElementContentAsString();
- var movie = item as Movie;
-
- if (!string.IsNullOrWhiteSpace(val) && movie != null)
- {
- movie.CollectionName = val;
- }
-
- break;
- }
-
- default:
- base.FetchDataFromXmlNode(reader, result);
- break;
- }
- }
-
- public BaseVideoXmlParser(ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory, IFileSystem fileSystem) : base(logger, providerManager, xmlReaderSettingsFactory, fileSystem)
- {
- }
- }
-
- public class MovieXmlParser : BaseVideoXmlParser
- {
- public MovieXmlParser(ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory, IFileSystem fileSystem) : base(logger, providerManager, xmlReaderSettingsFactory, fileSystem)
- {
- }
- }
-
- public class VideoXmlParser : BaseVideoXmlParser
-
-
-
-
Properties\SharedVersion.cs
@@ -326,7 +322,6 @@
-
diff --git a/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs b/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs
index 0518064c9..1843fb69a 100644
--- a/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs
+++ b/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs
@@ -30,6 +30,7 @@ namespace MediaBrowser.Model.MediaInfo
public bool ForceDirectPlayRemoteMediaSource { get; set; }
public bool AllowVideoStreamCopy { get; set; }
public bool AllowAudioStreamCopy { get; set; }
+ public bool AutoOpenLiveStream { get; set; }
public PlaybackInfoRequest()
{
diff --git a/MediaBrowser.Model/Querying/ItemFields.cs b/MediaBrowser.Model/Querying/ItemFields.cs
index 9a7052089..85d0a0baf 100644
--- a/MediaBrowser.Model/Querying/ItemFields.cs
+++ b/MediaBrowser.Model/Querying/ItemFields.cs
@@ -206,11 +206,6 @@
///
Tags,
- ///
- /// The vote count
- ///
- VoteCount,
-
///
/// The trailer url of the item
///
diff --git a/MediaBrowser.Model/Session/PlaybackProgressInfo.cs b/MediaBrowser.Model/Session/PlaybackProgressInfo.cs
index fff4ee8e0..5f81f7269 100644
--- a/MediaBrowser.Model/Session/PlaybackProgressInfo.cs
+++ b/MediaBrowser.Model/Session/PlaybackProgressInfo.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Dto;
namespace MediaBrowser.Model.Session
{
@@ -17,7 +17,7 @@ namespace MediaBrowser.Model.Session
/// Gets or sets the item.
///
/// The item.
- public BaseItemInfo Item { get; set; }
+ public BaseItemDto Item { get; set; }
///
/// Gets or sets the item identifier.
@@ -67,6 +67,8 @@ namespace MediaBrowser.Model.Session
/// The position ticks.
public long? PositionTicks { get; set; }
+ public long? playbackStartTimeTicks { get; set; }
+
///
/// Gets or sets the volume level.
///
diff --git a/MediaBrowser.Model/Session/PlaybackStopInfo.cs b/MediaBrowser.Model/Session/PlaybackStopInfo.cs
index 74347f894..160ef3554 100644
--- a/MediaBrowser.Model/Session/PlaybackStopInfo.cs
+++ b/MediaBrowser.Model/Session/PlaybackStopInfo.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Dto;
namespace MediaBrowser.Model.Session
{
@@ -11,7 +11,7 @@ namespace MediaBrowser.Model.Session
/// Gets or sets the item.
///
/// The item.
- public BaseItemInfo Item { get; set; }
+ public BaseItemDto Item { get; set; }
///
/// Gets or sets the item identifier.
///
diff --git a/MediaBrowser.Model/Session/SessionInfoDto.cs b/MediaBrowser.Model/Session/SessionInfoDto.cs
index 0909d255a..b21a089aa 100644
--- a/MediaBrowser.Model/Session/SessionInfoDto.cs
+++ b/MediaBrowser.Model/Session/SessionInfoDto.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Dto;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -72,7 +72,7 @@ namespace MediaBrowser.Model.Session
/// Gets or sets the now viewing item.
///
/// The now viewing item.
- public BaseItemInfo NowViewingItem { get; set; }
+ public BaseItemDto NowViewingItem { get; set; }
///
/// Gets or sets the name of the device.
@@ -84,7 +84,7 @@ namespace MediaBrowser.Model.Session
/// Gets or sets the now playing item.
///
/// The now playing item.
- public BaseItemInfo NowPlayingItem { get; set; }
+ public BaseItemDto NowPlayingItem { get; set; }
///
/// Gets or sets the device id.
diff --git a/MediaBrowser.Model/project.json b/MediaBrowser.Model/project.json
deleted file mode 100644
index fbbe9eaf3..000000000
--- a/MediaBrowser.Model/project.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "frameworks":{
- "netstandard1.6":{
- "dependencies":{
- "NETStandard.Library":"1.6.0",
- }
- },
- ".NETPortable,Version=v4.5,Profile=Profile7":{
- "buildOptions": {
- "define": [ ]
- },
- "frameworkAssemblies":{
-
- }
- }
- }
-}
\ No newline at end of file
diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs
index 16dfd8945..3cdda2cbb 100644
--- a/MediaBrowser.Providers/Manager/ProviderManager.cs
+++ b/MediaBrowser.Providers/Manager/ProviderManager.cs
@@ -13,17 +13,13 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Providers;
using System;
-using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.IO;
-
using MediaBrowser.Controller.Dto;
-using MediaBrowser.Controller.IO;
-using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization;
using Priority_Queue;
@@ -69,6 +65,7 @@ namespace MediaBrowser.Providers.Manager
private readonly Func _libraryManagerFactory;
private readonly IMemoryStreamFactory _memoryStreamProvider;
+ private CancellationTokenSource _disposeCancellationTokenSource = new CancellationTokenSource();
///
/// Initializes a new instance of the class.
@@ -882,6 +879,13 @@ namespace MediaBrowser.Providers.Manager
Tuple refreshItem;
var libraryManager = _libraryManagerFactory();
+ if (_disposed)
+ {
+ return;
+ }
+
+ var cancellationToken = _disposeCancellationTokenSource.Token;
+
while (_refreshQueue.TryDequeue(out refreshItem))
{
if (_disposed)
@@ -902,18 +906,22 @@ namespace MediaBrowser.Providers.Manager
var folder = item as Folder;
if (folder != null)
{
- await folder.ValidateChildren(new Progress(), CancellationToken.None).ConfigureAwait(false);
+ await folder.ValidateChildren(new Progress(), cancellationToken).ConfigureAwait(false);
}
}
var artist = item as MusicArtist;
var task = artist == null
- ? RefreshItem(item, refreshItem.Item2, CancellationToken.None)
- : RefreshArtist(artist, refreshItem.Item2);
+ ? RefreshItem(item, refreshItem.Item2, cancellationToken)
+ : RefreshArtist(artist, refreshItem.Item2, cancellationToken);
await task.ConfigureAwait(false);
}
}
+ catch (OperationCanceledException)
+ {
+ break;
+ }
catch (Exception ex)
{
_logger.ErrorException("Error refreshing item", ex);
@@ -928,14 +936,14 @@ namespace MediaBrowser.Providers.Manager
private async Task RefreshItem(BaseItem item, MetadataRefreshOptions options, CancellationToken cancellationToken)
{
- await item.RefreshMetadata(options, CancellationToken.None).ConfigureAwait(false);
+ await item.RefreshMetadata(options, cancellationToken).ConfigureAwait(false);
// Collection folders don't validate their children so we'll have to simulate that here
var collectionFolder = item as CollectionFolder;
if (collectionFolder != null)
{
- await RefreshCollectionFolderChildren(options, collectionFolder).ConfigureAwait(false);
+ await RefreshCollectionFolderChildren(options, collectionFolder, cancellationToken).ConfigureAwait(false);
}
else
{
@@ -948,25 +956,23 @@ namespace MediaBrowser.Providers.Manager
}
}
- private async Task RefreshCollectionFolderChildren(MetadataRefreshOptions options, CollectionFolder collectionFolder)
+ private async Task RefreshCollectionFolderChildren(MetadataRefreshOptions options, CollectionFolder collectionFolder, CancellationToken cancellationToken)
{
foreach (var child in collectionFolder.Children.ToList())
{
- await child.RefreshMetadata(options, CancellationToken.None).ConfigureAwait(false);
+ await child.RefreshMetadata(options, cancellationToken).ConfigureAwait(false);
if (child.IsFolder)
{
var folder = (Folder)child;
- await folder.ValidateChildren(new Progress(), CancellationToken.None, options, true).ConfigureAwait(false);
+ await folder.ValidateChildren(new Progress(), cancellationToken, options, true).ConfigureAwait(false);
}
}
}
- private async Task RefreshArtist(MusicArtist item, MetadataRefreshOptions options)
+ private async Task RefreshArtist(MusicArtist item, MetadataRefreshOptions options, CancellationToken cancellationToken)
{
- var cancellationToken = CancellationToken.None;
-
var albums = _libraryManagerFactory()
.GetItemList(new InternalItemsQuery
{
@@ -991,7 +997,7 @@ namespace MediaBrowser.Providers.Manager
try
{
- await item.RefreshMetadata(options, CancellationToken.None).ConfigureAwait(false);
+ await item.RefreshMetadata(options, cancellationToken).ConfigureAwait(false);
}
catch (Exception ex)
{
@@ -1009,6 +1015,11 @@ namespace MediaBrowser.Providers.Manager
public void Dispose()
{
_disposed = true;
+
+ if (!_disposeCancellationTokenSource.IsCancellationRequested)
+ {
+ _disposeCancellationTokenSource.Cancel();
+ }
}
}
}
\ No newline at end of file
diff --git a/MediaBrowser.Providers/Manager/ProviderUtils.cs b/MediaBrowser.Providers/Manager/ProviderUtils.cs
index 1e107d0be..042b7241b 100644
--- a/MediaBrowser.Providers/Manager/ProviderUtils.cs
+++ b/MediaBrowser.Providers/Manager/ProviderUtils.cs
@@ -180,11 +180,6 @@ namespace MediaBrowser.Providers.Manager
}
}
- if (replaceData || !target.VoteCount.HasValue)
- {
- target.VoteCount = source.VoteCount;
- }
-
foreach (var id in source.ProviderIds)
{
var key = id.Key;
@@ -200,6 +195,32 @@ namespace MediaBrowser.Providers.Manager
MergeCriticRating(source, target, lockedFields, replaceData);
MergeTrailers(source, target, lockedFields, replaceData);
MergeVideoInfo(source, target, lockedFields, replaceData);
+ MergeDisplayOrder(source, target, lockedFields, replaceData);
+
+ //if (!lockedFields.Contains(MetadataFields.SortName))
+ {
+ if (replaceData || string.IsNullOrEmpty(target.ForcedSortName))
+ {
+ var forcedSortName = source.ForcedSortName;
+
+ if (!string.IsNullOrWhiteSpace(forcedSortName))
+ {
+ target.ForcedSortName = forcedSortName;
+ }
+ }
+ }
+
+ //if (!lockedFields.Contains(MetadataFields.DisplayMediaType))
+ {
+ if (replaceData || string.IsNullOrEmpty(target.DisplayMediaType))
+ {
+ // Safeguard against incoming data having an emtpy name
+ if (!string.IsNullOrWhiteSpace(source.DisplayMediaType))
+ {
+ target.DisplayMediaType = source.DisplayMediaType;
+ }
+ }
+ }
if (mergeMetadataSettings)
{
@@ -235,10 +256,8 @@ namespace MediaBrowser.Providers.Manager
public static void MergeMetadataSettings(BaseItem source,
BaseItem target)
{
- target.ForcedSortName = source.ForcedSortName;
target.LockedFields = source.LockedFields;
target.IsLocked = source.IsLocked;
- target.DisplayMediaType = source.DisplayMediaType;
// Grab the value if it's there, but if not then don't overwrite the default
if (source.DateCreated != default(DateTime))
@@ -248,7 +267,10 @@ namespace MediaBrowser.Providers.Manager
target.PreferredMetadataCountryCode = source.PreferredMetadataCountryCode;
target.PreferredMetadataLanguage = source.PreferredMetadataLanguage;
+ }
+ private static void MergeDisplayOrder(BaseItem source, BaseItem target, List lockedFields, bool replaceData)
+ {
var sourceHasDisplayOrder = source as IHasDisplayOrder;
var targetHasDisplayOrder = target as IHasDisplayOrder;
diff --git a/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs b/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs
index ba24bd600..c3aa87a22 100644
--- a/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs
+++ b/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs
@@ -62,13 +62,6 @@ namespace MediaBrowser.Providers.Movies
public bool Supports(IHasImages item)
{
- // Supports images for tv movies
- var tvProgram = item as LiveTvProgram;
- if (tvProgram != null && tvProgram.IsMovie)
- {
- return true;
- }
-
return item is Movie || item is BoxSet || item is MusicVideo;
}
diff --git a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs
index 6a1af9272..b40e4a120 100644
--- a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs
+++ b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs
@@ -173,7 +173,7 @@ namespace MediaBrowser.Providers.Movies
movie.CommunityRating = rating;
}
- movie.VoteCount = movieData.vote_count;
+ //movie.VoteCount = movieData.vote_count;
//release date and certification are retrieved based on configured country and we fall back on US if not there and to minimun release date if still no match
if (movieData.releases != null && movieData.releases.countries != null)
diff --git a/MediaBrowser.Providers/Omdb/OmdbImageProvider.cs b/MediaBrowser.Providers/Omdb/OmdbImageProvider.cs
index 98a746053..04d218472 100644
--- a/MediaBrowser.Providers/Omdb/OmdbImageProvider.cs
+++ b/MediaBrowser.Providers/Omdb/OmdbImageProvider.cs
@@ -54,11 +54,23 @@ namespace MediaBrowser.Providers.Omdb
if (!string.IsNullOrEmpty(rootObject.Poster))
{
- list.Add(new RemoteImageInfo
+ if (item is Episode)
{
- ProviderName = Name,
- Url = string.Format("https://img.omdbapi.com/?i={0}&apikey=82e83907", imdbId)
- });
+ // img.omdbapi.com returning 404's
+ list.Add(new RemoteImageInfo
+ {
+ ProviderName = Name,
+ Url = rootObject.Poster
+ });
+ }
+ else
+ {
+ list.Add(new RemoteImageInfo
+ {
+ ProviderName = Name,
+ Url = string.Format("https://img.omdbapi.com/?i={0}&apikey=82e83907", imdbId)
+ });
+ }
}
}
diff --git a/MediaBrowser.Providers/Omdb/OmdbProvider.cs b/MediaBrowser.Providers/Omdb/OmdbProvider.cs
index 41ff71070..0a95b449c 100644
--- a/MediaBrowser.Providers/Omdb/OmdbProvider.cs
+++ b/MediaBrowser.Providers/Omdb/OmdbProvider.cs
@@ -78,7 +78,7 @@ namespace MediaBrowser.Providers.Omdb
&& int.TryParse(result.imdbVotes, NumberStyles.Number, _usCulture, out voteCount)
&& voteCount >= 0)
{
- item.VoteCount = voteCount;
+ //item.VoteCount = voteCount;
}
float imdbRating;
@@ -185,7 +185,7 @@ namespace MediaBrowser.Providers.Omdb
&& int.TryParse(result.imdbVotes, NumberStyles.Number, _usCulture, out voteCount)
&& voteCount >= 0)
{
- item.VoteCount = voteCount;
+ //item.VoteCount = voteCount;
}
float imdbRating;
diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs
index 1938f7ff0..2e549f610 100644
--- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs
+++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs
@@ -122,7 +122,7 @@ namespace MediaBrowser.Providers.TV
item.Overview = response.overview;
item.CommunityRating = (float)response.vote_average;
- item.VoteCount = response.vote_count;
+ //item.VoteCount = response.vote_count;
if (response.videos != null && response.videos.results != null)
{
diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs
index fe3d7d78c..0b5708b56 100644
--- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs
+++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs
@@ -217,7 +217,7 @@ namespace MediaBrowser.Providers.TV
series.Name = seriesInfo.name;
series.SetProviderId(MetadataProviders.Tmdb, seriesInfo.id.ToString(_usCulture));
- series.VoteCount = seriesInfo.vote_count;
+ //series.VoteCount = seriesInfo.vote_count;
string voteAvg = seriesInfo.vote_average.ToString(CultureInfo.InvariantCulture);
float rating;
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs
index 686bacfe1..d823de786 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs
@@ -680,7 +680,7 @@ namespace MediaBrowser.Providers.TV
// int.TryParse is local aware, so it can be probamatic, force us culture
if (int.TryParse(val, NumberStyles.Integer, _usCulture, out rval))
{
- item.VoteCount = rval;
+ //item.VoteCount = rval;
}
}
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
index 4c5e57a94..8a10affb9 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
@@ -1150,7 +1150,7 @@ namespace MediaBrowser.Providers.TV
// int.TryParse is local aware, so it can be probamatic, force us culture
if (int.TryParse(val, NumberStyles.Integer, _usCulture, out rval))
{
- item.VoteCount = rval;
+ //item.VoteCount = rval;
}
}
diff --git a/MediaBrowser.Providers/project.json b/MediaBrowser.Providers/project.json
deleted file mode 100644
index fbbe9eaf3..000000000
--- a/MediaBrowser.Providers/project.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "frameworks":{
- "netstandard1.6":{
- "dependencies":{
- "NETStandard.Library":"1.6.0",
- }
- },
- ".NETPortable,Version=v4.5,Profile=Profile7":{
- "buildOptions": {
- "define": [ ]
- },
- "frameworkAssemblies":{
-
- }
- }
- }
-}
\ No newline at end of file
diff --git a/MediaBrowser.Server.Implementations/project.json b/MediaBrowser.Server.Implementations/project.json
deleted file mode 100644
index fbbe9eaf3..000000000
--- a/MediaBrowser.Server.Implementations/project.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "frameworks":{
- "netstandard1.6":{
- "dependencies":{
- "NETStandard.Library":"1.6.0",
- }
- },
- ".NETPortable,Version=v4.5,Profile=Profile7":{
- "buildOptions": {
- "define": [ ]
- },
- "frameworkAssemblies":{
-
- }
- }
- }
-}
\ No newline at end of file
diff --git a/MediaBrowser.Server.Mono/ImageEncoderHelper.cs b/MediaBrowser.Server.Mono/ImageEncoderHelper.cs
index 2f7f2a45c..92eaf418b 100644
--- a/MediaBrowser.Server.Mono/ImageEncoderHelper.cs
+++ b/MediaBrowser.Server.Mono/ImageEncoderHelper.cs
@@ -8,6 +8,7 @@ using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
+using Emby.Drawing.Skia;
namespace MediaBrowser.Server.Startup.Common
{
@@ -22,6 +23,15 @@ namespace MediaBrowser.Server.Startup.Common
{
if (!startupOptions.ContainsOption("-enablegdi"))
{
+ try
+ {
+ return new SkiaEncoder(logManager.GetLogger("Skia"), appPaths, httpClient, fileSystem);
+ }
+ catch
+ {
+ logger.Error("Error loading Skia. Will revert to ImageMagick.");
+ }
+
try
{
return new ImageMagickEncoder(logManager.GetLogger("ImageMagick"), appPaths, httpClient, fileSystem);
diff --git a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj
index 8199cf2c4..872330e9f 100644
--- a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj
+++ b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj
@@ -50,7 +50,7 @@
..\packages\Mono.Posix.4.0.0.0\lib\net40\Mono.Posix.dll
- ..\packages\NLog.4.4.9\lib\net45\NLog.dll
+ ..\packages\NLog.4.4.10\lib\net45\NLog.dll
..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll
@@ -60,9 +60,8 @@
..\packages\SharpCompress.0.14.0\lib\net45\SharpCompress.dll
True
-
- ..\packages\SimpleInjector.4.0.7\lib\net45\SimpleInjector.dll
- True
+
+ ..\packages\SimpleInjector.4.0.8\lib\net45\SimpleInjector.dll
..\packages\SQLitePCLRaw.core.1.1.5\lib\net45\SQLitePCLRaw.core.dll
@@ -115,6 +114,10 @@
{6cfee013-6e7c-432b-ac37-cabf0880c69a}
Emby.Drawing.ImageMagick
+
+ {2312da6d-ff86-4597-9777-bceec32d96dd}
+ Emby.Drawing.Skia
+
{08fff49b-f175-4807-a2b5-73b0ebd9f716}
Emby.Drawing
@@ -198,6 +201,9 @@
PreserveNewest
+
+ PreserveNewest
+
Designer
PreserveNewest
diff --git a/MediaBrowser.Server.Mono/Properties/AssemblyInfo.cs b/MediaBrowser.Server.Mono/Properties/AssemblyInfo.cs
index d4856bd01..eda3bcf97 100644
--- a/MediaBrowser.Server.Mono/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.Server.Mono/Properties/AssemblyInfo.cs
@@ -7,7 +7,7 @@ using System.Reflection;
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
-[assembly: AssemblyCopyright ("Luke")]
+[assembly: AssemblyCopyright ("Emby")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
diff --git a/MediaBrowser.Server.Mono/SkiaSharp.dll.config b/MediaBrowser.Server.Mono/SkiaSharp.dll.config
new file mode 100644
index 000000000..fe0650f64
--- /dev/null
+++ b/MediaBrowser.Server.Mono/SkiaSharp.dll.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/MediaBrowser.Server.Mono/packages.config b/MediaBrowser.Server.Mono/packages.config
index 0e846ac8f..85f3d58b0 100644
--- a/MediaBrowser.Server.Mono/packages.config
+++ b/MediaBrowser.Server.Mono/packages.config
@@ -1,10 +1,10 @@
-
+
-
+
\ No newline at end of file
diff --git a/MediaBrowser.ServerApplication/ImageEncoderHelper.cs b/MediaBrowser.ServerApplication/ImageEncoderHelper.cs
index a6651ea40..56729e74c 100644
--- a/MediaBrowser.ServerApplication/ImageEncoderHelper.cs
+++ b/MediaBrowser.ServerApplication/ImageEncoderHelper.cs
@@ -30,15 +30,6 @@ namespace MediaBrowser.Server.Startup.Common
logger.Error("Error loading Skia. Will revert to ImageMagick.");
}
- try
- {
- return new ImageMagickEncoder(logManager.GetLogger("ImageMagick"), appPaths, httpClient, fileSystem);
- }
- catch
- {
- logger.Error("Error loading ImageMagick. Will revert to GDI.");
- }
-
return new NullImageEncoder();
}
}
diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
index 637474380..4cc3fd6a5 100644
--- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
+++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
@@ -78,7 +78,7 @@
..\packages\ImageMagickSharp.1.0.0.18\lib\net45\ImageMagickSharp.dll
- ..\packages\NLog.4.4.9\lib\net45\NLog.dll
+ ..\packages\NLog.4.4.10\lib\net45\NLog.dll
..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll
@@ -88,9 +88,8 @@
..\packages\SharpCompress.0.14.0\lib\net45\SharpCompress.dll
True
-
- ..\packages\SimpleInjector.4.0.7\lib\net45\SimpleInjector.dll
- True
+
+ ..\packages\SimpleInjector.4.0.8\lib\net45\SimpleInjector.dll
..\packages\SkiaSharp.1.58.0\lib\net45\SkiaSharp.dll
@@ -632,6 +631,8 @@
PreserveNewest
+
+
PreserveNewest
@@ -695,7 +696,6 @@
PreserveNewest
-
PreserveNewest
@@ -1071,7 +1071,6 @@
PreserveNewest
-
PreserveNewest
diff --git a/MediaBrowser.ServerApplication/packages.config b/MediaBrowser.ServerApplication/packages.config
index 4d4bde09f..9abd370f3 100644
--- a/MediaBrowser.ServerApplication/packages.config
+++ b/MediaBrowser.ServerApplication/packages.config
@@ -1,10 +1,10 @@
-
+
-
+
diff --git a/MediaBrowser.WebDashboard/project.json b/MediaBrowser.WebDashboard/project.json
deleted file mode 100644
index fbbe9eaf3..000000000
--- a/MediaBrowser.WebDashboard/project.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "frameworks":{
- "netstandard1.6":{
- "dependencies":{
- "NETStandard.Library":"1.6.0",
- }
- },
- ".NETPortable,Version=v4.5,Profile=Profile7":{
- "buildOptions": {
- "define": [ ]
- },
- "frameworkAssemblies":{
-
- }
- }
- }
-}
\ No newline at end of file
diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs
index c9ec195d9..d424cc0ca 100644
--- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs
+++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs
@@ -704,21 +704,6 @@ namespace MediaBrowser.XbmcMetadata.Parsers
break;
}
- case "votes":
- {
- var val = reader.ReadElementContentAsString();
- if (!string.IsNullOrWhiteSpace(val))
- {
- int num;
-
- if (int.TryParse(val, NumberStyles.Integer, _usCulture, out num))
- {
- item.VoteCount = num;
- }
- }
- break;
- }
-
case "genre":
{
var val = reader.ReadElementContentAsString();
diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs
index a5955e14d..cf7c25584 100644
--- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs
+++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs
@@ -63,7 +63,6 @@ namespace MediaBrowser.XbmcMetadata.Savers
"releasedate",
"outline",
"id",
- "votes",
"credits",
"originaltitle",
"watched",
@@ -659,11 +658,6 @@ namespace MediaBrowser.XbmcMetadata.Savers
}
}
- if (item.VoteCount.HasValue)
- {
- writer.WriteElementString("votes", item.VoteCount.Value.ToString(UsCulture));
- }
-
// Use original runtime here, actual file runtime later in MediaInfo
var runTimeTicks = item.RunTimeTicks;
diff --git a/MediaBrowser.XbmcMetadata/project.json b/MediaBrowser.XbmcMetadata/project.json
deleted file mode 100644
index fbbe9eaf3..000000000
--- a/MediaBrowser.XbmcMetadata/project.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "frameworks":{
- "netstandard1.6":{
- "dependencies":{
- "NETStandard.Library":"1.6.0",
- }
- },
- ".NETPortable,Version=v4.5,Profile=Profile7":{
- "buildOptions": {
- "define": [ ]
- },
- "frameworkAssemblies":{
-
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec
index 23fbb9bc3..90663b500 100644
--- a/Nuget/MediaBrowser.Common.nuspec
+++ b/Nuget/MediaBrowser.Common.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Common
- 3.0.701
+ 3.0.703
Emby.Common
Emby Team
ebr,Luke,scottisafool
diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec
index 8f59afce3..e5cb120d3 100644
--- a/Nuget/MediaBrowser.Server.Core.nuspec
+++ b/Nuget/MediaBrowser.Server.Core.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Server.Core
- 3.0.701
+ 3.0.703
Emby.Server.Core
Emby Team
ebr,Luke,scottisafool
@@ -12,7 +12,7 @@
Contains core components required to build plugins for Emby Server.
Copyright © Emby 2013
-
+
diff --git a/OpenSubtitlesHandler/OpenSubtitlesHandler.csproj b/OpenSubtitlesHandler/OpenSubtitlesHandler.csproj
index e54683027..d70f72962 100644
--- a/OpenSubtitlesHandler/OpenSubtitlesHandler.csproj
+++ b/OpenSubtitlesHandler/OpenSubtitlesHandler.csproj
@@ -107,9 +107,6 @@
-
-
-