diff options
| author | Michalis Adamidis <gsnerf@gsnerf.de> | 2014-08-30 02:05:33 +0200 |
|---|---|---|
| committer | Michalis Adamidis <gsnerf@gsnerf.de> | 2014-08-30 02:05:33 +0200 |
| commit | 7c5613fc51738cb3af1ce3e7ada9eb19a54b3aed (patch) | |
| tree | dfd23a717d87e1da776a74f9952a5fae8f215b4a /MediaBrowser.Controller/Entities | |
| parent | 5740a4c22d676d0050e875b0bd5455f5a303f5bd (diff) | |
| parent | 6a9dbf6ae85b4e7abcf06f7f29ef9d8b0b890876 (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Diffstat (limited to 'MediaBrowser.Controller/Entities')
| -rw-r--r-- | MediaBrowser.Controller/Entities/Audio/Audio.cs | 36 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs | 27 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 26 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/IThemeMedia.cs | 8 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Photo.cs | 39 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/PhotoAlbum.cs | 21 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/TV/Episode.cs | 1 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Video.cs | 5 |
8 files changed, 112 insertions, 51 deletions
diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index d3085cb680..b13403bbf8 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -20,7 +20,8 @@ namespace MediaBrowser.Controller.Entities.Audio IHasMusicGenres, IHasLookupInfo<SongInfo>, IHasTags, - IHasMediaSources + IHasMediaSources, + IThemeMedia { public string FormatName { get; set; } public long? Size { get; set; } @@ -28,9 +29,12 @@ namespace MediaBrowser.Controller.Entities.Audio public int? TotalBitrate { get; set; } public List<string> Tags { get; set; } + public bool IsThemeMedia { get; set; } + public Audio() { Artists = new List<string>(); + AlbumArtists = new List<string>(); Tags = new List<string>(); } @@ -73,6 +77,7 @@ namespace MediaBrowser.Controller.Entities.Audio } } + [IgnoreDataMember] public override Folder LatestItemsIndexContainer { get @@ -87,12 +92,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); @@ -101,36 +108,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. diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs index 152d767823..2eeec9715a 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -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,24 +50,12 @@ namespace MediaBrowser.Controller.Entities.Audio } } + public List<string> AlbumArtists { get; set; } + [IgnoreDataMember] - public List<string> AlbumArtists + public string AlbumArtist { - get - { - var list = new List<string>(); - - if (!string.IsNullOrEmpty(AlbumArtist)) - { - list.Add(AlbumArtist); - } - - return list; - } - set - { - AlbumArtist = value.FirstOrDefault(); - } + get { return AlbumArtists.FirstOrDefault(); } } /// <summary> @@ -139,8 +128,6 @@ namespace MediaBrowser.Controller.Entities.Audio return AllArtists.Contains(artist, StringComparer.OrdinalIgnoreCase); } - public string AlbumArtist { get; set; } - public List<string> Artists { get; set; } /// <summary> diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index e718a53ff8..fd7a33ddf4 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -749,7 +749,18 @@ namespace MediaBrowser.Controller.Entities var themeVideosChanged = !item.ThemeVideoIds.SequenceEqual(newThemeVideoIds); - var tasks = newThemeVideos.Select(i => i.RefreshMetadata(options, cancellationToken)); + var tasks = newThemeVideos.Select(i => + { + var subOptions = new MetadataRefreshOptions(options); + + if (!i.IsThemeMedia) + { + i.IsThemeMedia = true; + subOptions.ForceSave = true; + } + + return i.RefreshMetadata(subOptions, cancellationToken); + }); await Task.WhenAll(tasks).ConfigureAwait(false); @@ -768,7 +779,18 @@ namespace MediaBrowser.Controller.Entities var themeSongsChanged = !item.ThemeSongIds.SequenceEqual(newThemeSongIds); - var tasks = newThemeSongs.Select(i => i.RefreshMetadata(options, cancellationToken)); + var tasks = newThemeSongs.Select(i => + { + var subOptions = new MetadataRefreshOptions(options); + + if (!i.IsThemeMedia) + { + i.IsThemeMedia = true; + subOptions.ForceSave = true; + } + + return i.RefreshMetadata(subOptions, cancellationToken); + }); await Task.WhenAll(tasks).ConfigureAwait(false); diff --git a/MediaBrowser.Controller/Entities/IThemeMedia.cs b/MediaBrowser.Controller/Entities/IThemeMedia.cs new file mode 100644 index 0000000000..b2eff230ff --- /dev/null +++ b/MediaBrowser.Controller/Entities/IThemeMedia.cs @@ -0,0 +1,8 @@ + +namespace MediaBrowser.Controller.Entities +{ + public interface IThemeMedia + { + bool IsThemeMedia { get; } + } +} diff --git a/MediaBrowser.Controller/Entities/Photo.cs b/MediaBrowser.Controller/Entities/Photo.cs index 96995c315b..1f38de9a31 100644 --- a/MediaBrowser.Controller/Entities/Photo.cs +++ b/MediaBrowser.Controller/Entities/Photo.cs @@ -1,4 +1,8 @@ -using System.Collections.Generic; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Drawing; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; namespace MediaBrowser.Controller.Entities { @@ -13,6 +17,14 @@ namespace MediaBrowser.Controller.Entities Taglines = new List<string>(); } + public override bool SupportsLocalMetadata + { + get + { + return false; + } + } + public override string MediaType { get @@ -20,5 +32,30 @@ namespace MediaBrowser.Controller.Entities return Model.Entities.MediaType.Photo; } } + + [IgnoreDataMember] + public override Folder LatestItemsIndexContainer + { + get + { + return Parents.OfType<PhotoAlbum>().FirstOrDefault(); + } + } + + 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? Orientation { get; set; } + public double? Aperture { get; set; } + public double? ShutterSpeed { get; set; } + + protected override bool GetBlockUnratedValue(UserConfiguration config) + { + return config.BlockUnratedItems.Contains(UnratedItem.Other); + } } } diff --git a/MediaBrowser.Controller/Entities/PhotoAlbum.cs b/MediaBrowser.Controller/Entities/PhotoAlbum.cs new file mode 100644 index 0000000000..7af4109f32 --- /dev/null +++ b/MediaBrowser.Controller/Entities/PhotoAlbum.cs @@ -0,0 +1,21 @@ +using MediaBrowser.Model.Configuration; +using System.Linq; + +namespace MediaBrowser.Controller.Entities +{ + public class PhotoAlbum : Folder + { + public override bool SupportsLocalMetadata + { + get + { + return false; + } + } + + protected override bool GetBlockUnratedValue(UserConfiguration config) + { + return config.BlockUnratedItems.Contains(UnratedItem.Other); + } + } +} diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index 70577bbfde..b95c7df9c5 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -95,6 +95,7 @@ namespace MediaBrowser.Controller.Entities.TV } } + [IgnoreDataMember] public override Folder LatestItemsIndexContainer { get diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index ff4c5dd900..ea530272dd 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -24,7 +24,8 @@ namespace MediaBrowser.Controller.Entities IHasTags, ISupportsPlaceHolders, IHasMediaSources, - IHasShortOverview + IHasShortOverview, + IThemeMedia { public bool IsMultiPart { get; set; } public bool HasLocalAlternateVersions { get; set; } @@ -33,6 +34,8 @@ namespace MediaBrowser.Controller.Entities public List<Guid> AdditionalPartIds { get; set; } public List<Guid> LocalAlternateVersionIds { get; set; } + public bool IsThemeMedia { get; set; } + public string FormatName { get; set; } public long? Size { get; set; } public string Container { get; set; } |
