consolidate internal interfaces

This commit is contained in:
Luke Pulverenti 2016-10-31 00:28:23 -04:00
parent 0579f245e4
commit 3bf72b71b3
28 changed files with 114 additions and 301 deletions

View File

@ -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);
}
}
}

View File

@ -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));
var tmpPath = Path.Combine(_appPaths.TempDirectory, Path.ChangeExtension(Guid.NewGuid().ToString(), Path.GetExtension(enhancedImagePath)));
_fileSystem.CreateDirectory(Path.GetDirectoryName(tmpPath));
await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false);
try
{
_fileSystem.CreateDirectory(Path.GetDirectoryName(enhancedImagePath));
await ExecuteImageEnhancers(supportedEnhancers, originalImagePath, tmpPath, item, imageType, imageIndex).ConfigureAwait(false);
await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false);
imageProcessingLockTaken = true;
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;
}
/// <summary>
@ -838,21 +836,6 @@ namespace Emby.Drawing
}
}
/// <summary>
/// The _semaphoreLocks
/// </summary>
private readonly ConcurrentDictionary<string, SemaphoreSlim> _semaphoreLocks = new ConcurrentDictionary<string, SemaphoreSlim>();
/// <summary>
/// Gets the lock.
/// </summary>
/// <param name="filename">The filename.</param>
/// <returns>System.Object.</returns>
private SemaphoreSlim GetLock(string filename)
{
return _semaphoreLocks.GetOrAdd(filename, key => new SemaphoreSlim(1, 1));
}
/// <summary>
/// Gets the cache path.
/// </summary>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25420" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25420</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>7d5d3d18-3b43-43e6-a5a9-ac734430affd</ProjectGuid>
<RootNamespace>MediaBrowser.Common</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -22,8 +22,7 @@ namespace MediaBrowser.Controller.Entities.Audio
IHasArtist,
IHasMusicGenres,
IHasLookupInfo<SongInfo>,
IHasMediaSources,
IThemeMedia
IHasMediaSources
{
public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
@ -39,7 +38,7 @@ namespace MediaBrowser.Controller.Entities.Audio
public List<string> AlbumArtists { get; set; }
[IgnoreDataMember]
public bool IsThemeMedia
public override bool IsThemeMedia
{
get
{

View File

@ -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; }
/// <summary>

View File

@ -1,8 +0,0 @@

namespace MediaBrowser.Controller.Entities
{
public interface IHasOriginalTitle
{
string OriginalTitle { get; set; }
}
}

View File

@ -1,8 +0,0 @@

namespace MediaBrowser.Controller.Entities
{
public interface IThemeMedia
{
bool IsThemeMedia { get; }
}
}

View File

@ -17,7 +17,7 @@ namespace MediaBrowser.Controller.Entities.Movies
/// <summary>
/// Class Movie
/// </summary>
public class Movie : Video, IHasSpecialFeatures, IHasBudget, IHasTrailers, IHasAwards, IHasMetascore, IHasLookupInfo<MovieInfo>, ISupportsBoxSetGrouping, IHasOriginalTitle
public class Movie : Video, IHasSpecialFeatures, IHasBudget, IHasTrailers, IHasAwards, IHasMetascore, IHasLookupInfo<MovieInfo>, ISupportsBoxSetGrouping
{
public List<Guid> SpecialFeatureIds { get; set; }

View File

@ -17,7 +17,7 @@ namespace MediaBrowser.Controller.Entities.TV
/// <summary>
/// Class Series
/// </summary>
public class Series : Folder, IHasTrailers, IHasDisplayOrder, IHasLookupInfo<SeriesInfo>, IMetadataContainer, IHasOriginalTitle
public class Series : Folder, IHasTrailers, IHasDisplayOrder, IHasLookupInfo<SeriesInfo>, IMetadataContainer
{
public int? AnimeSeriesIndex { get; set; }

View File

@ -10,7 +10,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Class Trailer
/// </summary>
public class Trailer : Video, IHasBudget, IHasMetascore, IHasOriginalTitle, IHasLookupInfo<TrailerInfo>
public class Trailer : Video, IHasBudget, IHasMetascore, IHasLookupInfo<TrailerInfo>
{
public Trailer()
{

View File

@ -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<ChannelMediaInfo> 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; }
/// <summary>
/// Gets or sets the video bit rate.
/// </summary>
/// <value>The video bit rate.</value>
public int? VideoBitRate { get; set; }
/// <summary>
/// Gets or sets the default index of the video stream.
/// </summary>

View File

@ -113,7 +113,6 @@
<Compile Include="Entities\KeywordExtensions.cs" />
<Compile Include="Entities\IHasMediaSources.cs" />
<Compile Include="Entities\IHasMetascore.cs" />
<Compile Include="Entities\IHasOriginalTitle.cs" />
<Compile Include="Entities\IHasProgramAttributes.cs" />
<Compile Include="Entities\IHasScreenshots.cs" />
<Compile Include="Entities\IHasSeries.cs" />
@ -129,7 +128,6 @@
<Compile Include="Entities\ISupportsBoxSetGrouping.cs" />
<Compile Include="Entities\ISupportsPlaceHolders.cs" />
<Compile Include="Entities\ItemImageInfo.cs" />
<Compile Include="Entities\IThemeMedia.cs" />
<Compile Include="Entities\LinkedChild.cs" />
<Compile Include="Entities\MusicVideo.cs" />
<Compile Include="Entities\IHasAwards.cs" />

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25420" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25420</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>f9fe523c-6eb0-4e4d-ae26-de5c7982b063</ProjectGuid>
<RootNamespace>MediaBrowser.Controller</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -96,7 +96,5 @@ namespace MediaBrowser.LocalMetadata
return "Emby Xml";
}
}
internal static readonly SemaphoreSlim XmlParsingResourcePool = new SemaphoreSlim(4, 4);
}
}

View File

@ -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;
}

