aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-10-31 03:42:14 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-10-31 03:42:14 -0400
commit9c813f9aedb3d4f20ff495fc23693591e7dda914 (patch)
treeef898a20921bc7037f2e657b39bdad65f153b3f7
parentb91dcdbff43559e4cbaa4148d56f6b7295256b7a (diff)
update taglib
-rw-r--r--Emby.Photos/Emby.Photos.csproj5
-rw-r--r--Emby.Photos/PhotoProvider.cs8
-rw-r--r--Emby.Photos/StreamFileAbstraction.cs33
-rw-r--r--MediaBrowser.Controller/Entities/Trailer.cs16
4 files changed, 43 insertions, 19 deletions
diff --git a/Emby.Photos/Emby.Photos.csproj b/Emby.Photos/Emby.Photos.csproj
index efc15519f..8ff570199 100644
--- a/Emby.Photos/Emby.Photos.csproj
+++ b/Emby.Photos/Emby.Photos.csproj
@@ -39,11 +39,12 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
- <Reference Include="taglib-sharp">
- <HintPath>..\ThirdParty\taglib\taglib-sharp.dll</HintPath>
+ <Reference Include="TagLib.Portable">
+ <HintPath>..\ThirdParty\taglib\TagLib.Portable.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
+ <Compile Include="StreamFileAbstraction.cs" />
<Compile Include="PhotoProvider.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
diff --git a/Emby.Photos/PhotoProvider.cs b/Emby.Photos/PhotoProvider.cs
index aa9b36f17..c088ac864 100644
--- a/Emby.Photos/PhotoProvider.cs
+++ b/Emby.Photos/PhotoProvider.cs
@@ -1,4 +1,5 @@
using System;
+using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@@ -6,6 +7,7 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using TagLib;
using TagLib.IFD;
@@ -17,10 +19,12 @@ namespace Emby.Photos
public class PhotoProvider : ICustomMetadataProvider<Photo>, IHasItemChangeMonitor, IForcedProvider
{
private readonly ILogger _logger;
+ private readonly IFileSystem _fileSystem;
- public PhotoProvider(ILogger logger)
+ public PhotoProvider(ILogger logger, IFileSystem fileSystem)
{
_logger = logger;
+ _fileSystem = fileSystem;
}
public Task<ItemUpdateType> FetchAsync(Photo item, MetadataRefreshOptions options, CancellationToken cancellationToken)
@@ -31,7 +35,7 @@ namespace Emby.Photos
try
{
- using (var file = TagLib.File.Create(item.Path))
+ using (var file = TagLib.File.Create(new StreamFileAbstraction(Path.GetFileName(item.Path), _fileSystem.OpenRead(item.Path))))
{
var image = file as TagLib.Image.File;
diff --git a/Emby.Photos/StreamFileAbstraction.cs b/Emby.Photos/StreamFileAbstraction.cs
new file mode 100644
index 000000000..e1ea19bbe
--- /dev/null
+++ b/Emby.Photos/StreamFileAbstraction.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using MediaBrowser.Model.IO;
+using File = TagLib.File;
+
+namespace Emby.Photos
+{
+ public class StreamFileAbstraction : File.IFileAbstraction
+ {
+ public StreamFileAbstraction(string name, Stream readStream)
+ {
+ // TODO: Fix deadlock when setting an actual writable Stream
+ WriteStream = readStream;
+ ReadStream = readStream;
+ Name = name;
+ }
+
+ public string Name { get; private set; }
+
+ public Stream ReadStream { get; private set; }
+
+ public Stream WriteStream { get; private set; }
+
+ public void CloseStream(Stream stream)
+ {
+ stream.Dispose();
+ }
+ }
+}
diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs
index b67e7ffe3..dd6d8a999 100644
--- a/MediaBrowser.Controller/Entities/Trailer.cs
+++ b/MediaBrowser.Controller/Entities/Trailer.cs
@@ -10,7 +10,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Class Trailer
/// </summary>
- public class Trailer : Video, IHasBudget, IHasMetascore, IHasLookupInfo<TrailerInfo>
+ public class Trailer : Video, IHasLookupInfo<TrailerInfo>
{
public Trailer()
{
@@ -21,8 +21,6 @@ namespace MediaBrowser.Controller.Entities
public List<TrailerType> TrailerTypes { get; set; }
- public float? Metascore { get; set; }
-
public List<MediaUrl> RemoteTrailers { get; set; }
[IgnoreDataMember]
@@ -31,18 +29,6 @@ namespace MediaBrowser.Controller.Entities
get { return TrailerTypes.Contains(TrailerType.LocalTrailer); }
}
- /// <summary>
- /// Gets or sets the budget.
- /// </summary>
- /// <value>The budget.</value>
- public double? Budget { get; set; }
-
- /// <summary>
- /// Gets or sets the revenue.
- /// </summary>
- /// <value>The revenue.</value>
- public double? Revenue { get; set; }
-
public override UnratedItem GetBlockUnratedType()
{
return UnratedItem.Trailer;