mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-03 14:28:46 +01:00
Removed unused properties from BaseItem.
This commit is contained in:
@@ -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()
|
||||
{
|
||||
@@ -17,6 +17,12 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
Artists = new List<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the language.
|
||||
/// </summary>
|
||||
/// <value>The language.</value>
|
||||
public string Language { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the media streams.
|
||||
/// </summary>
|
||||
|
||||
@@ -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,11 +17,18 @@ 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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>();
|
||||
}
|
||||
|
||||
@@ -84,12 +78,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <value>The id.</value>
|
||||
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.
|
||||
@@ -509,12 +497,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <value>The backdrop image sources.</value>
|
||||
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>
|
||||
@@ -533,11 +515,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <value>The custom rating.</value>
|
||||
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>
|
||||
@@ -550,12 +527,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <value>The people.</value>
|
||||
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>
|
||||
@@ -596,12 +567,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <value>The home page URL.</value>
|
||||
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>
|
||||
@@ -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);
|
||||
}
|
||||
@@ -1229,24 +1195,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>
|
||||
@@ -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>
|
||||
@@ -1296,24 +1231,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>
|
||||
@@ -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)
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
15
MediaBrowser.Controller/Entities/IHasLanguage.cs
Normal file
15
MediaBrowser.Controller/Entities/IHasLanguage.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
34
MediaBrowser.Controller/Entities/IHasProductionLocations.cs
Normal file
34
MediaBrowser.Controller/Entities/IHasProductionLocations.cs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
16
MediaBrowser.Controller/Entities/IHasScreenshots.cs
Normal file
16
MediaBrowser.Controller/Entities/IHasScreenshots.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
39
MediaBrowser.Controller/Entities/IHasTaglines.cs
Normal file
39
MediaBrowser.Controller/Entities/IHasTaglines.cs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
MediaBrowser.Controller/Entities/IHasTags.cs
Normal file
34
MediaBrowser.Controller/Entities/IHasTags.cs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
MediaBrowser.Controller/Entities/IHasThemeMedia.cs
Normal file
23
MediaBrowser.Controller/Entities/IHasThemeMedia.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,24 +11,43 @@ 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; }
|
||||
|
||||
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>
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user