fixes #903 - Display image info on web client detail page

This commit is contained in:
Luke Pulverenti 2014-08-28 20:49:25 -04:00
parent d2494148f7
commit 7e636a977a
23 changed files with 106 additions and 295 deletions

View file

@ -34,6 +34,7 @@ namespace MediaBrowser.Controller.Entities.Audio
public Audio()
{
Artists = new List<string>();
AlbumArtists = new List<string>();
Tags = new List<string>();
}
@ -90,12 +91,14 @@ namespace MediaBrowser.Controller.Entities.Audio
/// <value>The artist.</value>
public List<string> Artists { get; set; }
public List<string> AlbumArtists { get; set; }
[IgnoreDataMember]
public List<string> AllArtists
{
get
{
var list = AlbumArtists;
var list = AlbumArtists.ToList();
list.AddRange(Artists);
@ -104,36 +107,11 @@ namespace MediaBrowser.Controller.Entities.Audio
}
}
[IgnoreDataMember]
public List<string> AlbumArtists
{
get
{
var list = new List<string>();
if (!string.IsNullOrEmpty(AlbumArtist))
{
list.Add(AlbumArtist);
}
return list;
}
set
{
AlbumArtist = value.FirstOrDefault();
}
}
/// <summary>
/// Gets or sets the album.
/// </summary>
/// <value>The album.</value>
public string Album { get; set; }
/// <summary>
/// Gets or sets the album artist.
/// </summary>
/// <value>The album artist.</value>
public string AlbumArtist { get; set; }
/// <summary>
/// Gets the type of the media.

View file

@ -17,8 +17,9 @@ namespace MediaBrowser.Controller.Entities.Audio
public MusicAlbum()
{
Artists = new List<string>();
SoundtrackIds = new List<Guid>();
Artists = new List<string>();
AlbumArtists = new List<string>();
}
public override bool SupportsAddingToPlaylist
@ -40,7 +41,7 @@ namespace MediaBrowser.Controller.Entities.Audio
{
get
{
var list = AlbumArtists;
var list = AlbumArtists.ToList();
list.AddRange(Artists);
@ -49,25 +50,7 @@ namespace MediaBrowser.Controller.Entities.Audio
}
}
[IgnoreDataMember]
public List<string> AlbumArtists
{
get
{
var list = new List<string>();
if (!string.IsNullOrEmpty(AlbumArtist))
{
list.Add(AlbumArtist);
}
return list;
}
set
{
AlbumArtist = value.FirstOrDefault();
}
}
public List<string> AlbumArtists { get; set; }
/// <summary>
/// Gets the tracks.
@ -139,8 +122,6 @@ namespace MediaBrowser.Controller.Entities.Audio
return AllArtists.Contains(artist, StringComparer.OrdinalIgnoreCase);
}
public string AlbumArtist { get; set; }
public List<string> Artists { get; set; }
/// <summary>

View file

@ -24,14 +24,12 @@ namespace MediaBrowser.Controller.Entities
public int? Width { get; set; }
public int? Height { get; set; }
public string CameraManufacturer { get; set; }
public string CameraMake { get; set; }
public string CameraModel { get; set; }
public string Software { get; set; }
public double? ExposureTime { get; set; }
public double? FocalLength { get; set; }
public ImageOrientation? Orientation { get; set; }
public double? Aperture { get; set; }
public double? ShutterSpeed { get; set; }
}

View file

@ -341,9 +341,6 @@
<Compile Include="..\MediaBrowser.Model\Dto\RecommendationType.cs">
<Link>Dto\RecommendationType.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Dto\StreamOptions.cs">
<Link>Dto\StreamOptions.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Dto\StudioDto.cs">
<Link>Dto\StudioDto.cs</Link>
</Compile>
@ -356,9 +353,6 @@
<Compile Include="..\MediaBrowser.Model\Dto\UserItemDataDto.cs">
<Link>Dto\UserItemDataDto.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Dto\VideoStreamOptions.cs">
<Link>Dto\VideoStreamOptions.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Entities\BaseItemInfo.cs">
<Link>Entities\BaseItemInfo.cs</Link>
</Compile>

View file

