aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-08-27 13:34:55 -0400
committerGitHub <noreply@github.com>2017-08-27 13:34:55 -0400
commitf3ee129bd9e88e8768221ba176bc8356f9b240e3 (patch)
tree72dc082f77629e8d70f764d175433b40ac4c02d0 /MediaBrowser.Controller
parent4f8684a16b1102056bd2b527dcbd585b78dd8000 (diff)
parentfa6bec94b59cf850246c5d0757b9279d080643d7 (diff)
Merge pull request #2847 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Channels/IChannelManager.cs2
-rw-r--r--MediaBrowser.Controller/Channels/InternalChannelFeatures.cs9
-rw-r--r--MediaBrowser.Controller/Chapters/IChapterManager.cs4
-rw-r--r--MediaBrowser.Controller/Collections/CollectionCreationOptions.cs8
-rw-r--r--MediaBrowser.Controller/Collections/ICollectionManager.cs5
-rw-r--r--MediaBrowser.Controller/Drawing/IImageProcessor.cs4
-rw-r--r--MediaBrowser.Controller/Dto/DtoOptions.cs24
-rw-r--r--MediaBrowser.Controller/Dto/IDtoService.cs9
-rw-r--r--MediaBrowser.Controller/Entities/AggregateFolder.cs39
-rw-r--r--MediaBrowser.Controller/Entities/Audio/Audio.cs22
-rw-r--r--MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs16
-rw-r--r--MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs62
-rw-r--r--MediaBrowser.Controller/Entities/Audio/MusicArtist.cs20
-rw-r--r--MediaBrowser.Controller/Entities/Audio/MusicGenre.cs1
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs14
-rw-r--r--MediaBrowser.Controller/Entities/Book.cs2
-rw-r--r--MediaBrowser.Controller/Entities/CollectionFolder.cs34
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs54
-rw-r--r--MediaBrowser.Controller/Entities/Game.cs1
-rw-r--r--MediaBrowser.Controller/Entities/GameGenre.cs1
-rw-r--r--MediaBrowser.Controller/Entities/Genre.cs1
-rw-r--r--MediaBrowser.Controller/Entities/ICollectionFolder.cs2
-rw-r--r--MediaBrowser.Controller/Entities/IHasMediaSources.cs2
-rw-r--r--MediaBrowser.Controller/Entities/IHasUserData.cs2
-rw-r--r--MediaBrowser.Controller/Entities/InternalPeopleQuery.cs4
-rw-r--r--MediaBrowser.Controller/Entities/Movies/BoxSet.cs51
-rw-r--r--MediaBrowser.Controller/Entities/MusicVideo.cs6
-rw-r--r--MediaBrowser.Controller/Entities/PeopleHelper.cs10
-rw-r--r--MediaBrowser.Controller/Entities/Person.cs1
-rw-r--r--MediaBrowser.Controller/Entities/Photo.cs12
-rw-r--r--MediaBrowser.Controller/Entities/Studio.cs1
-rw-r--r--MediaBrowser.Controller/Entities/TV/Season.cs12
-rw-r--r--MediaBrowser.Controller/Entities/TV/Series.cs49
-rw-r--r--MediaBrowser.Controller/Entities/User.cs34
-rw-r--r--MediaBrowser.Controller/Entities/UserRootFolder.cs4
-rw-r--r--MediaBrowser.Controller/Entities/UserView.cs8
-rw-r--r--MediaBrowser.Controller/Entities/UserViewBuilder.cs8
-rw-r--r--MediaBrowser.Controller/Entities/Video.cs106
-rw-r--r--MediaBrowser.Controller/Entities/Year.cs1
-rw-r--r--MediaBrowser.Controller/IO/FileData.cs17
-rw-r--r--MediaBrowser.Controller/Library/ILibraryManager.cs17
-rw-r--r--MediaBrowser.Controller/Library/IUserDataManager.cs9
-rw-r--r--MediaBrowser.Controller/Library/IUserManager.cs16
-rw-r--r--MediaBrowser.Controller/Library/IUserViewManager.cs2
-rw-r--r--MediaBrowser.Controller/Library/ItemResolveArgs.cs43
-rw-r--r--MediaBrowser.Controller/Library/NameExtensions.cs44
-rw-r--r--MediaBrowser.Controller/LiveTv/ChannelInfo.cs2
-rw-r--r--MediaBrowser.Controller/LiveTv/ILiveTvManager.cs10
-rw-r--r--MediaBrowser.Controller/LiveTv/ILiveTvRecording.cs9
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs1
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvProgram.cs1
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs1
-rw-r--r--MediaBrowser.Controller/LiveTv/TimerInfo.cs3
-rw-r--r--MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs22
-rw-r--r--MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs15
-rw-r--r--MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs7
-rw-r--r--MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs21
-rw-r--r--MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs4
-rw-r--r--MediaBrowser.Controller/Notifications/INotificationManager.cs2
-rw-r--r--MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs7
-rw-r--r--MediaBrowser.Controller/Persistence/IItemRepository.cs24
-rw-r--r--MediaBrowser.Controller/Persistence/IUserDataRepository.cs7
-rw-r--r--MediaBrowser.Controller/Persistence/IUserRepository.cs5
-rw-r--r--MediaBrowser.Controller/Playlists/Playlist.cs2
-rw-r--r--MediaBrowser.Controller/Providers/DirectoryService.cs16
-rw-r--r--MediaBrowser.Controller/Providers/IDirectoryService.cs2
-rw-r--r--MediaBrowser.Controller/Providers/IProviderManager.cs2
-rw-r--r--MediaBrowser.Controller/Providers/MetadataResult.cs11
-rw-r--r--MediaBrowser.Controller/Providers/SongInfo.cs5
-rw-r--r--MediaBrowser.Controller/Security/IAuthenticationRepository.cs5
-rw-r--r--MediaBrowser.Controller/Session/ISessionManager.cs6
-rw-r--r--MediaBrowser.Controller/Session/SessionInfo.cs27
-rw-r--r--MediaBrowser.Controller/Subtitles/ISubtitleManager.cs6
-rw-r--r--MediaBrowser.Controller/Sync/ISyncManager.cs18
-rw-r--r--MediaBrowser.Controller/Sync/ISyncProvider.cs4
75 files changed, 523 insertions, 515 deletions
diff --git a/MediaBrowser.Controller/Channels/IChannelManager.cs b/MediaBrowser.Controller/Channels/IChannelManager.cs
index 824bdf8ff..46e55a21c 100644
--- a/MediaBrowser.Controller/Channels/IChannelManager.cs
+++ b/MediaBrowser.Controller/Channels/IChannelManager.cs
@@ -30,7 +30,7 @@ namespace MediaBrowser.Controller.Channels
/// Gets all channel features.
/// </summary>
/// <returns>IEnumerable{ChannelFeatures}.</returns>
- IEnumerable<ChannelFeatures> GetAllChannelFeatures();
+ ChannelFeatures[] GetAllChannelFeatures();
/// <summary>
/// Gets the channel.
diff --git a/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs b/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs
index 7d80d7e12..976808aad 100644
--- a/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs
+++ b/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs
@@ -58,13 +58,4 @@ namespace MediaBrowser.Controller.Channels
DefaultSortFields = new List<ChannelItemSortField>();
}
}
-
- public class ChannelDownloadException : Exception
- {
- public ChannelDownloadException(string message)
- : base(message)
- {
-
- }
- }
}
diff --git a/MediaBrowser.Controller/Chapters/IChapterManager.cs b/MediaBrowser.Controller/Chapters/IChapterManager.cs
index 85feec40b..d1c190ab5 100644
--- a/MediaBrowser.Controller/Chapters/IChapterManager.cs
+++ b/MediaBrowser.Controller/Chapters/IChapterManager.cs
@@ -14,11 +14,11 @@ namespace MediaBrowser.Controller.Chapters
/// </summary>
/// <param name="itemId">The item identifier.</param>
/// <returns>List{ChapterInfo}.</returns>
- IEnumerable<ChapterInfo> GetChapters(string itemId);
+ List<ChapterInfo> GetChapters(string itemId);
/// <summary>
/// Saves the chapters.
/// </summary>
- Task SaveChapters(string itemId, List<ChapterInfo> chapters);
+ void SaveChapters(string itemId, List<ChapterInfo> chapters);
}
}
diff --git a/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs b/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs
index 4a2d39066..7a387e319 100644
--- a/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs
+++ b/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs
@@ -14,14 +14,14 @@ namespace MediaBrowser.Controller.Collections
public Dictionary<string, string> ProviderIds { get; set; }
- public List<Guid> ItemIdList { get; set; }
- public List<Guid> UserIds { get; set; }
+ public string[] ItemIdList { get; set; }
+ public string[] UserIds { get; set; }
public CollectionCreationOptions()
{
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
- ItemIdList = new List<Guid>();
- UserIds = new List<Guid>();
+ ItemIdList = new string[] { };
+ UserIds = new string[] { };
}
}
}
diff --git a/MediaBrowser.Controller/Collections/ICollectionManager.cs b/MediaBrowser.Controller/Collections/ICollectionManager.cs
index 89e505579..d89843cc0 100644
--- a/MediaBrowser.Controller/Collections/ICollectionManager.cs
+++ b/MediaBrowser.Controller/Collections/ICollectionManager.cs
@@ -36,7 +36,7 @@ namespace MediaBrowser.Controller.Collections
/// <param name="collectionId">The collection identifier.</param>
/// <param name="itemIds">The item ids.</param>
/// <returns>Task.</returns>
- Task AddToCollection(Guid collectionId, IEnumerable<Guid> itemIds);
+ Task AddToCollection(Guid collectionId, IEnumerable<string> itemIds);
/// <summary>
/// Removes from collection.
@@ -44,6 +44,9 @@ namespace MediaBrowser.Controller.Collections
/// <param name="collectionId">The collection identifier.</param>
/// <param name="itemIds">The item ids.</param>
/// <returns>Task.</returns>
+ Task RemoveFromCollection(Guid collectionId, IEnumerable<string> itemIds);
+
+ Task AddToCollection(Guid collectionId, IEnumerable<Guid> itemIds);
Task RemoveFromCollection(Guid collectionId, IEnumerable<Guid> itemIds);
/// <summary>
diff --git a/MediaBrowser.Controller/Drawing/IImageProcessor.cs b/MediaBrowser.Controller/Drawing/IImageProcessor.cs
index 29363f492..113f823f5 100644
--- a/MediaBrowser.Controller/Drawing/IImageProcessor.cs
+++ b/MediaBrowser.Controller/Drawing/IImageProcessor.cs
@@ -24,7 +24,7 @@ namespace MediaBrowser.Controller.Drawing
/// Gets the image enhancers.
/// </summary>
/// <value>The image enhancers.</value>
- IEnumerable<IImageEnhancer> ImageEnhancers { get; }
+ IImageEnhancer[] ImageEnhancers { get; }
/// <summary>
/// Gets the size of the image.
@@ -54,7 +54,7 @@ namespace MediaBrowser.Controller.Drawing
/// <param name="item">The item.</param>
/// <param name="imageType">Type of the image.</param>
/// <returns>IEnumerable{IImageEnhancer}.</returns>
- IEnumerable<IImageEnhancer> GetSupportedEnhancers(IHasMetadata item, ImageType imageType);
+ List<IImageEnhancer> GetSupportedEnhancers(IHasMetadata item, ImageType imageType);
/// <summary>
/// Gets the image cache tag.
diff --git a/MediaBrowser.Controller/Dto/DtoOptions.cs b/MediaBrowser.Controller/Dto/DtoOptions.cs
index 098ba558f..f05ae4e71 100644
--- a/MediaBrowser.Controller/Dto/DtoOptions.cs
+++ b/MediaBrowser.Controller/Dto/DtoOptions.cs
@@ -14,8 +14,8 @@ namespace MediaBrowser.Controller.Dto
ItemFields.RefreshState
};
- public List<ItemFields> Fields { get; set; }
- public List<ImageType> ImageTypes { get; set; }
+ public ItemFields[] Fields { get; set; }
+ public ImageType[] ImageTypes { get; set; }
public int ImageTypeLimit { get; set; }
public bool EnableImages { get; set; }
public bool AddProgramRecordingInfo { get; set; }
@@ -28,6 +28,15 @@ namespace MediaBrowser.Controller.Dto
{
}
+ private static readonly ImageType[] AllImageTypes = Enum.GetNames(typeof(ImageType))
+ .Select(i => (ImageType)Enum.Parse(typeof(ImageType), i, true))
+ .ToArray();
+
+ private static readonly ItemFields[] AllItemFields = Enum.GetNames(typeof(ItemFields))
+ .Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true))
+ .Except(DefaultExcludedFields)
+ .ToArray();
+
public DtoOptions(bool allFields)
{
ImageTypeLimit = int.MaxValue;
@@ -37,19 +46,14 @@ namespace MediaBrowser.Controller.Dto
if (allFields)
{
- Fields = Enum.GetNames(typeof(ItemFields))
- .Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true))
- .Except(DefaultExcludedFields)
- .ToList();
+ Fields = AllItemFields;
}
else
{
- Fields = new List<ItemFields>();
+ Fields = new ItemFields[] { };
}
- ImageTypes = Enum.GetNames(typeof(ImageType))
- .Select(i => (ImageType)Enum.Parse(typeof(ImageType), i, true))
- .ToList();
+ ImageTypes = AllImageTypes;
}
public int GetImageLimit(ImageType type)
diff --git a/MediaBrowser.Controller/Dto/IDtoService.cs b/MediaBrowser.Controller/Dto/IDtoService.cs
index 963092f52..76ecd8180 100644
--- a/MediaBrowser.Controller/Dto/IDtoService.cs
+++ b/MediaBrowser.Controller/Dto/IDtoService.cs
@@ -41,7 +41,7 @@ namespace MediaBrowser.Controller.Dto
/// <param name="user">The user.</param>
/// <param name="owner">The owner.</param>
/// <returns>Task{BaseItemDto}.</returns>
- BaseItemDto GetBaseItemDto(BaseItem item, List<ItemFields> fields, User user = null, BaseItem owner = null);
+ BaseItemDto GetBaseItemDto(BaseItem item, ItemFields[] fields, User user = null, BaseItem owner = null);
/// <summary>
/// Gets the base item dto.
@@ -61,9 +61,10 @@ namespace MediaBrowser.Controller.Dto
/// <param name="user">The user.</param>
/// <param name="owner">The owner.</param>
/// <returns>IEnumerable&lt;BaseItemDto&gt;.</returns>
- Task<List<BaseItemDto>> GetBaseItemDtos(IEnumerable<BaseItem> items, DtoOptions options, User user = null,
- BaseItem owner = null);
-
+ Task<BaseItemDto[]> GetBaseItemDtos(BaseItem[] items, DtoOptions options, User user = null, BaseItem owner = null);
+
+ Task<BaseItemDto[]> GetBaseItemDtos(List<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null);
+
/// <summary>
/// Gets the chapter information dto.
/// </summary>
diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs
index f88522f78..2105ef907 100644
--- a/MediaBrowser.Controller/Entities/AggregateFolder.cs
+++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs
@@ -20,7 +20,7 @@ namespace MediaBrowser.Controller.Entities
{
public AggregateFolder()
{
- PhysicalLocationsList = new List<string>();
+ PhysicalLocationsList = EmptyStringArray;
}
[IgnoreDataMember]
@@ -58,7 +58,7 @@ namespace MediaBrowser.Controller.Entities
}
[IgnoreDataMember]
- public override IEnumerable<string> PhysicalLocations
+ public override string[] PhysicalLocations
{
get
{
@@ -66,23 +66,23 @@ namespace MediaBrowser.Controller.Entities
}
}
- public List<string> PhysicalLocationsList { get; set; }
+ public string[] PhysicalLocationsList { get; set; }
protected override FileSystemMetadata[] GetFileSystemChildren(IDirectoryService directoryService)
{
- return CreateResolveArgs(directoryService, true).FileSystemChildren.ToArray();
+ return CreateResolveArgs(directoryService, true).FileSystemChildren;
}
- private List<Guid> _childrenIds = null;
+ private Guid[] _childrenIds = null;
private readonly object _childIdsLock = new object();
protected override List<BaseItem> LoadChildren()
{
lock (_childIdsLock)
{
- if (_childrenIds == null || _childrenIds.Count == 0)
+ if (_childrenIds == null || _childrenIds.Length == 0)
{
- var list = base.LoadChildren().ToList();
- _childrenIds = list.Select(i => i.Id).ToList();
+ var list = base.LoadChildren();
+ _childrenIds = list.Select(i => i.Id).ToArray();
return list;
}
@@ -105,9 +105,9 @@ namespace MediaBrowser.Controller.Entities
if (!changed)
{
- var locations = PhysicalLocations.ToList();
+ var locations = PhysicalLocations;
- var newLocations = CreateResolveArgs(new DirectoryService(Logger, FileSystem), false).PhysicalLocations.ToList();
+ var newLocations = CreateResolveArgs(new DirectoryService(Logger, FileSystem), false).PhysicalLocations;
if (!locations.SequenceEqual(newLocations))
{
@@ -148,24 +148,22 @@ namespace MediaBrowser.Controller.Entities
// When resolving the root, we need it's grandchildren (children of user views)
var flattenFolderDepth = isPhysicalRoot ? 2 : 0;
- var fileSystemDictionary = FileData.GetFilteredFileSystemEntries(directoryService, args.Path, FileSystem, Logger, args, flattenFolderDepth: flattenFolderDepth, resolveShortcuts: isPhysicalRoot || args.IsVf);
+ var files = FileData.GetFilteredFileSystemEntries(directoryService, args.Path, FileSystem, Logger, args, flattenFolderDepth: flattenFolderDepth, resolveShortcuts: isPhysicalRoot || args.IsVf);
// Need to remove subpaths that may have been resolved from shortcuts
// Example: if \\server\movies exists, then strip out \\server\movies\action
if (isPhysicalRoot)
{
- var paths = LibraryManager.NormalizeRootPathList(fileSystemDictionary.Values);
-
- fileSystemDictionary = paths.ToDictionary(i => i.FullName);
+ files = LibraryManager.NormalizeRootPathList(files).ToArray();
}
- args.FileSystemDictionary = fileSystemDictionary;
+ args.FileSystemChildren = files;
}
_requiresRefresh = _requiresRefresh || !args.PhysicalLocations.SequenceEqual(PhysicalLocations);
if (setPhysicalLocations)
{
- PhysicalLocationsList = args.PhysicalLocations.ToList();
+ PhysicalLocationsList = args.PhysicalLocations;
}
return args;
@@ -214,7 +212,14 @@ namespace MediaBrowser.Controller.Entities
throw new ArgumentNullException("id");
}
- return _virtualChildren.FirstOrDefault(i => i.Id == id);
+ foreach (var child in _virtualChildren)
+ {
+ if (child.Id == id)
+ {
+ return child;
+ }
+ }
+ return null;
}
}
}
diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs
index 0781dc35b..3ebf4da00 100644
--- a/MediaBrowser.Controller/Entities/Audio/Audio.cs
+++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs
@@ -29,7 +29,7 @@ namespace MediaBrowser.Controller.Entities.Audio
/// </summary>
/// <value>The artist.</value>
[IgnoreDataMember]
- public List<string> Artists { get; set; }
+ public string[] Artists { get; set; }
[IgnoreDataMember]
public string[] AlbumArtists { get; set; }
@@ -42,7 +42,7 @@ namespace MediaBrowser.Controller.Entities.Audio
public Audio()
{
- Artists = new List<string>();
+ Artists = EmptyStringArray;
AlbumArtists = EmptyStringArray;
}
@@ -98,13 +98,23 @@ namespace MediaBrowser.Controller.Entities.Audio
}
[IgnoreDataMember]
- public List<string> AllArtists
+ public string[] AllArtists
{
get
{
- var list = AlbumArtists.ToList();
+ var list = new string[AlbumArtists.Length + Artists.Length];
- list.AddRange(Artists);
+ var index = 0;
+ foreach (var artist in AlbumArtists)
+ {
+ list[index] = artist;
+ index++;
+ }
+ foreach (var artist in Artists)
+ {
+ list[index] = artist;
+ index++;
+ }
return list;
@@ -160,7 +170,7 @@ namespace MediaBrowser.Controller.Entities.Audio
songKey = Album + "-" + songKey;
}
- var albumArtist = AlbumArtists.FirstOrDefault();
+ var albumArtist = AlbumArtists.Length == 0 ? null : AlbumArtists[0];
if (!string.IsNullOrWhiteSpace(albumArtist))
{
songKey = albumArtist + "-" + songKey;
diff --git a/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs b/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs
index 6900699e5..b2dedada4 100644
--- a/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs
+++ b/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs
@@ -1,6 +1,4 @@
-using MediaBrowser.Controller.Library;
-using System.Collections.Generic;
-
+
namespace MediaBrowser.Controller.Entities.Audio
{
public interface IHasAlbumArtist
@@ -10,16 +8,8 @@ namespace MediaBrowser.Controller.Entities.Audio
public interface IHasArtist
{
- List<string> AllArtists { get; }
-
- List<string> Artists { get; set; }
- }
+ string[] AllArtists { get; }
- public static class HasArtistExtensions
- {
- public static bool HasAnyArtist(this IHasArtist hasArtist, string artist)
- {
- return NameExtensions.EqualsAny(hasArtist.AllArtists, artist);
- }
+ string[] Artists { get; set; }
}
}
diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs
index c35e81826..7af8161ca 100644
--- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs
+++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs
@@ -10,7 +10,6 @@ using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Library;
-using MediaBrowser.Model.Dto;
namespace MediaBrowser.Controller.Entities.Audio
{
@@ -20,11 +19,11 @@ namespace MediaBrowser.Controller.Entities.Audio
public class MusicAlbum : Folder, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasLookupInfo<AlbumInfo>, IMetadataContainer
{
public string[] AlbumArtists { get; set; }
- public List<string> Artists { get; set; }
+ public string[] Artists { get; set; }
public MusicAlbum()
{
- Artists = new List<string>();
+ Artists = EmptyStringArray;
AlbumArtists = EmptyStringArray;
}
@@ -48,17 +47,22 @@ namespace MediaBrowser.Controller.Entities.Audio
public MusicArtist GetMusicArtist(DtoOptions options)
{
- var artist = GetParents().OfType<MusicArtist>().FirstOrDefault();
-
- if (artist == null)
+ var parents = GetParents();
+ foreach (var parent in parents)
{
- var name = AlbumArtist;
- if (!string.IsNullOrWhiteSpace(name))
+ var artist = parent as MusicArtist;
+ if (artist != null)
{
- artist = LibraryManager.GetArtist(name, options);
+ return artist;
}
}
- return artist;
+
+ var name = AlbumArtist;
+ if (!string.IsNullOrWhiteSpace(name))
+ {
+ return LibraryManager.GetArtist(name, options);
+ }
+ return null;
}
[IgnoreDataMember]
@@ -80,23 +84,32 @@ namespace MediaBrowser.Controller.Entities.Audio
}
[IgnoreDataMember]
- public List<string> AllArtists
+ public string[] AllArtists
{
get
{
- var list = AlbumArtists.ToList();
+ var list = new string[AlbumArtists.Length + Artists.Length];
- list.AddRange(Artists);
+ var index = 0;
+ foreach (var artist in AlbumArtists)
+ {
+ list[index] = artist;
+ index++;
+ }
+ foreach (var artist in Artists)
+ {
+ list[index] = artist;
+ index++;
+ }
return list;
-
}
}
[IgnoreDataMember]
public string AlbumArtist
{
- get { return AlbumArtists.FirstOrDefault(); }
+ get { return AlbumArtists.Length == 0 ? null : AlbumArtists[0]; }
}
[IgnoreDataMember]
@@ -110,11 +123,11 @@ namespace MediaBrowser.Controller.Entities.Audio
/// </summary>
/// <value>The tracks.</value>
[IgnoreDataMember]
- public IEnumerable<Audio> Tracks
+ public IEnumerable<BaseItem> Tracks
{
get
{
- return GetRecursiveChildren(i => i is Audio).Cast<Audio>();
+ return GetRecursiveChildren(i => i is Audio);
}
}
@@ -200,7 +213,7 @@ namespace MediaBrowser.Controller.Entities.Audio
public async Task RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress<double> progress, CancellationToken cancellationToken)
{
- var items = GetRecursiveChildren().ToList();
+ var items = GetRecursiveChildren();
var totalItems = items.Count;
var numComplete = 0;
@@ -239,27 +252,22 @@ namespace MediaBrowser.Controller.Entities.Audio
private async Task RefreshArtists(MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
{
- var artists = AllArtists.Select(i =>
+ var all = AllArtists;
+ foreach (var i in all)
{
// This should not be necessary but we're seeing some cases of it
if (string.IsNullOrWhiteSpace(i))
{
- return null;
+ continue;
}
var artist = LibraryManager.GetArtist(i);
if (!artist.IsAccessedByName)
{
- return null;
+ continue;
}
- return artist;
-
- }).Where(i => i != null).ToList();
-
- foreach (var artist in artists)
- {
await artist.RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false);
}
}
diff --git a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
index 559806ac4..19fe68e25 100644
--- a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
+++ b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
@@ -214,18 +214,19 @@ namespace MediaBrowser.Controller.Entities.Audio
{
var items = GetRecursiveChildren();
- var songs = items.OfType<Audio>().ToList();
-
- var others = items.Except(songs).ToList();
-
- var totalItems = songs.Count + others.Count;
+ var totalItems = items.Count;
var numComplete = 0;
var childUpdateType = ItemUpdateType.None;
// Refresh songs
- foreach (var item in songs)
+ foreach (var item in items)
{
+ if (!(item is Audio))
+ {
+ continue;
+ }
+
cancellationToken.ThrowIfCancellationRequested();
var updateType = await item.RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false);
@@ -248,8 +249,13 @@ namespace MediaBrowser.Controller.Entities.Audio
await RefreshMetadata(parentRefreshOptions, cancellationToken).ConfigureAwait(false);
// Refresh all non-songs
- foreach (var item in others)
+ foreach (var item in items)
{
+ if (item is Audio)
+ {
+ continue;
+ }
+
cancellationToken.ThrowIfCancellationRequested();
var updateType = await item.RefreshMetadata(parentRefreshOptions, cancellationToken).ConfigureAwait(false);
diff --git a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs
index d4a85b4d0..02e652048 100644
--- a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs
+++ b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Extensions;
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index a6418418e..513b85d8b 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -25,6 +25,7 @@ using System.Threading.Tasks;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Controller.IO;
+using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Globalization;
@@ -536,6 +537,7 @@ namespace MediaBrowser.Controller.Entities
public static ICollectionManager CollectionManager { get; set; }
public static IImageProcessor ImageProcessor { get; set; }
public static IMediaSourceManager MediaSourceManager { get; set; }
+ public static IMediaEncoder MediaEncoder { get; set; }
/// <summary>
/// Returns a <see cref="System.String" /> that represents this instance.
@@ -570,7 +572,7 @@ namespace MediaBrowser.Controller.Entities
}
[IgnoreDataMember]
- public virtual IEnumerable<string> PhysicalLocations
+ public virtual string[] PhysicalLocations
{
get
{
@@ -1769,7 +1771,7 @@ namespace MediaBrowser.Controller.Entities
/// <param name="resetPosition">if set to <c>true</c> [reset position].</param>
/// <returns>Task.</returns>
/// <exception cref="System.ArgumentNullException"></exception>
- public virtual async Task MarkPlayed(User user,
+ public virtual void MarkPlayed(User user,
DateTime? datePlayed,
bool resetPosition)
{
@@ -1797,7 +1799,7 @@ namespace MediaBrowser.Controller.Entities
data.LastPlayedDate = datePlayed ?? data.LastPlayedDate ?? DateTime.UtcNow;
data.Played = true;
- await UserDataManager.SaveUserData(user.Id, this, data, UserDataSaveReason.TogglePlayed, CancellationToken.None).ConfigureAwait(false);
+ UserDataManager.SaveUserData(user.Id, this, data, UserDataSaveReason.TogglePlayed, CancellationToken.None);
}
/// <summary>
@@ -1806,7 +1808,7 @@ namespace MediaBrowser.Controller.Entities
/// <param name="user">The user.</param>
/// <returns>Task.</returns>
/// <exception cref="System.ArgumentNullException"></exception>
- public virtual async Task MarkUnplayed(User user)
+ public virtual void MarkUnplayed(User user)
{
if (user == null)
{
@@ -1823,7 +1825,7 @@ namespace MediaBrowser.Controller.Entities
data.LastPlayedDate = null;
data.Played = false;
- await UserDataManager.SaveUserData(user.Id, this, data, UserDataSaveReason.TogglePlayed, CancellationToken.None).ConfigureAwait(false);
+ UserDataManager.SaveUserData(user.Id, this, data, UserDataSaveReason.TogglePlayed, CancellationToken.None);
}
/// <summary>
@@ -2265,7 +2267,7 @@ namespace MediaBrowser.Controller.Entities
return path;
}
- public virtual void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, List<ItemFields> fields)
+ public virtual void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, ItemFields[] fields)
{
if (RunTimeTicks.HasValue)
{
diff --git a/MediaBrowser.Controller/Entities/Book.cs b/MediaBrowser.Controller/Entities/Book.cs
index 7cb242589..9b1a52f83 100644
--- a/MediaBrowser.Controller/Entities/Book.cs
+++ b/MediaBrowser.Controller/Entities/Book.cs
@@ -1,7 +1,7 @@
using System;
+using System.Linq;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
-using System.Linq;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Entities;
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs
index d02e469d4..537beb26b 100644
--- a/MediaBrowser.Controller/Entities/CollectionFolder.cs
+++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs
@@ -27,8 +27,8 @@ namespace MediaBrowser.Controller.Entities
public CollectionFolder()
{
- PhysicalLocationsList = new List<string>();
- PhysicalFolderIds = new List<Guid>();
+ PhysicalLocationsList = EmptyStringArray;
+ PhysicalFolderIds = EmptyGuidArray;
}
[IgnoreDataMember]
@@ -140,7 +140,7 @@ namespace MediaBrowser.Controller.Entities
}
[IgnoreDataMember]
- public override IEnumerable<string> PhysicalLocations
+ public override string[] PhysicalLocations
{
get
{
@@ -153,12 +153,12 @@ namespace MediaBrowser.Controller.Entities
return true;
}
- public List<string> PhysicalLocationsList { get; set; }
- public List<Guid> PhysicalFolderIds { get; set; }
+ public string[] PhysicalLocationsList { get; set; }
+ public Guid[] PhysicalFolderIds { get; set; }
protected override FileSystemMetadata[] GetFileSystemChildren(IDirectoryService directoryService)
{
- return CreateResolveArgs(directoryService, true).FileSystemChildren.ToArray();
+ return CreateResolveArgs(directoryService, true).FileSystemChildren;
}
private bool _requiresRefresh;
@@ -168,9 +168,9 @@ namespace MediaBrowser.Controller.Entities
if (!changed)
{
- var locations = PhysicalLocations.ToList();
+ var locations = PhysicalLocations;
- var newLocations = CreateResolveArgs(new DirectoryService(Logger, FileSystem), false).PhysicalLocations.ToList();
+ var newLocations = CreateResolveArgs(new DirectoryService(Logger, FileSystem), false).PhysicalLocations;
if (!locations.SequenceEqual(newLocations))
{
@@ -180,7 +180,7 @@ namespace MediaBrowser.Controller.Entities
if (!changed)
{
- var folderIds = PhysicalFolderIds.ToList();
+ var folderIds = PhysicalFolderIds;
var newFolderIds = GetPhysicalFolders(false).Select(i => i.Id).ToList();
@@ -242,15 +242,15 @@ namespace MediaBrowser.Controller.Entities
LinkedChildren = linkedChildren.ToArray(linkedChildren.Count);
- var folderIds = PhysicalFolderIds.ToList();
- var newFolderIds = physicalFolders.Select(i => i.Id).ToList();
+ var folderIds = PhysicalFolderIds;
+ var newFolderIds = physicalFolders.Select(i => i.Id).ToArray();
if (!folderIds.SequenceEqual(newFolderIds))
{
changed = true;
if (setFolders)
{
- PhysicalFolderIds = newFolderIds.ToList();
+ PhysicalFolderIds = newFolderIds;
}
}
@@ -292,24 +292,22 @@ namespace MediaBrowser.Controller.Entities
// When resolving the root, we need it's grandchildren (children of user views)
var flattenFolderDepth = isPhysicalRoot ? 2 : 0;
- var fileSystemDictionary = FileData.GetFilteredFileSystemEntries(directoryService, args.Path, FileSystem, Logger, args, flattenFolderDepth: flattenFolderDepth, resolveShortcuts: isPhysicalRoot || args.IsVf);
+ var files = FileData.GetFilteredFileSystemEntries(directoryService, args.Path, FileSystem, Logger, args, flattenFolderDepth: flattenFolderDepth, resolveShortcuts: isPhysicalRoot || args.IsVf);
// Need to remove subpaths that may have been resolved from shortcuts
// Example: if \\server\movies exists, then strip out \\server\movies\action
if (isPhysicalRoot)
{
- var paths = LibraryManager.NormalizeRootPathList(fileSystemDictionary.Values);
-
- fileSystemDictionary = paths.ToDictionary(i => i.FullName);
+ files = LibraryManager.NormalizeRootPathList(files).ToArray();
}
- args.FileSystemDictionary = fileSystemDictionary;
+ args.FileSystemChildren = files;
}
_requiresRefresh = _requiresRefresh || !args.PhysicalLocations.SequenceEqual(PhysicalLocations);
if (setPhysicalLocations)
{
- PhysicalLocationsList = args.PhysicalLocations.ToList();
+ PhysicalLocationsList = args.PhysicalLocations;
}
return args;
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index 46ae9230b..8a87f3c6a 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -186,7 +186,7 @@ namespace MediaBrowser.Controller.Entities
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
/// <exception cref="System.InvalidOperationException">Unable to add + item.Name</exception>
- public async Task AddChild(BaseItem item, CancellationToken cancellationToken)
+ public void AddChild(BaseItem item, CancellationToken cancellationToken)
{
item.SetParent(this);
@@ -209,7 +209,7 @@ namespace MediaBrowser.Controller.Entities
item.DateModified = DateTime.UtcNow;
}
- await LibraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
+ LibraryManager.CreateItem(item, cancellationToken);
}
/// <summary>
@@ -469,7 +469,7 @@ namespace MediaBrowser.Controller.Entities
}
}
- await LibraryManager.CreateItems(newItems, cancellationToken).ConfigureAwait(false);
+ LibraryManager.CreateItems(newItems, cancellationToken);
}
}
else
@@ -648,15 +648,15 @@ namespace MediaBrowser.Controller.Entities
public static bool IsPathOffline(string path, List<string> allLibraryPaths)
{
- if (FileSystem.FileExists(path))
- {
- return false;
- }
+ //if (FileSystem.FileExists(path))
+ //{
+ // return false;
+ //}
var originalPath = path;
// Depending on whether the path is local or unc, it may return either null or '\' at the top
- while (!string.IsNullOrEmpty(path) && path.Length > 1)
+ while (!string.IsNullOrWhiteSpace(path) && path.Length > 1)
{
if (FileSystem.DirectoryExists(path))
{
@@ -711,7 +711,7 @@ namespace MediaBrowser.Controller.Entities
{
if (!(this is ICollectionFolder))
{
- return GetChildren(user, true).Count();
+ return GetChildren(user, true).Count;
}
}
@@ -792,16 +792,16 @@ namespace MediaBrowser.Controller.Entities
query.StartIndex = null;
query.Limit = null;
- IEnumerable<BaseItem> itemsList = LibraryManager.GetItemList(query);
+ var itemsList = LibraryManager.GetItemList(query);
var user = query.User;
if (user != null)
{
// needed for boxsets
- itemsList = itemsList.Where(i => i.IsVisibleStandalone(query.User));
+ itemsList = itemsList.Where(i => i.IsVisibleStandalone(query.User)).ToList();
}
- IEnumerable<BaseItem> returnItems;
+ BaseItem[] returnItems;
int totalCount = 0;
if (query.EnableTotalRecordCount)
@@ -812,16 +812,16 @@ namespace MediaBrowser.Controller.Entities
}
else
{
- returnItems = itemsList;
+ returnItems = itemsList.ToArray();
}
if (limit.HasValue)
{
- returnItems = returnItems.Skip(startIndex ?? 0).Take(limit.Value);
+ returnItems = returnItems.Skip(startIndex ?? 0).Take(limit.Value).ToArray();
}
else if (startIndex.HasValue)
{
- returnItems = returnItems.Skip(startIndex.Value);
+ returnItems = returnItems.Skip(startIndex.Value).ToArray();
}
return new QueryResult<BaseItem>
@@ -1044,7 +1044,7 @@ namespace MediaBrowser.Controller.Entities
return UserViewBuilder.PostFilterAndSort(items, this, null, query, LibraryManager, ConfigurationManager, collapseBoxSetItems, enableSorting);
}
- public virtual IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)
+ public virtual List<BaseItem> GetChildren(User user, bool includeLinkedChildren)
{
if (user == null)
{
@@ -1058,7 +1058,7 @@ namespace MediaBrowser.Controller.Entities
AddChildren(user, includeLinkedChildren, result, false, null);
- return result.Values;
+ return result.Values.ToList();
}
protected virtual IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user)
@@ -1370,7 +1370,7 @@ namespace MediaBrowser.Controller.Entities
/// <param name="datePlayed">The date played.</param>
/// <param name="resetPosition">if set to <c>true</c> [reset position].</param>
/// <returns>Task.</returns>
- public override async Task MarkPlayed(User user,
+ public override void MarkPlayed(User user,
DateTime? datePlayed,
bool resetPosition)
{
@@ -1390,9 +1390,10 @@ namespace MediaBrowser.Controller.Entities
var itemsResult = GetItemList(query);
// Sweep through recursively and update status
- var tasks = itemsResult.Select(c => c.MarkPlayed(user, datePlayed, resetPosition));
-
- await Task.WhenAll(tasks).ConfigureAwait(false);
+ foreach (var item in itemsResult)
+ {
+ item.MarkPlayed(user, datePlayed, resetPosition);
+ }
}
/// <summary>
@@ -1400,7 +1401,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <param name="user">The user.</param>
/// <returns>Task.</returns>
- public override async Task MarkUnplayed(User user)
+ public override void MarkUnplayed(User user)
{
var itemsResult = GetItemList(new InternalItemsQuery
{
@@ -1412,9 +1413,10 @@ namespace MediaBrowser.Controller.Entities
});
// Sweep through recursively and update status
- var tasks = itemsResult.Select(c => c.MarkUnplayed(user));
-
- await Task.WhenAll(tasks).ConfigureAwait(false);
+ foreach (var item in itemsResult)
+ {
+ item.MarkUnplayed(user);
+ }
}
public override bool IsPlayed(User user)
@@ -1477,7 +1479,7 @@ namespace MediaBrowser.Controller.Entities
}
}
- public override void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, List<ItemFields> fields)
+ public override void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, ItemFields[] fields)
{
if (!SupportsUserDataFromChildren)
{
diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs
index eb2638ee4..a99058925 100644
--- a/MediaBrowser.Controller/Entities/Game.cs
+++ b/MediaBrowser.Controller/Entities/Game.cs
@@ -3,7 +3,6 @@ using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
-using System.Linq;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization;
diff --git a/MediaBrowser.Controller/Entities/GameGenre.cs b/MediaBrowser.Controller/Entities/GameGenre.cs
index 836020d88..4e78a7fa5 100644
--- a/MediaBrowser.Controller/Entities/GameGenre.cs
+++ b/MediaBrowser.Controller/Entities/GameGenre.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Extensions;
diff --git a/MediaBrowser.Controller/Entities/Genre.cs b/MediaBrowser.Controller/Entities/Genre.cs
index 4b70eae58..790f8938e 100644
--- a/MediaBrowser.Controller/Entities/Genre.cs
+++ b/MediaBrowser.Controller/Entities/Genre.cs
@@ -2,7 +2,6 @@
using MediaBrowser.Controller.Entities.Audio;
using System;
using System.Collections.Generic;
-using System.Linq;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.Extensions;
diff --git a/MediaBrowser.Controller/Entities/ICollectionFolder.cs b/MediaBrowser.Controller/Entities/ICollectionFolder.cs
index d8b02034c..b70ad322d 100644
--- a/MediaBrowser.Controller/Entities/ICollectionFolder.cs
+++ b/MediaBrowser.Controller/Entities/ICollectionFolder.cs
@@ -13,7 +13,7 @@ namespace MediaBrowser.Controller.Entities
string Path { get; }
string Name { get; }
Guid Id { get; }
- IEnumerable<string> PhysicalLocations { get; }
+ string[] PhysicalLocations { get; }
}
public interface ISupportsUserSpecificView
diff --git a/MediaBrowser.Controller/Entities/IHasMediaSources.cs b/MediaBrowser.Controller/Entities/IHasMediaSources.cs
index bf4acdfbd..54786134f 100644
--- a/MediaBrowser.Controller/Entities/IHasMediaSources.cs
+++ b/MediaBrowser.Controller/Entities/IHasMediaSources.cs
@@ -4,7 +4,7 @@ using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Entities
{
- public interface IHasMediaSources : IHasUserData
+ public interface IHasMediaSources : IHasMetadata
{
/// <summary>
/// Gets the media sources.
diff --git a/MediaBrowser.Controller/Entities/IHasUserData.cs b/MediaBrowser.Controller/Entities/IHasUserData.cs
index ce4a482ba..ab4f624e2 100644
--- a/MediaBrowser.Controller/Entities/IHasUserData.cs
+++ b/MediaBrowser.Controller/Entities/IHasUserData.cs
@@ -16,7 +16,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Fills the user data dto values.
/// </summary>
- void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, List<ItemFields> fields);
+ void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, ItemFields[] fields);
bool EnableRememberingTrackSelections { get; }
diff --git a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs
index 05d23d986..9e0e9c208 100644
--- a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs
+++ b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs
@@ -6,7 +6,7 @@ namespace MediaBrowser.Controller.Entities
public class InternalPeopleQuery
{
public Guid ItemId { get; set; }
- public List<string> PersonTypes { get; set; }
+ public string[] PersonTypes { get; set; }
public List<string> ExcludePersonTypes { get; set; }
public int? MaxListOrder { get; set; }
public Guid AppearsInItemId { get; set; }
@@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Entities
public InternalPeopleQuery()
{
- PersonTypes = new List<string>();
+ PersonTypes = new string[] {};
ExcludePersonTypes = new List<string>();
}
}
diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
index 6ba9577d1..900e8a664 100644
--- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
+++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
@@ -1,5 +1,4 @@
-using MediaBrowser.Controller.Entities.TV;
-using MediaBrowser.Controller.Providers;
+using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
@@ -8,7 +7,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Controller.Entities.Audio;
namespace MediaBrowser.Controller.Entities.Movies
{
@@ -82,20 +80,11 @@ namespace MediaBrowser.Controller.Entities.Movies
protected override IEnumerable<BaseItem> GetNonCachedChildren(IDirectoryService directoryService)
{
- if (IsLegacyBoxSet)
- {
- return base.GetNonCachedChildren(directoryService);
- }
return new List<BaseItem>();
}
protected override List<BaseItem> LoadChildren()
{
- if (IsLegacyBoxSet)
- {
- return base.LoadChildren();
- }
-
// Save a trip to the database
return new List<BaseItem>();
}
@@ -109,34 +98,6 @@ namespace MediaBrowser.Controller.Entities.Movies
}
}
- [IgnoreDataMember]
- protected override bool SupportsShortcutChildren
- {
- get
- {
- if (IsLegacyBoxSet)
- {
- return false;
- }
-
- return false;
- }
- }
-
- [IgnoreDataMember]
- private bool IsLegacyBoxSet
- {
- get
- {
- if (string.IsNullOrWhiteSpace(Path))
- {
- return false;
- }
-
- return !FileSystem.ContainsSubPath(ConfigurationManager.ApplicationPaths.DataPath, Path);
- }
- }
-
public override bool IsAuthorizedToDelete(User user)
{
return true;
@@ -170,24 +131,24 @@ namespace MediaBrowser.Controller.Entities.Movies
StringComparison.OrdinalIgnoreCase);
}
- public override IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)
+ public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren)
{
var children = base.GetChildren(user, includeLinkedChildren);
if (string.Equals(DisplayOrder, ItemSortBy.SortName, StringComparison.OrdinalIgnoreCase))
{
// Sort by name
- return LibraryManager.Sort(children, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending);
+ return LibraryManager.Sort(children, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending).ToList();
}
if (string.Equals(DisplayOrder, ItemSortBy.PremiereDate, StringComparison.OrdinalIgnoreCase))
{
// Sort by release date
- return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending);
+ return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending).ToList();
}
// Default sorting
- return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending);
+ return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending).ToList();
}
public BoxSetInfo GetLookupInfo()
@@ -207,7 +168,7 @@ namespace MediaBrowser.Controller.Entities.Movies
if (base.IsVisible(user))
{
- return base.GetChildren(user, true).Any();
+ return base.GetChildren(user, true).Count > 0;
}
return false;
diff --git a/MediaBrowser.Controller/Entities/MusicVideo.cs b/MediaBrowser.Controller/Entities/MusicVideo.cs
index 2028c1c3b..b7470d679 100644
--- a/MediaBrowser.Controller/Entities/MusicVideo.cs
+++ b/MediaBrowser.Controller/Entities/MusicVideo.cs
@@ -9,15 +9,15 @@ namespace MediaBrowser.Controller.Entities
public class MusicVideo : Video, IHasArtist, IHasMusicGenres, IHasLookupInfo<MusicVideoInfo>
{
[IgnoreDataMember]
- public List<string> Artists { get; set; }
+ public string[] Artists { get; set; }
public MusicVideo()
{
- Artists = new List<string>();
+ Artists = EmptyStringArray;
}
[IgnoreDataMember]
- public List<string> AllArtists
+ public string[] AllArtists
{
get
{
diff --git a/MediaBrowser.Controller/Entities/PeopleHelper.cs b/MediaBrowser.Controller/Entities/PeopleHelper.cs
index 40a93d9e6..412eb9499 100644
--- a/MediaBrowser.Controller/Entities/PeopleHelper.cs
+++ b/MediaBrowser.Controller/Entities/PeopleHelper.cs
@@ -105,7 +105,15 @@ namespace MediaBrowser.Controller.Entities
{
throw new ArgumentNullException("name");
}
- return people.Any(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase));
+
+ foreach (var i in people)
+ {
+ if (string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase))
+ {
+ return true;
+ }
+ }
+ return false;
}
}
}
diff --git a/MediaBrowser.Controller/Entities/Person.cs b/MediaBrowser.Controller/Entities/Person.cs
index 20d9c7999..b3a91f944 100644
--- a/MediaBrowser.Controller/Entities/Person.cs
+++ b/MediaBrowser.Controller/Entities/Person.cs
@@ -1,7 +1,6 @@
using MediaBrowser.Controller.Providers;
using System;
using System.Collections.Generic;
-using System.Linq;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.Entities;
diff --git a/MediaBrowser.Controller/Entities/Photo.cs b/MediaBrowser.Controller/Entities/Photo.cs
index e95ceee52..8e9eac50c 100644
--- a/MediaBrowser.Controller/Entities/Photo.cs
+++ b/MediaBrowser.Controller/Entities/Photo.cs
@@ -1,5 +1,4 @@
using MediaBrowser.Model.Drawing;
-using System.Linq;
using MediaBrowser.Model.Serialization;
namespace MediaBrowser.Controller.Entities
@@ -39,7 +38,16 @@ namespace MediaBrowser.Controller.Entities
{
get
{
- return GetParents().OfType<PhotoAlbum>().FirstOrDefault();
+ var parents = GetParents();
+ foreach (var parent in parents)
+ {
+ var photoAlbum = parent as PhotoAlbum;
+ if (photoAlbum != null)
+ {
+ return photoAlbum;
+ }
+ }
+ return null;
}
}
diff --git a/MediaBrowser.Controller/Entities/Studio.cs b/MediaBrowser.Controller/Entities/Studio.cs
index 8cb65c60a..a6a72d994 100644
--- a/MediaBrowser.Controller/Entities/Studio.cs
+++ b/MediaBrowser.Controller/Entities/Studio.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Extensions;
diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs
index b681fdcb1..bf6dc5678 100644
--- a/MediaBrowser.Controller/Entities/TV/Season.cs
+++ b/MediaBrowser.Controller/Entities/TV/Season.cs
@@ -81,7 +81,7 @@ namespace MediaBrowser.Controller.Entities.TV
public override int GetChildCount(User user)
{
- var result = GetChildren(user, true).Count();
+ var result = GetChildren(user, true).Count;
return result;
}
@@ -160,27 +160,27 @@ namespace MediaBrowser.Controller.Entities.TV
/// <summary>
/// Gets the episodes.
/// </summary>
- public IEnumerable<Episode> GetEpisodes(User user, DtoOptions options)
+ public List<BaseItem> GetEpisodes(User user, DtoOptions options)
{
return GetEpisodes(Series, user, options);
}
- public IEnumerable<Episode> GetEpisodes(Series series, User user, DtoOptions options)
+ public List<BaseItem> GetEpisodes(Series series, User user, DtoOptions options)
{
return GetEpisodes(series, user, null, options);
}
- public IEnumerable<Episode> GetEpisodes(Series series, User user, IEnumerable<Episode> allSeriesEpisodes, DtoOptions options)
+ public List<BaseItem> GetEpisodes(Series series, User user, IEnumerable<Episode> allSeriesEpisodes, DtoOptions options)
{
return series.GetSeasonEpisodes(this, user, allSeriesEpisodes, options);
}
- public IEnumerable<Episode> GetEpisodes()
+ public List<BaseItem> GetEpisodes()
{
return Series.GetSeasonEpisodes(this, null, null, new DtoOptions(true));
}
- public override IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)
+ public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren)
{
return GetEpisodes(user, new DtoOptions(true));
}
diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs
index 3350a6579..6514d31d2 100644
--- a/MediaBrowser.Controller/Entities/TV/Series.cs
+++ b/MediaBrowser.Controller/Entities/TV/Series.cs
@@ -152,12 +152,8 @@ namespace MediaBrowser.Controller.Entities.TV
IncludeItemTypes = new[] { typeof(Season).Name },
IsVirtualItem = false,
Limit = 0,
- DtoOptions = new Dto.DtoOptions
+ DtoOptions = new Dto.DtoOptions(false)
{
- Fields = new List<ItemFields>
- {
-
- },
EnableImages = false
}
});
@@ -173,12 +169,8 @@ namespace MediaBrowser.Controller.Entities.TV
{
AncestorWithPresentationUniqueKey = null,
SeriesPresentationUniqueKey = seriesKey,
- DtoOptions = new Dto.DtoOptions
+ DtoOptions = new Dto.DtoOptions(false)
{
- Fields = new List<ItemFields>
- {
-
- },
EnableImages = false
}
};
@@ -222,16 +214,24 @@ namespace MediaBrowser.Controller.Entities.TV
{
get
{
- return Children.OfType<Video>().Any();
+ var children = Children;
+ foreach (var child in children)
+ {
+ if (child is Video)
+ {
+ return true;
+ }
+ }
+ return false;
}
}
- public override IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)
+ public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren)
{
return GetSeasons(user, new DtoOptions(true));
}
- public IEnumerable<Season> GetSeasons(User user, DtoOptions options)
+ public List<BaseItem> GetSeasons(User user, DtoOptions options)
{
var query = new InternalItemsQuery(user)
{
@@ -240,7 +240,7 @@ namespace MediaBrowser.Controller.Entities.TV
SetSeasonQueryOptions(query, user);
- return LibraryManager.GetItemList(query).Cast<Season>();
+ return LibraryManager.GetItemList(query);
}
private void SetSeasonQueryOptions(InternalItemsQuery query, User user)
@@ -292,7 +292,7 @@ namespace MediaBrowser.Controller.Entities.TV
return LibraryManager.GetItemsResult(query);
}
- public IEnumerable<Episode> GetEpisodes(User user, DtoOptions options)
+ public IEnumerable<BaseItem> GetEpisodes(User user, DtoOptions options)
{
var seriesKey = GetUniqueSeriesKey(this);
@@ -312,7 +312,7 @@ namespace MediaBrowser.Controller.Entities.TV
var allItems = LibraryManager.GetItemList(query);
- var allSeriesEpisodes = allItems.OfType<Episode>();
+ var allSeriesEpisodes = allItems.OfType<Episode>().ToList();
var allEpisodes = allItems.OfType<Season>()
.SelectMany(i => i.GetEpisodes(this, user, allSeriesEpisodes, options))
@@ -396,7 +396,7 @@ namespace MediaBrowser.Controller.Entities.TV
await ProviderManager.RefreshSingleItem(this, refreshOptions, cancellationToken).ConfigureAwait(false);
}
- public IEnumerable<Episode> GetSeasonEpisodes(Season parentSeason, User user, DtoOptions options)
+ public List<BaseItem> GetSeasonEpisodes(Season parentSeason, User user, DtoOptions options)
{
var queryFromSeries = ConfigurationManager.Configuration.DisplaySpecialsWithinSeasons;
@@ -422,12 +422,12 @@ namespace MediaBrowser.Controller.Entities.TV
}
}
- var allItems = LibraryManager.GetItemList(query).OfType<Episode>();
+ var allItems = LibraryManager.GetItemList(query);
return GetSeasonEpisodes(parentSeason, user, allItems, options);
}
- public IEnumerable<Episode> GetSeasonEpisodes(Season parentSeason, User user, IEnumerable<Episode> allSeriesEpisodes, DtoOptions options)
+ public List<BaseItem> GetSeasonEpisodes(Season parentSeason, User user, IEnumerable<BaseItem> allSeriesEpisodes, DtoOptions options)
{
if (allSeriesEpisodes == null)
{
@@ -438,14 +438,13 @@ namespace MediaBrowser.Controller.Entities.TV
var sortBy = (parentSeason.IndexNumber ?? -1) == 0 ? ItemSortBy.SortName : ItemSortBy.AiredEpisodeOrder;
- return LibraryManager.Sort(episodes, user, new[] { sortBy }, SortOrder.Ascending)
- .Cast<Episode>();
+ return LibraryManager.Sort(episodes, user, new[] { sortBy }, SortOrder.Ascending).ToList();
}
/// <summary>
/// Filters the episodes by season.
/// </summary>
- public static IEnumerable<Episode> FilterEpisodesBySeason(IEnumerable<Episode> episodes, Season parentSeason, bool includeSpecials)
+ public static IEnumerable<BaseItem> FilterEpisodesBySeason(IEnumerable<BaseItem> episodes, Season parentSeason, bool includeSpecials)
{
var seasonNumber = parentSeason.IndexNumber;
var seasonPresentationKey = GetUniqueSeriesKey(parentSeason);
@@ -454,7 +453,9 @@ namespace MediaBrowser.Controller.Entities.TV
return episodes.Where(episode =>
{
- var currentSeasonNumber = supportSpecialsInSeason ? episode.AiredSeasonNumber : episode.ParentIndexNumber;
+ var episodeItem = (Episode) episode;
+
+ var currentSeasonNumber = supportSpecialsInSeason ? episodeItem.AiredSeasonNumber : episode.ParentIndexNumber;
if (currentSeasonNumber.HasValue && seasonNumber.HasValue && currentSeasonNumber.Value == seasonNumber.Value)
{
return true;
@@ -465,7 +466,7 @@ namespace MediaBrowser.Controller.Entities.TV
return true;
}
- var season = episode.Season;
+ var season = episodeItem.Season;
return season != null && string.Equals(GetUniqueSeriesKey(season), seasonPresentationKey, StringComparison.OrdinalIgnoreCase);
});
}
diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs
index d5d229bb3..3c89037cc 100644
--- a/MediaBrowser.Controller/Entities/User.cs
+++ b/MediaBrowser.Controller/Entities/User.cs
@@ -5,7 +5,6 @@ using MediaBrowser.Model.Connect;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Users;
using System;
-using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@@ -166,7 +165,7 @@ namespace MediaBrowser.Controller.Entities
}
}
}
-
+
return _policy;
}
set { _policy = value; }
@@ -195,24 +194,24 @@ namespace MediaBrowser.Controller.Entities
var oldConfigurationDirectory = ConfigurationDirectoryPath;
// Exceptions will be thrown if these paths already exist
- if (FileSystem.DirectoryExists(newConfigDirectory))
+ if (FileSystem.DirectoryExists(newConfigDirectory))
{
FileSystem.DeleteDirectory(newConfigDirectory, true);
}
- if (FileSystem.DirectoryExists(oldConfigurationDirectory))
+ if (FileSystem.DirectoryExists(oldConfigurationDirectory))
{
- FileSystem.MoveDirectory(oldConfigurationDirectory, newConfigDirectory);
+ FileSystem.MoveDirectory(oldConfigurationDirectory, newConfigDirectory);
}
else
{
- FileSystem.CreateDirectory(newConfigDirectory);
+ FileSystem.CreateDirectory(newConfigDirectory);
}
}
Name = newName;
- return RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(Logger, FileSystem))
+ return RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(Logger, FileSystem))
{
ReplaceAllMetadata = true,
ImageRefreshMode = ImageRefreshMode.FullRefresh,
@@ -224,7 +223,8 @@ namespace MediaBrowser.Controller.Entities
public override Task UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken)
{
- return UserManager.UpdateUser(this);
+ UserManager.UpdateUser(this);
+ return Task.FromResult(true);
}
/// <summary>
@@ -279,7 +279,14 @@ namespace MediaBrowser.Controller.Entities
return true;
}
- return schedules.Any(i => IsParentalScheduleAllowed(i, date));
+ foreach (var i in schedules)
+ {
+ if (IsParentalScheduleAllowed(i, date))
+ {
+ return true;
+ }
+ }
+ return false;
}
private bool IsParentalScheduleAllowed(AccessSchedule schedule, DateTime date)
@@ -304,7 +311,14 @@ namespace MediaBrowser.Controller.Entities
public bool IsFolderGrouped(Guid id)
{
- return Configuration.GroupedFolders.Select(i => new Guid(i)).Contains(id);
+ foreach (var i in Configuration.GroupedFolders)
+ {
+ if (new Guid(i) == id)
+ {
+ return true;
+ }
+ }
+ return false;
}
[IgnoreDataMember]
diff --git a/MediaBrowser.Controller/Entities/UserRootFolder.cs b/MediaBrowser.Controller/Entities/UserRootFolder.cs
index d35156345..2ed3bf20f 100644
--- a/MediaBrowser.Controller/Entities/UserRootFolder.cs
+++ b/MediaBrowser.Controller/Entities/UserRootFolder.cs
@@ -24,7 +24,7 @@ namespace MediaBrowser.Controller.Entities
{
if (_childrenIds == null)
{
- var list = base.LoadChildren().ToList();
+ var list = base.LoadChildren();
_childrenIds = list.Select(i => i.Id).ToList();
return list;
}
@@ -81,7 +81,7 @@ namespace MediaBrowser.Controller.Entities
public override int GetChildCount(User user)
{
- return GetChildren(user, true).Count();
+ return GetChildren(user, true).Count;
}
[IgnoreDataMember]
diff --git a/MediaBrowser.Controller/Entities/UserView.cs b/MediaBrowser.Controller/Entities/UserView.cs
index 4c44a613b..66174034d 100644
--- a/MediaBrowser.Controller/Entities/UserView.cs
+++ b/MediaBrowser.Controller/Entities/UserView.cs
@@ -4,9 +4,9 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using System;
using System.Collections.Generic;
+using System.Linq;
using MediaBrowser.Model.Serialization;
using System.Threading.Tasks;
-using System.Linq;
using MediaBrowser.Controller.Dto;
namespace MediaBrowser.Controller.Entities
@@ -60,7 +60,7 @@ namespace MediaBrowser.Controller.Entities
public override int GetChildCount(User user)
{
- return GetChildren(user, true).Count();
+ return GetChildren(user, true).Count;
}
protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query)
@@ -80,7 +80,7 @@ namespace MediaBrowser.Controller.Entities
.GetUserItems(parent, this, ViewType, query).Result;
}
- public override IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)
+ public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren)
{
var result = GetItemList(new InternalItemsQuery
{
@@ -90,7 +90,7 @@ namespace MediaBrowser.Controller.Entities
});
- return result;
+ return result.ToList();
}
public override bool CanDelete()
diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
index 9323404e3..acfa239d3 100644
--- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs
+++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
@@ -533,7 +533,7 @@ namespace MediaBrowser.Controller.Entities
return ConvertToResult(_libraryManager.GetItemList(query));
}
- private QueryResult<BaseItem> ConvertToResult(IEnumerable<BaseItem> items)
+ private QueryResult<BaseItem> ConvertToResult(List<BaseItem> items)
{
var arr = items.ToArray();
return new QueryResult<BaseItem>
@@ -789,7 +789,7 @@ namespace MediaBrowser.Controller.Entities
// This must be the last filter
if (!string.IsNullOrEmpty(query.AdjacentTo))
{
- items = FilterForAdjacency(items, query.AdjacentTo);
+ items = FilterForAdjacency(items.ToList(), query.AdjacentTo);
}
return SortAndPage(items, totalRecordLimit, query, libraryManager, enableSorting);
@@ -1763,10 +1763,8 @@ namespace MediaBrowser.Controller.Entities
return _userViewManager.GetUserSubView(parent.Id.ToString("N"), type, sortName, CancellationToken.None);
}
- public static IEnumerable<BaseItem> FilterForAdjacency(IEnumerable<BaseItem> items, string adjacentToId)
+ public static IEnumerable<BaseItem> FilterForAdjacency(List<BaseItem> list, string adjacentToId)
{
- var list = items.ToList();
-
var adjacentToIdGuid = new Guid(adjacentToId);
var adjacentToItem = list.FirstOrDefault(i => i.Id == adjacentToIdGuid);
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs
index 3b166db92..ffb601dc4 100644
--- a/MediaBrowser.Controller/Entities/Video.cs
+++ b/MediaBrowser.Controller/Entities/Video.cs
@@ -149,18 +149,23 @@ namespace MediaBrowser.Controller.Entities
/// <value>The video3 D format.</value>
public Video3DFormat? Video3DFormat { get; set; }
- /// <summary>
- /// Gets the playable stream files.
- /// </summary>
- /// <returns>List{System.String}.</returns>
- public List<string> GetPlayableStreamFiles()
+ public string[] GetPlayableStreamFileNames()
{
- return GetPlayableStreamFiles(Path);
- }
+ var videoType = VideoType;
- public List<string> GetPlayableStreamFileNames()
- {
- return GetPlayableStreamFiles().Select(System.IO.Path.GetFileName).ToList(); ;
+ if (videoType == VideoType.Iso && IsoType == Model.Entities.IsoType.BluRay)
+ {
+ videoType = VideoType.BluRay;
+ }
+ else if (videoType == VideoType.Iso && IsoType == Model.Entities.IsoType.Dvd)
+ {
+ videoType = VideoType.Dvd;
+ }
+ else
+ {
+ return new string[] { };
+ }
+ return MediaEncoder.GetPlayableStreamFileNames(Path, videoType);
}
/// <summary>
@@ -235,6 +240,41 @@ namespace MediaBrowser.Controller.Entities
}
[IgnoreDataMember]
+ public override SourceType SourceType
+ {
+ get
+ {
+ if (IsActiveRecording())
+ {
+ return SourceType.LiveTV;
+ }
+
+ return base.SourceType;
+ }
+ }
+
+ protected bool IsActiveRecording()
+ {
+ return LiveTvManager.GetActiveRecordingInfo(Path) != null;
+ }
+
+ public override bool CanDelete()
+ {
+ if (IsActiveRecording())
+ {
+ return false;
+ }
+
+ return base.CanDelete();
+ }
+
+ [IgnoreDataMember]
+ public bool IsCompleteMedia
+ {
+ get { return !IsActiveRecording(); }
+ }
+
+ [IgnoreDataMember]
protected virtual bool EnableDefaultVideoUserDataKeys
{
get
@@ -384,37 +424,7 @@ namespace MediaBrowser.Controller.Entities
return base.IsValidFromResolver(newItem);
}
- /// <summary>
- /// Gets the playable stream files.
- /// </summary>
- /// <param name="rootPath">The root path.</param>
- /// <returns>List{System.String}.</returns>
- public List<string> GetPlayableStreamFiles(string rootPath)
- {
- if (VideoType == VideoType.VideoFile)
- {
- return new List<string>();
- }
-
- var allFiles = FileSystem.GetFilePaths(rootPath, true).ToList();
-
- var videoType = VideoType;
-
- if (videoType == VideoType.Iso && IsoType == Model.Entities.IsoType.BluRay)
- {
- videoType = VideoType.BluRay;
- }
- else if (videoType == VideoType.Iso && IsoType == Model.Entities.IsoType.Dvd)
- {
- videoType = VideoType.Dvd;
- }
-
- return QueryPlayableStreamFiles(rootPath, videoType).Select(name => allFiles.FirstOrDefault(f => string.Equals(System.IO.Path.GetFileName(f), name, StringComparison.OrdinalIgnoreCase)))
- .Where(f => !string.IsNullOrEmpty(f))
- .ToList();
- }
-
- public static List<string> QueryPlayableStreamFiles(string rootPath, VideoType videoType)
+ public static string[] QueryPlayableStreamFiles(string rootPath, VideoType videoType)
{
if (videoType == VideoType.Dvd)
{
@@ -423,7 +433,7 @@ namespace MediaBrowser.Controller.Entities
.ThenBy(i => i.FullName)
.Take(1)
.Select(i => i.FullName)
- .ToList();
+ .ToArray();
}
if (videoType == VideoType.BluRay)
{
@@ -432,9 +442,9 @@ namespace MediaBrowser.Controller.Entities
.ThenBy(i => i.FullName)
.Take(1)
.Select(i => i.FullName)
- .ToList();
+ .ToArray();
}
- return new List<string>();
+ return new string[] { };
}
/// <summary>
@@ -616,6 +626,14 @@ namespace MediaBrowser.Controller.Entities
var list = GetAllVideosForMediaSources();
var result = list.Select(i => GetVersionInfo(enablePathSubstitution, i.Item1, i.Item2)).ToList();
+ if (IsActiveRecording())
+ {
+ foreach (var mediaSource in result)
+ {
+ mediaSource.Type = MediaSourceType.Placeholder;
+ }
+ }
+
return result.OrderBy(i =>
{
if (i.VideoType == VideoType.VideoFile)
diff --git a/MediaBrowser.Controller/Entities/Year.cs b/MediaBrowser.Controller/Entities/Year.cs
index 61b1a3b1a..7d820b007 100644
--- a/MediaBrowser.Controller/Entities/Year.cs
+++ b/MediaBrowser.Controller/Entities/Year.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
-using System.Linq;
using MediaBrowser.Model.Serialization;
namespace MediaBrowser.Controller.Entities
diff --git a/MediaBrowser.Controller/IO/FileData.cs b/MediaBrowser.Controller/IO/FileData.cs
index 64a7610fe..880b3a0ce 100644
--- a/MediaBrowser.Controller/IO/FileData.cs
+++ b/MediaBrowser.Controller/IO/FileData.cs
@@ -3,7 +3,6 @@ using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Logging;
using System;
using System.Collections.Generic;
-
using MediaBrowser.Model.IO;
namespace MediaBrowser.Controller.IO
@@ -36,7 +35,7 @@ namespace MediaBrowser.Controller.IO
/// <param name="resolveShortcuts">if set to <c>true</c> [resolve shortcuts].</param>
/// <returns>Dictionary{System.StringFileSystemInfo}.</returns>
/// <exception cref="System.ArgumentNullException">path</exception>
- public static Dictionary<string, FileSystemMetadata> GetFilteredFileSystemEntries(IDirectoryService directoryService,
+ public static FileSystemMetadata[] GetFilteredFileSystemEntries(IDirectoryService directoryService,
string path,
IFileSystem fileSystem,
ILogger logger,
@@ -57,7 +56,7 @@ namespace MediaBrowser.Controller.IO
if (!resolveShortcuts && flattenFolderDepth == 0)
{
- return GetFileSystemDictionary(entries);
+ return entries;
}
var dict = new Dictionary<string, FileSystemMetadata>(StringComparer.OrdinalIgnoreCase);
@@ -98,7 +97,7 @@ namespace MediaBrowser.Controller.IO
{
foreach (var child in GetFilteredFileSystemEntries(directoryService, fullName, fileSystem, logger, args, flattenFolderDepth: flattenFolderDepth - 1, resolveShortcuts: resolveShortcuts))
{
- dict[child.Key] = child.Value;
+ dict[child.FullName] = child;
}
}
else
@@ -107,7 +106,15 @@ namespace MediaBrowser.Controller.IO
}
}
- return dict;
+ var returnResult = new FileSystemMetadata[dict.Count];
+ var index = 0;
+ var values = dict.Values;
+ foreach (var value in values)
+ {
+ returnResult[index] = value;
+ index++;
+ }
+ return returnResult;
}
}
diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs
index 025254d4b..265d4d786 100644
--- a/MediaBrowser.Controller/Library/ILibraryManager.cs
+++ b/MediaBrowser.Controller/Library/ILibraryManager.cs
@@ -195,16 +195,14 @@ namespace MediaBrowser.Controller.Library
/// </summary>
/// <param name="item">The item.</param>
/// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>Task.</returns>
- Task CreateItem(BaseItem item, CancellationToken cancellationToken);
+ void CreateItem(BaseItem item, CancellationToken cancellationToken);
/// <summary>
/// Creates the items.
/// </summary>
/// <param name="items">The items.</param>
/// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>Task.</returns>
- Task CreateItems(IEnumerable<BaseItem> items, CancellationToken cancellationToken);
+ void CreateItems(IEnumerable<BaseItem> items, CancellationToken cancellationToken);
/// <summary>
/// Updates the item.
@@ -277,7 +275,7 @@ namespace MediaBrowser.Controller.Library
/// </summary>
/// <param name="paths">The paths.</param>
/// <returns>IEnumerable{System.String}.</returns>
- IEnumerable<FileSystemMetadata> NormalizeRootPathList(IEnumerable<FileSystemMetadata> paths);
+ List<FileSystemMetadata> NormalizeRootPathList(IEnumerable<FileSystemMetadata> paths);
/// <summary>
/// Registers the item.
@@ -303,7 +301,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="sortName">Name of the sort.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task&lt;UserView&gt;.</returns>
- Task<UserView> GetNamedView(User user,
+ UserView GetNamedView(User user,
string name,
string parentId,
string viewType,
@@ -319,7 +317,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="sortName">Name of the sort.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task&lt;UserView&gt;.</returns>
- Task<UserView> GetNamedView(User user,
+ UserView GetNamedView(User user,
string name,
string viewType,
string sortName,
@@ -363,7 +361,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="sortName">Name of the sort.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task&lt;UserView&gt;.</returns>
- Task<UserView> GetShadowView(BaseItem parent,
+ UserView GetShadowView(BaseItem parent,
string viewType,
string sortName,
CancellationToken cancellationToken);
@@ -471,8 +469,7 @@ namespace MediaBrowser.Controller.Library
/// </summary>
/// <param name="item">The item.</param>
/// <param name="people">The people.</param>
- /// <returns>Task.</returns>
- Task UpdatePeople(BaseItem item, List<PersonInfo> people);
+ void UpdatePeople(BaseItem item, List<PersonInfo> people);
/// <summary>
/// Gets the item ids.
diff --git a/MediaBrowser.Controller/Library/IUserDataManager.cs b/MediaBrowser.Controller/Library/IUserDataManager.cs
index e9954545e..cd4bd2e34 100644
--- a/MediaBrowser.Controller/Library/IUserDataManager.cs
+++ b/MediaBrowser.Controller/Library/IUserDataManager.cs
@@ -4,7 +4,6 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using System;
using System.Threading;
-using System.Threading.Tasks;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Controller.Library
@@ -28,7 +27,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="reason">The reason.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
- Task SaveUserData(Guid userId, IHasUserData item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
+ void SaveUserData(Guid userId, IHasUserData item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
UserItemData GetUserData(IHasUserData user, IHasUserData item);
@@ -40,14 +39,14 @@ namespace MediaBrowser.Controller.Library
/// </summary>
UserItemDataDto GetUserDataDto(IHasUserData item, User user);
- UserItemDataDto GetUserDataDto(IHasUserData item, BaseItemDto itemDto, User user, List<ItemFields> fields);
+ UserItemDataDto GetUserDataDto(IHasUserData item, BaseItemDto itemDto, User user, ItemFields[] fields);
/// <summary>
/// Get all user data for the given user
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
- IEnumerable<UserItemData> GetAllUserData(Guid userId);
+ List<UserItemData> GetAllUserData(Guid userId);
/// <summary>
/// Save the all provided user data for the given user
@@ -56,7 +55,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="userData"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
- Task SaveAllUserData(Guid userId, IEnumerable<UserItemData> userData, CancellationToken cancellationToken);
+ void SaveAllUserData(Guid userId, UserItemData[] userData, CancellationToken cancellationToken);
/// <summary>
/// Updates playstate for an item and returns true or false indicating if it was played to completion
diff --git a/MediaBrowser.Controller/Library/IUserManager.cs b/MediaBrowser.Controller/Library/IUserManager.cs
index ef68d2560..6da3e53aa 100644
--- a/MediaBrowser.Controller/Library/IUserManager.cs
+++ b/MediaBrowser.Controller/Library/IUserManager.cs
@@ -91,7 +91,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="user">The user.</param>
/// <exception cref="System.ArgumentNullException">user</exception>
/// <exception cref="System.ArgumentException"></exception>
- Task UpdateUser(User user);
+ void UpdateUser(User user);
/// <summary>
/// Creates the user.
@@ -116,7 +116,7 @@ namespace MediaBrowser.Controller.Library
/// </summary>
/// <param name="user">The user.</param>
/// <returns>Task.</returns>
- Task ResetPassword(User user);
+ void ResetPassword(User user);
/// <summary>
/// Gets the offline user dto.
@@ -130,7 +130,7 @@ namespace MediaBrowser.Controller.Library
/// </summary>
/// <param name="user">The user.</param>
/// <returns>Task.</returns>
- Task ResetEasyPassword(User user);
+ void ResetEasyPassword(User user);
/// <summary>
/// Changes the password.
@@ -138,7 +138,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="user">The user.</param>
/// <param name="newPasswordSha1">The new password sha1.</param>
/// <returns>Task.</returns>
- Task ChangePassword(User user, string newPasswordSha1);
+ void ChangePassword(User user, string newPasswordSha1);
/// <summary>
/// Changes the easy password.
@@ -146,7 +146,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="user">The user.</param>
/// <param name="newPasswordSha1">The new password sha1.</param>
/// <returns>Task.</returns>
- Task ChangeEasyPassword(User user, string newPasswordSha1);
+ void ChangeEasyPassword(User user, string newPasswordSha1);
/// <summary>
/// Gets the user dto.
@@ -179,7 +179,7 @@ namespace MediaBrowser.Controller.Library
/// </summary>
/// <param name="pin">The pin.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
- Task<PinRedeemResult> RedeemPasswordResetPin(string pin);
+ PinRedeemResult RedeemPasswordResetPin(string pin);
/// <summary>
/// Gets the user policy.
@@ -201,14 +201,14 @@ namespace MediaBrowser.Controller.Library
/// <param name="userId">The user identifier.</param>
/// <param name="newConfiguration">The new configuration.</param>
/// <returns>Task.</returns>
- Task UpdateConfiguration(string userId, UserConfiguration newConfiguration);
+ void UpdateConfiguration(string userId, UserConfiguration newConfiguration);
/// <summary>
/// Updates the user policy.
/// </summary>
/// <param name="userId">The user identifier.</param>
/// <param name="userPolicy">The user policy.</param>
- Task UpdateUserPolicy(string userId, UserPolicy userPolicy);
+ void UpdateUserPolicy(string userId, UserPolicy userPolicy);
/// <summary>
/// Makes the valid username.
diff --git a/MediaBrowser.Controller/Library/IUserViewManager.cs b/MediaBrowser.Controller/Library/IUserViewManager.cs
index b46ece49d..76182c641 100644
--- a/MediaBrowser.Controller/Library/IUserViewManager.cs
+++ b/MediaBrowser.Controller/Library/IUserViewManager.cs
@@ -11,7 +11,7 @@ namespace MediaBrowser.Controller.Library
{
public interface IUserViewManager
{
- Task<IEnumerable<Folder>> GetUserViews(UserViewQuery query, CancellationToken cancellationToken);
+ Task<Folder[]> GetUserViews(UserViewQuery query, CancellationToken cancellationToken);
Task<UserView> GetUserSubView(string name, string parentId, string type, string sortName, CancellationToken cancellationToken);
diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs
index 76b6d8768..56392eee7 100644
--- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs
+++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs
@@ -4,7 +4,6 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.Configuration;
@@ -40,20 +39,7 @@ namespace MediaBrowser.Controller.Library
/// Gets the file system children.
/// </summary>
/// <value>The file system children.</value>
- public IEnumerable<FileSystemMetadata> FileSystemChildren
- {
- get
- {
- var dict = FileSystemDictionary;
-
- if (dict == null)
- {
- return new List<FileSystemMetadata>();
- }
-
- return dict.Values;
- }
- }
+ public FileSystemMetadata[] FileSystemChildren { get; set; }
public LibraryOptions LibraryOptions { get; set; }
@@ -63,12 +49,6 @@ namespace MediaBrowser.Controller.Library
}
/// <summary>
- /// Gets or sets the file system dictionary.
- /// </summary>
- /// <value>The file system dictionary.</value>
- public Dictionary<string, FileSystemMetadata> FileSystemDictionary { get; set; }
-
- /// <summary>
/// Gets or sets the parent.
/// </summary>
/// <value>The parent.</value>
@@ -153,7 +133,14 @@ namespace MediaBrowser.Controller.Library
// Not officially supported but in some cases we can handle it.
if (item == null)
{
- item = parent.GetParents().OfType<T>().FirstOrDefault();
+ var parents = parent.GetParents();
+ foreach (var currentParent in parents)
+ {
+ if (currentParent is T)
+ {
+ return true;
+ }
+ }
}
return item != null;
@@ -186,12 +173,12 @@ namespace MediaBrowser.Controller.Library
/// Gets the physical locations.
/// </summary>
/// <value>The physical locations.</value>
- public IEnumerable<string> PhysicalLocations
+ public string[] PhysicalLocations
{
get
{
var paths = string.IsNullOrWhiteSpace(Path) ? new string[] { } : new[] { Path };
- return AdditionalLocations == null ? paths : paths.Concat(AdditionalLocations);
+ return AdditionalLocations == null ? paths : paths.Concat(AdditionalLocations).ToArray();
}
}
@@ -224,13 +211,11 @@ namespace MediaBrowser.Controller.Library
throw new ArgumentNullException();
}
- if (FileSystemDictionary != null)
+ foreach (var file in FileSystemChildren)
{
- FileSystemMetadata entry;
-
- if (FileSystemDictionary.TryGetValue(path, out entry))
+ if (string.Equals(file.FullName, path, StringComparison.Ordinal))
{
- return entry;
+ return file;
}
}
diff --git a/MediaBrowser.Controller/Library/NameExtensions.cs b/MediaBrowser.Controller/Library/NameExtensions.cs
index 693b7b221..bab334a6d 100644
--- a/MediaBrowser.Controller/Library/NameExtensions.cs
+++ b/MediaBrowser.Controller/Library/NameExtensions.cs
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.Extensions;
@@ -9,25 +7,6 @@ namespace MediaBrowser.Controller.Library
{
public static class NameExtensions
{
- public static bool EqualsAny(IEnumerable<string> names, string x)
- {
- x = NormalizeForComparison(x);
-
- return names.Any(y => string.Compare(x, y, StringComparison.OrdinalIgnoreCase) == 0);
- //return names.Any(y => string.Compare(x, y, CultureInfo.InvariantCulture, CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace) == 0);
- }
-
- private static string NormalizeForComparison(string name)
- {
- if (name == null)
- {
- return string.Empty;
- }
-
- return name;
- //return name.RemoveDiacritics();
- }
-
private static string RemoveDiacritics(string name)
{
if (name == null)
@@ -44,27 +23,4 @@ namespace MediaBrowser.Controller.Library
return names.DistinctBy(RemoveDiacritics, StringComparer.OrdinalIgnoreCase);
}
}
-
- public class DistinctNameComparer : IComparer<string>, IEqualityComparer<string>
- {
- public int Compare(string x, string y)
- {
- if (string.IsNullOrWhiteSpace(x) && string.IsNullOrWhiteSpace(y))
- {
- return 0;
- }
-
- return string.Compare(x.RemoveDiacritics(), y.RemoveDiacritics(), StringComparison.OrdinalIgnoreCase);
- }
-
- public bool Equals(string x, string y)
- {
- return Compare(x, y) == 0;
- }
-
- public int GetHashCode(string obj)
- {
- return (obj ?? string.Empty).GetHashCode();
- }
- }
}
diff --git a/MediaBrowser.Controller/LiveTv/ChannelInfo.cs b/MediaBrowser.Controller/LiveTv/ChannelInfo.cs
index 6682942ad..892a7d5b7 100644
--- a/MediaBrowser.Controller/LiveTv/ChannelInfo.cs
+++ b/MediaBrowser.Controller/LiveTv/ChannelInfo.cs
@@ -25,6 +25,8 @@ namespace MediaBrowser.Controller.LiveTv
/// <value>The id of the channel.</value>
public string Id { get; set; }
+ public string Path { get; set; }
+
public string TunerChannelId { get; set; }
public string CallSign { get; set; }
diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs
index d6855b792..6ff630590 100644
--- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs
+++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs
@@ -243,7 +243,7 @@ namespace MediaBrowser.Controller.LiveTv
/// Gets the recommended programs internal.
/// </summary>
/// <returns>Task&lt;QueryResult&lt;LiveTvProgram&gt;&gt;.</returns>
- Task<QueryResult<LiveTvProgram>> GetRecommendedProgramsInternal(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken);
+ Task<QueryResult<BaseItem>> GetRecommendedProgramsInternal(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken);
/// <summary>
/// Gets the live tv information.
@@ -316,7 +316,7 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="fields">The fields.</param>
/// <param name="user">The user.</param>
/// <returns>Task.</returns>
- Task AddInfoToProgramDto(List<Tuple<BaseItem, BaseItemDto>> programs, List<ItemFields> fields, User user = null);
+ Task AddInfoToProgramDto(List<Tuple<BaseItem, BaseItemDto>> programs, ItemFields[] fields, User user = null);
/// <summary>
/// Saves the tuner host.
@@ -335,7 +335,7 @@ namespace MediaBrowser.Controller.LiveTv
Task<TunerChannelMapping> SetChannelMapping(string providerId, string tunerChannelNumber, string providerChannelNumber);
- TunerChannelMapping GetTunerChannelMapping(ChannelInfo channel, List<NameValuePair> mappings, List<ChannelInfo> providerChannels);
+ TunerChannelMapping GetTunerChannelMapping(ChannelInfo channel, NameValuePair[] mappings, List<ChannelInfo> providerChannels);
/// <summary>
/// Gets the lineups.
@@ -384,5 +384,9 @@ namespace MediaBrowser.Controller.LiveTv
string GetEmbyTvActiveRecordingPath(string id);
Task<LiveStream> GetEmbyTvLiveStream(string id);
+
+ ActiveRecordingInfo GetActiveRecordingInfo(string path);
+
+ void AddInfoToRecordingDto(BaseItem item, BaseItemDto dto, ActiveRecordingInfo activeRecordingInfo, User user = null);
}
}
diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvRecording.cs b/MediaBrowser.Controller/LiveTv/ILiveTvRecording.cs
index 43fc307f4..4b757f0b9 100644
--- a/MediaBrowser.Controller/LiveTv/ILiveTvRecording.cs
+++ b/MediaBrowser.Controller/LiveTv/ILiveTvRecording.cs
@@ -36,4 +36,13 @@ namespace MediaBrowser.Controller.LiveTv
DateTime? EndDate { get; set; }
DateTime DateCreated { get; set; }
}
+
+ public class ActiveRecordingInfo
+ {
+ public string Id { get; set; }
+ public string Path { get; set; }
+ public TimerInfo Timer { get; set; }
+ public ProgramInfo Program { get; set; }
+ public CancellationTokenSource CancellationTokenSource { get; set; }
+ }
}
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs
index 25bc10dec..c29d73253 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs
@@ -6,7 +6,6 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.LiveTv;
using System;
using System.Collections.Generic;
-using System.Linq;
using MediaBrowser.Model.Serialization;
using System.Threading.Tasks;
using MediaBrowser.Controller.Library;
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
index 3efbc41f1..1607dbcba 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
@@ -9,7 +9,6 @@ using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Controller.LiveTv
{
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs
index 2c26d3556..950949f37 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs
@@ -5,7 +5,6 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.LiveTv;
using System;
using System.Collections.Generic;
-using System.Linq;
using MediaBrowser.Model.Serialization;
using System.Threading.Tasks;
using MediaBrowser.Controller.Library;
diff --git a/MediaBrowser.Controller/LiveTv/TimerInfo.cs b/MediaBrowser.Controller/LiveTv/TimerInfo.cs
index 0b94c85fa..a0002241d 100644
--- a/MediaBrowser.Controller/LiveTv/TimerInfo.cs
+++ b/MediaBrowser.Controller/LiveTv/TimerInfo.cs
@@ -109,6 +109,9 @@ namespace MediaBrowser.Controller.LiveTv
public bool IsKids { get; set; }
public bool IsSports { get; set; }
public bool IsNews { get; set; }
+ public bool IsSeries { get; set; }
+ public bool IsLive { get; set; }
+ public bool IsPremiere { get; set; }
public int? ProductionYear { get; set; }
public string EpisodeTitle { get; set; }
public DateTime? OriginalAirDate { get; set; }
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
index 823c893ea..736f1b32f 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
@@ -778,6 +778,11 @@ namespace MediaBrowser.Controller.MediaEncoding
return false;
}
+ if (state.EnableMpDecimate)
+ {
+ return false;
+ }
+
if (videoStream.IsInterlaced)
{
if (request.DeInterlace)
@@ -1449,6 +1454,11 @@ namespace MediaBrowser.Controller.MediaEncoding
}
}
+ if (state.EnableMpDecimate)
+ {
+ filters.Add("mpdecimate,setpts=N/FRAME_RATE/TB");
+ }
+
if (filters.Count > 0)
{
output += string.Format(" -vf \"{0}\"", string.Join(",", filters.ToArray()));
@@ -1521,7 +1531,7 @@ namespace MediaBrowser.Controller.MediaEncoding
{
var inputModifier = string.Empty;
- var numInputFiles = state.PlayableStreamFileNames.Count > 0 ? state.PlayableStreamFileNames.Count : 1;
+ var numInputFiles = state.PlayableStreamFileNames.Length > 0 ? state.PlayableStreamFileNames.Length : 1;
var probeSizeArgument = GetProbeSizeArgument(numInputFiles);
string analyzeDurationArgument;
@@ -1664,24 +1674,24 @@ namespace MediaBrowser.Controller.MediaEncoding
if (mediaSource.VideoType.Value == VideoType.BluRay || mediaSource.VideoType.Value == VideoType.Dvd)
{
- state.PlayableStreamFileNames = Video.QueryPlayableStreamFiles(state.MediaPath, mediaSource.VideoType.Value);
+ state.PlayableStreamFileNames = Video.QueryPlayableStreamFiles(state.MediaPath, mediaSource.VideoType.Value).Select(Path.GetFileName).ToArray();
}
else if (mediaSource.VideoType.Value == VideoType.Iso && state.IsoType == IsoType.BluRay)
{
- state.PlayableStreamFileNames = Video.QueryPlayableStreamFiles(state.MediaPath, VideoType.BluRay);
+ state.PlayableStreamFileNames = Video.QueryPlayableStreamFiles(state.MediaPath, VideoType.BluRay).Select(Path.GetFileName).ToArray();
}
else if (mediaSource.VideoType.Value == VideoType.Iso && state.IsoType == IsoType.Dvd)
{
- state.PlayableStreamFileNames = Video.QueryPlayableStreamFiles(state.MediaPath, VideoType.Dvd);
+ state.PlayableStreamFileNames = Video.QueryPlayableStreamFiles(state.MediaPath, VideoType.Dvd).Select(Path.GetFileName).ToArray();
}
else
{
- state.PlayableStreamFileNames = new List<string>();
+ state.PlayableStreamFileNames = new string[]{};
}
}
else
{
- state.PlayableStreamFileNames = new List<string>();
+ state.PlayableStreamFileNames = new string[] { };
}
if (mediaSource.Timestamp.HasValue)
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
index b552579a8..e76217fda 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
@@ -27,7 +27,7 @@ namespace MediaBrowser.Controller.MediaEncoding
public string MediaPath { get; set; }
public bool IsInputVideo { get; set; }
public IIsoMount IsoMount { get; set; }
- public List<string> PlayableStreamFileNames { get; set; }
+ public string[] PlayableStreamFileNames { get; set; }
public string OutputAudioCodec { get; set; }
public int? OutputVideoBitrate { get; set; }
public MediaStream SubtitleStream { get; set; }
@@ -42,8 +42,8 @@ namespace MediaBrowser.Controller.MediaEncoding
public bool ReadInputAtNativeFramerate { get; set; }
- private List<TranscodeReason> _transcodeReasons = null;
- public List<TranscodeReason> TranscodeReasons
+ private TranscodeReason[] _transcodeReasons = null;
+ public TranscodeReason[] TranscodeReasons
{
get
{
@@ -53,7 +53,7 @@ namespace MediaBrowser.Controller.MediaEncoding
.Split(',')
.Where(i => !string.IsNullOrWhiteSpace(i))
.Select(v => (TranscodeReason)Enum.Parse(typeof(TranscodeReason), v, true))
- .ToList();
+ .ToArray();
}
return _transcodeReasons;
@@ -127,6 +127,11 @@ namespace MediaBrowser.Controller.MediaEncoding
}
}
+ public bool EnableMpDecimate
+ {
+ get { return MediaSource.EnableMpDecimate; }
+ }
+
public string AlbumCoverPath { get; set; }
public string InputAudioSync { get; set; }
@@ -164,7 +169,7 @@ namespace MediaBrowser.Controller.MediaEncoding
_logger = logger;
TranscodingType = jobType;
RemoteHttpHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
- PlayableStreamFileNames = new List<string>();
+ PlayableStreamFileNames = new string[]{};
SupportedAudioCodecs = new List<string>();
SupportedVideoCodecs = new List<string>();
SupportedSubtitleCodecs = new List<string>();
diff --git a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs
index 05bb35771..31cd96c9a 100644
--- a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs
+++ b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs
@@ -1,9 +1,11 @@
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.MediaInfo;
using System;
+using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Dlna;
+using MediaBrowser.Model.IO;
namespace MediaBrowser.Controller.MediaEncoding
{
@@ -102,6 +104,8 @@ namespace MediaBrowser.Controller.MediaEncoding
IProgress<double> progress,
CancellationToken cancellationToken);
+ Task ConvertImage(string inputPath, string outputPath);
+
/// <summary>
/// Escapes the subtitle filter path.
/// </summary>
@@ -116,5 +120,8 @@ namespace MediaBrowser.Controller.MediaEncoding
void SetLogFilename(string name);
void ClearLogFilename();
+
+ string[] GetPlayableStreamFileNames(string path, VideoType videoType);
+ IEnumerable<string> GetPrimaryPlaylistVobFiles(string path, IIsoMount isoMount, uint? titleNumber);
}
}
diff --git a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs
index d5c85197f..70e4db84f 100644
--- a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs
+++ b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs
@@ -1,12 +1,9 @@
using MediaBrowser.Model.IO;
using MediaBrowser.Model.MediaInfo;
using System;
-using System.Collections.Generic;
using System.IO;
using System.Linq;
-using MediaBrowser.Controller.IO;
-
namespace MediaBrowser.Controller.MediaEncoding
{
/// <summary>
@@ -23,34 +20,34 @@ namespace MediaBrowser.Controller.MediaEncoding
/// <param name="isoMount">The iso mount.</param>
/// <param name="playableStreamFileNames">The playable stream file names.</param>
/// <returns>System.String[][].</returns>
- public static string[] GetInputArgument(IFileSystem fileSystem, string videoPath, MediaProtocol protocol, IIsoMount isoMount, List<string> playableStreamFileNames)
+ public static string[] GetInputArgument(IFileSystem fileSystem, string videoPath, MediaProtocol protocol, IIsoMount isoMount, string[] playableStreamFileNames)
{
- if (playableStreamFileNames.Count > 0)
+ if (playableStreamFileNames.Length > 0)
{
if (isoMount == null)
{
- return GetPlayableStreamFiles(fileSystem, videoPath, playableStreamFileNames).ToArray();
+ return GetPlayableStreamFiles(fileSystem, videoPath, playableStreamFileNames);
}
- return GetPlayableStreamFiles(fileSystem, isoMount.MountedPath, playableStreamFileNames).ToArray();
+ return GetPlayableStreamFiles(fileSystem, isoMount.MountedPath, playableStreamFileNames);
}
return new[] {videoPath};
}
- private static List<string> GetPlayableStreamFiles(IFileSystem fileSystem, string rootPath, List<string> filenames)
+ private static string[] GetPlayableStreamFiles(IFileSystem fileSystem, string rootPath, string[] filenames)
{
- if (filenames.Count == 0)
+ if (filenames.Length == 0)
{
- return new List<string>();
+ return new string[]{};
}
var allFiles = fileSystem
.GetFilePaths(rootPath, true)
- .ToList();
+ .ToArray();
return filenames.Select(name => allFiles.FirstOrDefault(f => string.Equals(Path.GetFileName(f), name, StringComparison.OrdinalIgnoreCase)))
.Where(f => !string.IsNullOrEmpty(f))
- .ToList();
+ .ToArray();
}
}
}
diff --git a/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs b/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs
index 0785ee29f..929f4e649 100644
--- a/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs
+++ b/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs
@@ -14,12 +14,12 @@ namespace MediaBrowser.Controller.MediaEncoding
public DlnaProfileType MediaType { get; set; }
public IIsoMount MountedIso { get; set; }
public VideoType VideoType { get; set; }
- public List<string> PlayableStreamFileNames { get; set; }
+ public string[] PlayableStreamFileNames { get; set; }
public int AnalyzeDurationMs { get; set; }
public MediaInfoRequest()
{
- PlayableStreamFileNames = new List<string>();
+ PlayableStreamFileNames = new string[] { };
}
}
}
diff --git a/MediaBrowser.Controller/Notifications/INotificationManager.cs b/MediaBrowser.Controller/Notifications/INotificationManager.cs
index cb1e3da90..f9d264314 100644
--- a/MediaBrowser.Controller/Notifications/INotificationManager.cs
+++ b/MediaBrowser.Controller/Notifications/INotificationManager.cs
@@ -26,7 +26,7 @@ namespace MediaBrowser.Controller.Notifications
/// Gets the notification types.
/// </summary>
/// <returns>IEnumerable{NotificationTypeInfo}.</returns>
- IEnumerable<NotificationTypeInfo> GetNotificationTypes();
+ List<NotificationTypeInfo> GetNotificationTypes();
/// <summary>
/// Gets the notification services.
diff --git a/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs b/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs
index abf96994f..25aba6bd9 100644
--- a/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs
+++ b/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs
@@ -2,7 +2,6 @@
using MediaBrowser.Model.Entities;
using System;
using System.Threading;
-using System.Threading.Tasks;
namespace MediaBrowser.Controller.Persistence
{
@@ -19,9 +18,9 @@ namespace MediaBrowser.Controller.Persistence
/// <param name="client">The client.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
- Task SaveDisplayPreferences(DisplayPreferences displayPreferences, string userId, string client,
+ void SaveDisplayPreferences(DisplayPreferences displayPreferences, string userId, string client,
CancellationToken cancellationToken);
-
+
/// <summary>
/// Saves all display preferences for a user
/// </summary>
@@ -29,7 +28,7 @@ namespace MediaBrowser.Controller.Persistence
/// <param name="userId">The user id.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
- Task SaveAllDisplayPreferences(IEnumerable<DisplayPreferences> displayPreferences, Guid userId,
+ void SaveAllDisplayPreferences(IEnumerable<DisplayPreferences> displayPreferences, Guid userId,
CancellationToken cancellationToken);
/// <summary>
/// Gets the display preferences.
diff --git a/MediaBrowser.Controller/Persistence/IItemRepository.cs b/MediaBrowser.Controller/Persistence/IItemRepository.cs
index bf54914b1..3d05d2fca 100644
--- a/MediaBrowser.Controller/Persistence/IItemRepository.cs
+++ b/MediaBrowser.Controller/Persistence/IItemRepository.cs
@@ -3,7 +3,6 @@ using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.Threading;
-using System.Threading.Tasks;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Querying;
@@ -19,16 +18,14 @@ namespace MediaBrowser.Controller.Persistence
/// </summary>
/// <param name="item">The item.</param>
/// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>Task.</returns>
- Task SaveItem(BaseItem item, CancellationToken cancellationToken);
+ void SaveItem(BaseItem item, CancellationToken cancellationToken);
/// <summary>
/// Deletes the item.
/// </summary>
/// <param name="id">The identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>Task.</returns>
- Task DeleteItem(Guid id, CancellationToken cancellationToken);
+ void DeleteItem(Guid id, CancellationToken cancellationToken);
/// <summary>
/// Gets the critic reviews.
@@ -42,16 +39,14 @@ namespace MediaBrowser.Controller.Persistence
/// </summary>
/// <param name="itemId">The item id.</param>
/// <param name="criticReviews">The critic reviews.</param>
- /// <returns>Task.</returns>
- Task SaveCriticReviews(Guid itemId, IEnumerable<ItemReview> criticReviews);
+ void SaveCriticReviews(Guid itemId, IEnumerable<ItemReview> criticReviews);
/// <summary>
/// Saves the items.
/// </summary>
/// <param name="items">The items.</param>
/// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>Task.</returns>
- Task SaveItems(List<BaseItem> items, CancellationToken cancellationToken);
+ void SaveItems(List<BaseItem> items, CancellationToken cancellationToken);
/// <summary>
/// Retrieves the item.
@@ -78,7 +73,7 @@ namespace MediaBrowser.Controller.Persistence
/// <summary>
/// Saves the chapters.
/// </summary>
- Task SaveChapters(Guid id, List<ChapterInfo> chapters);
+ void SaveChapters(Guid id, List<ChapterInfo> chapters);
/// <summary>
/// Gets the media streams.
@@ -93,8 +88,7 @@ namespace MediaBrowser.Controller.Persistence
/// <param name="id">The identifier.</param>
/// <param name="streams">The streams.</param>
/// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>Task.</returns>
- Task SaveMediaStreams(Guid id, List<MediaStream> streams, CancellationToken cancellationToken);
+ void SaveMediaStreams(Guid id, List<MediaStream> streams, CancellationToken cancellationToken);
/// <summary>
/// Gets the item ids.
@@ -128,8 +122,7 @@ namespace MediaBrowser.Controller.Persistence
/// </summary>
/// <param name="itemId">The item identifier.</param>
/// <param name="people">The people.</param>
- /// <returns>Task.</returns>
- Task UpdatePeople(Guid itemId, List<PersonInfo> people);
+ void UpdatePeople(Guid itemId, List<PersonInfo> people);
/// <summary>
/// Gets the people names.
@@ -156,8 +149,7 @@ namespace MediaBrowser.Controller.Persistence
/// Updates the inherited values.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>Task.</returns>
- Task UpdateInheritedValues(CancellationToken cancellationToken);
+ void UpdateInheritedValues(CancellationToken cancellationToken);
int GetCount(InternalItemsQuery query);
diff --git a/MediaBrowser.Controller/Persistence/IUserDataRepository.cs b/MediaBrowser.Controller/Persistence/IUserDataRepository.cs
index ca4dc9751..f79a3a9fc 100644
--- a/MediaBrowser.Controller/Persistence/IUserDataRepository.cs
+++ b/MediaBrowser.Controller/Persistence/IUserDataRepository.cs
@@ -2,7 +2,6 @@
using MediaBrowser.Controller.Entities;
using System;
using System.Threading;
-using System.Threading.Tasks;
namespace MediaBrowser.Controller.Persistence
{
@@ -19,7 +18,7 @@ namespace MediaBrowser.Controller.Persistence
/// <param name="userData">The user data.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
- Task SaveUserData(Guid userId, string key, UserItemData userData, CancellationToken cancellationToken);
+ void SaveUserData(Guid userId, string key, UserItemData userData, CancellationToken cancellationToken);
/// <summary>
/// Gets the user data.
@@ -36,7 +35,7 @@ namespace MediaBrowser.Controller.Persistence
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
- IEnumerable<UserItemData> GetAllUserData(Guid userId);
+ List<UserItemData> GetAllUserData(Guid userId);
/// <summary>
/// Save all user data associated with the given user
@@ -45,7 +44,7 @@ namespace MediaBrowser.Controller.Persistence
/// <param name="userData"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
- Task SaveAllUserData(Guid userId, IEnumerable<UserItemData> userData, CancellationToken cancellationToken);
+ void SaveAllUserData(Guid userId, UserItemData[] userData, CancellationToken cancellationToken);
}
}
diff --git a/MediaBrowser.Controller/Persistence/IUserRepository.cs b/MediaBrowser.Controller/Persistence/IUserRepository.cs
index 80961a369..721ddb7e3 100644
--- a/MediaBrowser.Controller/Persistence/IUserRepository.cs
+++ b/MediaBrowser.Controller/Persistence/IUserRepository.cs
@@ -1,7 +1,6 @@
using MediaBrowser.Controller.Entities;
using System.Collections.Generic;
using System.Threading;
-using System.Threading.Tasks;
namespace MediaBrowser.Controller.Persistence
{
@@ -16,7 +15,7 @@ namespace MediaBrowser.Controller.Persistence
/// <param name="user">The user.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
- Task DeleteUser(User user, CancellationToken cancellationToken);
+ void DeleteUser(User user, CancellationToken cancellationToken);
/// <summary>
/// Saves the user.
@@ -24,7 +23,7 @@ namespace MediaBrowser.Controller.Persistence
/// <param name="user">The user.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
- Task SaveUser(User user, CancellationToken cancellationToken);
+ void SaveUser(User user, CancellationToken cancellationToken);
/// <summary>
/// Retrieves all users.
diff --git a/MediaBrowser.Controller/Playlists/Playlist.cs b/MediaBrowser.Controller/Playlists/Playlist.cs
index aec0668d4..e36e6ad5d 100644
--- a/MediaBrowser.Controller/Playlists/Playlist.cs
+++ b/MediaBrowser.Controller/Playlists/Playlist.cs
@@ -89,7 +89,7 @@ namespace MediaBrowser.Controller.Playlists
return new List<BaseItem>();
}
- public override IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)
+ public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren)
{
return GetPlayableItems(user, new DtoOptions(true));
}
diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs
index 337bb23a4..d957470d3 100644
--- a/MediaBrowser.Controller/Providers/DirectoryService.cs
+++ b/MediaBrowser.Controller/Providers/DirectoryService.cs
@@ -4,7 +4,6 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
@@ -73,14 +72,23 @@ namespace MediaBrowser.Controller.Providers
return entries;
}
- public IEnumerable<FileSystemMetadata> GetFiles(string path)
+ public List<FileSystemMetadata> GetFiles(string path)
{
return GetFiles(path, false);
}
- public IEnumerable<FileSystemMetadata> GetFiles(string path, bool clearCache)
+ public List<FileSystemMetadata> GetFiles(string path, bool clearCache)
{
- return GetFileSystemEntries(path, clearCache).Where(i => !i.IsDirectory);
+ var list = new List<FileSystemMetadata>();
+ var items = GetFileSystemEntries(path, clearCache);
+ foreach (var item in items)
+ {
+ if (!item.IsDirectory)
+ {
+ list.Add(item);
+ }
+ }
+ return list;
}
public FileSystemMetadata GetFile(string path)
diff --git a/MediaBrowser.Controller/Providers/IDirectoryService.cs b/MediaBrowser.Controller/Providers/IDirectoryService.cs
index 374703948..6f864f4be 100644
--- a/MediaBrowser.Controller/Providers/IDirectoryService.cs
+++ b/MediaBrowser.Controller/Providers/IDirectoryService.cs
@@ -6,7 +6,7 @@ namespace MediaBrowser.Controller.Providers
public interface IDirectoryService
{
FileSystemMetadata[] GetFileSystemEntries(string path);
- IEnumerable<FileSystemMetadata> GetFiles(string path);
+ List<FileSystemMetadata> GetFiles(string path);
FileSystemMetadata GetFile(string path);
}
} \ No newline at end of file
diff --git a/MediaBrowser.Controller/Providers/IProviderManager.cs b/MediaBrowser.Controller/Providers/IProviderManager.cs
index 703666d66..77e6a7e40 100644
--- a/MediaBrowser.Controller/Providers/IProviderManager.cs
+++ b/MediaBrowser.Controller/Providers/IProviderManager.cs
@@ -97,7 +97,7 @@ namespace MediaBrowser.Controller.Providers
/// Gets all metadata plugins.
/// </summary>
/// <returns>IEnumerable{MetadataPlugin}.</returns>
- IEnumerable<MetadataPluginSummary> GetAllMetadataPlugins();
+ MetadataPluginSummary[] GetAllMetadataPlugins();
/// <summary>
/// Gets the external urls.
diff --git a/MediaBrowser.Controller/Providers/MetadataResult.cs b/MediaBrowser.Controller/Providers/MetadataResult.cs
index 99402a969..5ed55ea16 100644
--- a/MediaBrowser.Controller/Providers/MetadataResult.cs
+++ b/MediaBrowser.Controller/Providers/MetadataResult.cs
@@ -1,7 +1,6 @@
using MediaBrowser.Controller.Entities;
using System;
using System.Collections.Generic;
-using System.Linq;
namespace MediaBrowser.Controller.Providers
{
@@ -51,7 +50,15 @@ namespace MediaBrowser.Controller.Providers
UserDataList = new List<UserItemData>();
}
- var userData = UserDataList.FirstOrDefault(i => string.Equals(userId, i.UserId.ToString("N"), StringComparison.OrdinalIgnoreCase));
+ UserItemData userData = null;
+
+ foreach (var i in UserDataList)
+ {
+ if (string.Equals(userId, i.UserId.ToString("N"), StringComparison.OrdinalIgnoreCase))
+ {
+ userData = i;
+ }
+ }
if (userData == null)
{
diff --git a/MediaBrowser.Controller/Providers/SongInfo.cs b/MediaBrowser.Controller/Providers/SongInfo.cs
index 988e931cd..e3a6f5d37 100644
--- a/MediaBrowser.Controller/Providers/SongInfo.cs
+++ b/MediaBrowser.Controller/Providers/SongInfo.cs
@@ -1,4 +1,3 @@
-using System.Collections.Generic;
namespace MediaBrowser.Controller.Providers
{
@@ -6,11 +5,11 @@ namespace MediaBrowser.Controller.Providers
{
public string[] AlbumArtists { get; set; }
public string Album { get; set; }
- public List<string> Artists { get; set; }
+ public string[] Artists { get; set; }
public SongInfo()
{
- Artists = new List<string>();
+ Artists = EmptyStringArray;
AlbumArtists = EmptyStringArray;
}
}
diff --git a/MediaBrowser.Controller/Security/IAuthenticationRepository.cs b/MediaBrowser.Controller/Security/IAuthenticationRepository.cs
index 219b07028..f80ee6e7f 100644
--- a/MediaBrowser.Controller/Security/IAuthenticationRepository.cs
+++ b/MediaBrowser.Controller/Security/IAuthenticationRepository.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Model.Querying;
using System.Threading;
-using System.Threading.Tasks;
namespace MediaBrowser.Controller.Security
{
@@ -12,7 +11,7 @@ namespace MediaBrowser.Controller.Security
/// <param name="info">The information.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
- Task Create(AuthenticationInfo info, CancellationToken cancellationToken);
+ void Create(AuthenticationInfo info, CancellationToken cancellationToken);
/// <summary>
/// Updates the specified information.
@@ -20,7 +19,7 @@ namespace MediaBrowser.Controller.Security
/// <param name="info">The information.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
- Task Update(AuthenticationInfo info, CancellationToken cancellationToken);
+ void Update(AuthenticationInfo info, CancellationToken cancellationToken);
/// <summary>
/// Gets the specified query.
diff --git a/MediaBrowser.Controller/Session/ISessionManager.cs b/MediaBrowser.Controller/Session/ISessionManager.cs
index 8d77e0747..603e5ef76 100644
--- a/MediaBrowser.Controller/Session/ISessionManager.cs
+++ b/MediaBrowser.Controller/Session/ISessionManager.cs
@@ -318,19 +318,19 @@ namespace MediaBrowser.Controller.Session
/// </summary>
/// <param name="accessToken">The access token.</param>
/// <returns>Task.</returns>
- Task Logout(string accessToken);
+ void Logout(string accessToken);
/// <summary>
/// Revokes the user tokens.
/// </summary>
/// <returns>Task.</returns>
- Task RevokeUserTokens(string userId, string currentAccessToken);
+ void RevokeUserTokens(string userId, string currentAccessToken);
/// <summary>
/// Revokes the token.
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns>Task.</returns>
- Task RevokeToken(string id);
+ void RevokeToken(string id);
}
} \ No newline at end of file
diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs
index 11a9ceac4..90c1de2f2 100644
--- a/MediaBrowser.Controller/Session/SessionInfo.cs
+++ b/MediaBrowser.Controller/Session/SessionInfo.cs
@@ -2,7 +2,6 @@
using MediaBrowser.Model.Session;
using System;
using System.Collections.Generic;
-using System.Linq;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Threading;
@@ -22,13 +21,13 @@ namespace MediaBrowser.Controller.Session
_sessionManager = sessionManager;
_logger = logger;
- AdditionalUsers = new List<SessionUserInfo>();
+ AdditionalUsers = new SessionUserInfo[] { };
PlayState = new PlayerStateInfo();
}
public PlayerStateInfo PlayState { get; set; }
- public List<SessionUserInfo> AdditionalUsers { get; set; }
+ public SessionUserInfo[] AdditionalUsers { get; set; }
public ClientCapabilities Capabilities { get; set; }
@@ -42,13 +41,13 @@ namespace MediaBrowser.Controller.Session
/// Gets or sets the playable media types.
/// </summary>
/// <value>The playable media types.</value>
- public List<string> PlayableMediaTypes
+ public string[] PlayableMediaTypes
{
get
{
if (Capabilities == null)
{
- return new List<string>();
+ return new string[] { };
}
return Capabilities.PlayableMediaTypes;
}
@@ -138,13 +137,13 @@ namespace MediaBrowser.Controller.Session
/// Gets or sets the supported commands.
/// </summary>
/// <value>The supported commands.</value>
- public List<string> SupportedCommands
+ public string[] SupportedCommands
{
get
{
if (Capabilities == null)
{
- return new List<string>();
+ return new string[] { };
}
return Capabilities.SupportedCommands;
}
@@ -194,7 +193,19 @@ namespace MediaBrowser.Controller.Session
public bool ContainsUser(Guid userId)
{
- return (UserId ?? Guid.Empty) == userId || AdditionalUsers.Any(i => userId == new Guid(i.UserId));
+ if ((UserId ?? Guid.Empty) == userId)
+ {
+ return true;
+ }
+
+ foreach (var additionalUser in AdditionalUsers)
+ {
+ if (userId == new Guid(additionalUser.UserId))
+ {
+ return true;
+ }
+ }
+ return false;
}
private readonly object _progressLock = new object();
diff --git a/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs b/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs
index d1d5f27be..2199c21e6 100644
--- a/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs
+++ b/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs
@@ -28,7 +28,7 @@ namespace MediaBrowser.Controller.Subtitles
/// <summary>
/// Searches the subtitles.
/// </summary>
- Task<IEnumerable<RemoteSubtitleInfo>> SearchSubtitles(Video video,
+ Task<RemoteSubtitleInfo[]> SearchSubtitles(Video video,
string language,
bool? isPerfectMatch,
CancellationToken cancellationToken);
@@ -39,7 +39,7 @@ namespace MediaBrowser.Controller.Subtitles
/// <param name="request">The request.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{IEnumerable{RemoteSubtitleInfo}}.</returns>
- Task<IEnumerable<RemoteSubtitleInfo>> SearchSubtitles(SubtitleSearchRequest request,
+ Task<RemoteSubtitleInfo[]> SearchSubtitles(SubtitleSearchRequest request,
CancellationToken cancellationToken);
/// <summary>
@@ -74,6 +74,6 @@ namespace MediaBrowser.Controller.Subtitles
/// </summary>
/// <param name="itemId">The item identifier.</param>
/// <returns>IEnumerable{SubtitleProviderInfo}.</returns>
- IEnumerable<SubtitleProviderInfo> GetProviders(string itemId);
+ SubtitleProviderInfo[] GetProviders(string itemId);
}
}
diff --git a/MediaBrowser.Controller/Sync/ISyncManager.cs b/MediaBrowser.Controller/Sync/ISyncManager.cs
index 66f64464f..910d697ec 100644
--- a/MediaBrowser.Controller/Sync/ISyncManager.cs
+++ b/MediaBrowser.Controller/Sync/ISyncManager.cs
@@ -79,7 +79,7 @@ namespace MediaBrowser.Controller.Sync
/// <param name="targetId">The target identifier.</param>
/// <param name="itemIds">The item ids.</param>
/// <returns>Task.</returns>
- Task CancelItems(string targetId, IEnumerable<string> itemIds);
+ Task CancelItems(string targetId, string[] itemIds);
/// <summary>
/// Adds the parts.
@@ -89,9 +89,9 @@ namespace MediaBrowser.Controller.Sync
/// <summary>
/// Gets the synchronize targets.
/// </summary>
- IEnumerable<SyncTarget> GetSyncTargets(string userId);
+ List<SyncTarget> GetSyncTargets(string userId);
- IEnumerable<SyncTarget> GetSyncTargets(string userId, bool? supportsRemoteSync);
+ List<SyncTarget> GetSyncTargets(string userId, bool? supportsRemoteSync);
/// <summary>
/// Supportses the synchronize.
@@ -160,28 +160,24 @@ namespace MediaBrowser.Controller.Sync
/// Gets the quality options.
/// </summary>
/// <param name="targetId">The target identifier.</param>
- /// <returns>IEnumerable&lt;SyncQualityOption&gt;.</returns>
- IEnumerable<SyncQualityOption> GetQualityOptions(string targetId);
+ List<SyncQualityOption> GetQualityOptions(string targetId);
/// <summary>
/// Gets the quality options.
/// </summary>
/// <param name="targetId">The target identifier.</param>
/// <param name="user">The user.</param>
- /// <returns>IEnumerable&lt;SyncQualityOption&gt;.</returns>
- IEnumerable<SyncQualityOption> GetQualityOptions(string targetId, User user);
+ List<SyncQualityOption> GetQualityOptions(string targetId, User user);
/// <summary>
/// Gets the profile options.
/// </summary>
/// <param name="targetId">The target identifier.</param>
- /// <returns>IEnumerable&lt;SyncQualityOption&gt;.</returns>
- IEnumerable<SyncProfileOption> GetProfileOptions(string targetId);
+ List<SyncProfileOption> GetProfileOptions(string targetId);
/// <summary>
/// Gets the profile options.
/// </summary>
/// <param name="targetId">The target identifier.</param>
/// <param name="user">The user.</param>
- /// <returns>IEnumerable&lt;SyncProfileOption&gt;.</returns>
- IEnumerable<SyncProfileOption> GetProfileOptions(string targetId, User user);
+ List<SyncProfileOption> GetProfileOptions(string targetId, User user);
}
}
diff --git a/MediaBrowser.Controller/Sync/ISyncProvider.cs b/MediaBrowser.Controller/Sync/ISyncProvider.cs
index aa4b36427..2f60e124e 100644
--- a/MediaBrowser.Controller/Sync/ISyncProvider.cs
+++ b/MediaBrowser.Controller/Sync/ISyncProvider.cs
@@ -18,13 +18,13 @@ namespace MediaBrowser.Controller.Sync
/// </summary>
/// <param name="userId">The user identifier.</param>
/// <returns>IEnumerable&lt;SyncTarget&gt;.</returns>
- IEnumerable<SyncTarget> GetSyncTargets(string userId);
+ List<SyncTarget> GetSyncTargets(string userId);
/// <summary>
/// Gets all synchronize targets.
/// </summary>
/// <returns>IEnumerable&lt;SyncTarget&gt;.</returns>
- IEnumerable<SyncTarget> GetAllSyncTargets();
+ List<SyncTarget> GetAllSyncTargets();
}
public interface IHasUniqueTargetIds