Merge pull request #2636 from MediaBrowser/dev

Dev
pull/1154/head
Luke 8 years ago committed by GitHub
commit fcf588ac14

@ -513,20 +513,25 @@ namespace Emby.Drawing
/// <returns>ImageSize.</returns> /// <returns>ImageSize.</returns>
private ImageSize GetImageSizeInternal(string path, bool allowSlowMethod) private ImageSize GetImageSizeInternal(string path, bool allowSlowMethod)
{ {
// Can't use taglib because it keeps a lock on the file
//try //try
//{ //{
// using (var file = TagLib.File.Create(new StreamFileAbstraction(Path.GetFileName(path), _fileSystem.OpenRead(path), null))) // using (var fileStream = _fileSystem.OpenRead(path))
// { // {
// var image = file as TagLib.Image.File; // using (var file = TagLib.File.Create(new StreamFileAbstraction(Path.GetFileName(path), fileStream, null)))
// var properties = image.Properties;
// return new ImageSize
// { // {
// Height = properties.PhotoHeight, // var image = file as TagLib.Image.File;
// Width = properties.PhotoWidth
// }; // if (image != null)
// {
// var properties = image.Properties;
// return new ImageSize
// {
// Height = properties.PhotoHeight,
// Width = properties.PhotoWidth
// };
// }
// }
// } // }
//} //}
//catch //catch

@ -35,110 +35,113 @@ namespace Emby.Photos
try try
{ {
using (var file = TagLib.File.Create(new StreamFileAbstraction(Path.GetFileName(item.Path), _fileSystem.OpenRead(item.Path), null))) using (var fileStream = _fileSystem.OpenRead(item.Path))
{ {
var image = file as TagLib.Image.File; using (var file = TagLib.File.Create(new StreamFileAbstraction(Path.GetFileName(item.Path), fileStream, null)))
var tag = file.GetTag(TagTypes.TiffIFD) as IFDTag;
if (tag != null)
{ {
var structure = tag.Structure; var image = file as TagLib.Image.File;
var tag = file.GetTag(TagTypes.TiffIFD) as IFDTag;
if (structure != null) if (tag != null)
{ {
var exif = structure.GetEntry(0, (ushort)IFDEntryTag.ExifIFD) as SubIFDEntry; var structure = tag.Structure;
if (exif != null) if (structure != null)
{ {
var exifStructure = exif.Structure; var exif = structure.GetEntry(0, (ushort)IFDEntryTag.ExifIFD) as SubIFDEntry;
if (exifStructure != null) if (exif != null)
{ {
var entry = exifStructure.GetEntry(0, (ushort)ExifEntryTag.ApertureValue) as RationalIFDEntry; var exifStructure = exif.Structure;
if (entry != null)
{
double val = entry.Value.Numerator;
val /= entry.Value.Denominator;
item.Aperture = val;
}
entry = exifStructure.GetEntry(0, (ushort)ExifEntryTag.ShutterSpeedValue) as RationalIFDEntry;
if (entry != null) if (exifStructure != null)
{ {
double val = entry.Value.Numerator; var entry = exifStructure.GetEntry(0, (ushort)ExifEntryTag.ApertureValue) as RationalIFDEntry;
val /= entry.Value.Denominator;
item.ShutterSpeed = val; if (entry != null)
{
double val = entry.Value.Numerator;
val /= entry.Value.Denominator;
item.Aperture = val;
}
entry = exifStructure.GetEntry(0, (ushort)ExifEntryTag.ShutterSpeedValue) as RationalIFDEntry;
if (entry != null)
{
double val = entry.Value.Numerator;
val /= entry.Value.Denominator;
item.ShutterSpeed = val;
}
} }
} }
} }
} }
}
item.CameraMake = image.ImageTag.Make; item.CameraMake = image.ImageTag.Make;
item.CameraModel = image.ImageTag.Model; item.CameraModel = image.ImageTag.Model;
item.Width = image.Properties.PhotoWidth; item.Width = image.Properties.PhotoWidth;
item.Height = image.Properties.PhotoHeight; item.Height = image.Properties.PhotoHeight;
var rating = image.ImageTag.Rating; var rating = image.ImageTag.Rating;
if (rating.HasValue) if (rating.HasValue)
{ {
item.CommunityRating = rating; item.CommunityRating = rating;
} }
else else
{ {
item.CommunityRating = null; item.CommunityRating = null;
} }
item.Overview = image.ImageTag.Comment; item.Overview = image.ImageTag.Comment;
if (!string.IsNullOrWhiteSpace(image.ImageTag.Title)) if (!string.IsNullOrWhiteSpace(image.ImageTag.Title))
{ {
item.Name = image.ImageTag.Title; item.Name = image.ImageTag.Title;
} }
var dateTaken = image.ImageTag.DateTime; var dateTaken = image.ImageTag.DateTime;
if (dateTaken.HasValue) if (dateTaken.HasValue)
{ {
item.DateCreated = dateTaken.Value; item.DateCreated = dateTaken.Value;
item.PremiereDate = dateTaken.Value; item.PremiereDate = dateTaken.Value;
item.ProductionYear = dateTaken.Value.Year; item.ProductionYear = dateTaken.Value.Year;
} }
item.Genres = image.ImageTag.Genres.ToList(); item.Genres = image.ImageTag.Genres.ToList();
item.Tags = image.ImageTag.Keywords.ToList(); item.Tags = image.ImageTag.Keywords.ToList();
item.Software = image.ImageTag.Software; item.Software = image.ImageTag.Software;
if (image.ImageTag.Orientation == TagLib.Image.ImageOrientation.None) if (image.ImageTag.Orientation == TagLib.Image.ImageOrientation.None)
{
item.Orientation = null;
}
else
{
MediaBrowser.Model.Drawing.ImageOrientation orientation;
if (Enum.TryParse(image.ImageTag.Orientation.ToString(), true, out orientation))
{ {
item.Orientation = orientation; item.Orientation = null;
}
else
{
MediaBrowser.Model.Drawing.ImageOrientation orientation;
if (Enum.TryParse(image.ImageTag.Orientation.ToString(), true, out orientation))
{
item.Orientation = orientation;
}
} }
}
item.ExposureTime = image.ImageTag.ExposureTime; item.ExposureTime = image.ImageTag.ExposureTime;
item.FocalLength = image.ImageTag.FocalLength; item.FocalLength = image.ImageTag.FocalLength;
item.Latitude = image.ImageTag.Latitude; item.Latitude = image.ImageTag.Latitude;
item.Longitude = image.ImageTag.Longitude; item.Longitude = image.ImageTag.Longitude;
item.Altitude = image.ImageTag.Altitude; item.Altitude = image.ImageTag.Altitude;
if (image.ImageTag.ISOSpeedRatings.HasValue) if (image.ImageTag.ISOSpeedRatings.HasValue)
{ {
item.IsoSpeedRating = Convert.ToInt32(image.ImageTag.ISOSpeedRatings.Value); item.IsoSpeedRating = Convert.ToInt32(image.ImageTag.ISOSpeedRatings.Value);
} }
else else
{ {
item.IsoSpeedRating = null; item.IsoSpeedRating = null;
}
} }
} }
} }

@ -668,7 +668,7 @@ namespace Emby.Server.Implementations.Updates
_logger.Info("Deleting plugin file {0}", path); _logger.Info("Deleting plugin file {0}", path);
// Make this case-insensitive to account for possible incorrect assembly naming // Make this case-insensitive to account for possible incorrect assembly naming
var file = _fileSystem.GetFilePaths(path) var file = _fileSystem.GetFilePaths(_fileSystem.GetDirectoryName(path))
.FirstOrDefault(i => string.Equals(i, path, StringComparison.OrdinalIgnoreCase)); .FirstOrDefault(i => string.Equals(i, path, StringComparison.OrdinalIgnoreCase));
if (!string.IsNullOrWhiteSpace(file)) if (!string.IsNullOrWhiteSpace(file))

@ -234,11 +234,11 @@ namespace MediaBrowser.Api.Playback.Hls
try try
{ {
return FileSystem.GetFileStream(tmpPath, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite, true); return FileSystem.GetFileStream(tmpPath, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite, FileOpenOptions.Asynchronous | FileOpenOptions.SequentialScan);
} }
catch (IOException) catch (IOException)
{ {
return FileSystem.GetFileStream(path, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite, true); return FileSystem.GetFileStream(path, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite, FileOpenOptions.Asynchronous | FileOpenOptions.SequentialScan);
} }
} }

