aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller/Entities')
-rw-r--r--MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs4
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs35
-rw-r--r--MediaBrowser.Controller/Entities/Game.cs5
-rw-r--r--MediaBrowser.Controller/Entities/IHasSoundtracks.cs29
-rw-r--r--MediaBrowser.Controller/Entities/Movies/Movie.cs18
-rw-r--r--MediaBrowser.Controller/Entities/TV/Series.cs22
-rw-r--r--MediaBrowser.Controller/Entities/Trailer.cs5
7 files changed, 43 insertions, 75 deletions
diff --git a/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs b/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs
index 254f90376..a7c914664 100644
--- a/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs
+++ b/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs
@@ -17,10 +17,6 @@ namespace MediaBrowser.Controller.Entities.Audio
public static class HasArtistExtensions
{
- public static bool HasArtist(this IHasArtist hasArtist, string artist)
- {
- return NameExtensions.EqualsAny(hasArtist.Artists, artist);
- }
public static bool HasAnyArtist(this IHasArtist hasArtist, string artist)
{
return NameExtensions.EqualsAny(hasArtist.AllArtists, artist);
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 22efd3fba..3313f45fd 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -491,6 +491,17 @@ namespace MediaBrowser.Controller.Entities
}
}
+ /// <summary>
+ /// Finds a parent of a given type
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <returns>``0.</returns>
+ public T FindParent<T>()
+ where T : Folder
+ {
+ return Parents.OfType<T>().FirstOrDefault();
+ }
+
[IgnoreDataMember]
public virtual BaseItem DisplayParent
{
@@ -1458,30 +1469,6 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// Finds a parent of a given type
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <returns>``0.</returns>
- public T FindParent<T>()
- where T : Folder
- {
- var parent = Parent;
-
- while (parent != null)
- {
- var result = parent as T;
- if (result != null)
- {
- return result;
- }
-
- parent = parent.Parent;
- }
-
- return null;
- }
-
- /// <summary>
/// Gets an image
/// </summary>
/// <param name="type">The type.</param>
diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs
index 899e5628f..15d2d755a 100644
--- a/MediaBrowser.Controller/Entities/Game.cs
+++ b/MediaBrowser.Controller/Entities/Game.cs
@@ -8,10 +8,8 @@ using System.Linq;
namespace MediaBrowser.Controller.Entities
{
- public class Game : BaseItem, IHasSoundtracks, IHasTrailers, IHasThemeMedia, IHasTags, IHasScreenshots, ISupportsPlaceHolders, IHasPreferredMetadataLanguage, IHasLookupInfo<GameInfo>
+ public class Game : BaseItem, IHasTrailers, IHasThemeMedia, IHasTags, IHasScreenshots, ISupportsPlaceHolders, IHasPreferredMetadataLanguage, IHasLookupInfo<GameInfo>
{
- public List<Guid> SoundtrackIds { get; set; }
-
public List<Guid> ThemeSongIds { get; set; }
public List<Guid> ThemeVideoIds { get; set; }
@@ -26,7 +24,6 @@ namespace MediaBrowser.Controller.Entities
public Game()
{
MultiPartGameFiles = new List<string>();
- SoundtrackIds = new List<Guid>();
RemoteTrailers = new List<MediaUrl>();
LocalTrailerIds = new List<Guid>();
RemoteTrailerIds = new List<Guid>();
diff --git a/MediaBrowser.Controller/Entities/IHasSoundtracks.cs b/MediaBrowser.Controller/Entities/IHasSoundtracks.cs
deleted file mode 100644
index 3ac2491fb..000000000
--- a/MediaBrowser.Controller/Entities/IHasSoundtracks.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace MediaBrowser.Controller.Entities
-{
- /// <summary>
- /// Interface IHasSoundtracks
- /// </summary>
- public interface IHasSoundtracks
- {
- /// <summary>
- /// Gets or sets the soundtrack ids.
- /// </summary>
- /// <value>The soundtrack ids.</value>
- List<Guid> SoundtrackIds { get; set; }
-
- /// <summary>
- /// Gets the name.
- /// </summary>
- /// <value>The name.</value>
- string Name { get; }
-
- /// <summary>
- /// Gets the identifier.
- /// </summary>
- /// <value>The identifier.</value>
- Guid Id { get; }
- }
-}
diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs
index 411004782..fc07f6778 100644
--- a/MediaBrowser.Controller/Entities/Movies/Movie.cs
+++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs
@@ -14,12 +14,11 @@ namespace MediaBrowser.Controller.Entities.Movies
/// <summary>
/// Class Movie
/// </summary>
- public class Movie : Video, IHasCriticRating, IHasSoundtracks, IHasSpecialFeatures, IHasProductionLocations, IHasBudget, IHasKeywords, IHasTrailers, IHasThemeMedia, IHasTaglines, IHasAwards, IHasMetascore, IHasLookupInfo<MovieInfo>, ISupportsBoxSetGrouping, IHasOriginalTitle
+ public class Movie : Video, IHasCriticRating, IHasSpecialFeatures, IHasProductionLocations, IHasBudget, IHasKeywords, IHasTrailers, IHasThemeMedia, IHasTaglines, IHasAwards, IHasMetascore, IHasLookupInfo<MovieInfo>, ISupportsBoxSetGrouping, IHasOriginalTitle
{
public List<Guid> SpecialFeatureIds { get; set; }
public string OriginalTitle { get; set; }
- public List<Guid> SoundtrackIds { get; set; }
public List<Guid> ThemeSongIds { get; set; }
public List<Guid> ThemeVideoIds { get; set; }
@@ -28,7 +27,6 @@ namespace MediaBrowser.Controller.Entities.Movies
public Movie()
{
SpecialFeatureIds = new List<Guid>();
- SoundtrackIds = new List<Guid>();
RemoteTrailers = new List<MediaUrl>();
LocalTrailerIds = new List<Guid>();
RemoteTrailerIds = new List<Guid>();
@@ -102,7 +100,19 @@ namespace MediaBrowser.Controller.Entities.Movies
/// <returns>System.String.</returns>
protected override string CreateUserDataKey()
{
- return this.GetProviderId(MetadataProviders.Tmdb) ?? this.GetProviderId(MetadataProviders.Imdb) ?? base.CreateUserDataKey();
+ var key = this.GetProviderId(MetadataProviders.Tmdb);
+
+ if (string.IsNullOrWhiteSpace(key))
+ {
+ key = this.GetProviderId(MetadataProviders.Imdb);
+ }
+
+ if (string.IsNullOrWhiteSpace(key))
+ {
+ key = base.CreateUserDataKey();
+ }
+
+ return key;
}
protected override async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, List<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs
index 91014ccda..4696afeb6 100644
--- a/MediaBrowser.Controller/Entities/TV/Series.cs
+++ b/MediaBrowser.Controller/Entities/TV/Series.cs
@@ -15,10 +15,9 @@ namespace MediaBrowser.Controller.Entities.TV
/// <summary>
/// Class Series
/// </summary>
- public class Series : Folder, IHasSoundtracks, IHasTrailers, IHasDisplayOrder, IHasLookupInfo<SeriesInfo>, IHasSpecialFeatures, IMetadataContainer, IHasOriginalTitle
+ public class Series : Folder, IHasTrailers, IHasDisplayOrder, IHasLookupInfo<SeriesInfo>, IHasSpecialFeatures, IMetadataContainer, IHasOriginalTitle
{
public List<Guid> SpecialFeatureIds { get; set; }
- public List<Guid> SoundtrackIds { get; set; }
public string OriginalTitle { get; set; }
public int SeasonCount { get; set; }
@@ -30,7 +29,6 @@ namespace MediaBrowser.Controller.Entities.TV
AirDays = new List<DayOfWeek>();
SpecialFeatureIds = new List<Guid>();
- SoundtrackIds = new List<Guid>();
RemoteTrailers = new List<MediaUrl>();
LocalTrailerIds = new List<Guid>();
RemoteTrailerIds = new List<Guid>();
@@ -63,7 +61,7 @@ namespace MediaBrowser.Controller.Entities.TV
/// airdate, dvd or absolute
/// </summary>
public string DisplayOrder { get; set; }
-
+
/// <summary>
/// Gets or sets the status.
/// </summary>
@@ -115,7 +113,19 @@ namespace MediaBrowser.Controller.Entities.TV
/// <returns>System.String.</returns>
protected override string CreateUserDataKey()
{
- return this.GetProviderId(MetadataProviders.Tvdb) ?? this.GetProviderId(MetadataProviders.Tvcom) ?? base.CreateUserDataKey();
+ var key = this.GetProviderId(MetadataProviders.Tvdb);
+
+ if (string.IsNullOrWhiteSpace(key))
+ {
+ key = this.GetProviderId(MetadataProviders.Imdb);
+ }
+
+ if (string.IsNullOrWhiteSpace(key))
+ {
+ key = base.CreateUserDataKey();
+ }
+
+ return key;
}
/// <summary>
@@ -190,7 +200,7 @@ namespace MediaBrowser.Controller.Entities.TV
public IEnumerable<Episode> GetEpisodes(User user)
{
var config = user.Configuration;
-
+
return GetEpisodes(user, config.DisplayMissingEpisodes, config.DisplayUnairedEpisodes);
}
diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs
index 522e6edf6..f44128e2d 100644
--- a/MediaBrowser.Controller/Entities/Trailer.cs
+++ b/MediaBrowser.Controller/Entities/Trailer.cs
@@ -14,17 +14,14 @@ namespace MediaBrowser.Controller.Entities
/// Class Trailer
/// </summary>
[Obsolete]
- public class Trailer : Video, IHasCriticRating, IHasSoundtracks, IHasProductionLocations, IHasBudget, IHasKeywords, IHasTaglines, IHasMetascore, IHasLookupInfo<TrailerInfo>
+ public class Trailer : Video, IHasCriticRating, IHasProductionLocations, IHasBudget, IHasKeywords, IHasTaglines, IHasMetascore, IHasLookupInfo<TrailerInfo>
{
- public List<Guid> SoundtrackIds { get; set; }
-
public List<string> ProductionLocations { get; set; }
public Trailer()
{
RemoteTrailers = new List<MediaUrl>();
Taglines = new List<string>();
- SoundtrackIds = new List<Guid>();
Keywords = new List<string>();
ProductionLocations = new List<string>();
}