@ -304,9 +304,6 @@
<Compile Include="..\MediaBrowser.Model\Dto\RecommendationType.cs">
<Link>Dto\RecommendationType.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Dto\StreamOptions.cs">
<Link>Dto\StreamOptions.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Dto\StudioDto.cs">
<Link>Dto\StudioDto.cs</Link>
</Compile>
@ -319,9 +316,6 @@
<Compile Include="..\MediaBrowser.Model\Dto\UserItemDataDto.cs">
<Link>Dto\UserItemDataDto.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Dto\VideoStreamOptions.cs">
<Link>Dto\VideoStreamOptions.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Entities\BaseItemInfo.cs">
<Link>Entities\BaseItemInfo.cs</Link>
</Compile>

View file

@ -61,30 +61,6 @@ namespace MediaBrowser.Model.ApiClient
Task<T> GetAsync<T>(string url, CancellationToken cancellationToken = default(CancellationToken))
where T : class;
/// <summary>
/// Gets the url needed to stream an audio file
/// </summary>
/// <param name="options">The options.</param>
/// <returns>System.String.</returns>
/// <exception cref="ArgumentNullException">options</exception>
string GetAudioStreamUrl(StreamOptions options);
/// <summary>
/// Gets the url needed to stream a video file
/// </summary>
/// <param name="options">The options.</param>
/// <returns>System.String.</returns>
/// <exception cref="ArgumentNullException">options</exception>
string GetVideoStreamUrl(VideoStreamOptions options);
/// <summary>
/// Formulates a url for streaming video using the HLS protocol
/// </summary>
/// <param name="options">The options.</param>
/// <returns>System.String.</returns>
/// <exception cref="ArgumentNullException">options</exception>
string GetHlsVideoStreamUrl(VideoStreamOptions options);
/// <summary>
/// Reports the capabilities.
/// </summary>

View file