@ -59,7 +59,7 @@ namespace MediaBrowser.Controller.MediaEncoding
{ {
get get
{ {
return false; return MediaSource.GenPtsInput;
} }
} }
@ -93,11 +93,13 @@ namespace MediaBrowser.Controller.MediaEncoding
{ {
get get
{ {
// For live tv + recordings // For live tv + in progress recordings
if (string.Equals(InputContainer, "mpegts", StringComparison.OrdinalIgnoreCase) || if (string.Equals(InputContainer, "mpegts", StringComparison.OrdinalIgnoreCase) || string.Equals(InputContainer, "ts", StringComparison.OrdinalIgnoreCase))
string.Equals(InputContainer, "ts", StringComparison.OrdinalIgnoreCase))
{ {
return "cfr"; if (!MediaSource.RunTimeTicks.HasValue)
{
return "cfr";
}
} }
return "-1"; return "-1";

@ -31,6 +31,7 @@ namespace MediaBrowser.Model.Dto
public bool ReadAtNativeFramerate { get; set; } public bool ReadAtNativeFramerate { get; set; }
public bool IgnoreDts { get; set; } public bool IgnoreDts { get; set; }
public bool IgnoreIndex { get; set; } public bool IgnoreIndex { get; set; }
public bool GenPtsInput { get; set; }
public bool SupportsTranscoding { get; set; } public bool SupportsTranscoding { get; set; }
public bool SupportsDirectStream { get; set; } public bool SupportsDirectStream { get; set; }
public bool SupportsDirectPlay { get; set; } public bool SupportsDirectPlay { get; set; }

@ -1,3 +1,3 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("3.2.16.2")] [assembly: AssemblyVersion("3.2.16.3")]

Loading…
Cancel
Save