mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-07 10:14:14 -04:00
consolidate internal interfaces
This commit is contained in:
parent
0579f245e4
commit
3bf72b71b3
@ -408,13 +408,13 @@ namespace Emby.Common.Implementations.IO
|
|||||||
{
|
{
|
||||||
if (isHidden)
|
if (isHidden)
|
||||||
{
|
{
|
||||||
FileAttributes attributes = File.GetAttributes(path);
|
File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden);
|
||||||
attributes = RemoveAttribute(attributes, FileAttributes.Hidden);
|
|
||||||
File.SetAttributes(path, attributes);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden);
|
FileAttributes attributes = File.GetAttributes(path);
|
||||||
|
attributes = RemoveAttribute(attributes, FileAttributes.Hidden);
|
||||||
|
File.SetAttributes(path, attributes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -780,40 +780,38 @@ namespace Emby.Drawing
|
|||||||
// All enhanced images are saved as png to allow transparency
|
// All enhanced images are saved as png to allow transparency
|
||||||
var enhancedImagePath = GetCachePath(EnhancedImageCachePath, cacheGuid + ".png");
|
var enhancedImagePath = GetCachePath(EnhancedImageCachePath, cacheGuid + ".png");
|
||||||
|
|
||||||
var semaphore = GetLock(enhancedImagePath);
|
|
||||||
|
|
||||||
await semaphore.WaitAsync().ConfigureAwait(false);
|
|
||||||
|
|
||||||
// Check again in case of contention
|
// Check again in case of contention
|
||||||
if (_fileSystem.FileExists(enhancedImagePath))
|
if (_fileSystem.FileExists(enhancedImagePath))
|
||||||
{
|
{
|
||||||
semaphore.Release();
|
|
||||||
return enhancedImagePath;
|
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
|
try
|
||||||
{
|
{
|
||||||
_fileSystem.CreateDirectory(Path.GetDirectoryName(enhancedImagePath));
|
await ExecuteImageEnhancers(supportedEnhancers, originalImagePath, tmpPath, item, imageType, imageIndex).ConfigureAwait(false);
|
||||||
|
|
||||||
await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false);
|
try
|
||||||
|
{
|
||||||
imageProcessingLockTaken = true;
|
File.Copy(tmpPath, enhancedImagePath, true);
|
||||||
|
}
|
||||||
await ExecuteImageEnhancers(supportedEnhancers, originalImagePath, enhancedImagePath, item, imageType, imageIndex).ConfigureAwait(false);
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (imageProcessingLockTaken)
|
_imageProcessingSemaphore.Release();
|
||||||
{
|
|
||||||
_imageProcessingSemaphore.Release();
|
|
||||||
}
|
|
||||||
|
|
||||||
semaphore.Release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return enhancedImagePath;
|
return tmpPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// <summary>
|
||||||
/// Gets the cache path.
|
/// Gets the cache path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -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>
|
|
@ -22,8 +22,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||||||
IHasArtist,
|
IHasArtist,
|
||||||
IHasMusicGenres,
|
IHasMusicGenres,
|
||||||
IHasLookupInfo<SongInfo>,
|
IHasLookupInfo<SongInfo>,
|
||||||
IHasMediaSources,
|
IHasMediaSources
|
||||||
IThemeMedia
|
|
||||||
{
|
{
|
||||||
public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
|
public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
|
||||||
|
|
||||||
@ -39,7 +38,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||||||
public List<string> AlbumArtists { get; set; }
|
public List<string> AlbumArtists { get; set; }
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public bool IsThemeMedia
|
public override bool IsThemeMedia
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
@ -203,6 +203,16 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
get { return PremiereDate.HasValue && PremiereDate.Value.ToLocalTime().Date >= DateTime.Now.Date; }
|
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; }
|
public string OriginalTitle { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
|
|
||||||
namespace MediaBrowser.Controller.Entities
|
|
||||||
{
|
|
||||||
public interface IHasOriginalTitle
|
|
||||||
{
|
|
||||||
string OriginalTitle { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
|
|
||||||
namespace MediaBrowser.Controller.Entities
|
|
||||||
{
|
|
||||||
public interface IThemeMedia
|
|
||||||
{
|
|
||||||
bool IsThemeMedia { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -17,7 +17,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class Movie
|
/// Class Movie
|
||||||
/// </summary>
|
/// </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; }
|
public List<Guid> SpecialFeatureIds { get; set; }
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class Series
|
/// Class Series
|
||||||
/// </summary>
|
/// </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; }
|
public int? AnimeSeriesIndex { get; set; }
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class Trailer
|
/// Class Trailer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Trailer : Video, IHasBudget, IHasMetascore, IHasOriginalTitle, IHasLookupInfo<TrailerInfo>
|
public class Trailer : Video, IHasBudget, IHasMetascore, IHasLookupInfo<TrailerInfo>
|
||||||
{
|
{
|
||||||
public Trailer()
|
public Trailer()
|
||||||
{
|
{
|
||||||
|
@ -25,8 +25,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
public class Video : BaseItem,
|
public class Video : BaseItem,
|
||||||
IHasAspectRatio,
|
IHasAspectRatio,
|
||||||
ISupportsPlaceHolders,
|
ISupportsPlaceHolders,
|
||||||
IHasMediaSources,
|
IHasMediaSources
|
||||||
IThemeMedia
|
|
||||||
{
|
{
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public string PrimaryVersionId { get; set; }
|
public string PrimaryVersionId { get; set; }
|
||||||
@ -37,7 +36,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
|
public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public bool IsThemeMedia
|
public override bool IsThemeMedia
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@ -113,12 +112,6 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
public bool IsShortcut { get; set; }
|
public bool IsShortcut { get; set; }
|
||||||
public string ShortcutPath { 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>
|
/// <summary>
|
||||||
/// Gets or sets the default index of the video stream.
|
/// Gets or sets the default index of the video stream.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -113,7 +113,6 @@
|
|||||||
<Compile Include="Entities\KeywordExtensions.cs" />
|
<Compile Include="Entities\KeywordExtensions.cs" />
|
||||||
<Compile Include="Entities\IHasMediaSources.cs" />
|
<Compile Include="Entities\IHasMediaSources.cs" />
|
||||||
<Compile Include="Entities\IHasMetascore.cs" />
|
<Compile Include="Entities\IHasMetascore.cs" />
|
||||||
<Compile Include="Entities\IHasOriginalTitle.cs" />
|
|
||||||
<Compile Include="Entities\IHasProgramAttributes.cs" />
|
<Compile Include="Entities\IHasProgramAttributes.cs" />
|
||||||
<Compile Include="Entities\IHasScreenshots.cs" />
|
<Compile Include="Entities\IHasScreenshots.cs" />
|
||||||
<Compile Include="Entities\IHasSeries.cs" />
|
<Compile Include="Entities\IHasSeries.cs" />
|
||||||
@ -129,7 +128,6 @@
|
|||||||
<Compile Include="Entities\ISupportsBoxSetGrouping.cs" />
|
<Compile Include="Entities\ISupportsBoxSetGrouping.cs" />
|
||||||
<Compile Include="Entities\ISupportsPlaceHolders.cs" />
|
<Compile Include="Entities\ISupportsPlaceHolders.cs" />
|
||||||
<Compile Include="Entities\ItemImageInfo.cs" />
|
<Compile Include="Entities\ItemImageInfo.cs" />
|
||||||
<Compile Include="Entities\IThemeMedia.cs" />
|
|
||||||
<Compile Include="Entities\LinkedChild.cs" />
|
<Compile Include="Entities\LinkedChild.cs" />
|
||||||
<Compile Include="Entities\MusicVideo.cs" />
|
<Compile Include="Entities\MusicVideo.cs" />
|
||||||
<Compile Include="Entities\IHasAwards.cs" />
|
<Compile Include="Entities\IHasAwards.cs" />
|
||||||
|
@ -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>
|
|
@ -96,7 +96,5 @@ namespace MediaBrowser.LocalMetadata
|
|||||||
return "Emby Xml";
|
return "Emby Xml";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static readonly SemaphoreSlim XmlParsingResourcePool = new SemaphoreSlim(4, 4);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,13 +163,9 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||||||
{
|
{
|
||||||
var val = reader.ReadElementContentAsString();
|
var val = reader.ReadElementContentAsString();
|
||||||
|
|
||||||
var hasOriginalTitle = item as IHasOriginalTitle;
|
if (!string.IsNullOrEmpty(val))
|
||||||
if (hasOriginalTitle != null)
|
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(hasOriginalTitle.OriginalTitle))
|
item.OriginalTitle = val;
|
||||||
{
|
|
||||||
hasOriginalTitle.OriginalTitle = val;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -344,58 +344,52 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||||||
writer.WriteElementString("Overview", item.Overview);
|
writer.WriteElementString("Overview", item.Overview);
|
||||||
}
|
}
|
||||||
|
|
||||||
//var hasOriginalTitle = item as IHasOriginalTitle;
|
if (!string.IsNullOrEmpty(item.OriginalTitle))
|
||||||
//if (hasOriginalTitle != null)
|
{
|
||||||
//{
|
writer.WriteElementString("OriginalTitle", item.OriginalTitle);
|
||||||
// if (!string.IsNullOrEmpty(hasOriginalTitle.OriginalTitle))
|
}
|
||||||
// {
|
if (!string.IsNullOrEmpty(item.ShortOverview))
|
||||||
// builder.Append("<OriginalTitle>" + SecurityElement.Escape(hasOriginalTitle.OriginalTitle) + "</OriginalTitle>");
|
{
|
||||||
// }
|
writer.WriteElementString("ShortOverview", item.ShortOverview);
|
||||||
//}
|
}
|
||||||
|
if (!string.IsNullOrEmpty(item.CustomRating))
|
||||||
|
{
|
||||||
|
writer.WriteElementString("CustomRating", item.CustomRating);
|
||||||
|
}
|
||||||
|
|
||||||
//if (!string.IsNullOrEmpty(item.ShortOverview))
|
if (!string.IsNullOrEmpty(item.Name) && !(item is Episode))
|
||||||
//{
|
{
|
||||||
// builder.Append("<ShortOverview><![CDATA[" + item.ShortOverview + "]]></ShortOverview>");
|
writer.WriteElementString("LocalTitle", item.Name);
|
||||||
//}
|
}
|
||||||
|
|
||||||
//if (!string.IsNullOrEmpty(item.CustomRating))
|
if (!string.IsNullOrEmpty(item.ForcedSortName))
|
||||||
//{
|
{
|
||||||
// builder.Append("<CustomRating>" + SecurityElement.Escape(item.CustomRating) + "</CustomRating>");
|
writer.WriteElementString("SortTitle", item.ForcedSortName);
|
||||||
//}
|
}
|
||||||
|
|
||||||
//if (!string.IsNullOrEmpty(item.Name) && !(item is Episode))
|
if (item.PremiereDate.HasValue)
|
||||||
//{
|
{
|
||||||
// builder.Append("<LocalTitle>" + SecurityElement.Escape(item.Name) + "</LocalTitle>");
|
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))
|
if (item.EndDate.HasValue)
|
||||||
//{
|
{
|
||||||
// builder.Append("<SortTitle>" + SecurityElement.Escape(item.ForcedSortName) + "</SortTitle>");
|
if (item is Person)
|
||||||
//}
|
{
|
||||||
|
writer.WriteElementString("DeathDate", item.EndDate.Value.ToLocalTime().ToString("yyyy-MM-dd"));
|
||||||
//if (item.PremiereDate.HasValue)
|
}
|
||||||
//{
|
else if (!(item is Episode))
|
||||||
// if (item is Person)
|
{
|
||||||
// {
|
writer.WriteElementString("EndDate", item.EndDate.Value.ToLocalTime().ToString("yyyy-MM-dd"));
|
||||||
// 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>");
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//var hasTrailers = item as IHasTrailers;
|
//var hasTrailers = item as IHasTrailers;
|
||||||
//if (hasTrailers != null)
|
//if (hasTrailers != null)
|
||||||
@ -612,6 +606,8 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||||||
//{
|
//{
|
||||||
// AddShares(hasShares, builder);
|
// AddShares(hasShares, builder);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
AddMediaInfo(item, writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddShares(IHasShares item, StringBuilder builder)
|
public static void AddShares(IHasShares item, StringBuilder builder)
|
||||||
@ -635,33 +631,31 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||||||
/// Appends the media info.
|
/// Appends the media info.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <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
|
where T : BaseItem
|
||||||
{
|
{
|
||||||
var video = item as Video;
|
var video = item as Video;
|
||||||
|
|
||||||
if (video != null)
|
if (video != null)
|
||||||
{
|
{
|
||||||
//AddChapters(video, builder, itemRepository);
|
|
||||||
|
|
||||||
if (video.Video3DFormat.HasValue)
|
if (video.Video3DFormat.HasValue)
|
||||||
{
|
{
|
||||||
switch (video.Video3DFormat.Value)
|
switch (video.Video3DFormat.Value)
|
||||||
{
|
{
|
||||||
case Video3DFormat.FullSideBySide:
|
case Video3DFormat.FullSideBySide:
|
||||||
builder.Append("<Format3D>FSBS</Format3D>");
|
writer.WriteElementString("Format3D", "FSBS");
|
||||||
break;
|
break;
|
||||||
case Video3DFormat.FullTopAndBottom:
|
case Video3DFormat.FullTopAndBottom:
|
||||||
builder.Append("<Format3D>FTAB</Format3D>");
|
writer.WriteElementString("Format3D", "FTAB");
|
||||||
break;
|
break;
|
||||||
case Video3DFormat.HalfSideBySide:
|
case Video3DFormat.HalfSideBySide:
|
||||||
builder.Append("<Format3D>HSBS</Format3D>");
|
writer.WriteElementString("Format3D", "HSBS");
|
||||||
break;
|
break;
|
||||||
case Video3DFormat.HalfTopAndBottom:
|
case Video3DFormat.HalfTopAndBottom:
|
||||||
builder.Append("<Format3D>HTAB</Format3D>");
|
writer.WriteElementString("Format3D", "HTAB");
|
||||||
break;
|
break;
|
||||||
case Video3DFormat.MVC:
|
case Video3DFormat.MVC:
|
||||||
builder.Append("<Format3D>MVC</Format3D>");
|
writer.WriteElementString("Format3D", "MVC");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,6 +132,8 @@ namespace MediaBrowser.Model.Entities
|
|||||||
/// <value>The album.</value>
|
/// <value>The album.</value>
|
||||||
public string Album { get; set; }
|
public string Album { get; set; }
|
||||||
|
|
||||||
|
public bool IsThemeMedia { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the artists.
|
/// Gets or sets the artists.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -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>
|
|
@ -6,14 +6,11 @@ using MediaBrowser.Controller.Entities.Audio;
|
|||||||
using MediaBrowser.Controller.MediaEncoding;
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Common.IO;
|
|
||||||
using MediaBrowser.Controller.IO;
|
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.MediaInfo
|
namespace MediaBrowser.Providers.MediaInfo
|
||||||
@ -23,8 +20,6 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class AudioImageProvider : IDynamicImageProvider, IHasItemChangeMonitor
|
public class AudioImageProvider : IDynamicImageProvider, IHasItemChangeMonitor
|
||||||
{
|
{
|
||||||
private readonly ConcurrentDictionary<string, SemaphoreSlim> _locks = new ConcurrentDictionary<string, SemaphoreSlim>();
|
|
||||||
|
|
||||||
private readonly IMediaEncoder _mediaEncoder;
|
private readonly IMediaEncoder _mediaEncoder;
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
@ -67,41 +62,25 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
|
|
||||||
if (!_fileSystem.FileExists(path))
|
if (!_fileSystem.FileExists(path))
|
||||||
{
|
{
|
||||||
var semaphore = GetLock(path);
|
_fileSystem.CreateDirectory(Path.GetDirectoryName(path));
|
||||||
|
|
||||||
// Acquire a lock
|
var imageStream = imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("front", StringComparison.OrdinalIgnoreCase) != -1) ??
|
||||||
await semaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
|
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
|
try
|
||||||
{
|
{
|
||||||
// Check again in case it was saved while waiting for the lock
|
_fileSystem.DeleteFile(tempFile);
|
||||||
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
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
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
|
public string Name
|
||||||
{
|
{
|
||||||
get { return "Image Extractor"; }
|
get { return "Image Extractor"; }
|
||||||
|
@ -203,7 +203,6 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
|
|
||||||
var videoStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video);
|
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.DefaultVideoStreamIndex = videoStream == null ? (int?)null : videoStream.Index;
|
||||||
|
|
||||||
video.HasSubtitles = mediaStreams.Any(i => i.Type == MediaStreamType.Subtitle);
|
video.HasSubtitles = mediaStreams.Any(i => i.Type == MediaStreamType.Subtitle);
|
||||||
|
@ -13,9 +13,6 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Common.IO;
|
|
||||||
using MediaBrowser.Controller.IO;
|
|
||||||
using MediaBrowser.Model.IO;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.MediaInfo
|
namespace MediaBrowser.Providers.MediaInfo
|
||||||
{
|
{
|
||||||
|
@ -123,8 +123,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var themeMedia = item as IThemeMedia;
|
if (item.IsThemeMedia)
|
||||||
if (themeMedia != null && themeMedia.IsThemeMedia)
|
|
||||||
{
|
{
|
||||||
// Don't report theme song or local trailer playback
|
// Don't report theme song or local trailer playback
|
||||||
return;
|
return;
|
||||||
@ -156,8 +155,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var themeMedia = item as IThemeMedia;
|
if (item.IsThemeMedia)
|
||||||
if (themeMedia != null && themeMedia.IsThemeMedia)
|
|
||||||
{
|
{
|
||||||
// Don't report theme song or local trailer playback
|
// Don't report theme song or local trailer playback
|
||||||
return;
|
return;
|
||||||
|
@ -256,9 +256,8 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
|
|||||||
}
|
}
|
||||||
|
|
||||||
var item = e.MediaInfo;
|
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
|
// Don't report theme song or local trailer playback
|
||||||
return;
|
return;
|
||||||
|
@ -367,7 +367,6 @@
|
|||||||
<Compile Include="Persistence\SqliteUserDataRepository.cs" />
|
<Compile Include="Persistence\SqliteUserDataRepository.cs" />
|
||||||
<Compile Include="Persistence\SqliteUserRepository.cs" />
|
<Compile Include="Persistence\SqliteUserRepository.cs" />
|
||||||
<Compile Include="Sorting\StudioComparer.cs" />
|
<Compile Include="Sorting\StudioComparer.cs" />
|
||||||
<Compile Include="Sorting\VideoBitRateComparer.cs" />
|
|
||||||
<Compile Include="Sync\AppSyncProvider.cs" />
|
<Compile Include="Sync\AppSyncProvider.cs" />
|
||||||
<Compile Include="Sync\CloudSyncProfile.cs" />
|
<Compile Include="Sync\CloudSyncProfile.cs" />
|
||||||
<Compile Include="Sync\IHasSyncQuality.cs" />
|
<Compile Include="Sync\IHasSyncQuality.cs" />
|
||||||
|
@ -1611,7 +1611,8 @@ namespace MediaBrowser.Server.Implementations.Session
|
|||||||
IndexNumber = item.IndexNumber,
|
IndexNumber = item.IndexNumber,
|
||||||
ParentIndexNumber = item.ParentIndexNumber,
|
ParentIndexNumber = item.ParentIndexNumber,
|
||||||
PremiereDate = item.PremiereDate,
|
PremiereDate = item.PremiereDate,
|
||||||
ProductionYear = item.ProductionYear
|
ProductionYear = item.ProductionYear,
|
||||||
|
IsThemeMedia = item.IsThemeMedia
|
||||||
};
|
};
|
||||||
|
|
||||||
info.PrimaryImageTag = GetImageCacheTag(item, ImageType.Primary);
|
info.PrimaryImageTag = GetImageCacheTag(item, ImageType.Primary);
|
||||||
|
@ -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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -278,13 +278,9 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
{
|
{
|
||||||
var val = reader.ReadElementContentAsString();
|
var val = reader.ReadElementContentAsString();
|
||||||
|
|
||||||
var hasOriginalTitle = item as IHasOriginalTitle;
|
if (!string.IsNullOrEmpty(val))
|
||||||
if (hasOriginalTitle != null)
|
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(hasOriginalTitle.OriginalTitle))
|
item.OriginalTitle = val;
|
||||||
{
|
|
||||||
hasOriginalTitle.OriginalTitle = val;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -485,13 +485,9 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
|
|
||||||
writer.WriteElementString("title", item.Name ?? string.Empty);
|
writer.WriteElementString("title", item.Name ?? string.Empty);
|
||||||
|
|
||||||
var hasOriginalTitle = item as IHasOriginalTitle;
|
if (!string.IsNullOrWhiteSpace(item.OriginalTitle))
|
||||||
if (hasOriginalTitle != null)
|
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(hasOriginalTitle.OriginalTitle))
|
writer.WriteElementString("originaltitle", item.OriginalTitle);
|
||||||
{
|
|
||||||
writer.WriteElementString("originaltitle", hasOriginalTitle.OriginalTitle ?? string.Empty);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var people = libraryManager.GetPeople(item);
|
var people = libraryManager.GetPeople(item);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user