@ -1,5 +1,5 @@
using System.Collections.Generic;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Dto;
using System.Collections.Generic;
namespace MediaBrowser.Model.Dlna
{
@ -8,6 +8,11 @@ namespace MediaBrowser.Model.Dlna
/// </summary>
public class AudioOptions
{
public AudioOptions()
{
Context = EncodingContext.Streaming;
}
public string ItemId { get; set; }
public List<MediaSourceInfo> MediaSources { get; set; }
public DeviceProfile Profile { get; set; }

View file

@ -3,7 +3,6 @@ namespace MediaBrowser.Model.Drawing
{
public enum ImageOrientation
{
None = 0,
TopLeft = 1,
TopRight = 2,
BottomRight = 3,

View file

@ -1,4 +1,5 @@
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Library;
using MediaBrowser.Model.Providers;
@ -721,6 +722,17 @@ namespace MediaBrowser.Model.Dto
/// <value><c>true</c> if [enable internet providers]; otherwise, <c>false</c>.</value>
public bool? LockData { get; set; }
public int? Width { get; set; }
public int? Height { get; set; }
public string CameraMake { get; set; }
public string CameraModel { get; set; }
public string Software { get; set; }
public double? ExposureTime { get; set; }
public double? FocalLength { get; set; }
public ImageOrientation? ImageOrientation { get; set; }
public double? Aperture { get; set; }
public double? ShutterSpeed { get; set; }
/// <summary>
/// Gets a value indicating whether this instance can resume.
/// </summary>

View file

@ -1,64 +0,0 @@
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// Class StreamOptions
/// </summary>
public class StreamOptions
{
/// <summary>
/// Gets or sets the audio bit rate.
/// </summary>
/// <value>The audio bit rate.</value>
public int? AudioBitRate { get; set; }
/// <summary>
/// Gets or sets the audio codec.
/// Omit to copy the original stream
/// </summary>
/// <value>The audio encoding format.</value>
public string AudioCodec { get; set; }
/// <summary>
/// Gets or sets the item id.
/// </summary>
/// <value>The item id.</value>
public string ItemId { get; set; }
/// <summary>
/// Gets or sets the max audio channels.
/// </summary>
/// <value>The max audio channels.</value>
public int? MaxAudioChannels { get; set; }
/// <summary>
/// Gets or sets the max audio sample rate.
/// </summary>
/// <value>The max audio sample rate.</value>
public int? MaxAudioSampleRate { get; set; }
/// <summary>
/// Gets or sets the start time ticks.
/// </summary>
/// <value>The start time ticks.</value>
public long? StartTimeTicks { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the original media should be served statically
/// Only used with progressive streaming
/// </summary>
/// <value><c>true</c> if static; otherwise, <c>false</c>.</value>
public bool? Static { get; set; }
/// <summary>
/// Gets or sets the output file extension.
/// </summary>
/// <value>The output file extension.</value>
public string OutputFileExtension { get; set; }
/// <summary>
/// Gets or sets the device id.
/// </summary>
/// <value>The device id.</value>
public string DeviceId { get; set; }
}
}

View file

@ -1,99 +0,0 @@
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// Class VideoStreamOptions
/// </summary>
public class VideoStreamOptions : StreamOptions
{
/// <summary>
/// Gets or sets the video codec.
/// Omit to copy
/// </summary>
/// <value>The video codec.</value>
public string VideoCodec { 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 width.
/// </summary>
/// <value>The width.</value>
public int? Width { get; set; }
/// <summary>
/// Gets or sets the height.
/// </summary>
/// <value>The height.</value>
public int? Height { get; set; }
/// <summary>
/// Gets or sets the width of the max.
/// </summary>
/// <value>The width of the max.</value>
public int? MaxWidth { get; set; }
/// <summary>
/// Gets or sets the height of the max.
/// </summary>
/// <value>The height of the max.</value>
public int? MaxHeight { get; set; }
/// <summary>
/// Gets or sets the frame rate.
/// </summary>
/// <value>The frame rate.</value>
public double? FrameRate { get; set; }
/// <summary>
/// Gets or sets the index of the audio stream.
/// </summary>
/// <value>The index of the audio stream.</value>
public int? AudioStreamIndex { get; set; }
/// <summary>
/// Gets or sets the index of the video stream.
/// </summary>
/// <value>The index of the video stream.</value>
public int? VideoStreamIndex { get; set; }
/// <summary>
/// Gets or sets the index of the subtitle stream.
/// </summary>
/// <value>The index of the subtitle stream.</value>
public int? SubtitleStreamIndex { get; set; }
/// <summary>
/// Gets or sets the profile.
/// </summary>
/// <value>The profile.</value>
public string Profile { get; set; }
/// <summary>
/// Gets or sets the level.
/// </summary>
/// <value>The level.</value>
public string Level { get; set; }
/// <summary>
/// Gets or sets the baseline stream audio bit rate.
/// </summary>
/// <value>The baseline stream audio bit rate.</value>
public int? BaselineStreamAudioBitRate { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [append baseline stream].
/// </summary>
/// <value><c>true</c> if [append baseline stream]; otherwise, <c>false</c>.</value>
public bool AppendBaselineStream { get; set; }
/// <summary>
/// Gets or sets the time stamp offset ms. Only used with HLS.
/// </summary>
/// <value>The time stamp offset ms.</value>
public int? TimeStampOffsetMs { get; set; }
}
}

View file

@ -152,7 +152,6 @@
<Compile Include="Dto\MediaSourceInfo.cs" />
<Compile Include="Dto\RecommendationType.cs" />
<Compile Include="Dto\SubtitleDownloadOptions.cs" />
<Compile Include="Dto\VideoStreamOptions.cs" />
<Compile Include="Entities\IsoType.cs" />
<Compile Include="Entities\MediaInfo.cs" />
<Compile Include="Entities\MediaStreamType.cs" />
@ -285,7 +284,6 @@
<Compile Include="Querying\ItemQuery.cs" />
<Compile Include="Entities\LibraryUpdateInfo.cs" />
<Compile Include="Entities\ParentalRating.cs" />
<Compile Include="Dto\StreamOptions.cs" />
<Compile Include="Entities\VirtualFolderInfo.cs" />
<Compile Include="IO\IZipClient.cs" />
<Compile Include="Logging\ILogger.cs" />

View file

@ -168,6 +168,15 @@ namespace MediaBrowser.Providers.MediaInfo
return true;
}
if (item is Audio)
{
// Moved to plural AlbumArtists
if (date < new DateTime(2014, 8, 28))
{
return true;
}
}
if (item.SupportsLocalMetadata)
{
var video = item as Video;

View file

@ -9,8 +9,6 @@ using MediaBrowser.Providers.Manager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Providers.Music
{
@ -104,17 +102,15 @@ namespace MediaBrowser.Providers.Music
{
var updateType = ItemUpdateType.None;
var albumArtist = songs
var albumArtists = songs
.SelectMany(i => i.AlbumArtists)
.FirstOrDefault(i => !string.IsNullOrEmpty(i));
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToList();
if (!string.IsNullOrEmpty(albumArtist))
if (!item.AlbumArtists.SequenceEqual(albumArtists, StringComparer.OrdinalIgnoreCase))
{
if (!string.Equals(item.AlbumArtist, albumArtist, StringComparison.Ordinal))
{
item.AlbumArtist = albumArtist;
updateType = updateType | ItemUpdateType.MetadataDownload;
}
item.AlbumArtists = albumArtists;
updateType = updateType | ItemUpdateType.MetadataDownload;
}
return updateType;

View file

@ -70,7 +70,10 @@ namespace MediaBrowser.Providers.Music
private void ProcessResult(MusicAlbum item, Album result)
{
item.AlbumArtist = result.strArtist;
if (!string.IsNullOrWhiteSpace(result.strArtist))
{
item.AlbumArtists = new List<string> { result.strArtist };
}
if (!string.IsNullOrEmpty(result.intYearReleased))
{

View file

@ -8,15 +8,15 @@ namespace MediaBrowser.Providers.Music
{
public static string GetAlbumArtist(this AlbumInfo info)
{
var id = info.AlbumArtists.FirstOrDefault();
if (string.IsNullOrEmpty(id))
{
return info.SongInfos.SelectMany(i => i.AlbumArtists)
var id = info.SongInfos.SelectMany(i => i.AlbumArtists)
.FirstOrDefault(i => !string.IsNullOrEmpty(i));
if (!string.IsNullOrEmpty(id))
{
return id;
}
return id;
return info.AlbumArtists.FirstOrDefault();
}
public static string GetReleaseGroupId(this AlbumInfo info)

View file

@ -29,7 +29,6 @@ namespace MediaBrowser.Providers.Photos
public Task<ItemUpdateType> FetchAsync(Photo item, MetadataRefreshOptions options, CancellationToken cancellationToken)
{
item.SetImagePath(ImageType.Primary, item.Path);
item.SetImagePath(ImageType.Backdrop, item.Path);
// Examples: https://github.com/mono/taglib-sharp/blob/a5f6949a53d09ce63ee7495580d6802921a21f14/tests/fixtures/TagLib.Tests.Images/NullOrientationTest.cs
@ -77,7 +76,7 @@ namespace MediaBrowser.Providers.Photos
}
}
item.CameraManufacturer = image.ImageTag.Make;
item.CameraMake = image.ImageTag.Make;
item.CameraModel = image.ImageTag.Model;
var rating = image.ImageTag.Rating;
@ -105,18 +104,21 @@ namespace MediaBrowser.Providers.Photos
item.ProductionYear = dateTaken.Value.Year;
}
var size = _imageProcessor.GetImageSize(item.Path);
item.Height = Convert.ToInt32(size.Height);
item.Width = Convert.ToInt32(size.Width);
item.Genres = image.ImageTag.Genres.ToList();
item.Tags = image.ImageTag.Keywords.ToList();
item.Software = image.ImageTag.Software;
Model.Drawing.ImageOrientation orientation;
if (Enum.TryParse(image.ImageTag.Orientation.ToString(), true, out orientation))
if (image.ImageTag.Orientation == TagLib.Image.ImageOrientation.None)
{
item.Orientation = orientation;
item.Orientation = null;
}
else
{
Model.Drawing.ImageOrientation orientation;
if (Enum.TryParse(image.ImageTag.Orientation.ToString(), true, out orientation))
{
item.Orientation = orientation;
}
}
item.ExposureTime = image.ImageTag.ExposureTime;
@ -127,6 +129,10 @@ namespace MediaBrowser.Providers.Photos
_logger.ErrorException("Image Provider - Error reading image tag for {0}", e, item.Path);
}
var size = _imageProcessor.GetImageSize(item.Path);
item.Height = Convert.ToInt32(size.Height);
item.Width = Convert.ToInt32(size.Width);
const ItemUpdateType result = ItemUpdateType.ImageUpdate | ItemUpdateType.MetadataImport;
return Task.FromResult(result);
}
@ -138,6 +144,13 @@ namespace MediaBrowser.Providers.Photos
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
{
// Moved to plural AlbumArtists
if (date < new DateTime(2014, 8, 28))
{
// Revamped vaptured metadata
return true;
}
return item.DateModified > date;
}
}

View file

@ -357,6 +357,19 @@ namespace MediaBrowser.Server.Implementations.Dto
{
dto.SeriesName = item.SeriesName;
}
private void SetPhotoProperties(BaseItemDto dto, Photo item)
{
dto.Width = item.Width;
dto.Height = item.Height;
dto.CameraMake = item.CameraMake;
dto.CameraModel = item.CameraModel;
dto.Software = item.Software;
dto.ExposureTime = item.ExposureTime;
dto.FocalLength = item.FocalLength;
dto.ImageOrientation = item.Orientation;
dto.Aperture = item.Aperture;
dto.ShutterSpeed = item.ShutterSpeed;
}
private void SetMusicVideoProperties(BaseItemDto dto, MusicVideo item)
{
@ -1187,21 +1200,24 @@ namespace MediaBrowser.Server.Implementations.Dto
}
var book = item as Book;
if (book != null)
{
SetBookProperties(dto, book);
}
var tvChannel = item as LiveTvChannel;
var photo = item as Photo;
if (photo != null)
{
SetPhotoProperties(dto, photo);
}
var tvChannel = item as LiveTvChannel;
if (tvChannel != null)
{
dto.MediaSources = tvChannel.GetMediaSources(true).ToList();
}
var channelItem = item as IChannelItem;
if (channelItem != null)
{
dto.ChannelId = channelItem.ChannelId;

View file

@ -1093,8 +1093,8 @@
"MessageLeaveEmptyToInherit": "Leave empty to inherit settings from a parent item, or the global default value.",
"TabSupporterClub": "Supporter Club",
"HeaderDonationType": "Donation type:",
"OptionMakeOneTimeDonation": "Make an additional donation",
"OptionOneTimeDescription": "This is an additional donation to the team to show extra support. It does not have any additional benefits.",
"OptionMakeOneTimeDonation": "Make a separate donation",
"OptionOneTimeDescription": "This is an additional donation to the team to show your support. It does not have any additional benefits.",
"OptionLifeTimeSupporterClubMembership": "Lifetime supporter club membership",
"HeaderSupporterBenefit": "Becoming a supporter club member provides additional benefits such as access to premium plugins, internet channel content, and more.",
"OptionNoTrailer": "No Trailer",
@ -1108,5 +1108,7 @@
"OptionProducer": "Producer",
"OptionWriter": "Writer",
"LabelAirDays": "Air days:",
"LabelAirTime": "Air time:"
"LabelAirTime": "Air time:",
"HeaderMediaInfo": "Media Info",
"HeaderPhotoInfo": "Photo Info"
}

View file

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common.Internal</id>
<version>3.0.427</version>
<version>3.0.428</version>
<title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Media Browser 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.427" />
<dependency id="MediaBrowser.Common" version="3.0.428" />
<dependency id="NLog" version="3.1.0.0" />
<dependency id="SimpleInjector" version="2.5.2" />
<dependency id="sharpcompress" version="0.10.2" />

View file

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common</id>
<version>3.0.427</version>
<version>3.0.428</version>
<title>MediaBrowser.Common</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>

View file

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Model.Signed</id>
<version>3.0.427</version>
<version>3.0.428</version>
<title>MediaBrowser.Model - Signed Edition</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>

View file

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MediaBrowser.Server.Core</id>
<version>3.0.427</version>
<version>3.0.428</version>
<title>Media Browser.Server.Core</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Media Browser Server.</description>
<copyright>Copyright © Media Browser 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.427" />
<dependency id="MediaBrowser.Common" version="3.0.428" />
</dependencies>
</metadata>
<files>