View File

@ -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("<OriginalTitle>" + SecurityElement.Escape(hasOriginalTitle.OriginalTitle) + "</OriginalTitle>");
// }
//}
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.ShortOverview))
//{
// builder.Append("<ShortOverview><![CDATA[" + item.ShortOverview + "]]></ShortOverview>");
//}
if (!string.IsNullOrEmpty(item.Name) && !(item is Episode))
{
writer.WriteElementString("LocalTitle", item.Name);
}
//if (!string.IsNullOrEmpty(item.CustomRating))
//{
// builder.Append("<CustomRating>" + SecurityElement.Escape(item.CustomRating) + "</CustomRating>");
//}
if (!string.IsNullOrEmpty(item.ForcedSortName))
{
writer.WriteElementString("SortTitle", item.ForcedSortName);
}
//if (!string.IsNullOrEmpty(item.Name) && !(item is Episode))
//{
// builder.Append("<LocalTitle>" + SecurityElement.Escape(item.Name) + "</LocalTitle>");
//}
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 (!string.IsNullOrEmpty(item.ForcedSortName))
//{
// builder.Append("<SortTitle>" + SecurityElement.Escape(item.ForcedSortName) + "</SortTitle>");
//}
//if (item.PremiereDate.HasValue)
//{
// if (item is Person)
// {
// builder.Append("<BirthDate>" + SecurityElement.Escape(item.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd")) + "</BirthDate>");
// }
// else if (!(item is Episode))
// {
// builder.Append("<PremiereDate>" + SecurityElement.Escape(item.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd")) + "</PremiereDate>");
// }
//}
//if (item.EndDate.HasValue)
//{
// if (item is Person)
// {
// builder.Append("<DeathDate>" + SecurityElement.Escape(item.EndDate.Value.ToString("yyyy-MM-dd")) + "</DeathDate>");
// }
// else if (!(item is Episode))
// {
// builder.Append("<EndDate>" + SecurityElement.Escape(item.EndDate.Value.ToString("yyyy-MM-dd")) + "</EndDate>");
// }
//}
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.
/// </summary>
/// <typeparam name="T"></typeparam>
public static void AddMediaInfo<T>(T item, StringBuilder builder, IItemRepository itemRepository)
public static void AddMediaInfo<T>(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("<Format3D>FSBS</Format3D>");
writer.WriteElementString("Format3D", "FSBS");
break;
case Video3DFormat.FullTopAndBottom:
builder.Append("<Format3D>FTAB</Format3D>");
writer.WriteElementString("Format3D", "FTAB");
break;
case Video3DFormat.HalfSideBySide:
builder.Append("<Format3D>HSBS</Format3D>");
writer.WriteElementString("Format3D", "HSBS");
break;
case Video3DFormat.HalfTopAndBottom:
builder.Append("<Format3D>HTAB</Format3D>");
writer.WriteElementString("Format3D", "HTAB");
break;
case Video3DFormat.MVC:
builder.Append("<Format3D>MVC</Format3D>");
writer.WriteElementString("Format3D", "MVC");
break;
}
}

