diff options
Diffstat (limited to 'MediaBrowser.Controller')
20 files changed, 368 insertions, 132 deletions
diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index 13b33c637..2a7aa4fea 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -9,7 +9,7 @@ namespace MediaBrowser.Controller.Entities.Audio /// <summary> /// Class Audio /// </summary> - public class Audio : BaseItem, IHasMediaStreams, IHasAlbumArtist, IHasArtist, IHasMusicGenres + public class Audio : BaseItem, IHasMediaStreams, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasLanguage { public Audio() { @@ -18,6 +18,12 @@ namespace MediaBrowser.Controller.Entities.Audio } /// <summary> + /// Gets or sets the language. + /// </summary> + /// <value>The language.</value> + public string Language { get; set; } + + /// <summary> /// Gets or sets the media streams. /// </summary> /// <value>The media streams.</value> diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs index 09aefdac9..3facccec1 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -9,7 +9,7 @@ namespace MediaBrowser.Controller.Entities.Audio /// <summary> /// Class MusicAlbum /// </summary> - public class MusicAlbum : Folder, IHasAlbumArtist, IHasArtist, IHasMusicGenres + public class MusicAlbum : Folder, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasTags { public List<Guid> SoundtrackIds { get; set; } @@ -17,12 +17,19 @@ namespace MediaBrowser.Controller.Entities.Audio { Artists = new List<string>(); SoundtrackIds = new List<Guid>(); + Tags = new List<string>(); } public string LastFmImageUrl { get; set; } public string LastFmImageSize { get; set; } /// <summary> + /// Gets or sets the tags. + /// </summary> + /// <value>The tags.</value> + public List<string> Tags { get; set; } + + /// <summary> /// Songs will group into us so don't also include us in the index /// </summary> /// <value><c>true</c> if [include in index]; otherwise, <c>false</c>.</value> diff --git a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs index d5572b9a5..3be555f49 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs @@ -11,13 +11,21 @@ namespace MediaBrowser.Controller.Entities.Audio /// <summary> /// Class MusicArtist /// </summary> - public class MusicArtist : Folder, IItemByName, IHasMusicGenres, IHasDualAccess + public class MusicArtist : Folder, IItemByName, IHasMusicGenres, IHasDualAccess, IHasTags, IHasProductionLocations { [IgnoreDataMember] public List<ItemByNameCounts> UserItemCountList { get; set; } public bool IsAccessedByName { get; set; } + /// <summary> + /// Gets or sets the tags. + /// </summary> + /// <value>The tags.</value> + public List<string> Tags { get; set; } + + public List<string> ProductionLocations { get; set; } + public override bool IsFolder { get @@ -70,6 +78,8 @@ namespace MediaBrowser.Controller.Entities.Audio public MusicArtist() { UserItemCountList = new List<ItemByNameCounts>(); + Tags = new List<string>(); + ProductionLocations = new List<string>(); } /// <summary> diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 4f7889f97..2be4c7708 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -29,16 +29,10 @@ namespace MediaBrowser.Controller.Entities Genres = new List<string>(); Studios = new List<string>(); People = new List<PersonInfo>(); - ScreenshotImagePaths = new List<string>(); BackdropImagePaths = new List<string>(); - ProductionLocations = new List<string>(); Images = new Dictionary<ImageType, string>(); ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); - Tags = new List<string>(); - ThemeSongIds = new List<Guid>(); - ThemeVideoIds = new List<Guid>(); LockedFields = new List<MetadataFields>(); - Taglines = new List<string>(); ImageSources = new List<ImageSourceInfo>(); } @@ -85,12 +79,6 @@ namespace MediaBrowser.Controller.Entities public Guid Id { get; set; } /// <summary> - /// Gets or sets the taglines. - /// </summary> - /// <value>The taglines.</value> - public List<string> Taglines { get; set; } - - /// <summary> /// Return the id that should be used to key display prefs for this item. /// Default is based on the type for everything except actual generic folders. /// </summary> @@ -510,12 +498,6 @@ namespace MediaBrowser.Controller.Entities public List<ImageSourceInfo> ImageSources { get; set; } /// <summary> - /// Gets or sets the screenshot image paths. - /// </summary> - /// <value>The screenshot image paths.</value> - public List<string> ScreenshotImagePaths { get; set; } - - /// <summary> /// Gets or sets the official rating. /// </summary> /// <value>The official rating.</value> @@ -534,11 +516,6 @@ namespace MediaBrowser.Controller.Entities public string CustomRating { get; set; } /// <summary> - /// Gets or sets the language. - /// </summary> - /// <value>The language.</value> - public string Language { get; set; } - /// <summary> /// Gets or sets the overview. /// </summary> /// <value>The overview.</value> @@ -551,12 +528,6 @@ namespace MediaBrowser.Controller.Entities public List<PersonInfo> People { get; set; } /// <summary> - /// Gets or sets the tags. - /// </summary> - /// <value>The tags.</value> - public List<string> Tags { get; set; } - - /// <summary> /// Override this if you need to combine/collapse person information /// </summary> /// <value>All people.</value> @@ -597,12 +568,6 @@ namespace MediaBrowser.Controller.Entities public string HomePageUrl { get; set; } /// <summary> - /// Gets or sets the production locations. - /// </summary> - /// <value>The production locations.</value> - public List<string> ProductionLocations { get; set; } - - /// <summary> /// Gets or sets the community rating. /// </summary> /// <value>The community rating.</value> @@ -644,9 +609,6 @@ namespace MediaBrowser.Controller.Entities /// <value>The parent index number.</value> public int? ParentIndexNumber { get; set; } - public List<Guid> ThemeSongIds { get; set; } - public List<Guid> ThemeVideoIds { get; set; } - [IgnoreDataMember] public virtual string OfficialRatingForComparison { @@ -884,9 +846,13 @@ namespace MediaBrowser.Controller.Entities if (LocationType == LocationType.FileSystem && Parent != null) { - themeSongsChanged = await RefreshThemeSongs(cancellationToken, forceSave, forceRefresh, allowSlowProviders).ConfigureAwait(false); + var hasThemeMedia = this as IHasThemeMedia; + if (hasThemeMedia != null) + { + themeSongsChanged = await RefreshThemeSongs(hasThemeMedia, cancellationToken, forceSave, forceRefresh, allowSlowProviders).ConfigureAwait(false); - themeVideosChanged = await RefreshThemeVideos(cancellationToken, forceSave, forceRefresh, allowSlowProviders).ConfigureAwait(false); + themeVideosChanged = await RefreshThemeVideos(hasThemeMedia, cancellationToken, forceSave, forceRefresh, allowSlowProviders).ConfigureAwait(false); + } var hasTrailers = this as IHasTrailers; if (hasTrailers != null) @@ -928,18 +894,18 @@ namespace MediaBrowser.Controller.Entities return itemsChanged || results.Contains(true); } - private async Task<bool> RefreshThemeVideos(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false, bool allowSlowProviders = true) + private async Task<bool> RefreshThemeVideos(IHasThemeMedia item, CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false, bool allowSlowProviders = true) { var newThemeVideos = LoadThemeVideos().ToList(); var newThemeVideoIds = newThemeVideos.Select(i => i.Id).ToList(); - var themeVideosChanged = !ThemeVideoIds.SequenceEqual(newThemeVideoIds); + var themeVideosChanged = !item.ThemeVideoIds.SequenceEqual(newThemeVideoIds); var tasks = newThemeVideos.Select(i => i.RefreshMetadata(cancellationToken, forceSave, forceRefresh, allowSlowProviders, resetResolveArgs: false)); var results = await Task.WhenAll(tasks).ConfigureAwait(false); - ThemeVideoIds = newThemeVideoIds; + item.ThemeVideoIds = newThemeVideoIds; return themeVideosChanged || results.Contains(true); } @@ -947,18 +913,18 @@ namespace MediaBrowser.Controller.Entities /// <summary> /// Refreshes the theme songs. /// </summary> - private async Task<bool> RefreshThemeSongs(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false, bool allowSlowProviders = true) + private async Task<bool> RefreshThemeSongs(IHasThemeMedia item, CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false, bool allowSlowProviders = true) { var newThemeSongs = LoadThemeSongs().ToList(); var newThemeSongIds = newThemeSongs.Select(i => i.Id).ToList(); - var themeSongsChanged = !ThemeSongIds.SequenceEqual(newThemeSongIds); + var themeSongsChanged = !item.ThemeSongIds.SequenceEqual(newThemeSongIds); var tasks = newThemeSongs.Select(i => i.RefreshMetadata(cancellationToken, forceSave, forceRefresh, allowSlowProviders, resetResolveArgs: false)); var results = await Task.WhenAll(tasks).ConfigureAwait(false); - ThemeSongIds = newThemeSongIds; + item.ThemeSongIds = newThemeSongIds; return themeSongsChanged || results.Contains(true); } @@ -1230,24 +1196,6 @@ namespace MediaBrowser.Controller.Entities } /// <summary> - /// Adds the tagline. - /// </summary> - /// <param name="tagline">The tagline.</param> - /// <exception cref="System.ArgumentNullException">tagline</exception> - public void AddTagline(string tagline) - { - if (string.IsNullOrWhiteSpace(tagline)) - { - throw new ArgumentNullException("tagline"); - } - - if (!Taglines.Contains(tagline, StringComparer.OrdinalIgnoreCase)) - { - Taglines.Add(tagline); - } - } - - /// <summary> /// Adds a studio to the item /// </summary> /// <param name="name">The name.</param> @@ -1265,19 +1213,6 @@ namespace MediaBrowser.Controller.Entities } } - public void AddTag(string name) - { - if (string.IsNullOrWhiteSpace(name)) - { - throw new ArgumentNullException("name"); - } - - if (!Tags.Contains(name, StringComparer.OrdinalIgnoreCase)) - { - Tags.Add(name); - } - } - /// <summary> /// Adds a genre to the item /// </summary> @@ -1297,24 +1232,6 @@ namespace MediaBrowser.Controller.Entities } /// <summary> - /// Adds the production location. - /// </summary> - /// <param name="location">The location.</param> - /// <exception cref="System.ArgumentNullException">location</exception> - public void AddProductionLocation(string location) - { - if (string.IsNullOrWhiteSpace(location)) - { - throw new ArgumentNullException("location"); - } - - if (!ProductionLocations.Contains(location, StringComparer.OrdinalIgnoreCase)) - { - ProductionLocations.Add(location); - } - } - - /// <summary> /// Marks the played. /// </summary> /// <param name="user">The user.</param> @@ -1516,9 +1433,10 @@ namespace MediaBrowser.Controller.Entities throw new ArgumentException("Please specify a screenshot image index to delete."); } - var file = ScreenshotImagePaths[index.Value]; + var hasScreenshots = (IHasScreenshots)this; + var file = hasScreenshots.ScreenshotImagePaths[index.Value]; - ScreenshotImagePaths.Remove(file); + hasScreenshots.ScreenshotImagePaths.Remove(file); // Delete the source file DeleteImagePath(file); @@ -1673,15 +1591,17 @@ namespace MediaBrowser.Controller.Entities /// </summary> public void ValidateScreenshots() { + var hasScreenshots = (IHasScreenshots)this; + // Only validate paths from the same directory - need to copy to a list because we are going to potentially modify the collection below - var deletedImages = ScreenshotImagePaths + var deletedImages = hasScreenshots.ScreenshotImagePaths .Where(path => !File.Exists(path)) .ToList(); // Now remove them from the dictionary foreach (var path in deletedImages) { - ScreenshotImagePaths.Remove(path); + hasScreenshots.ScreenshotImagePaths.Remove(path); } } @@ -1703,7 +1623,8 @@ namespace MediaBrowser.Controller.Entities if (imageType == ImageType.Screenshot) { - return ScreenshotImagePaths[imageIndex]; + var hasScreenshots = (IHasScreenshots)this; + return hasScreenshots.ScreenshotImagePaths[imageIndex]; } if (imageType == ImageType.Chapter) diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index e8b583181..ba2bd85e8 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -21,13 +21,19 @@ namespace MediaBrowser.Controller.Entities /// <summary> /// Class Folder /// </summary> - public class Folder : BaseItem + public class Folder : BaseItem, IHasThemeMedia { public static IUserManager UserManager { get; set; } + public List<Guid> ThemeSongIds { get; set; } + public List<Guid> ThemeVideoIds { get; set; } + public Folder() { LinkedChildren = new List<LinkedChild>(); + + ThemeSongIds = new List<Guid>(); + ThemeVideoIds = new List<Guid>(); } /// <summary> @@ -687,7 +693,12 @@ namespace MediaBrowser.Controller.Entities //existing item - check if it has changed if (currentChild.HasChanged(child)) { - EntityResolutionHelper.EnsureDates(FileSystem, currentChild, child.ResolveArgs, false); + var currentChildLocationType = currentChild.LocationType; + if (currentChildLocationType != LocationType.Remote && + currentChildLocationType != LocationType.Virtual) + { + EntityResolutionHelper.EnsureDates(FileSystem, currentChild, child.ResolveArgs, false); + } validChildren.Add(new Tuple<BaseItem, bool>(currentChild, true)); } diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs index e15b7e4c9..c15a31dd3 100644 --- a/MediaBrowser.Controller/Entities/Game.cs +++ b/MediaBrowser.Controller/Entities/Game.cs @@ -4,26 +4,51 @@ using System.Collections.Generic; namespace MediaBrowser.Controller.Entities { - public class Game : BaseItem, IHasSoundtracks, IHasTrailers + public class Game : BaseItem, IHasSoundtracks, IHasTrailers, IHasThemeMedia, IHasTags, IHasLanguage, IHasScreenshots { public List<Guid> SoundtrackIds { get; set; } + public List<Guid> ThemeSongIds { get; set; } + public List<Guid> ThemeVideoIds { get; set; } + public Game() { MultiPartGameFiles = new List<string>(); SoundtrackIds = new List<Guid>(); RemoteTrailers = new List<MediaUrl>(); LocalTrailerIds = new List<Guid>(); + ThemeSongIds = new List<Guid>(); + ThemeVideoIds = new List<Guid>(); + Tags = new List<string>(); + ScreenshotImagePaths = new List<string>(); } + /// <summary> + /// Gets or sets the language. + /// </summary> + /// <value>The language.</value> + public string Language { get; set; } + public List<Guid> LocalTrailerIds { get; set; } - + + /// <summary> + /// Gets or sets the screenshot image paths. + /// </summary> + /// <value>The screenshot image paths.</value> + public List<string> ScreenshotImagePaths { get; set; } + + /// <summary> + /// Gets or sets the tags. + /// </summary> + /// <value>The tags.</value> + public List<string> Tags { get; set; } + /// <summary> /// Gets or sets the remote trailers. /// </summary> /// <value>The remote trailers.</value> public List<MediaUrl> RemoteTrailers { get; set; } - + /// <summary> /// Gets the type of the media. /// </summary> diff --git a/MediaBrowser.Controller/Entities/IHasLanguage.cs b/MediaBrowser.Controller/Entities/IHasLanguage.cs new file mode 100644 index 000000000..a1bb80098 --- /dev/null +++ b/MediaBrowser.Controller/Entities/IHasLanguage.cs @@ -0,0 +1,15 @@ + +namespace MediaBrowser.Controller.Entities +{ + /// <summary> + /// Interface IHasLanguage + /// </summary> + public interface IHasLanguage + { + /// <summary> + /// Gets or sets the language. + /// </summary> + /// <value>The language.</value> + string Language { get; set; } + } +} diff --git a/MediaBrowser.Controller/Entities/IHasProductionLocations.cs b/MediaBrowser.Controller/Entities/IHasProductionLocations.cs new file mode 100644 index 000000000..e4652fa8d --- /dev/null +++ b/MediaBrowser.Controller/Entities/IHasProductionLocations.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace MediaBrowser.Controller.Entities +{ + /// <summary> + /// Interface IHasProductionLocations + /// </summary> + public interface IHasProductionLocations + { + /// <summary> + /// Gets or sets the production locations. + /// </summary> + /// <value>The production locations.</value> + List<string> ProductionLocations { get; set; } + } + + public static class ProductionLocationExtensions + { + public static void AddProductionLocation(this IHasProductionLocations item, string name) + { + if (string.IsNullOrWhiteSpace(name)) + { + throw new ArgumentNullException("name"); + } + + if (!item.ProductionLocations.Contains(name, StringComparer.OrdinalIgnoreCase)) + { + item.ProductionLocations.Add(name); + } + } + } +} diff --git a/MediaBrowser.Controller/Entities/IHasScreenshots.cs b/MediaBrowser.Controller/Entities/IHasScreenshots.cs new file mode 100644 index 000000000..341d6403f --- /dev/null +++ b/MediaBrowser.Controller/Entities/IHasScreenshots.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Entities +{ + /// <summary> + /// Interface IHasScreenshots + /// </summary> + public interface IHasScreenshots + { + /// <summary> + /// Gets or sets the screenshot image paths. + /// </summary> + /// <value>The screenshot image paths.</value> + List<string> ScreenshotImagePaths { get; set; } + } +} diff --git a/MediaBrowser.Controller/Entities/IHasTaglines.cs b/MediaBrowser.Controller/Entities/IHasTaglines.cs new file mode 100644 index 000000000..8025d6b44 --- /dev/null +++ b/MediaBrowser.Controller/Entities/IHasTaglines.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace MediaBrowser.Controller.Entities +{ + /// <summary> + /// Interface IHasTaglines + /// </summary> + public interface IHasTaglines + { + /// <summary> + /// Gets or sets the taglines. + /// </summary> + /// <value>The taglines.</value> + List<string> Taglines { get; set; } + } + + public static class TaglineExtensions + { + /// <summary> + /// Adds the tagline. + /// </summary> + /// <param name="tagline">The tagline.</param> + /// <exception cref="System.ArgumentNullException">tagline</exception> + public static void AddTagline(this IHasTaglines item, string tagline) + { + if (string.IsNullOrWhiteSpace(tagline)) + { + throw new ArgumentNullException("tagline"); + } + + if (!item.Taglines.Contains(tagline, StringComparer.OrdinalIgnoreCase)) + { + item.Taglines.Add(tagline); + } + } + } +} diff --git a/MediaBrowser.Controller/Entities/IHasTags.cs b/MediaBrowser.Controller/Entities/IHasTags.cs new file mode 100644 index 000000000..45a56009d --- /dev/null +++ b/MediaBrowser.Controller/Entities/IHasTags.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace MediaBrowser.Controller.Entities +{ + /// <summary> + /// Interface IHasTags + /// </summary> + public interface IHasTags + { + /// <summary> + /// Gets or sets the tags. + /// </summary> + /// <value>The tags.</value> + List<string> Tags { get; set; } + } + + public static class TagExtensions + { + public static void AddTag(this IHasTags item, string name) + { + if (string.IsNullOrWhiteSpace(name)) + { + throw new ArgumentNullException("name"); + } + + if (!item.Tags.Contains(name, StringComparer.OrdinalIgnoreCase)) + { + item.Tags.Add(name); + } + } + } +} diff --git a/MediaBrowser.Controller/Entities/IHasThemeMedia.cs b/MediaBrowser.Controller/Entities/IHasThemeMedia.cs new file mode 100644 index 000000000..acc0050ce --- /dev/null +++ b/MediaBrowser.Controller/Entities/IHasThemeMedia.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Entities +{ + /// <summary> + /// Interface IHasThemeMedia + /// </summary> + public interface IHasThemeMedia + { + /// <summary> + /// Gets or sets the theme song ids. + /// </summary> + /// <value>The theme song ids.</value> + List<Guid> ThemeSongIds { get; set; } + + /// <summary> + /// Gets or sets the theme video ids. + /// </summary> + /// <value>The theme video ids.</value> + List<Guid> ThemeVideoIds { get; set; } + } +} diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs index 4a6221ee9..a1154482c 100644 --- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs +++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs @@ -7,12 +7,13 @@ namespace MediaBrowser.Controller.Entities.Movies /// <summary> /// Class BoxSet /// </summary> - public class BoxSet : Folder, IHasTrailers + public class BoxSet : Folder, IHasTrailers, IHasTags { public BoxSet() { RemoteTrailers = new List<MediaUrl>(); LocalTrailerIds = new List<Guid>(); + Tags = new List<string>(); } public List<Guid> LocalTrailerIds { get; set; } @@ -22,5 +23,11 @@ namespace MediaBrowser.Controller.Entities.Movies /// </summary> /// <value>The remote trailers.</value> public List<MediaUrl> RemoteTrailers { get; set; } + + /// <summary> + /// Gets or sets the tags. + /// </summary> + /// <value>The tags.</value> + public List<string> Tags { get; set; } } } diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs index 473ea4996..b4cf6c047 100644 --- a/MediaBrowser.Controller/Entities/Movies/Movie.cs +++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs @@ -11,18 +11,25 @@ namespace MediaBrowser.Controller.Entities.Movies /// <summary> /// Class Movie /// </summary> - public class Movie : Video, IHasCriticRating, IHasSoundtracks, IHasBudget, IHasTrailers + public class Movie : Video, IHasCriticRating, IHasSoundtracks, IHasBudget, IHasTrailers, IHasThemeMedia, IHasTaglines, IHasTags { public List<Guid> SpecialFeatureIds { get; set; } public List<Guid> SoundtrackIds { get; set; } + public List<Guid> ThemeSongIds { get; set; } + public List<Guid> ThemeVideoIds { get; set; } + public Movie() { SpecialFeatureIds = new List<Guid>(); SoundtrackIds = new List<Guid>(); RemoteTrailers = new List<MediaUrl>(); LocalTrailerIds = new List<Guid>(); + ThemeSongIds = new List<Guid>(); + ThemeVideoIds = new List<Guid>(); + Taglines = new List<string>(); + Tags = new List<string>(); } public List<Guid> LocalTrailerIds { get; set; } @@ -30,6 +37,18 @@ namespace MediaBrowser.Controller.Entities.Movies public List<MediaUrl> RemoteTrailers { get; set; } /// <summary> + /// Gets or sets the tags. + /// </summary> + /// <value>The tags.</value> + public List<string> Tags { get; set; } + + /// <summary> + /// Gets or sets the taglines. + /// </summary> + /// <value>The taglines.</value> + public List<string> Taglines { get; set; } + + /// <summary> /// Gets or sets the budget. /// </summary> /// <value>The budget.</value> diff --git a/MediaBrowser.Controller/Entities/Person.cs b/MediaBrowser.Controller/Entities/Person.cs index 243861da7..832586ab9 100644 --- a/MediaBrowser.Controller/Entities/Person.cs +++ b/MediaBrowser.Controller/Entities/Person.cs @@ -1,5 +1,4 @@ using MediaBrowser.Model.Dto; -using System; using System.Collections.Generic; using System.Runtime.Serialization; @@ -15,6 +14,12 @@ namespace MediaBrowser.Controller.Entities UserItemCountList = new List<ItemByNameCounts>(); } + /// <summary> + /// Gets or sets the place of birth. + /// </summary> + /// <value>The place of birth.</value> + public string PlaceOfBirth { get; set; } + [IgnoreDataMember] public List<ItemByNameCounts> UserItemCountList { get; set; } diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index b4a3fc811..2312df2a1 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -12,7 +12,7 @@ namespace MediaBrowser.Controller.Entities.TV /// <summary> /// Class Series /// </summary> - public class Series : Folder, IHasSoundtracks, IHasTrailers + public class Series : Folder, IHasSoundtracks, IHasTrailers, IHasTags { public List<Guid> SpecialFeatureIds { get; set; } public List<Guid> SoundtrackIds { get; set; } @@ -27,12 +27,19 @@ namespace MediaBrowser.Controller.Entities.TV SoundtrackIds = new List<Guid>(); RemoteTrailers = new List<MediaUrl>(); LocalTrailerIds = new List<Guid>(); + Tags = new List<string>(); } public List<Guid> LocalTrailerIds { get; set; } public List<MediaUrl> RemoteTrailers { get; set; } - + + /// <summary> + /// Gets or sets the tags. + /// </summary> + /// <value>The tags.</value> + public List<string> Tags { get; set; } + /// <summary> /// Gets or sets the status. /// </summary> diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs index 77efe8e8c..591fea14a 100644 --- a/MediaBrowser.Controller/Entities/Trailer.cs +++ b/MediaBrowser.Controller/Entities/Trailer.cs @@ -8,7 +8,7 @@ namespace MediaBrowser.Controller.Entities /// <summary> /// Class Trailer /// </summary> - public class Trailer : Video, IHasCriticRating, IHasSoundtracks, IHasBudget, IHasTrailers + public class Trailer : Video, IHasCriticRating, IHasSoundtracks, IHasBudget, IHasTrailers, IHasTaglines, IHasTags { public List<Guid> SoundtrackIds { get; set; } @@ -18,12 +18,25 @@ namespace MediaBrowser.Controller.Entities Taglines = new List<string>(); SoundtrackIds = new List<Guid>(); LocalTrailerIds = new List<Guid>(); + Tags = new List<string>(); } public List<Guid> LocalTrailerIds { get; set; } public List<MediaUrl> RemoteTrailers { get; set; } - + + /// <summary> + /// Gets or sets the tags. + /// </summary> + /// <value>The tags.</value> + public List<string> Tags { get; set; } + + /// <summary> + /// Gets or sets the taglines. + /// </summary> + /// <value>The taglines.</value> + public List<string> Taglines { get; set; } + /// <summary> /// Gets or sets the budget. /// </summary> diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 2beb3588e..03aa1413b 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -92,7 +92,13 @@ <Compile Include="Entities\IHasAspectRatio.cs" /> <Compile Include="Entities\IHasBudget.cs" /> <Compile Include="Entities\IHasCriticRating.cs" /> + <Compile Include="Entities\IHasLanguage.cs" /> + <Compile Include="Entities\IHasProductionLocations.cs" /> + <Compile Include="Entities\IHasScreenshots.cs" /> <Compile Include="Entities\IHasSoundtracks.cs" /> + <Compile Include="Entities\IHasTaglines.cs" /> + <Compile Include="Entities\IHasTags.cs" /> + <Compile Include="Entities\IHasThemeMedia.cs" /> <Compile Include="Entities\IHasTrailers.cs" /> <Compile Include="Entities\IItemByName.cs" /> <Compile Include="Entities\ILibraryItem.cs" /> diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs index 617e4fd81..78ae35b96 100644 --- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs +++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs @@ -63,11 +63,22 @@ namespace MediaBrowser.Controller.Providers ValidationType = ValidationType.None }; - item.Taglines.Clear(); + var hasTaglines = item as IHasTaglines; + if (hasTaglines != null) + { + hasTaglines.Taglines.Clear(); + } + item.Studios.Clear(); item.Genres.Clear(); item.People.Clear(); - item.Tags.Clear(); + + var hasTags = item as IHasTags; + if (hasTags != null) + { + hasTags.Tags.Clear(); + } + var hasTrailers = item as IHasTrailers; if (hasTrailers != null) @@ -242,9 +253,26 @@ namespace MediaBrowser.Controller.Providers { var tagline = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(tagline)) + var hasTaglines = item as IHasTaglines; + if (hasTaglines != null) { - item.AddTagline(tagline); + if (!string.IsNullOrWhiteSpace(tagline)) + { + hasTaglines.AddTagline(tagline); + } + } + + break; + } + + case "Language": + { + var val = reader.ReadElementContentAsString(); + + var hasLanguage = item as IHasLanguage; + if (hasLanguage != null) + { + hasLanguage.Language = val; } break; @@ -256,7 +284,11 @@ namespace MediaBrowser.Controller.Providers if (!string.IsNullOrWhiteSpace(val)) { - item.ProductionLocations = new List<string> { val }; + var person = item as Person; + if (person != null) + { + person.PlaceOfBirth = val; + } } break; @@ -690,7 +722,11 @@ namespace MediaBrowser.Controller.Providers { using (var subtree = reader.ReadSubtree()) { - FetchFromTagsNode(subtree, item); + var hasTags = item as IHasTags; + if (hasTags != null) + { + FetchFromTagsNode(subtree, hasTags); + } } break; } @@ -841,7 +877,14 @@ namespace MediaBrowser.Controller.Providers if (!string.IsNullOrWhiteSpace(val)) { - item.AddTagline(val); + var hasTaglines = item as IHasTaglines; + if (hasTaglines != null) + { + if (!string.IsNullOrWhiteSpace(val)) + { + hasTaglines.AddTagline(val); + } + } } break; } @@ -888,7 +931,7 @@ namespace MediaBrowser.Controller.Providers } } - private void FetchFromTagsNode(XmlReader reader, T item) + private void FetchFromTagsNode(XmlReader reader, IHasTags item) { reader.MoveToContent(); @@ -981,7 +1024,7 @@ namespace MediaBrowser.Controller.Providers } } } - + protected async Task FetchChaptersFromXmlNode(BaseItem item, XmlReader reader, IItemRepository repository, CancellationToken cancellationToken) { var runtime = item.RunTimeTicks ?? 0; @@ -1194,9 +1237,9 @@ namespace MediaBrowser.Controller.Providers var personInfo = new PersonInfo { - Name = name.Trim(), - Role = role, - Type = type, + Name = name.Trim(), + Role = role, + Type = type, SortOrder = sortOrder }; diff --git a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs index 1e4fabc7c..b39205b5d 100644 --- a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs +++ b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs @@ -133,11 +133,6 @@ namespace MediaBrowser.Controller.Resolvers /// <param name="includeCreationTime">if set to <c>true</c> [include creation time].</param> public static void EnsureDates(IFileSystem fileSystem, BaseItem item, ItemResolveArgs args, bool includeCreationTime) { - if (!Path.IsPathRooted(item.Path)) - { - return; - } - // See if a different path came out of the resolver than what went in if (!string.Equals(args.Path, item.Path, StringComparison.OrdinalIgnoreCase)) { |
