aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Emby.Drawing.ImageMagick/ImageMagickEncoder.cs2
-rw-r--r--Emby.Drawing.Skia/SkiaEncoder.cs121
-rw-r--r--Emby.Drawing/ImageProcessor.cs28
-rw-r--r--Emby.Drawing/NullImageEncoder.cs2
-rw-r--r--Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs4
-rw-r--r--Emby.Server.Implementations/Notifications/Notifications.cs5
-rw-r--r--Emby.Server.Implementations/Session/SessionManager.cs200
-rw-r--r--MediaBrowser.Api/Session/SessionsService.cs23
-rw-r--r--MediaBrowser.Controller/Drawing/IImageEncoder.cs2
-rw-r--r--MediaBrowser.Controller/Entities/InternalItemsQuery.cs2
-rw-r--r--MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs4
-rw-r--r--MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs2
-rw-r--r--MediaBrowser.Controller/Session/ISessionManager.cs4
-rw-r--r--MediaBrowser.Controller/Session/SessionInfo.cs6
-rw-r--r--MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.cs11
-rw-r--r--MediaBrowser.Model/Entities/BaseItemInfo.cs178
-rw-r--r--MediaBrowser.Model/MediaBrowser.Model.csproj1
-rw-r--r--MediaBrowser.Model/Session/PlaybackProgressInfo.cs6
-rw-r--r--MediaBrowser.Model/Session/PlaybackStopInfo.cs4
-rw-r--r--MediaBrowser.Model/Session/SessionInfoDto.cs6
-rw-r--r--Nuget/MediaBrowser.Common.nuspec2
-rw-r--r--Nuget/MediaBrowser.Server.Core.nuspec4
-rw-r--r--SharedVersion.cs2
23 files changed, 217 insertions, 402 deletions
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 8a38b9248..2c7dc58c2 100644
--- a/Emby.Drawing.Skia/SkiaEncoder.cs
+++ b/Emby.Drawing.Skia/SkiaEncoder.cs
@@ -184,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);
@@ -199,6 +199,8 @@ namespace Emby.Drawing.Skia
// decode
codec.GetPixels(bitmap.Info, bitmap.GetPixels());
+ origin = codec.Origin;
+
return bitmap;
}
}
@@ -207,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
@@ -215,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);
+ }
+
+ 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, 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)
{
if (string.IsNullOrWhiteSpace(inputPath))
{
@@ -253,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)
{
@@ -265,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<string, string, DateTime>(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<string, string, DateTime>(originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified);
}
+ _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(cacheFilePath));
CopyFile(tmpPath, cacheFilePath);
return new Tuple<string, string, DateTime>(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.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/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/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;
+
/// <summary>
/// Converts a BaseItem to a BaseItemInfo
/// </summary>
- /// <param name="item">The item.</param>
- /// <param name="chapterOwner">The chapter owner.</param>
- /// <param name="mediaSource">The media source.</param>
- /// <returns>BaseItemInfo.</returns>
- /// <exception cref="System.ArgumentNullException">item</exception>
- 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
- };
-
- info.PrimaryImageTag = GetImageCacheTag(item, ImageType.Primary);
- if (info.PrimaryImageTag != 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)
- {
- info.Name = recording.EpisodeTitle;
- info.SeriesName = recording.Name;
-
- if (string.IsNullOrWhiteSpace(info.Name))
- {
- info.Name = recording.Name;
- }
- }
- }
-
- 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;
- }
- }
- }
+ var dtoOptions = _itemInfoDtoOptions;
- if (backropItem == null)
+ if (_itemInfoDtoOptions == null)
{
- if (episode != null)
+ dtoOptions = new DtoOptions
{
- 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();
- }
+ AddProgramRecordingInfo = false
+ };
+
+ 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 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/Session/SessionsService.cs b/MediaBrowser.Api/Session/SessionsService.cs
index a42441268..358d09c18 100644
--- a/MediaBrowser.Api/Session/SessionsService.cs
+++ b/MediaBrowser.Api/Session/SessionsService.cs
@@ -98,7 +98,7 @@ namespace MediaBrowser.Api.Session
[Route("/Sessions/{Id}/Playing/{Command}", "POST", Summary = "Issues a playstate command to a client")]
[Authenticated]
- public class SendPlaystateCommand : IReturnVoid
+ public class SendPlaystateCommand : PlaystateRequest, IReturnVoid
{
/// <summary>
/// Gets or sets the id.
@@ -106,19 +106,6 @@ namespace MediaBrowser.Api.Session
/// <value>The id.</value>
[ApiMember(Name = "Id", Description = "Session Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public string Id { get; set; }
-
- /// <summary>
- /// Gets or sets the position to seek to
- /// </summary>
- [ApiMember(Name = "SeekPositionTicks", Description = "The position to seek to.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
- public long? SeekPositionTicks { get; set; }
-
- /// <summary>
- /// Gets or sets the play command.
- /// </summary>
- /// <value>The play command.</value>
- [ApiMember(Name = "Command", Description = "The command to send - stop, pause, unpause, nexttrack, previoustrack, seek, fullscreen.", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
- public PlaystateCommand Command { get; set; }
}
[Route("/Sessions/{Id}/System/{Command}", "POST", Summary = "Issues a system command to a client")]
@@ -414,13 +401,7 @@ namespace MediaBrowser.Api.Session
public void Post(SendPlaystateCommand request)
{
- var command = new PlaystateRequest
- {
- Command = request.Command,
- SeekPositionTicks = request.SeekPositionTicks
- };
-
- var task = _sessionManager.SendPlaystateCommand(GetSession(_sessionContext).Result.Id, request.Id, command, CancellationToken.None);
+ var task = _sessionManager.SendPlaystateCommand(GetSession(_sessionContext).Result.Id, request.Id, request, CancellationToken.None);
Task.WaitAll(task);
}
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
/// <summary>
/// Encodes the image.
/// </summary>
- 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);
/// <summary>
/// Creates the image collage.
diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
index f3caac492..4d96c082f 100644
--- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
+++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
@@ -149,6 +149,7 @@ namespace MediaBrowser.Controller.Entities
public string[] PresetViews { get; set; }
public TrailerType[] TrailerTypes { get; set; }
+ public SourceType[] SourceTypes { get; set; }
public DayOfWeek[] AirDays { get; set; }
public SeriesStatus[] SeriesStatuses { get; set; }
@@ -214,6 +215,7 @@ namespace MediaBrowser.Controller.Entities
ExcludeInheritedTags = new string[] { };
PresetViews = new string[] { };
TrailerTypes = new TrailerType[] { };
+ SourceTypes = new SourceType[] { };
AirDays = new DayOfWeek[] { };
SeriesStatuses = new SeriesStatus[] { };
OrderBy = new List<Tuple<string, SortOrder>>();
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<User> 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/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
index 82d18a373..f790bb1a1 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.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)
{
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
/// </summary>
/// <param name="sessionId">The session identifier.</param>
/// <param name="item">The item.</param>
- void ReportNowViewingItem(string sessionId, BaseItemInfo item);
+ void ReportNowViewingItem(string sessionId, BaseItemDto item);
/// <summary>
/// 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.
/// </summary>
/// <value>The name of the now viewing item.</value>
- public BaseItemInfo NowViewingItem { get; set; }
+ public BaseItemDto NowViewingItem { get; set; }
/// <summary>
/// Gets or sets the now playing item.
/// </summary>
/// <value>The now playing item.</value>
- public BaseItemInfo NowPlayingItem { get; set; }
+ public BaseItemDto NowPlayingItem { get; set; }
public BaseItem FullNowPlayingItem { get; set; }
diff --git a/MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.cs
index 9dcfa2f76..de5c37255 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;
diff --git a/MediaBrowser.Model/Entities/BaseItemInfo.cs b/MediaBrowser.Model/Entities/BaseItemInfo.cs
deleted file mode 100644
index db6c4b3fa..000000000
--- a/MediaBrowser.Model/Entities/BaseItemInfo.cs
+++ /dev/null
@@ -1,178 +0,0 @@
-using MediaBrowser.Model.Dto;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using MediaBrowser.Model.Serialization;
-
-namespace MediaBrowser.Model.Entities
-{
- /// <summary>
- /// This is a stub class containing only basic information about an item
- /// </summary>
- [DebuggerDisplay("Name = {Name}, ID = {Id}, Type = {Type}")]
- public class BaseItemInfo
- {
- /// <summary>
- /// Gets or sets the name.
- /// </summary>
- /// <value>The name.</value>
- public string Name { get; set; }
-
- /// <summary>
- /// Gets or sets the id.
- /// </summary>
- /// <value>The id.</value>
- public string Id { get; set; }
-
- /// <summary>
- /// Gets or sets the type.
- /// </summary>
- /// <value>The type.</value>
- public string Type { get; set; }
-
- /// <summary>
- /// Gets or sets the type of the media.
- /// </summary>
- /// <value>The type of the media.</value>
- public string MediaType { get; set; }
-
- /// <summary>
- /// Gets or sets the run time ticks.
- /// </summary>
- /// <value>The run time ticks.</value>
- public long? RunTimeTicks { get; set; }
-
- /// <summary>
- /// Gets or sets the primary image tag.
- /// </summary>
- /// <value>The primary image tag.</value>
- public string PrimaryImageTag { get; set; }
-
- /// <summary>
- /// Gets or sets the primary image item identifier.
- /// </summary>
- /// <value>The primary image item identifier.</value>
- public string PrimaryImageItemId { get; set; }
-
- /// <summary>
- /// Gets or sets the logo image tag.
- /// </summary>
- /// <value>The logo image tag.</value>
- public string LogoImageTag { get; set; }
-
- /// <summary>
- /// Gets or sets the logo item identifier.
- /// </summary>
- /// <value>The logo item identifier.</value>
- public string LogoItemId { get; set; }
-
- /// <summary>
- /// Gets or sets the thumb image tag.
- /// </summary>
- /// <value>The thumb image tag.</value>
- public string ThumbImageTag { get; set; }
-
- /// <summary>
- /// Gets or sets the thumb item identifier.
- /// </summary>
- /// <value>The thumb item identifier.</value>
- public string ThumbItemId { get; set; }
-
- /// <summary>
- /// Gets or sets the thumb image tag.
- /// </summary>
- /// <value>The thumb image tag.</value>
- public string BackdropImageTag { get; set; }
-
- /// <summary>
- /// Gets or sets the thumb item identifier.
- /// </summary>
- /// <value>The thumb item identifier.</value>
- public string BackdropItemId { get; set; }
-
- /// <summary>
- /// Gets or sets the premiere date.
- /// </summary>
- /// <value>The premiere date.</value>
- public DateTime? PremiereDate { get; set; }
-
- /// <summary>
- /// Gets or sets the production year.
- /// </summary>
- /// <value>The production year.</value>
- public int? ProductionYear { get; set; }
-
- /// <summary>
- /// Gets or sets the index number.
- /// </summary>
- /// <value>The index number.</value>
- public int? IndexNumber { get; set; }
-
- /// <summary>
- /// Gets or sets the index number end.
- /// </summary>
- /// <value>The index number end.</value>
- public int? IndexNumberEnd { get; set; }
-
- /// <summary>
- /// Gets or sets the parent index number.
- /// </summary>
- /// <value>The parent index number.</value>
- public int? ParentIndexNumber { get; set; }
-
- /// <summary>
- /// Gets or sets the name of the series.
- /// </summary>
- /// <value>The name of the series.</value>
- public string SeriesName { get; set; }
-
- /// <summary>
- /// Gets or sets the album.
- /// </summary>
- /// <value>The album.</value>
- public string Album { get; set; }
-
- public bool IsThemeMedia { get; set; }
-
- /// <summary>
- /// Gets or sets the artists.
- /// </summary>
- /// <value>The artists.</value>
- public List<string> Artists { get; set; }
-
- /// <summary>
- /// Gets or sets the media streams.
- /// </summary>
- /// <value>The media streams.</value>
- public List<MediaStream> MediaStreams { get; set; }
-
- /// <summary>
- /// Gets or sets the chapter images item identifier.
- /// </summary>
- /// <value>The chapter images item identifier.</value>
- public string ChapterImagesItemId { get; set; }
-
- /// <summary>
- /// Gets or sets the chapters.
- /// </summary>
- /// <value>The chapters.</value>
- public List<ChapterInfoDto> Chapters { get; set; }
-
- /// <summary>
- /// Gets a value indicating whether this instance has primary image.
- /// </summary>
- /// <value><c>true</c> if this instance has primary image; otherwise, <c>false</c>.</value>
- [IgnoreDataMember]
- public bool HasPrimaryImage
- {
- get { return PrimaryImageTag != null; }
- }
-
- public BaseItemInfo()
- {
- Artists = new List<string>();
- MediaStreams = new List<MediaStream>();
- Chapters = new List<ChapterInfoDto>();
- }
- }
-}
diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj
index 354fd38ea..e6cc58868 100644
--- a/MediaBrowser.Model/MediaBrowser.Model.csproj
+++ b/MediaBrowser.Model/MediaBrowser.Model.csproj
@@ -322,7 +322,6 @@
<Compile Include="Querying\EpisodeQuery.cs" />
<Compile Include="Querying\ItemCountsQuery.cs" />
<Compile Include="Querying\ItemsByNameQuery.cs" />
- <Compile Include="Entities\BaseItemInfo.cs" />
<Compile Include="Querying\LatestItemsQuery.cs" />
<Compile Include="Querying\MovieRecommendationQuery.cs" />
<Compile Include="Querying\NextUpQuery.cs" />
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.
/// </summary>
/// <value>The item.</value>
- public BaseItemInfo Item { get; set; }
+ public BaseItemDto Item { get; set; }
/// <summary>
/// Gets or sets the item identifier.
@@ -67,6 +67,8 @@ namespace MediaBrowser.Model.Session
/// <value>The position ticks.</value>
public long? PositionTicks { get; set; }
+ public long? playbackStartTimeTicks { get; set; }
+
/// <summary>
/// Gets or sets the volume level.
/// </summary>
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.
/// </summary>
/// <value>The item.</value>
- public BaseItemInfo Item { get; set; }
+ public BaseItemDto Item { get; set; }
/// <summary>
/// Gets or sets the item identifier.
/// </summary>
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.
/// </summary>
/// <value>The now viewing item.</value>
- public BaseItemInfo NowViewingItem { get; set; }
+ public BaseItemDto NowViewingItem { get; set; }
/// <summary>
/// Gets or sets the name of the device.
@@ -84,7 +84,7 @@ namespace MediaBrowser.Model.Session
/// Gets or sets the now playing item.
/// </summary>
/// <value>The now playing item.</value>
- public BaseItemInfo NowPlayingItem { get; set; }
+ public BaseItemDto NowPlayingItem { get; set; }
/// <summary>
/// Gets or sets the device id.
diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec
index 0b988ddab..90663b500 100644
--- a/Nuget/MediaBrowser.Common.nuspec
+++ b/Nuget/MediaBrowser.Common.nuspec
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common</id>
- <version>3.0.702</version>
+ <version>3.0.703</version>
<title>Emby.Common</title>
<authors>Emby Team</authors>
<owners>ebr,Luke,scottisafool</owners>
diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec
index 18128c7b1..e5cb120d3 100644
--- a/Nuget/MediaBrowser.Server.Core.nuspec
+++ b/Nuget/MediaBrowser.Server.Core.nuspec
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MediaBrowser.Server.Core</id>
- <version>3.0.702</version>
+ <version>3.0.703</version>
<title>Emby.Server.Core</title>
<authors>Emby Team</authors>
<owners>ebr,Luke,scottisafool</owners>
@@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Emby Server.</description>
<copyright>Copyright © Emby 2013</copyright>
<dependencies>
- <dependency id="MediaBrowser.Common" version="3.0.702" />
+ <dependency id="MediaBrowser.Common" version="3.0.703" />
</dependencies>
</metadata>
<files>
diff --git a/SharedVersion.cs b/SharedVersion.cs
index 0bce33f9f..dbeb670ba 100644
--- a/SharedVersion.cs
+++ b/SharedVersion.cs
@@ -1,3 +1,3 @@
using System.Reflection;
-[assembly: AssemblyVersion("3.2.19.6")]
+[assembly: AssemblyVersion("3.2.19.7")]