View File

@ -132,6 +132,8 @@ namespace MediaBrowser.Model.Entities
/// <value>The album.</value>
public string Album { get; set; }
public bool IsThemeMedia { get; set; }
/// <summary>
/// Gets or sets the artists.
/// </summary>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25420" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25420</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>a02a9262-f007-4464-bb32-02f5f2593651</ProjectGuid>
<RootNamespace>MediaBrowser.Model</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -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
/// </summary>
public class AudioImageProvider : IDynamicImageProvider, IHasItemChangeMonitor
{
private readonly ConcurrentDictionary<string, SemaphoreSlim> _locks = new ConcurrentDictionary<string, SemaphoreSlim>();
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);
_fileSystem.CreateDirectory(Path.GetDirectoryName(path));
// Acquire a lock
await semaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
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 imageStreamIndex = imageStream == null ? (int?)null : imageStream.Index;
var tempFile = await _mediaEncoder.ExtractAudioImage(item.Path, imageStreamIndex, cancellationToken).ConfigureAwait(false);
_fileSystem.CopyFile(tempFile, path, true);
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();
var imageStreamIndex = imageStream == null ? (int?)null : imageStream.Index;
var tempFile = await _mediaEncoder.ExtractAudioImage(item.Path, imageStreamIndex, cancellationToken).ConfigureAwait(false);
_fileSystem.CopyFile(tempFile, path, true);
try
{
_fileSystem.DeleteFile(tempFile);
}
catch
{
}
}
_fileSystem.DeleteFile(tempFile);
}
finally
catch
{
semaphore.Release();
}
}
@ -145,16 +124,6 @@ namespace MediaBrowser.Providers.MediaInfo
}
}
/// <summary>
/// Gets the lock.
/// </summary>
/// <param name="filename">The filename.</param>
/// <returns>SemaphoreSlim.</returns>
private SemaphoreSlim GetLock(string filename)
{
return _locks.GetOrAdd(filename, key => new SemaphoreSlim(1, 1));
}
public string Name
{
get { return "Image Extractor"; }

View File

@ -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);

View File

@ -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
{

View File

@ -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;

View File

@ -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;

View File

@ -367,7 +367,6 @@
<Compile Include="Persistence\SqliteUserDataRepository.cs" />
<Compile Include="Persistence\SqliteUserRepository.cs" />
<Compile Include="Sorting\StudioComparer.cs" />
<Compile Include="Sorting\VideoBitRateComparer.cs" />
<Compile Include="Sync\AppSyncProvider.cs" />
<Compile Include="Sync\CloudSyncProfile.cs" />
<Compile Include="Sync\IHasSyncQuality.cs" />

View File

@ -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);

View File

@ -1,41 +0,0 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Sorting
{
class VideoBitRateComparer : IBaseItemComparer
{
/// <summary>
/// Compares the specified x.
/// </summary>
/// <param name="x">The x.</param>
/// <param name="y">The y.</param>
/// <returns>System.Int32.</returns>
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;
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get { return ItemSortBy.VideoBitRate; }
}
}
}

View File

@ -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;
}

View File

@ -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);