diff --git a/Emby.Common.Implementations/IO/ManagedFileSystem.cs b/Emby.Common.Implementations/IO/ManagedFileSystem.cs index 6317fc08b4..bfc316d3f0 100644 --- a/Emby.Common.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Common.Implementations/IO/ManagedFileSystem.cs @@ -408,13 +408,13 @@ namespace Emby.Common.Implementations.IO { if (isHidden) { - FileAttributes attributes = File.GetAttributes(path); - attributes = RemoveAttribute(attributes, FileAttributes.Hidden); - File.SetAttributes(path, attributes); + File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden); } else { - File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden); + FileAttributes attributes = File.GetAttributes(path); + attributes = RemoveAttribute(attributes, FileAttributes.Hidden); + File.SetAttributes(path, attributes); } } } diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index 3235b7efa8..47c9357fdf 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -780,40 +780,38 @@ namespace Emby.Drawing // All enhanced images are saved as png to allow transparency var enhancedImagePath = GetCachePath(EnhancedImageCachePath, cacheGuid + ".png"); - var semaphore = GetLock(enhancedImagePath); - - await semaphore.WaitAsync().ConfigureAwait(false); - // Check again in case of contention if (_fileSystem.FileExists(enhancedImagePath)) { - semaphore.Release(); return enhancedImagePath; } - var imageProcessingLockTaken = false; + _fileSystem.CreateDirectory(Path.GetDirectoryName(enhancedImagePath)); - try - { - _fileSystem.CreateDirectory(Path.GetDirectoryName(enhancedImagePath)); + var tmpPath = Path.Combine(_appPaths.TempDirectory, Path.ChangeExtension(Guid.NewGuid().ToString(), Path.GetExtension(enhancedImagePath))); + _fileSystem.CreateDirectory(Path.GetDirectoryName(tmpPath)); - await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false); + await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false); - imageProcessingLockTaken = true; + try + { + await ExecuteImageEnhancers(supportedEnhancers, originalImagePath, tmpPath, item, imageType, imageIndex).ConfigureAwait(false); - await ExecuteImageEnhancers(supportedEnhancers, originalImagePath, enhancedImagePath, item, imageType, imageIndex).ConfigureAwait(false); + try + { + File.Copy(tmpPath, enhancedImagePath, true); + } + catch + { + + } } finally { - if (imageProcessingLockTaken) - { - _imageProcessingSemaphore.Release(); - } - - semaphore.Release(); + _imageProcessingSemaphore.Release(); } - return enhancedImagePath; + return tmpPath; } /// @@ -838,21 +836,6 @@ namespace Emby.Drawing } } - /// - /// The _semaphoreLocks - /// - private readonly ConcurrentDictionary _semaphoreLocks = new ConcurrentDictionary(); - - /// - /// Gets the lock. - /// - /// The filename. - /// System.Object. - private SemaphoreSlim GetLock(string filename) - { - return _semaphoreLocks.GetOrAdd(filename, key => new SemaphoreSlim(1, 1)); - } - /// /// Gets the cache path. /// diff --git a/MediaBrowser.Common/MediaBrowser.Common.xproj b/MediaBrowser.Common/MediaBrowser.Common.xproj deleted file mode 100644 index 797070193c..0000000000 --- a/MediaBrowser.Common/MediaBrowser.Common.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0.25420 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 7d5d3d18-3b43-43e6-a5a9-ac734430affd - MediaBrowser.Common - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index e9a3eb5123..cd44616081 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -22,8 +22,7 @@ namespace MediaBrowser.Controller.Entities.Audio IHasArtist, IHasMusicGenres, IHasLookupInfo, - IHasMediaSources, - IThemeMedia + IHasMediaSources { public List ChannelMediaSources { get; set; } @@ -39,7 +38,7 @@ namespace MediaBrowser.Controller.Entities.Audio public List AlbumArtists { get; set; } [IgnoreDataMember] - public bool IsThemeMedia + public override bool IsThemeMedia { get { diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index ea3a7f79c5..8211d89d2d 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -203,6 +203,16 @@ namespace MediaBrowser.Controller.Entities get { return PremiereDate.HasValue && PremiereDate.Value.ToLocalTime().Date >= DateTime.Now.Date; } } + [IgnoreDataMember] + public virtual bool IsThemeMedia + { + get + { + return false; + } + } + + [IgnoreDataMember] public string OriginalTitle { get; set; } /// diff --git a/MediaBrowser.Controller/Entities/IHasOriginalTitle.cs b/MediaBrowser.Controller/Entities/IHasOriginalTitle.cs deleted file mode 100644 index 6f5cb59bc0..0000000000 --- a/MediaBrowser.Controller/Entities/IHasOriginalTitle.cs +++ /dev/null @@ -1,8 +0,0 @@ - -namespace MediaBrowser.Controller.Entities -{ - public interface IHasOriginalTitle - { - string OriginalTitle { get; set; } - } -} diff --git a/MediaBrowser.Controller/Entities/IThemeMedia.cs b/MediaBrowser.Controller/Entities/IThemeMedia.cs deleted file mode 100644 index b2eff230ff..0000000000 --- a/MediaBrowser.Controller/Entities/IThemeMedia.cs +++ /dev/null @@ -1,8 +0,0 @@ - -namespace MediaBrowser.Controller.Entities -{ - public interface IThemeMedia - { - bool IsThemeMedia { get; } - } -} diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs index 5fee87b7ae..6ae4cf9f11 100644 --- a/MediaBrowser.Controller/Entities/Movies/Movie.cs +++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs @@ -17,7 +17,7 @@ namespace MediaBrowser.Controller.Entities.Movies /// /// Class Movie /// - public class Movie : Video, IHasSpecialFeatures, IHasBudget, IHasTrailers, IHasAwards, IHasMetascore, IHasLookupInfo, ISupportsBoxSetGrouping, IHasOriginalTitle + public class Movie : Video, IHasSpecialFeatures, IHasBudget, IHasTrailers, IHasAwards, IHasMetascore, IHasLookupInfo, ISupportsBoxSetGrouping { public List SpecialFeatureIds { get; set; } diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index 64520646bc..cca8e3c193 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -17,7 +17,7 @@ namespace MediaBrowser.Controller.Entities.TV /// /// Class Series /// - public class Series : Folder, IHasTrailers, IHasDisplayOrder, IHasLookupInfo, IMetadataContainer, IHasOriginalTitle + public class Series : Folder, IHasTrailers, IHasDisplayOrder, IHasLookupInfo, IMetadataContainer { public int? AnimeSeriesIndex { get; set; } diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs index 08fd867436..b67e7ffe3f 100644 --- a/MediaBrowser.Controller/Entities/Trailer.cs +++ b/MediaBrowser.Controller/Entities/Trailer.cs @@ -10,7 +10,7 @@ namespace MediaBrowser.Controller.Entities /// /// Class Trailer /// - public class Trailer : Video, IHasBudget, IHasMetascore, IHasOriginalTitle, IHasLookupInfo + public class Trailer : Video, IHasBudget, IHasMetascore, IHasLookupInfo { public Trailer() { diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index d865578401..6b8c894c8d 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -25,8 +25,7 @@ namespace MediaBrowser.Controller.Entities public class Video : BaseItem, IHasAspectRatio, ISupportsPlaceHolders, - IHasMediaSources, - IThemeMedia + IHasMediaSources { [IgnoreDataMember] public string PrimaryVersionId { get; set; } @@ -37,7 +36,7 @@ namespace MediaBrowser.Controller.Entities public List ChannelMediaSources { get; set; } [IgnoreDataMember] - public bool IsThemeMedia + public override bool IsThemeMedia { get { @@ -113,12 +112,6 @@ namespace MediaBrowser.Controller.Entities public bool IsShortcut { get; set; } public string ShortcutPath { get; set; } - /// - /// Gets or sets the video bit rate. - /// - /// The video bit rate. - public int? VideoBitRate { get; set; } - /// /// Gets or sets the default index of the video stream. /// diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index d588f6127d..0f26ad5ec1 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -113,7 +113,6 @@ - @@ -129,7 +128,6 @@ - diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.xproj b/MediaBrowser.Controller/MediaBrowser.Controller.xproj deleted file mode 100644 index 34994695de..0000000000 --- a/MediaBrowser.Controller/MediaBrowser.Controller.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0.25420 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - f9fe523c-6eb0-4e4d-ae26-de5c7982b063 - MediaBrowser.Controller - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/MediaBrowser.LocalMetadata/BaseXmlProvider.cs b/MediaBrowser.LocalMetadata/BaseXmlProvider.cs index 9f5a12104d..50e9de727f 100644 --- a/MediaBrowser.LocalMetadata/BaseXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/BaseXmlProvider.cs @@ -96,7 +96,5 @@ namespace MediaBrowser.LocalMetadata return "Emby Xml"; } } - - internal static readonly SemaphoreSlim XmlParsingResourcePool = new SemaphoreSlim(4, 4); } } diff --git a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs index d54e41308d..d78ddc8ea4 100644 --- a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs +++ b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs @@ -163,13 +163,9 @@ namespace MediaBrowser.LocalMetadata.Parsers { var val = reader.ReadElementContentAsString(); - var hasOriginalTitle = item as IHasOriginalTitle; - if (hasOriginalTitle != null) + if (!string.IsNullOrEmpty(val)) { - if (!string.IsNullOrEmpty(hasOriginalTitle.OriginalTitle)) - { - hasOriginalTitle.OriginalTitle = val; - } + item.OriginalTitle = val; } break; } diff --git a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs index 9cfca3086a..3a8a4c9f82 100644 --- a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs +++ b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs @@ -344,58 +344,52 @@ namespace MediaBrowser.LocalMetadata.Savers writer.WriteElementString("Overview", item.Overview); } - //var hasOriginalTitle = item as IHasOriginalTitle; - //if (hasOriginalTitle != null) - //{ - // if (!string.IsNullOrEmpty(hasOriginalTitle.OriginalTitle)) - // { - // builder.Append("" + SecurityElement.Escape(hasOriginalTitle.OriginalTitle) + ""); - // } - //} - - //if (!string.IsNullOrEmpty(item.ShortOverview)) - //{ - // builder.Append(""); - //} - - //if (!string.IsNullOrEmpty(item.CustomRating)) - //{ - // builder.Append("" + SecurityElement.Escape(item.CustomRating) + ""); - //} + if (!string.IsNullOrEmpty(item.OriginalTitle)) + { + writer.WriteElementString("OriginalTitle", item.OriginalTitle); + } + if (!string.IsNullOrEmpty(item.ShortOverview)) + { + writer.WriteElementString("ShortOverview", item.ShortOverview); + } + if (!string.IsNullOrEmpty(item.CustomRating)) + { + writer.WriteElementString("CustomRating", item.CustomRating); + } - //if (!string.IsNullOrEmpty(item.Name) && !(item is Episode)) - //{ - // builder.Append("" + SecurityElement.Escape(item.Name) + ""); - //} + if (!string.IsNullOrEmpty(item.Name) && !(item is Episode)) + { + writer.WriteElementString("LocalTitle", item.Name); + } - //if (!string.IsNullOrEmpty(item.ForcedSortName)) - //{ - // builder.Append("" + SecurityElement.Escape(item.ForcedSortName) + ""); - //} + if (!string.IsNullOrEmpty(item.ForcedSortName)) + { + writer.WriteElementString("SortTitle", item.ForcedSortName); + } - //if (item.PremiereDate.HasValue) - //{ - // if (item is Person) - // { - // builder.Append("" + SecurityElement.Escape(item.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd")) + ""); - // } - // else if (!(item is Episode)) - // { - // builder.Append("" + SecurityElement.Escape(item.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd")) + ""); - // } - //} + if (item.PremiereDate.HasValue) + { + if (item is Person) + { + writer.WriteElementString("BirthDate", item.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd")); + } + else if (!(item is Episode)) + { + writer.WriteElementString("PremiereDate", item.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd")); + } + } - //if (item.EndDate.HasValue) - //{ - // if (item is Person) - // { - // builder.Append("" + SecurityElement.Escape(item.EndDate.Value.ToString("yyyy-MM-dd")) + ""); - // } - // else if (!(item is Episode)) - // { - // builder.Append("" + SecurityElement.Escape(item.EndDate.Value.ToString("yyyy-MM-dd")) + ""); - // } - //} + if (item.EndDate.HasValue) + { + if (item is Person) + { + writer.WriteElementString("DeathDate", item.EndDate.Value.ToLocalTime().ToString("yyyy-MM-dd")); + } + else if (!(item is Episode)) + { + writer.WriteElementString("EndDate", item.EndDate.Value.ToLocalTime().ToString("yyyy-MM-dd")); + } + } //var hasTrailers = item as IHasTrailers; //if (hasTrailers != null) @@ -612,6 +606,8 @@ namespace MediaBrowser.LocalMetadata.Savers //{ // AddShares(hasShares, builder); //} + + AddMediaInfo(item, writer); } public static void AddShares(IHasShares item, StringBuilder builder) @@ -635,33 +631,31 @@ namespace MediaBrowser.LocalMetadata.Savers /// Appends the media info. /// /// - public static void AddMediaInfo(T item, StringBuilder builder, IItemRepository itemRepository) + public static void AddMediaInfo(T item, XmlWriter writer) where T : BaseItem { var video = item as Video; if (video != null) { - //AddChapters(video, builder, itemRepository); - if (video.Video3DFormat.HasValue) { switch (video.Video3DFormat.Value) { case Video3DFormat.FullSideBySide: - builder.Append("FSBS"); + writer.WriteElementString("Format3D", "FSBS"); break; case Video3DFormat.FullTopAndBottom: - builder.Append("FTAB"); + writer.WriteElementString("Format3D", "FTAB"); break; case Video3DFormat.HalfSideBySide: - builder.Append("HSBS"); + writer.WriteElementString("Format3D", "HSBS"); break; case Video3DFormat.HalfTopAndBottom: - builder.Append("HTAB"); + writer.WriteElementString("Format3D", "HTAB"); break; case Video3DFormat.MVC: - builder.Append("MVC"); + writer.WriteElementString("Format3D", "MVC"); break; } } diff --git a/MediaBrowser.Model/Entities/BaseItemInfo.cs b/MediaBrowser.Model/Entities/BaseItemInfo.cs index af9091a78b..db6c4b3fa7 100644 --- a/MediaBrowser.Model/Entities/BaseItemInfo.cs +++ b/MediaBrowser.Model/Entities/BaseItemInfo.cs @@ -132,6 +132,8 @@ namespace MediaBrowser.Model.Entities /// The album. public string Album { get; set; } + public bool IsThemeMedia { get; set; } + /// /// Gets or sets the artists. /// diff --git a/MediaBrowser.Model/MediaBrowser.Model.xproj b/MediaBrowser.Model/MediaBrowser.Model.xproj deleted file mode 100644 index d4777935e6..0000000000 --- a/MediaBrowser.Model/MediaBrowser.Model.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0.25420 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - a02a9262-f007-4464-bb32-02f5f2593651 - MediaBrowser.Model - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs index fee11d989c..d65084287f 100644 --- a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs @@ -6,14 +6,11 @@ using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; -using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.IO; using MediaBrowser.Model.IO; namespace MediaBrowser.Providers.MediaInfo @@ -23,8 +20,6 @@ namespace MediaBrowser.Providers.MediaInfo /// public class AudioImageProvider : IDynamicImageProvider, IHasItemChangeMonitor { - private readonly ConcurrentDictionary _locks = new ConcurrentDictionary(); - private readonly IMediaEncoder _mediaEncoder; private readonly IServerConfigurationManager _config; private readonly IFileSystem _fileSystem; @@ -67,41 +62,25 @@ namespace MediaBrowser.Providers.MediaInfo if (!_fileSystem.FileExists(path)) { - var semaphore = GetLock(path); - - // Acquire a lock - await semaphore.WaitAsync(cancellationToken).ConfigureAwait(false); - - try - { - // Check again in case it was saved while waiting for the lock - if (!_fileSystem.FileExists(path)) - { - _fileSystem.CreateDirectory(Path.GetDirectoryName(path)); - - var imageStream = imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("front", StringComparison.OrdinalIgnoreCase) != -1) ?? - imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("cover", StringComparison.OrdinalIgnoreCase) != -1) ?? - imageStreams.FirstOrDefault(); + _fileSystem.CreateDirectory(Path.GetDirectoryName(path)); - var imageStreamIndex = imageStream == null ? (int?)null : imageStream.Index; + var imageStream = imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("front", StringComparison.OrdinalIgnoreCase) != -1) ?? + imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("cover", StringComparison.OrdinalIgnoreCase) != -1) ?? + imageStreams.FirstOrDefault(); - var tempFile = await _mediaEncoder.ExtractAudioImage(item.Path, imageStreamIndex, cancellationToken).ConfigureAwait(false); + var imageStreamIndex = imageStream == null ? (int?)null : imageStream.Index; - _fileSystem.CopyFile(tempFile, path, true); + var tempFile = await _mediaEncoder.ExtractAudioImage(item.Path, imageStreamIndex, cancellationToken).ConfigureAwait(false); - try - { - _fileSystem.DeleteFile(tempFile); - } - catch - { + _fileSystem.CopyFile(tempFile, path, true); - } - } + try + { + _fileSystem.DeleteFile(tempFile); } - finally + catch { - semaphore.Release(); + } } @@ -145,16 +124,6 @@ namespace MediaBrowser.Providers.MediaInfo } } - /// - /// Gets the lock. - /// - /// The filename. - /// SemaphoreSlim. - private SemaphoreSlim GetLock(string filename) - { - return _locks.GetOrAdd(filename, key => new SemaphoreSlim(1, 1)); - } - public string Name { get { return "Image Extractor"; } diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs index 45fcbc251e..0a070d3487 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs @@ -203,7 +203,6 @@ namespace MediaBrowser.Providers.MediaInfo var videoStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video); - video.VideoBitRate = videoStream == null ? null : videoStream.BitRate; video.DefaultVideoStreamIndex = videoStream == null ? (int?)null : videoStream.Index; video.HasSubtitles = mediaStreams.Any(i => i.Type == MediaStreamType.Subtitle); diff --git a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs index 5da18ac602..ca701b70f6 100644 --- a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs @@ -13,9 +13,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.IO; -using MediaBrowser.Model.IO; namespace MediaBrowser.Providers.MediaInfo { diff --git a/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs b/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs index 96b8aad5dd..51f5f57b3e 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs @@ -123,8 +123,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints return; } - var themeMedia = item as IThemeMedia; - if (themeMedia != null && themeMedia.IsThemeMedia) + if (item.IsThemeMedia) { // Don't report theme song or local trailer playback return; @@ -156,8 +155,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints return; } - var themeMedia = item as IThemeMedia; - if (themeMedia != null && themeMedia.IsThemeMedia) + if (item.IsThemeMedia) { // Don't report theme song or local trailer playback return; diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs index 8f35f0e768..f3d1dc8f9b 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs @@ -256,9 +256,8 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications } var item = e.MediaInfo; - var themeMedia = item as IThemeMedia; - if (themeMedia != null && themeMedia.IsThemeMedia) + if ( item.IsThemeMedia) { // Don't report theme song or local trailer playback return; diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index 295d78a5f3..f3224127ac 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -367,7 +367,6 @@ - diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 9326c4f43e..6d86ff0919 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -1611,7 +1611,8 @@ namespace MediaBrowser.Server.Implementations.Session IndexNumber = item.IndexNumber, ParentIndexNumber = item.ParentIndexNumber, PremiereDate = item.PremiereDate, - ProductionYear = item.ProductionYear + ProductionYear = item.ProductionYear, + IsThemeMedia = item.IsThemeMedia }; info.PrimaryImageTag = GetImageCacheTag(item, ImageType.Primary); diff --git a/MediaBrowser.Server.Implementations/Sorting/VideoBitRateComparer.cs b/MediaBrowser.Server.Implementations/Sorting/VideoBitRateComparer.cs deleted file mode 100644 index cbf6ebac66..0000000000 --- a/MediaBrowser.Server.Implementations/Sorting/VideoBitRateComparer.cs +++ /dev/null @@ -1,41 +0,0 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Sorting; -using MediaBrowser.Model.Querying; - -namespace MediaBrowser.Server.Implementations.Sorting -{ - class VideoBitRateComparer : IBaseItemComparer - { - /// - /// Compares the specified x. - /// - /// The x. - /// The y. - /// System.Int32. - public int Compare(BaseItem x, BaseItem y) - { - return GetValue(x).CompareTo(GetValue(y)); - } - - private int GetValue(BaseItem item) - { - var video = item as Video; - - if (video != null) - { - return video.VideoBitRate ?? 0; - } - - return 0; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get { return ItemSortBy.VideoBitRate; } - } - } -} diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs index 3f10220f20..ba1e2641b2 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs @@ -278,13 +278,9 @@ namespace MediaBrowser.XbmcMetadata.Parsers { var val = reader.ReadElementContentAsString(); - var hasOriginalTitle = item as IHasOriginalTitle; - if (hasOriginalTitle != null) + if (!string.IsNullOrEmpty(val)) { - if (!string.IsNullOrEmpty(hasOriginalTitle.OriginalTitle)) - { - hasOriginalTitle.OriginalTitle = val; - } + item.OriginalTitle = val; } break; } diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs index c342c209ae..fc5987815b 100644 --- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs @@ -485,13 +485,9 @@ namespace MediaBrowser.XbmcMetadata.Savers writer.WriteElementString("title", item.Name ?? string.Empty); - var hasOriginalTitle = item as IHasOriginalTitle; - if (hasOriginalTitle != null) + if (!string.IsNullOrWhiteSpace(item.OriginalTitle)) { - if (!string.IsNullOrEmpty(hasOriginalTitle.OriginalTitle)) - { - writer.WriteElementString("originaltitle", hasOriginalTitle.OriginalTitle ?? string.Empty); - } + writer.WriteElementString("originaltitle", item.OriginalTitle); } var people = libraryManager.GetPeople(item);