diff options
Diffstat (limited to 'MediaBrowser.Model')
116 files changed, 551 insertions, 3490 deletions
diff --git a/MediaBrowser.Model/Activity/IActivityManager.cs b/MediaBrowser.Model/Activity/IActivityManager.cs index 7032dff14..396be9573 100644 --- a/MediaBrowser.Model/Activity/IActivityManager.cs +++ b/MediaBrowser.Model/Activity/IActivityManager.cs @@ -1,5 +1,4 @@ using System; -using System.Threading.Tasks; using MediaBrowser.Model.Events; using MediaBrowser.Model.Querying; @@ -9,7 +8,7 @@ namespace MediaBrowser.Model.Activity { event EventHandler<GenericEventArgs<ActivityLogEntry>> EntryCreated; - Task Create(ActivityLogEntry entry); + void Create(ActivityLogEntry entry); QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, int? startIndex, int? limit); } diff --git a/MediaBrowser.Model/Activity/IActivityRepository.cs b/MediaBrowser.Model/Activity/IActivityRepository.cs index c1952d436..8ee87ee2e 100644 --- a/MediaBrowser.Model/Activity/IActivityRepository.cs +++ b/MediaBrowser.Model/Activity/IActivityRepository.cs @@ -1,12 +1,11 @@ using System; -using System.Threading.Tasks; using MediaBrowser.Model.Querying; namespace MediaBrowser.Model.Activity { public interface IActivityRepository { - Task Create(ActivityLogEntry entry); + void Create(ActivityLogEntry entry); QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, int? startIndex, int? limit); } diff --git a/MediaBrowser.Model/ApiClient/ApiClientExtensions.cs b/MediaBrowser.Model/ApiClient/ApiClientExtensions.cs deleted file mode 100644 index 4ae4fe822..000000000 --- a/MediaBrowser.Model/ApiClient/ApiClientExtensions.cs +++ /dev/null @@ -1,48 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Sync; -using System.IO; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Model.ApiClient -{ - /// <summary> - /// Class ApiClientExtensions - /// </summary> - public static class ApiClientExtensions - { - /// <summary> - /// Gets the image stream async. - /// </summary> - /// <param name="apiClient">The API client.</param> - /// <param name="url">The URL.</param> - /// <returns>Task{Stream}.</returns> - public static Task<Stream> GetImageStreamAsync(this IApiClient apiClient, string url) - { - return apiClient.GetImageStreamAsync(url, CancellationToken.None); - } - - public static Task<UserDto[]> GetPublicUsersAsync(this IApiClient apiClient) - { - return apiClient.GetPublicUsersAsync(CancellationToken.None); - } - - public static Task<ItemsResult> GetItemsAsync(this IApiClient apiClient, ItemQuery query) - { - return apiClient.GetItemsAsync(query, CancellationToken.None); - } - - public static Task<SyncDialogOptions> GetSyncOptions(this IApiClient apiClient, SyncJob job) - { - return apiClient.GetSyncOptions(new SyncJobRequest - { - Category = job.Category, - ItemIds = job.RequestedItemIds, - ParentId = job.ParentId, - TargetId = job.TargetId, - UserId = job.UserId - }); - } - } -} diff --git a/MediaBrowser.Model/ApiClient/ApiHelpers.cs b/MediaBrowser.Model/ApiClient/ApiHelpers.cs deleted file mode 100644 index 65b6495ab..000000000 --- a/MediaBrowser.Model/ApiClient/ApiHelpers.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; - -namespace MediaBrowser.Model.ApiClient -{ - public static class ApiHelpers - { - /// <summary> - /// Gets the name of the slug. - /// </summary> - /// <param name="name">The name.</param> - /// <returns>System.String.</returns> - public static string GetSlugName(string name) - { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException("name"); - } - - return name.Replace('/', '-').Replace('?', '-').Replace('&', '-'); - } - } -} diff --git a/MediaBrowser.Model/ApiClient/ConnectionMode.cs b/MediaBrowser.Model/ApiClient/ConnectionMode.cs deleted file mode 100644 index 5dc224d95..000000000 --- a/MediaBrowser.Model/ApiClient/ConnectionMode.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace MediaBrowser.Model.ApiClient -{ - public enum ConnectionMode - { - Local = 1, - Remote = 2, - Manual = 3 - } -}
\ No newline at end of file diff --git a/MediaBrowser.Model/ApiClient/ConnectionOptions.cs b/MediaBrowser.Model/ApiClient/ConnectionOptions.cs deleted file mode 100644 index e12676311..000000000 --- a/MediaBrowser.Model/ApiClient/ConnectionOptions.cs +++ /dev/null @@ -1,29 +0,0 @@ - -namespace MediaBrowser.Model.ApiClient -{ - public class ConnectionOptions - { - /// <summary> - /// Gets or sets a value indicating whether [enable web socket]. - /// </summary> - /// <value><c>true</c> if [enable web socket]; otherwise, <c>false</c>.</value> - public bool EnableWebSocket { get; set; } - /// <summary> - /// Gets or sets a value indicating whether [report capabilities]. - /// </summary> - /// <value><c>true</c> if [report capabilities]; otherwise, <c>false</c>.</value> - public bool ReportCapabilities { get; set; } - /// <summary> - /// Gets or sets a value indicating whether [update date last accessed]. - /// </summary> - /// <value><c>true</c> if [update date last accessed]; otherwise, <c>false</c>.</value> - public bool UpdateDateLastAccessed { get; set; } - - public ConnectionOptions() - { - EnableWebSocket = true; - ReportCapabilities = true; - UpdateDateLastAccessed = true; - } - } -} diff --git a/MediaBrowser.Model/ApiClient/ConnectionResult.cs b/MediaBrowser.Model/ApiClient/ConnectionResult.cs deleted file mode 100644 index 32a80d1a3..000000000 --- a/MediaBrowser.Model/ApiClient/ConnectionResult.cs +++ /dev/null @@ -1,21 +0,0 @@ -using MediaBrowser.Model.Connect; -using MediaBrowser.Model.Dto; -using System.Collections.Generic; - -namespace MediaBrowser.Model.ApiClient -{ - public class ConnectionResult - { - public ConnectionState State { get; set; } - public List<ServerInfo> Servers { get; set; } - public IApiClient ApiClient { get; set; } - public ConnectUser ConnectUser { get; set; } - public UserDto OfflineUser { get; set; } - - public ConnectionResult() - { - State = ConnectionState.Unavailable; - Servers = new List<ServerInfo>(); - } - } -} diff --git a/MediaBrowser.Model/ApiClient/ConnectionState.cs b/MediaBrowser.Model/ApiClient/ConnectionState.cs deleted file mode 100644 index 9b753c7bb..000000000 --- a/MediaBrowser.Model/ApiClient/ConnectionState.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace MediaBrowser.Model.ApiClient -{ - public enum ConnectionState - { - Unavailable = 1, - ServerSignIn = 2, - SignedIn = 3, - ServerSelection = 4, - ConnectSignIn = 5, - OfflineSignIn = 6, - OfflineSignedIn = 7 - } -}
\ No newline at end of file diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs deleted file mode 100644 index 2e9f57087..000000000 --- a/MediaBrowser.Model/ApiClient/IApiClient.cs +++ /dev/null @@ -1,1427 +0,0 @@ -using MediaBrowser.Model.Channels; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Devices; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Events; -using MediaBrowser.Model.Globalization; -using MediaBrowser.Model.LiveTv; -using MediaBrowser.Model.MediaInfo; -using MediaBrowser.Model.Net; -using MediaBrowser.Model.Notifications; -using MediaBrowser.Model.Playlists; -using MediaBrowser.Model.Plugins; -using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Search; -using MediaBrowser.Model.Serialization; -using MediaBrowser.Model.Session; -using MediaBrowser.Model.Sync; -using MediaBrowser.Model.System; -using MediaBrowser.Model.Tasks; -using MediaBrowser.Model.Users; -using System; -using System.Collections.Generic; -using System.IO; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Model.ApiClient -{ - /// <summary> - /// Interface IApiClient - /// </summary> - public interface IApiClient : IServerEvents, IDisposable - { - /// <summary> - /// Occurs when [remote logged out]. - /// </summary> - event EventHandler<GenericEventArgs<RemoteLogoutReason>> RemoteLoggedOut; - - /// <summary> - /// Gets the API URL. - /// </summary> - /// <param name="handler">The handler.</param> - /// <returns>System.String.</returns> - string GetApiUrl(string handler); - - /// <summary> - /// Gets the game system summaries async. - /// </summary> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{List{GameSystemSummary}}.</returns> - Task<List<GameSystemSummary>> GetGameSystemSummariesAsync(CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the async. - /// </summary> - /// <typeparam name="T"></typeparam> - /// <param name="url">The URL.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{``0}.</returns> - Task<T> GetAsync<T>(string url, CancellationToken cancellationToken = default(CancellationToken)) - where T : class; - - /// <summary> - /// Reports the capabilities. - /// </summary> - /// <param name="capabilities">The capabilities.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task.</returns> - Task ReportCapabilities(ClientCapabilities capabilities, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Logouts this instance. - /// </summary> - /// <returns>Task.</returns> - Task Logout(); - - /// <summary> - /// Gets the index of the game players. - /// </summary> - /// <param name="userId">The user id.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{List{ItemIndex}}.</returns> - Task<List<ItemIndex>> GetGamePlayerIndex(string userId, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the index of the year. - /// </summary> - /// <param name="userId">The user id.</param> - /// <param name="includeItemTypes">The include item types.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{List{ItemIndex}}.</returns> - Task<List<ItemIndex>> GetYearIndex(string userId, string[] includeItemTypes, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the critic reviews. - /// </summary> - /// <param name="itemId">The item id.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <param name="startIndex">The start index.</param> - /// <param name="limit">The limit.</param> - /// <returns>Task{ItemReviewsResult}.</returns> - Task<QueryResult<ItemReview>> GetCriticReviews(string itemId, CancellationToken cancellationToken = default(CancellationToken), int? startIndex = null, int? limit = null); - - /// <summary> - /// Gets the theme songs async. - /// </summary> - /// <param name="userId">The user id.</param> - /// <param name="itemId">The item id.</param> - /// <param name="inheritFromParents">if set to <c>true</c> [inherit from parents].</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{ThemeMediaResult}.</returns> - Task<ThemeMediaResult> GetThemeSongsAsync(string userId, string itemId, bool inheritFromParents, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the search hints async. - /// </summary> - /// <param name="query">The query.</param> - /// <returns>Task{SearchHintResult}.</returns> - Task<SearchHintResult> GetSearchHintsAsync(SearchQuery query); - - /// <summary> - /// Gets the filters. - /// </summary> - /// <param name="userId">The user identifier.</param> - /// <param name="parentId">The parent identifier.</param> - /// <param name="mediaTypes">The media types.</param> - /// <param name="itemTypes">The item types.</param> - /// <returns>Task<QueryFilters>.</returns> - Task<QueryFilters> GetFilters(string userId, string parentId, string[] mediaTypes, string[] itemTypes); - - /// <summary> - /// Gets the theme videos async. - /// </summary> - /// <param name="userId">The user id.</param> - /// <param name="itemId">The item id.</param> - /// <param name="inheritFromParents">if set to <c>true</c> [inherit from parents].</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{ThemeMediaResult}.</returns> - Task<ThemeMediaResult> GetThemeVideosAsync(string userId, string itemId, bool inheritFromParents, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets all theme media async. - /// </summary> - /// <param name="userId">The user id.</param> - /// <param name="itemId">The item id.</param> - /// <param name="inheritFromParents">if set to <c>true</c> [inherit from parents].</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{AllThemeMediaResult}.</returns> - Task<AllThemeMediaResult> GetAllThemeMediaAsync(string userId, string itemId, bool inheritFromParents, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Marks the notifications read. - /// </summary> - /// <param name="userId">The user id.</param> - /// <param name="notificationIdList">The notification id list.</param> - /// <param name="isRead">if set to <c>true</c> [is read].</param> - /// <returns>Task.</returns> - Task MarkNotificationsRead(string userId, IEnumerable<string> notificationIdList, bool isRead); - - /// <summary> - /// Gets the notifications summary. - /// </summary> - /// <param name="userId">The user id.</param> - /// <returns>Task{NotificationsSummary}.</returns> - Task<NotificationsSummary> GetNotificationsSummary(string userId); - - /// <summary> - /// Gets the notifications async. - /// </summary> - /// <param name="query">The query.</param> - /// <returns>Task{NotificationResult}.</returns> - Task<NotificationResult> GetNotificationsAsync(NotificationQuery query); - - /// <summary> - /// Gets an image stream based on a url - /// </summary> - /// <param name="url">The URL.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{Stream}.</returns> - /// <exception cref="ArgumentNullException">url</exception> - Task<Stream> GetImageStreamAsync(string url, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the stream. - /// </summary> - /// <param name="url">The URL.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task<Stream>.</returns> - Task<Stream> GetStream(string url, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the response. - /// </summary> - /// <param name="url">The URL.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task<HttpResponse>.</returns> - Task<HttpResponse> GetResponse(string url, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Updates the user configuration. - /// </summary> - /// <param name="userId">The user identifier.</param> - /// <param name="configuration">The configuration.</param> - /// <returns>Task.</returns> - Task UpdateUserConfiguration(string userId, UserConfiguration configuration); - - /// <summary> - /// Gets a BaseItem - /// </summary> - /// <param name="id">The id.</param> - /// <param name="userId">The user id.</param> - /// <returns>Task{BaseItemDto}.</returns> - /// <exception cref="ArgumentNullException">id</exception> - Task<BaseItemDto> GetItemAsync(string id, string userId); - - /// <summary> - /// Gets the latest items. - /// </summary> - /// <param name="query">The query.</param> - /// <returns>Task<QueryResult<BaseItemDto>>.</returns> - Task<BaseItemDto[]> GetLatestItems(LatestItemsQuery query); - - /// <summary> - /// Gets the intros async. - /// </summary> - /// <param name="itemId">The item id.</param> - /// <param name="userId">The user id.</param> - /// <returns>Task{ItemsResult}.</returns> - Task<ItemsResult> GetIntrosAsync(string itemId, string userId); - - /// <summary> - /// Gets a BaseItem - /// </summary> - /// <param name="userId">The user id.</param> - /// <returns>Task{BaseItemDto}.</returns> - /// <exception cref="ArgumentNullException">userId</exception> - Task<BaseItemDto> GetRootFolderAsync(string userId); - - /// <summary> - /// Gets the additional parts. - /// </summary> - /// <param name="itemId">The item identifier.</param> - /// <param name="userId">The user identifier.</param> - /// <returns>Task{BaseItemDto[]}.</returns> - Task<ItemsResult> GetAdditionalParts(string itemId, string userId); - - /// <summary> - /// Gets the playback information. - /// </summary> - /// <param name="request">The request.</param> - /// <returns>Task<LiveMediaInfoResult>.</returns> - Task<PlaybackInfoResponse> GetPlaybackInfo(PlaybackInfoRequest request); - - /// <summary> - /// Gets the users async. - /// </summary> - /// <param name="query">The query.</param> - /// <returns>Task{UserDto[]}.</returns> - Task<UserDto[]> GetUsersAsync(UserQuery query); - - /// <summary> - /// Gets the public users async. - /// </summary> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{UserDto[]}.</returns> - Task<UserDto[]> GetPublicUsersAsync(CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets active client sessions. - /// </summary> - /// <param name="query">The query.</param> - /// <returns>Task{SessionInfoDto[]}.</returns> - Task<SessionInfoDto[]> GetClientSessionsAsync(SessionQuery query); - - /// <summary> - /// Gets the client session asynchronous. - /// </summary> - /// <returns>Task{SessionInfoDto}.</returns> - Task<SessionInfoDto> GetCurrentSessionAsync(CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the item counts async. - /// </summary> - /// <param name="query">The query.</param> - /// <returns>Task{ItemCounts}.</returns> - Task<ItemCounts> GetItemCountsAsync(ItemCountsQuery query); - - /// <summary> - /// Gets the episodes asynchronous. - /// </summary> - /// <param name="query">The query.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{ItemsResult}.</returns> - Task<ItemsResult> GetEpisodesAsync(EpisodeQuery query, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the seasons asynchronous. - /// </summary> - /// <param name="query">The query.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{ItemsResult}.</returns> - Task<ItemsResult> GetSeasonsAsync(SeasonQuery query, CancellationToken cancellationToken = default(CancellationToken)); - - Task<PluginSecurityInfo> GetRegistrationInfo(); - - /// <summary> - /// Queries for items - /// </summary> - /// <param name="query">The query.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{ItemsResult}.</returns> - /// <exception cref="ArgumentNullException">query</exception> - Task<ItemsResult> GetItemsAsync(ItemQuery query, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the user views. - /// </summary> - /// <param name="userId">The user identifier.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task<ItemsResult>.</returns> - Task<ItemsResult> GetUserViews(string userId, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the instant mix from item asynchronous. - /// </summary> - /// <param name="query">The query.</param> - /// <returns>Task<ItemsResult>.</returns> - Task<ItemsResult> GetInstantMixFromItemAsync(SimilarItemsQuery query); - - /// <summary> - /// Gets the similar movies async. - /// </summary> - /// <param name="query">The query.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{ItemsResult}.</returns> - Task<ItemsResult> GetSimilarItemsAsync(SimilarItemsQuery query, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the people async. - /// </summary> - /// <param name="query">The query.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{ItemsResult}.</returns> - /// <exception cref="ArgumentNullException">userId</exception> - Task<ItemsResult> GetPeopleAsync(PersonsQuery query, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the artists. - /// </summary> - /// <param name="query">The query.</param> - /// <returns>Task{ItemsResult}.</returns> - /// <exception cref="ArgumentNullException">userId</exception> - Task<ItemsResult> GetArtistsAsync(ArtistsQuery query); - - /// <summary> - /// Gets the album artists asynchronous. - /// </summary> - /// <param name="query">The query.</param> - /// <returns>Task{ItemsResult}.</returns> - Task<ItemsResult> GetAlbumArtistsAsync(ArtistsQuery query); - - /// <summary> - /// Gets the next up async. - /// </summary> - /// <param name="query">The query.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{ItemsResult}.</returns> - Task<ItemsResult> GetNextUpEpisodesAsync(NextUpQuery query, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the upcoming episodes asynchronous. - /// </summary> - /// <param name="query">The query.</param> - /// <returns>Task{ItemsResult}.</returns> - Task<ItemsResult> GetUpcomingEpisodesAsync(UpcomingEpisodesQuery query); - - /// <summary> - /// Gets a genre - /// </summary> - /// <param name="name">The name.</param> - /// <param name="userId">The user id.</param> - /// <returns>Task{BaseItemDto}.</returns> - /// <exception cref="ArgumentNullException">userId</exception> - Task<BaseItemDto> GetGenreAsync(string name, string userId); - - /// <summary> - /// Gets the genres async. - /// </summary> - /// <param name="query">The query.</param> - /// <returns>Task{ItemsResult}.</returns> - Task<ItemsResult> GetGenresAsync(ItemsByNameQuery query); - - /// <summary> - /// Gets the studios async. - /// </summary> - /// <param name="query">The query.</param> - /// <returns>Task{ItemsResult}.</returns> - Task<ItemsResult> GetStudiosAsync(ItemsByNameQuery query); - - /// <summary> - /// Gets the music genre async. - /// </summary> - /// <param name="name">The name.</param> - /// <param name="userId">The user id.</param> - /// <returns>Task{BaseItemDto}.</returns> - Task<BaseItemDto> GetMusicGenreAsync(string name, string userId); - - /// <summary> - /// Gets the game genre async. - /// </summary> - /// <param name="name">The name.</param> - /// <param name="userId">The user id.</param> - /// <returns>Task{BaseItemDto}.</returns> - Task<BaseItemDto> GetGameGenreAsync(string name, string userId); - - /// <summary> - /// Restarts the server. - /// </summary> - /// <returns>Task.</returns> - Task RestartServerAsync(); - - /// <summary> - /// Gets the system status async. - /// </summary> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{SystemInfo}.</returns> - Task<SystemInfo> GetSystemInfoAsync(CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the public system information asynchronous. - /// </summary> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task<PublicSystemInfo>.</returns> - Task<PublicSystemInfo> GetPublicSystemInfoAsync(CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets a list of plugins installed on the server - /// </summary> - /// <returns>Task{PluginInfo[]}.</returns> - Task<PluginInfo[]> GetInstalledPluginsAsync(); - - /// <summary> - /// Gets the current server configuration - /// </summary> - /// <returns>Task{ServerConfiguration}.</returns> - Task<ServerConfiguration> GetServerConfigurationAsync(); - - /// <summary> - /// Gets the scheduled tasks. - /// </summary> - /// <returns>Task{TaskInfo[]}.</returns> - Task<TaskInfo[]> GetScheduledTasksAsync(); - - /// <summary> - /// Gets the scheduled task async. - /// </summary> - /// <param name="id">The id.</param> - /// <returns>Task{TaskInfo}.</returns> - /// <exception cref="ArgumentNullException">id</exception> - Task<TaskInfo> GetScheduledTaskAsync(string id); - - /// <summary> - /// Gets a user by id - /// </summary> - /// <param name="id">The id.</param> - /// <returns>Task{UserDto}.</returns> - /// <exception cref="ArgumentNullException">id</exception> - Task<UserDto> GetUserAsync(string id); - - /// <summary> - /// Gets the offline user asynchronous. - /// </summary> - /// <param name="id">The identifier.</param> - /// <returns>Task<UserDto>.</returns> - Task<UserDto> GetOfflineUserAsync(string id); - - /// <summary> - /// Gets the parental ratings async. - /// </summary> - /// <returns>Task{List{ParentalRating}}.</returns> - Task<List<ParentalRating>> GetParentalRatingsAsync(); - - /// <summary> - /// Gets local trailers for an item - /// </summary> - /// <param name="userId">The user id.</param> - /// <param name="itemId">The item id.</param> - /// <returns>Task{ItemsResult}.</returns> - /// <exception cref="ArgumentNullException">query</exception> - Task<BaseItemDto[]> GetLocalTrailersAsync(string userId, string itemId); - - /// <summary> - /// Gets special features for an item - /// </summary> - /// <param name="userId">The user id.</param> - /// <param name="itemId">The item id.</param> - /// <returns>Task{BaseItemDto[]}.</returns> - /// <exception cref="ArgumentNullException">userId</exception> - Task<BaseItemDto[]> GetSpecialFeaturesAsync(string userId, string itemId); - - /// <summary> - /// Gets the cultures async. - /// </summary> - /// <returns>Task{CultureDto[]}.</returns> - Task<CultureDto[]> GetCulturesAsync(); - - /// <summary> - /// Gets the countries async. - /// </summary> - /// <returns>Task{CountryInfo[]}.</returns> - Task<CountryInfo[]> GetCountriesAsync(); - - /// <summary> - /// Marks the played async. - /// </summary> - /// <param name="itemId">The item id.</param> - /// <param name="userId">The user id.</param> - /// <param name="datePlayed">The date played.</param> - /// <returns>Task{UserItemDataDto}.</returns> - Task<UserItemDataDto> MarkPlayedAsync(string itemId, string userId, DateTime? datePlayed); - - /// <summary> - /// Marks the unplayed async. - /// </summary> - /// <param name="itemId">The item id.</param> - /// <param name="userId">The user id.</param> - /// <returns>Task{UserItemDataDto}.</returns> - Task<UserItemDataDto> MarkUnplayedAsync(string itemId, string userId); - - /// <summary> - /// Updates the favorite status async. - /// </summary> - /// <param name="itemId">The item id.</param> - /// <param name="userId">The user id.</param> - /// <param name="isFavorite">if set to <c>true</c> [is favorite].</param> - /// <returns>Task.</returns> - /// <exception cref="ArgumentNullException">itemId</exception> - Task<UserItemDataDto> UpdateFavoriteStatusAsync(string itemId, string userId, bool isFavorite); - - /// <summary> - /// Reports to the server that the user has begun playing an item - /// </summary> - /// <param name="info">The information.</param> - /// <returns>Task{UserItemDataDto}.</returns> - /// <exception cref="ArgumentNullException">itemId</exception> - Task ReportPlaybackStartAsync(PlaybackStartInfo info); - - /// <summary> - /// Reports playback progress to the server - /// </summary> - /// <param name="info">The information.</param> - /// <returns>Task{UserItemDataDto}.</returns> - /// <exception cref="ArgumentNullException">itemId</exception> - Task ReportPlaybackProgressAsync(PlaybackProgressInfo info); - - /// <summary> - /// Reports to the server that the user has stopped playing an item - /// </summary> - /// <param name="info">The information.</param> - /// <returns>Task{UserItemDataDto}.</returns> - /// <exception cref="ArgumentNullException">itemId</exception> - Task ReportPlaybackStoppedAsync(PlaybackStopInfo info); - - /// <summary> - /// Instructs another client to browse to a library item. - /// </summary> - /// <param name="sessionId">The session id.</param> - /// <param name="itemId">The id of the item to browse to.</param> - /// <param name="itemName">The name of the item to browse to.</param> - /// <param name="itemType">The type of the item to browse to.</param> - /// <returns>Task.</returns> - Task SendBrowseCommandAsync(string sessionId, string itemId, string itemName, string itemType); - - /// <summary> - /// Sends the playstate command async. - /// </summary> - /// <param name="sessionId">The session id.</param> - /// <param name="request">The request.</param> - /// <returns>Task.</returns> - Task SendPlaystateCommandAsync(string sessionId, PlaystateRequest request); - - /// <summary> - /// Sends the play command async. - /// </summary> - /// <param name="sessionId">The session id.</param> - /// <param name="request">The request.</param> - /// <returns>Task.</returns> - /// <exception cref="ArgumentNullException">sessionId - /// or - /// request</exception> - Task SendPlayCommandAsync(string sessionId, PlayRequest request); - - /// <summary> - /// Sends the command asynchronous. - /// </summary> - /// <param name="sessionId">The session identifier.</param> - /// <param name="command">The command.</param> - /// <returns>Task.</returns> - Task SendCommandAsync(string sessionId, GeneralCommand command); - - /// <summary> - /// Sends the string. - /// </summary> - /// <param name="sessionId">The session identifier.</param> - /// <param name="text">The text.</param> - /// <returns>Task.</returns> - Task SendString(string sessionId, string text); - - /// <summary> - /// Sets the volume. - /// </summary> - /// <param name="sessionId">The session identifier.</param> - /// <param name="volume">The volume.</param> - /// <returns>Task.</returns> - Task SetVolume(string sessionId, int volume); - - /// <summary> - /// Stops the transcoding processes. - /// </summary> - /// <param name="deviceId">The device identifier.</param> - /// <param name="streamId">The stream identifier.</param> - /// <returns>Task.</returns> - Task StopTranscodingProcesses(string deviceId, string streamId); - - /// <summary> - /// Sets the index of the audio stream. - /// </summary> - /// <param name="sessionId">The session identifier.</param> - /// <param name="index">The index.</param> - /// <returns>Task.</returns> - Task SetAudioStreamIndex(string sessionId, int index); - - /// <summary> - /// Sets the index of the subtitle stream. - /// </summary> - /// <param name="sessionId">The session identifier.</param> - /// <param name="index">The index.</param> - /// <returns>Task.</returns> - Task SetSubtitleStreamIndex(string sessionId, int? index); - - /// <summary> - /// Instructs the client to display a message to the user - /// </summary> - /// <param name="sessionId">The session id.</param> - /// <param name="command">The command.</param> - /// <returns>Task.</returns> - Task SendMessageCommandAsync(string sessionId, MessageCommand command); - - /// <summary> - /// Clears a user's rating for an item - /// </summary> - /// <param name="itemId">The item id.</param> - /// <param name="userId">The user id.</param> - /// <returns>Task{UserItemDataDto}.</returns> - /// <exception cref="ArgumentNullException">itemId</exception> - Task<UserItemDataDto> ClearUserItemRatingAsync(string itemId, string userId); - - /// <summary> - /// Updates a user's rating for an item, based on likes or dislikes - /// </summary> - /// <param name="itemId">The item id.</param> - /// <param name="userId">The user id.</param> - /// <param name="likes">if set to <c>true</c> [likes].</param> - /// <returns>Task.</returns> - /// <exception cref="ArgumentNullException">itemId</exception> - Task<UserItemDataDto> UpdateUserItemRatingAsync(string itemId, string userId, bool likes); - - /// <summary> - /// Authenticates a user and returns the result - /// </summary> - /// <param name="username">The username.</param> - /// <param name="password">The password.</param> - /// <returns>Task.</returns> - /// <exception cref="ArgumentNullException">userId</exception> - Task<AuthenticationResult> AuthenticateUserAsync(string username, - string password); - - /// <summary> - /// Updates the server configuration async. - /// </summary> - /// <param name="configuration">The configuration.</param> - /// <returns>Task.</returns> - /// <exception cref="ArgumentNullException">configuration</exception> - Task UpdateServerConfigurationAsync(ServerConfiguration configuration); - - /// <summary> - /// Updates the scheduled task triggers. - /// </summary> - /// <param name="id">The id.</param> - /// <param name="triggers">The triggers.</param> - /// <returns>Task{RequestResult}.</returns> - /// <exception cref="ArgumentNullException">id</exception> - Task UpdateScheduledTaskTriggersAsync(string id, TaskTriggerInfo[] triggers); - - /// <summary> - /// Gets the display preferences. - /// </summary> - /// <param name="id">The id.</param> - /// <param name="userId">The user id.</param> - /// <param name="client">The client.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{BaseItemDto}.</returns> - Task<DisplayPreferences> GetDisplayPreferencesAsync(string id, string userId, string client, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Updates display preferences for a user - /// </summary> - /// <param name="displayPreferences">The display preferences.</param> - /// <param name="userId">The user id.</param> - /// <param name="client">The client.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{DisplayPreferences}.</returns> - /// <exception cref="System.ArgumentNullException">userId</exception> - Task UpdateDisplayPreferencesAsync(DisplayPreferences displayPreferences, string userId, string client, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Posts a set of data to a url, and deserializes the return stream into T - /// </summary> - /// <typeparam name="T"></typeparam> - /// <param name="url">The URL.</param> - /// <param name="args">The args.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{``0}.</returns> - Task<T> PostAsync<T>(string url, Dictionary<string, string> args, CancellationToken cancellationToken = default(CancellationToken)) - where T : class; - - /// <summary> - /// This is a helper around getting a stream from the server that contains serialized data - /// </summary> - /// <param name="url">The URL.</param> - /// <returns>Task{Stream}.</returns> - Task<Stream> GetSerializedStreamAsync(string url); - - /// <summary> - /// Gets the json serializer. - /// </summary> - /// <value>The json serializer.</value> - IJsonSerializer JsonSerializer { get; set; } - - /// <summary> - /// Gets or sets the server address - /// </summary> - /// <value>The server address.</value> - string ServerAddress { get; } - - /// <summary> - /// Gets or sets the type of the client. - /// </summary> - /// <value>The type of the client.</value> - string ClientName { get; set; } - - /// <summary> - /// Gets the device. - /// </summary> - /// <value>The device.</value> - IDevice Device { get; } - - /// <summary> - /// Gets or sets the name of the device. - /// </summary> - /// <value>The name of the device.</value> - string DeviceName { get; } - - /// <summary> - /// Gets or sets the device id. - /// </summary> - /// <value>The device id.</value> - string DeviceId { get; } - - /// <summary> - /// Gets or sets the current user id. - /// </summary> - /// <value>The current user id.</value> - string CurrentUserId { get; } - - /// <summary> - /// Gets the access token. - /// </summary> - /// <value>The access token.</value> - string AccessToken { get; } - - /// <summary> - /// Sets the authentication information. - /// </summary> - /// <param name="accessToken">The access token.</param> - /// <param name="userId">The user identifier.</param> - void SetAuthenticationInfo(string accessToken, string userId); - - /// <summary> - /// Sets the authentication information. - /// </summary> - /// <param name="accessToken">The access token.</param> - void SetAuthenticationInfo(string accessToken); - - /// <summary> - /// Clears the authentication information. - /// </summary> - void ClearAuthenticationInfo(); - - /// <summary> - /// Changes the server location. - /// </summary> - /// <param name="address">The address.</param> - /// <param name="keepExistingAuth">if set to <c>true</c> [keep existing authentication].</param> - void ChangeServerLocation(string address, bool keepExistingAuth = false); - - /// <summary> - /// Starts the receiving synchronize job updates. - /// </summary> - /// <param name="intervalMs">The interval ms.</param> - /// <param name="jobId">The job identifier.</param> - /// <returns>Task.</returns> - Task StartReceivingSyncJobUpdates(int intervalMs, string jobId); - - /// <summary> - /// Stops the receiving synchronize job updates. - /// </summary> - /// <returns>Task.</returns> - Task StopReceivingSyncJobUpdates(); - - /// <summary> - /// Starts the receiving synchronize jobs updates. - /// </summary> - /// <param name="intervalMs">The interval ms.</param> - /// <param name="userId">The user identifier.</param> - /// <param name="targetId">The target identifier.</param> - /// <returns>Task.</returns> - Task StartReceivingSyncJobsUpdates(int intervalMs, string userId, string targetId); - - /// <summary> - /// Stops the receiving synchronize jobs updates. - /// </summary> - /// <returns>Task.</returns> - Task StopReceivingSyncJobsUpdates(); - - /// <summary> - /// Starts the receiving session updates. - /// </summary> - /// <param name="intervalMs">The interval ms.</param> - /// <returns>Task.</returns> - Task StartReceivingSessionUpdates(int intervalMs); - - /// <summary> - /// Stops the receiving session updates. - /// </summary> - /// <returns>Task.</returns> - Task StopReceivingSessionUpdates(); - - /// <summary> - /// Gets the image URL. - /// </summary> - /// <param name="item">The item.</param> - /// <param name="options">The options.</param> - /// <returns>System.String.</returns> - /// <exception cref="ArgumentNullException">item</exception> - string GetImageUrl(BaseItemDto item, ImageOptions options); - - /// <summary> - /// Gets the image URL. - /// </summary> - /// <param name="item">The item.</param> - /// <param name="options">The options.</param> - /// <returns>System.String.</returns> - string GetImageUrl(ChannelInfoDto item, ImageOptions options); - - /// <summary> - /// Gets the subtitle URL. - /// </summary> - /// <param name="options">The options.</param> - /// <returns>System.String.</returns> - string GetSubtitleUrl(SubtitleDownloadOptions options); - - /// <summary> - /// Gets an image url that can be used to download an image from the api - /// </summary> - /// <param name="itemId">The Id of the item</param> - /// <param name="options">The options.</param> - /// <returns>System.String.</returns> - /// <exception cref="ArgumentNullException">itemId</exception> - string GetImageUrl(string itemId, ImageOptions options); - - /// <summary> - /// Gets the user image URL. - /// </summary> - /// <param name="user">The user.</param> - /// <param name="options">The options.</param> - /// <returns>System.String.</returns> - /// <exception cref="ArgumentNullException">user</exception> - string GetUserImageUrl(UserDto user, ImageOptions options); - - /// <summary> - /// Gets an image url that can be used to download an image from the api - /// </summary> - /// <param name="userId">The Id of the user</param> - /// <param name="options">The options.</param> - /// <returns>System.String.</returns> - /// <exception cref="ArgumentNullException">userId</exception> - string GetUserImageUrl(string userId, ImageOptions options); - - /// <summary> - /// Gets the person image URL. - /// </summary> - /// <param name="item">The item.</param> - /// <param name="options">The options.</param> - /// <returns>System.String.</returns> - /// <exception cref="ArgumentNullException">item</exception> - string GetPersonImageUrl(BaseItemPerson item, ImageOptions options); - - /// <summary> - /// Gets an image url that can be used to download an image from the api - /// </summary> - /// <param name="name">The name.</param> - /// <param name="options">The options.</param> - /// <returns>System.String.</returns> - /// <exception cref="ArgumentNullException">name</exception> - string GetGenreImageUrl(string name, ImageOptions options); - - /// <summary> - /// Gets the music genre image URL. - /// </summary> - /// <param name="name">The name.</param> - /// <param name="options">The options.</param> - /// <returns>System.String.</returns> - string GetMusicGenreImageUrl(string name, ImageOptions options); - - /// <summary> - /// Gets the game genre image URL. - /// </summary> - /// <param name="name">The name.</param> - /// <param name="options">The options.</param> - /// <returns>System.String.</returns> - string GetGameGenreImageUrl(string name, ImageOptions options); - - /// <summary> - /// This is a helper to get a list of backdrop url's from a given ApiBaseItemWrapper. If the actual item does not have any backdrops it will return backdrops from the first parent that does. - /// </summary> - /// <param name="item">A given item.</param> - /// <param name="options">The options.</param> - /// <returns>System.String[][].</returns> - /// <exception cref="ArgumentNullException">item</exception> - string[] GetBackdropImageUrls(BaseItemDto item, ImageOptions options); - - /// <summary> - /// This is a helper to get the logo image url from a given ApiBaseItemWrapper. If the actual item does not have a logo, it will return the logo from the first parent that does, or null. - /// </summary> - /// <param name="item">A given item.</param> - /// <param name="options">The options.</param> - /// <returns>System.String.</returns> - /// <exception cref="ArgumentNullException">item</exception> - string GetLogoImageUrl(BaseItemDto item, ImageOptions options); - - /// <summary> - /// Gets the art image URL. - /// </summary> - /// <param name="item">The item.</param> - /// <param name="options">The options.</param> - /// <returns>System.String.</returns> - string GetArtImageUrl(BaseItemDto item, ImageOptions options); - - /// <summary> - /// Gets the thumb image URL. - /// </summary> - /// <param name="item">The item.</param> - /// <param name="options">The options.</param> - /// <returns>System.String.</returns> - string GetThumbImageUrl(BaseItemDto item, ImageOptions options); - - /// <summary> - /// Gets the live tv information asynchronous. - /// </summary> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{LiveTvInfo}.</returns> - Task<LiveTvInfo> GetLiveTvInfoAsync(CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the live tv channels asynchronous. - /// </summary> - /// <param name="query">The query.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{LiveTvInfo}.</returns> - Task<QueryResult<ChannelInfoDto>> GetLiveTvChannelsAsync(LiveTvChannelQuery query, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the live tv channel asynchronous. - /// </summary> - /// <param name="id">The identifier.</param> - /// <param name="userId">The user identifier.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{ChannelInfoDto}.</returns> - Task<ChannelInfoDto> GetLiveTvChannelAsync(string id, string userId, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the live tv recordings asynchronous. - /// </summary> - /// <param name="query">The query.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{QueryResult{RecordingInfoDto}}.</returns> - Task<QueryResult<BaseItemDto>> GetLiveTvRecordingsAsync(RecordingQuery query, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the live tv recording asynchronous. - /// </summary> - /// <param name="id">The identifier.</param> - /// <param name="userId">The user identifier.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{RecordingInfoDto}.</returns> - Task<BaseItemDto> GetLiveTvRecordingAsync(string id, string userId, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the live tv recording groups asynchronous. - /// </summary> - /// <param name="query">The query.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{QueryResult{RecordingGroupDto}}.</returns> - Task<QueryResult<BaseItemDto>> GetLiveTvRecordingGroupsAsync(RecordingGroupQuery query, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the live tv recording group asynchronous. - /// </summary> - /// <param name="id">The identifier.</param> - /// <param name="userId">The user identifier.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{RecordingGroupDto}.</returns> - Task<BaseItemDto> GetLiveTvRecordingGroupAsync(string id, string userId, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the live tv timers asynchronous. - /// </summary> - /// <param name="query">The query.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{QueryResult{TimerInfoDto}}.</returns> - Task<QueryResult<TimerInfoDto>> GetLiveTvTimersAsync(TimerQuery query, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the live tv programs asynchronous. - /// </summary> - /// <param name="query">The query.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{QueryResult{ProgramInfoDto}}.</returns> - Task<QueryResult<BaseItemDto>> GetLiveTvProgramsAsync(ProgramQuery query, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the live tv program asynchronous. - /// </summary> - /// <param name="id">The identifier.</param> - /// <param name="userId">The user identifier.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{ProgramInfoDto}.</returns> - Task<BaseItemDto> GetLiveTvProgramAsync(string id, string userId, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the recommended live tv programs asynchronous. - /// </summary> - /// <param name="query">The query.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{QueryResult{ProgramInfoDto}}.</returns> - Task<QueryResult<BaseItemDto>> GetRecommendedLiveTvProgramsAsync(RecommendedProgramQuery query, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Creates the live tv timer asynchronous. - /// </summary> - /// <param name="timer">The timer.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task.</returns> - Task CreateLiveTvTimerAsync(BaseTimerInfoDto timer, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Updates the live tv timer asynchronous. - /// </summary> - /// <param name="timer">The timer.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task.</returns> - Task UpdateLiveTvTimerAsync(TimerInfoDto timer, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Creates the live tv series timer asynchronous. - /// </summary> - /// <param name="timer">The timer.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task.</returns> - Task CreateLiveTvSeriesTimerAsync(SeriesTimerInfoDto timer, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Updates the live tv series timer asynchronous. - /// </summary> - /// <param name="timer">The timer.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task.</returns> - Task UpdateLiveTvSeriesTimerAsync(SeriesTimerInfoDto timer, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the live tv timer asynchronous. - /// </summary> - /// <param name="id">The identifier.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{TimerInfoDto}.</returns> - Task<TimerInfoDto> GetLiveTvTimerAsync(string id, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the live tv series timers asynchronous. - /// </summary> - /// <param name="query">The query.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{QueryResult{SeriesTimerInfoDto}}.</returns> - Task<QueryResult<SeriesTimerInfoDto>> GetLiveTvSeriesTimersAsync(SeriesTimerQuery query, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the live tv series timer asynchronous. - /// </summary> - /// <param name="id">The identifier.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{SeriesTimerInfoDto}.</returns> - Task<SeriesTimerInfoDto> GetLiveTvSeriesTimerAsync(string id, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Cancels the live tv timer asynchronous. - /// </summary> - /// <param name="id">The identifier.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task.</returns> - Task CancelLiveTvTimerAsync(string id, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Cancels the live tv series timer asynchronous. - /// </summary> - /// <param name="id">The identifier.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task.</returns> - Task CancelLiveTvSeriesTimerAsync(string id, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the default timer information. - /// </summary> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{SeriesTimerInfoDto}.</returns> - Task<SeriesTimerInfoDto> GetDefaultLiveTvTimerInfo(CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the live tv guide information. - /// </summary> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{GuideInfo}.</returns> - Task<GuideInfo> GetLiveTvGuideInfo(CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the default timer information. - /// </summary> - /// <param name="programId">The program identifier.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{SeriesTimerInfoDto}.</returns> - Task<SeriesTimerInfoDto> GetDefaultLiveTvTimerInfo(string programId, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the channel features. - /// </summary> - /// <param name="channelId">The channel identifier.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{ChannelFeatures}.</returns> - Task<ChannelFeatures> GetChannelFeatures(string channelId, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the channel items. - /// </summary> - /// <param name="query">The query.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{QueryResult{BaseItemDto}}.</returns> - Task<QueryResult<BaseItemDto>> GetChannelItems(ChannelItemQuery query, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the channels. - /// </summary> - /// <param name="query">The query.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{QueryResult{BaseItemDto}}.</returns> - Task<QueryResult<BaseItemDto>> GetChannels(ChannelQuery query, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the latest channel items. - /// </summary> - /// <param name="query">The query.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{QueryResult{BaseItemDto}}.</returns> - Task<QueryResult<BaseItemDto>> GetLatestChannelItems(AllChannelMediaQuery query, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Creates the playlist. - /// </summary> - /// <param name="request">The request.</param> - /// <returns>Task<PlaylistCreationResult>.</returns> - Task<PlaylistCreationResult> CreatePlaylist(PlaylistCreationRequest request); - - /// <summary> - /// Adds to playlist. - /// </summary> - /// <param name="playlistId">The playlist identifier.</param> - /// <param name="itemIds">The item ids.</param> - /// <param name="userId">The user identifier.</param> - /// <returns>Task.</returns> - Task AddToPlaylist(string playlistId, IEnumerable<string> itemIds, string userId); - - /// <summary> - /// Removes from playlist. - /// </summary> - /// <param name="playlistId">The playlist identifier.</param> - /// <param name="entryIds">The entry ids.</param> - /// <returns>Task.</returns> - Task RemoveFromPlaylist(string playlistId, IEnumerable<string> entryIds); - - /// <summary> - /// Gets the playlist items. - /// </summary> - /// <param name="query">The query.</param> - /// <returns>Task<QueryResult<BaseItemDto>>.</returns> - Task<QueryResult<BaseItemDto>> GetPlaylistItems(PlaylistItemQuery query); - - /// <summary> - /// Sends the context message asynchronous. - /// </summary> - /// <param name="itemType">Type of the item.</param> - /// <param name="itemId">The item identifier.</param> - /// <param name="itemName">Name of the item.</param> - /// <param name="context">The context.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task.</returns> - Task SendContextMessageAsync(string itemType, string itemId, string itemName, string context, - CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the content upload history. - /// </summary> - /// <param name="deviceId">The device identifier.</param> - /// <returns>Task<ContentUploadHistory>.</returns> - Task<ContentUploadHistory> GetContentUploadHistory(string deviceId); - - /// <summary> - /// Uploads the file. - /// </summary> - /// <param name="stream">The stream.</param> - /// <param name="file">The file.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task.</returns> - Task UploadFile(Stream stream, - LocalFileInfo file, - CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the devices options options. - /// </summary> - /// <returns>Task<DevicesOptions>.</returns> - Task<DevicesOptions> GetDevicesOptions(); - - /// <summary> - /// Updates the item. - /// </summary> - /// <param name="item">The item.</param> - /// <returns>Task.</returns> - Task UpdateItem(BaseItemDto item); - - /// <summary> - /// Creates the synchronize job. - /// </summary> - /// <param name="request">The request.</param> - /// <returns>Task<SyncJob>.</returns> - Task<SyncJob> CreateSyncJob(SyncJobRequest request); - - /// <summary> - /// Updates the synchronize job. - /// </summary> - /// <param name="job">The job.</param> - /// <returns>Task.</returns> - Task UpdateSyncJob(SyncJob job); - - /// <summary> - /// Gets the synchronize jobs. - /// </summary> - /// <param name="query">The query.</param> - /// <returns>Task<QueryResult<SyncJob>>.</returns> - Task<QueryResult<SyncJob>> GetSyncJobs(SyncJobQuery query); - - /// <summary> - /// Gets the synchronize job items. - /// </summary> - /// <param name="query">The query.</param> - /// <returns>Task<QueryResult<SyncJobItem>>.</returns> - Task<QueryResult<SyncJobItem>> GetSyncJobItems(SyncJobItemQuery query); - - /// <summary> - /// Reports the synchronize job item transferred. - /// </summary> - /// <param name="id">The identifier.</param> - /// <returns>Task.</returns> - Task ReportSyncJobItemTransferred(string id); - - /// <summary> - /// Gets the synchronize job item file. - /// </summary> - /// <param name="id">The identifier.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task<Stream>.</returns> - Task<Stream> GetSyncJobItemFile(string id, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Gets the synchronize job item additional file. - /// </summary> - /// <param name="id">The identifier.</param> - /// <param name="name">The name.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task<Stream>.</returns> - Task<Stream> GetSyncJobItemAdditionalFile(string id, string name, CancellationToken cancellationToken); - - /// <summary> - /// Opens the web socket. - /// </summary> - /// <param name="webSocketFactory">The web socket factory.</param> - /// <param name="keepAliveTimerMs">The keep alive timer ms.</param> - void OpenWebSocket(Func<IClientWebSocket> webSocketFactory, int keepAliveTimerMs = 60000); - - /// <summary> - /// Reports the offline actions. - /// </summary> - /// <param name="actions">The actions.</param> - /// <returns>Task.</returns> - Task ReportOfflineActions(List<UserAction> actions); - - /// <summary> - /// Gets the ready synchronize items. - /// </summary> - /// <param name="targetId">The target identifier.</param> - /// <returns>List<SyncedItem>.</returns> - Task<List<SyncedItem>> GetReadySyncItems(string targetId); - - /// <summary> - /// Synchronizes the data. - /// </summary> - /// <param name="request">The request.</param> - /// <returns>Task<SyncDataResponse>.</returns> - Task<SyncDataResponse> SyncData(SyncDataRequest request); - /// <summary> - /// Gets the synchronize job item file URL. - /// </summary> - /// <param name="id">The identifier.</param> - /// <returns>System.String.</returns> - string GetSyncJobItemFileUrl(string id); - /// <summary> - /// Marks the synchronize job item for removal. - /// </summary> - /// <param name="id">The identifier.</param> - /// <returns>Task.</returns> - Task MarkSyncJobItemForRemoval(string id); - /// <summary> - /// Unmarks the synchronize job item for removal. - /// </summary> - /// <param name="id">The identifier.</param> - /// <returns>Task.</returns> - Task UnmarkSyncJobItemForRemoval(string id); - /// <summary> - /// Queues the failed synchronize job item for retry. - /// </summary> - /// <param name="id">The identifier.</param> - /// <returns>Task.</returns> - Task QueueFailedSyncJobItemForRetry(string id); - /// <summary> - /// Cancels the synchronize job. - /// </summary> - /// <param name="id">The identifier.</param> - /// <returns>Task.</returns> - Task CancelSyncJob(string id); - /// <summary> - /// Cancels the synchronize job item. - /// </summary> - /// <param name="id">The identifier.</param> - /// <returns>Task.</returns> - Task CancelSyncJobItem(string id); - /// <summary> - /// Enables the cancelled synchronize job item. - /// </summary> - /// <param name="id">The identifier.</param> - /// <returns>Task.</returns> - Task EnableCancelledSyncJobItem(string id); - /// <summary> - /// Gets the synchronize options. - /// </summary> - /// <param name="jobInfo">The job information.</param> - /// <returns>Task<SyncOptions>.</returns> - Task<SyncDialogOptions> GetSyncOptions(SyncJobRequest jobInfo); - /// <summary> - /// Gets the synchronize options. - /// </summary> - /// <param name="jobInfo">The job information.</param> - /// <returns>Task<SyncDialogOptions>.</returns> - Task<SyncDialogOptions> GetSyncOptions(SyncJob jobInfo); - /// <summary> - /// Gets the movie recommendations. - /// </summary> - /// <param name="query">The query.</param> - /// <returns>Task<List<RecommendationDto>>.</returns> - Task<List<RecommendationDto>> GetMovieRecommendations(MovieRecommendationQuery query); - /// <summary> - /// Opens the live stream. - /// </summary> - /// <param name="request">The request.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task<LiveStreamResponse>.</returns> - Task<LiveStreamResponse> OpenLiveStream(LiveStreamRequest request, CancellationToken cancellationToken); - /// <summary> - /// Cancels the synchronize library items. - /// </summary> - /// <param name="targetId">The target identifier.</param> - /// <param name="itemIds">The item ids.</param> - /// <returns>Task.</returns> - Task CancelSyncLibraryItems(string targetId, IEnumerable<string> itemIds); - /// <summary> - /// Gets the supported bitrate. - /// </summary> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task<System.Int32>.</returns> - Task<int> DetectMaxBitrate(CancellationToken cancellationToken); - - /// <summary> - /// Gets the end point information. - /// </summary> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>System.Threading.Tasks.Task<MediaBrowser.Model.Net.EndPointInfo>.</returns> - Task<EndPointInfo> GetEndPointInfo(CancellationToken cancellationToken); - } -}
\ No newline at end of file diff --git a/MediaBrowser.Model/ApiClient/IClientWebSocket.cs b/MediaBrowser.Model/ApiClient/IClientWebSocket.cs deleted file mode 100644 index ca3a761d4..000000000 --- a/MediaBrowser.Model/ApiClient/IClientWebSocket.cs +++ /dev/null @@ -1,54 +0,0 @@ -using MediaBrowser.Model.Net; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Model.ApiClient -{ - /// <summary> - /// Interface IClientWebSocket - /// </summary> - public interface IClientWebSocket : IDisposable - { - /// <summary> - /// Occurs when [closed]. - /// </summary> - event EventHandler Closed; - - /// <summary> - /// Gets or sets the state. - /// </summary> - /// <value>The state.</value> - WebSocketState State { get; } - - /// <summary> - /// Connects the async. - /// </summary> - /// <param name="url">The URL.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task.</returns> - Task ConnectAsync(string url, CancellationToken cancellationToken); - - /// <summary> - /// Gets or sets the receive action. - /// </summary> - /// <value>The receive action.</value> - Action<byte[]> OnReceiveBytes { get; set; } - - /// <summary> - /// Gets or sets the on receive. - /// </summary> - /// <value>The on receive.</value> - Action<string> OnReceive { get; set; } - - /// <summary> - /// Sends the async. - /// </summary> - /// <param name="bytes">The bytes.</param> - /// <param name="type">The type.</param> - /// <param name="endOfMessage">if set to <c>true</c> [end of message].</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task.</returns> - Task SendAsync(byte[] bytes, WebSocketMessageType type, bool endOfMessage, CancellationToken cancellationToken); - } -} diff --git a/MediaBrowser.Model/ApiClient/IConnectionManager.cs b/MediaBrowser.Model/ApiClient/IConnectionManager.cs deleted file mode 100644 index 083f230bc..000000000 --- a/MediaBrowser.Model/ApiClient/IConnectionManager.cs +++ /dev/null @@ -1,192 +0,0 @@ -using MediaBrowser.Model.Connect; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Events; -using MediaBrowser.Model.Session; -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Model.ApiClient -{ - public interface IConnectionManager - { - /// <summary> - /// Occurs when [connected]. - /// </summary> - event EventHandler<GenericEventArgs<ConnectionResult>> Connected; - /// <summary> - /// Occurs when [local user sign in]. - /// </summary> - event EventHandler<GenericEventArgs<UserDto>> LocalUserSignIn; - /// <summary> - /// Occurs when [connect user sign in]. - /// </summary> - event EventHandler<GenericEventArgs<ConnectUser>> ConnectUserSignIn; - /// <summary> - /// Occurs when [local user sign out]. - /// </summary> - event EventHandler<GenericEventArgs<IApiClient>> LocalUserSignOut; - /// <summary> - /// Occurs when [connect user sign out]. - /// </summary> - event EventHandler<EventArgs> ConnectUserSignOut; - /// <summary> - /// Occurs when [remote logged out]. - /// </summary> - event EventHandler<EventArgs> RemoteLoggedOut; - - /// <summary> - /// Gets the device. - /// </summary> - /// <value>The device.</value> - IDevice Device { get; } - - /// <summary> - /// Gets the connect user. - /// </summary> - /// <value>The connect user.</value> - ConnectUser ConnectUser { get; } - - /// <summary> - /// Gets or sets a value indicating whether [save local credentials]. - /// </summary> - /// <value><c>true</c> if [save local credentials]; otherwise, <c>false</c>.</value> - bool SaveLocalCredentials { get; set; } - - /// <summary> - /// Gets the client capabilities. - /// </summary> - /// <value>The client capabilities.</value> - ClientCapabilities ClientCapabilities { get; } - - /// <summary> - /// Gets the API client. - /// </summary> - /// <param name="item">The item.</param> - /// <returns>IApiClient.</returns> - IApiClient GetApiClient(IHasServerId item); - - /// <summary> - /// Gets the API client. - /// </summary> - /// <param name="serverId">The server identifier.</param> - /// <returns>IApiClient.</returns> - IApiClient GetApiClient(string serverId); - - /// <summary> - /// Connects the specified cancellation token. - /// </summary> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task<ConnectionResult>.</returns> - Task<ConnectionResult> Connect(CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Connects the specified API client. - /// </summary> - /// <param name="apiClient">The API client.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task<ConnectionResult>.</returns> - Task<ConnectionResult> Connect(IApiClient apiClient, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Connects the specified server. - /// </summary> - /// <param name="server">The server.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task<ConnectionResult>.</returns> - Task<ConnectionResult> Connect(ServerInfo server, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Connects the specified server. - /// </summary> - /// <param name="server">The server.</param> - /// <param name="options">The options.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task<ConnectionResult>.</returns> - Task<ConnectionResult> Connect(ServerInfo server, ConnectionOptions options, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Connects the specified server. - /// </summary> - /// <param name="address">The address.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task<ConnectionResult>.</returns> - Task<ConnectionResult> Connect(string address, CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Logouts this instance. - /// </summary> - /// <returns>Task<ConnectionResult>.</returns> - Task Logout(); - - /// <summary> - /// Logins to connect. - /// </summary> - /// <returns>Task.</returns> - Task LoginToConnect(string username, string password); - - /// <summary> - /// Gets the active api client instance - /// </summary> - IApiClient CurrentApiClient { get; } - - /// <summary> - /// Creates the pin. - /// </summary> - /// <returns>Task<PinCreationResult>.</returns> - Task<PinCreationResult> CreatePin(); - - /// <summary> - /// Gets the pin status. - /// </summary> - /// <param name="pin">The pin.</param> - /// <returns>Task<PinStatusResult>.</returns> - Task<PinStatusResult> GetPinStatus(PinCreationResult pin); - - /// <summary> - /// Exchanges the pin. - /// </summary> - /// <param name="pin">The pin.</param> - /// <returns>Task.</returns> - Task ExchangePin(PinCreationResult pin); - - /// <summary> - /// Gets the server information. - /// </summary> - /// <param name="id">The identifier.</param> - /// <returns>Task<ServerInfo>.</returns> - Task<ServerInfo> GetServerInfo(string id); - - /// <summary> - /// Gets the available servers. - /// </summary> - /// <param name="cancellationToken">The cancellation token.</param> - Task<List<ServerInfo>> GetAvailableServers(CancellationToken cancellationToken = default(CancellationToken)); - - /// <summary> - /// Authenticates an offline user with their password - /// </summary> - /// <param name="user">The user.</param> - /// <param name="password">The password.</param> - /// <param name="rememberCredentials">if set to <c>true</c> [remember credentials].</param> - /// <returns>Task.</returns> - Task AuthenticateOffline(UserDto user, string password, bool rememberCredentials); - - /// <summary> - /// Gets the offline users. - /// </summary> - /// <returns>Task<List<UserDto>>.</returns> - Task<List<UserDto>> GetOfflineUsers(); - - /// <summary> - /// Signups for connect. - /// </summary> - /// <param name="email">The email.</param> - /// <param name="username">The username.</param> - /// <param name="password">The password.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task.</returns> - Task<ConnectSignupResponse> SignupForConnect(string email, string username, string password, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/MediaBrowser.Model/ApiClient/IDevice.cs b/MediaBrowser.Model/ApiClient/IDevice.cs deleted file mode 100644 index 7b67122fb..000000000 --- a/MediaBrowser.Model/ApiClient/IDevice.cs +++ /dev/null @@ -1,44 +0,0 @@ -using MediaBrowser.Model.Devices; -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Model.ApiClient -{ - public interface IDevice - { - /// <summary> - /// Occurs when [resume from sleep]. - /// </summary> - event EventHandler<EventArgs> ResumeFromSleep; - /// <summary> - /// Gets the name of the device. - /// </summary> - /// <value>The name of the device.</value> - string DeviceName { get; } - /// <summary> - /// Gets the device identifier. - /// </summary> - /// <value>The device identifier.</value> - string DeviceId { get; } - /// <summary> - /// Gets the local images. - /// </summary> - /// <returns>IEnumerable<LocalFileInfo>.</returns> - Task<IEnumerable<LocalFileInfo>> GetLocalPhotos(); - /// <summary> - /// Gets the local videos. - /// </summary> - /// <returns>IEnumerable<LocalFileInfo>.</returns> - Task<IEnumerable<LocalFileInfo>> GetLocalVideos(); - /// <summary> - /// Uploads the file. - /// </summary> - /// <param name="file">The file.</param> - /// <param name="apiClient">The API client.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task.</returns> - Task UploadFile(LocalFileInfo file, IApiClient apiClient, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/MediaBrowser.Model/ApiClient/IServerEvents.cs b/MediaBrowser.Model/ApiClient/IServerEvents.cs deleted file mode 100644 index ae2d5d323..000000000 --- a/MediaBrowser.Model/ApiClient/IServerEvents.cs +++ /dev/null @@ -1,152 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Events; -using MediaBrowser.Model.Plugins; -using MediaBrowser.Model.Session; -using MediaBrowser.Model.Sync; -using MediaBrowser.Model.Tasks; -using MediaBrowser.Model.Updates; -using System; -using System.Collections.Generic; - -namespace MediaBrowser.Model.ApiClient -{ - /// <summary> - /// Interface IServerEvents - /// </summary> - public interface IServerEvents - { - /// <summary> - /// Occurs when [user deleted]. - /// </summary> - event EventHandler<GenericEventArgs<string>> UserDeleted; - /// <summary> - /// Occurs when [scheduled task ended]. - /// </summary> - event EventHandler<GenericEventArgs<TaskResult>> ScheduledTaskEnded; - /// <summary> - /// Occurs when [package installing]. - /// </summary> - event EventHandler<GenericEventArgs<InstallationInfo>> PackageInstalling; - /// <summary> - /// Occurs when [package installation failed]. - /// </summary> - event EventHandler<GenericEventArgs<InstallationInfo>> PackageInstallationFailed; - /// <summary> - /// Occurs when [package installation completed]. - /// </summary> - event EventHandler<GenericEventArgs<InstallationInfo>> PackageInstallationCompleted; - /// <summary> - /// Occurs when [package installation cancelled]. - /// </summary> - event EventHandler<GenericEventArgs<InstallationInfo>> PackageInstallationCancelled; - /// <summary> - /// Occurs when [user updated]. - /// </summary> - event EventHandler<GenericEventArgs<UserDto>> UserUpdated; - /// <summary> - /// Occurs when [plugin uninstalled]. - /// </summary> - event EventHandler<GenericEventArgs<PluginInfo>> PluginUninstalled; - /// <summary> - /// Occurs when [library changed]. - /// </summary> - event EventHandler<GenericEventArgs<LibraryUpdateInfo>> LibraryChanged; - /// <summary> - /// Occurs when [browse command]. - /// </summary> - event EventHandler<GenericEventArgs<BrowseRequest>> BrowseCommand; - /// <summary> - /// Occurs when [play command]. - /// </summary> - event EventHandler<GenericEventArgs<PlayRequest>> PlayCommand; - /// <summary> - /// Occurs when [playstate command]. - /// </summary> - event EventHandler<GenericEventArgs<PlaystateRequest>> PlaystateCommand; - /// <summary> - /// Occurs when [message command]. - /// </summary> - event EventHandler<GenericEventArgs<MessageCommand>> MessageCommand; - /// <summary> - /// Occurs when [system command]. - /// </summary> - event EventHandler<GenericEventArgs<GeneralCommandEventArgs>> GeneralCommand; - /// <summary> - /// Occurs when [notification added]. - /// </summary> - event EventHandler<EventArgs> NotificationAdded; - /// <summary> - /// Occurs when [notification updated]. - /// </summary> - event EventHandler<EventArgs> NotificationUpdated; - /// <summary> - /// Occurs when [notifications marked read]. - /// </summary> - event EventHandler<EventArgs> NotificationsMarkedRead; - /// <summary> - /// Occurs when [server restarting]. - /// </summary> - event EventHandler<EventArgs> ServerRestarting; - /// <summary> - /// Occurs when [server shutting down]. - /// </summary> - event EventHandler<EventArgs> ServerShuttingDown; - /// <summary> - /// Occurs when [send text command]. - /// </summary> - event EventHandler<GenericEventArgs<string>> SendStringCommand; - /// <summary> - /// Occurs when [set volume command]. - /// </summary> - event EventHandler<GenericEventArgs<int>> SetVolumeCommand; - /// <summary> - /// Occurs when [set audio stream index command]. - /// </summary> - event EventHandler<GenericEventArgs<int>> SetAudioStreamIndexCommand; - /// <summary> - /// Occurs when [set video stream index command]. - /// </summary> - event EventHandler<GenericEventArgs<int>> SetSubtitleStreamIndexCommand; - /// <summary> - /// Occurs when [sessions updated]. - /// </summary> - event EventHandler<GenericEventArgs<SessionUpdatesEventArgs>> SessionsUpdated; - /// <summary> - /// Occurs when [restart required]. - /// </summary> - event EventHandler<EventArgs> RestartRequired; - /// <summary> - /// Occurs when [user data changed]. - /// </summary> - event EventHandler<GenericEventArgs<UserDataChangeInfo>> UserDataChanged; - /// <summary> - /// Occurs when [playback start]. - /// </summary> - event EventHandler<GenericEventArgs<SessionInfoDto>> PlaybackStart; - /// <summary> - /// Occurs when [playback stopped]. - /// </summary> - event EventHandler<GenericEventArgs<SessionInfoDto>> PlaybackStopped; - /// <summary> - /// Occurs when [session ended]. - /// </summary> - event EventHandler<GenericEventArgs<SessionInfoDto>> SessionEnded; - /// <summary> - /// Occurs when [synchronize job created]. - /// </summary> - event EventHandler<GenericEventArgs<SyncJobCreationResult>> SyncJobCreated; - /// <summary> - /// Occurs when [synchronize job cancelled]. - /// </summary> - event EventHandler<GenericEventArgs<SyncJob>> SyncJobCancelled; - /// <summary> - /// Occurs when [synchronize jobs updated]. - /// </summary> - event EventHandler<GenericEventArgs<List<SyncJob>>> SyncJobsUpdated; - /// <summary> - /// Occurs when [synchronize job updated]. - /// </summary> - event EventHandler<GenericEventArgs<CompleteSyncJobInfo>> SyncJobUpdated; - } -} diff --git a/MediaBrowser.Model/ApiClient/NetworkStatus.cs b/MediaBrowser.Model/ApiClient/NetworkStatus.cs deleted file mode 100644 index 715087607..000000000 --- a/MediaBrowser.Model/ApiClient/NetworkStatus.cs +++ /dev/null @@ -1,30 +0,0 @@ - -namespace MediaBrowser.Model.ApiClient -{ - public class NetworkStatus - { - /// <summary> - /// Gets or sets a value indicating whether this instance is network available. - /// </summary> - /// <value><c>true</c> if this instance is network available; otherwise, <c>false</c>.</value> - public bool IsNetworkAvailable { get; set; } - /// <summary> - /// Gets or sets a value indicating whether this instance is local network available. - /// </summary> - /// <value><c>null</c> if [is local network available] contains no value, <c>true</c> if [is local network available]; otherwise, <c>false</c>.</value> - public bool? IsLocalNetworkAvailable { get; set; } - /// <summary> - /// Gets the is any local network available. - /// </summary> - /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> - public bool GetIsAnyLocalNetworkAvailable() - { - if (!IsLocalNetworkAvailable.HasValue) - { - return IsNetworkAvailable; - } - - return IsLocalNetworkAvailable.Value; - } - } -} diff --git a/MediaBrowser.Model/ApiClient/RemoteLogoutReason.cs b/MediaBrowser.Model/ApiClient/RemoteLogoutReason.cs deleted file mode 100644 index 237949c69..000000000 --- a/MediaBrowser.Model/ApiClient/RemoteLogoutReason.cs +++ /dev/null @@ -1,9 +0,0 @@ - -namespace MediaBrowser.Model.ApiClient -{ - public enum RemoteLogoutReason - { - GeneralAccesError = 0, - ParentalControlRestriction = 1 - } -} diff --git a/MediaBrowser.Model/ApiClient/ServerCredentials.cs b/MediaBrowser.Model/ApiClient/ServerCredentials.cs deleted file mode 100644 index ddeb7e546..000000000 --- a/MediaBrowser.Model/ApiClient/ServerCredentials.cs +++ /dev/null @@ -1,131 +0,0 @@ -using MediaBrowser.Model.Extensions; -using System; -using System.Collections.Generic; - -namespace MediaBrowser.Model.ApiClient -{ - public class ServerCredentials - { - public List<ServerInfo> Servers { get; set; } - - public string ConnectUserId { get; set; } - public string ConnectAccessToken { get; set; } - - public ServerCredentials() - { - Servers = new List<ServerInfo>(); - } - - public void AddOrUpdateServer(ServerInfo server) - { - if (server == null) - { - throw new ArgumentNullException("server"); - } - - // Clone the existing list of servers - var list = new List<ServerInfo>(); - foreach (ServerInfo serverInfo in Servers) - { - list.Add(serverInfo); - } - - var index = FindIndex(list, server.Id); - - if (index != -1) - { - var existing = list[index]; - - // Take the most recent DateLastAccessed - if (server.DateLastAccessed > existing.DateLastAccessed) - { - existing.DateLastAccessed = server.DateLastAccessed; - } - - existing.UserLinkType = server.UserLinkType; - - if (!string.IsNullOrEmpty(server.AccessToken)) - { - existing.AccessToken = server.AccessToken; - existing.UserId = server.UserId; - } - if (!string.IsNullOrEmpty(server.ExchangeToken)) - { - existing.ExchangeToken = server.ExchangeToken; - } - if (!string.IsNullOrEmpty(server.RemoteAddress)) - { - existing.RemoteAddress = server.RemoteAddress; - } - if (!string.IsNullOrEmpty(server.ConnectServerId)) - { - existing.ConnectServerId = server.ConnectServerId; - } - if (!string.IsNullOrEmpty(server.LocalAddress)) - { - existing.LocalAddress = server.LocalAddress; - } - if (!string.IsNullOrEmpty(server.ManualAddress)) - { - existing.ManualAddress = server.ManualAddress; - } - if (!string.IsNullOrEmpty(server.Name)) - { - existing.Name = server.Name; - } - if (server.WakeOnLanInfos != null && server.WakeOnLanInfos.Count > 0) - { - existing.WakeOnLanInfos = new List<WakeOnLanInfo>(); - foreach (WakeOnLanInfo info in server.WakeOnLanInfos) - { - existing.WakeOnLanInfos.Add(info); - } - } - if (server.LastConnectionMode.HasValue) - { - existing.LastConnectionMode = server.LastConnectionMode; - } - foreach (ServerUserInfo user in server.Users) - { - existing.AddOrUpdate(user); - } - } - else - { - list.Add(server); - } - - Servers = list; - } - - private int FindIndex(List<ServerInfo> servers, string id) - { - var index = 0; - - foreach (ServerInfo server in servers) - { - if (StringHelper.EqualsIgnoreCase(id, server.Id)) - { - return index; - } - - index++; - } - - return -1; - } - - public ServerInfo GetServer(string id) - { - foreach (ServerInfo server in Servers) - { - if (StringHelper.EqualsIgnoreCase(id, server.Id)) - { - return server; - } - } - - return null; - } - } -} diff --git a/MediaBrowser.Model/ApiClient/ServerInfo.cs b/MediaBrowser.Model/ApiClient/ServerInfo.cs deleted file mode 100644 index 48995e80a..000000000 --- a/MediaBrowser.Model/ApiClient/ServerInfo.cs +++ /dev/null @@ -1,127 +0,0 @@ -using MediaBrowser.Model.Connect; -using MediaBrowser.Model.Extensions; -using MediaBrowser.Model.System; -using System; -using System.Collections.Generic; - -namespace MediaBrowser.Model.ApiClient -{ - public class ServerInfo - { - public List<ServerUserInfo> Users { get; set; } - - public String Name { get; set; } - public String Id { get; set; } - public String ConnectServerId { get; set; } - public String LocalAddress { get; set; } - public String RemoteAddress { get; set; } - public String ManualAddress { get; set; } - public String UserId { get; set; } - public String AccessToken { get; set; } - public List<WakeOnLanInfo> WakeOnLanInfos { get; set; } - public DateTime DateLastAccessed { get; set; } - public String ExchangeToken { get; set; } - public UserLinkType? UserLinkType { get; set; } - public ConnectionMode? LastConnectionMode { get; set; } - - public ServerInfo() - { - WakeOnLanInfos = new List<WakeOnLanInfo>(); - Users = new List<ServerUserInfo>(); - } - - public void ImportInfo(PublicSystemInfo systemInfo) - { - Name = systemInfo.ServerName; - Id = systemInfo.Id; - - if (!string.IsNullOrEmpty(systemInfo.LocalAddress)) - { - LocalAddress = systemInfo.LocalAddress; - } - - if (!string.IsNullOrEmpty(systemInfo.WanAddress)) - { - RemoteAddress = systemInfo.WanAddress; - } - - var fullSystemInfo = systemInfo as SystemInfo; - - if (fullSystemInfo != null) - { - WakeOnLanInfos = new List<WakeOnLanInfo>(); - - if (!string.IsNullOrEmpty(fullSystemInfo.MacAddress)) - { - WakeOnLanInfos.Add(new WakeOnLanInfo - { - MacAddress = fullSystemInfo.MacAddress - }); - } - } - } - - public string GetAddress(ConnectionMode mode) - { - switch (mode) - { - case ConnectionMode.Local: - return LocalAddress; - case ConnectionMode.Manual: - return ManualAddress; - case ConnectionMode.Remote: - return RemoteAddress; - default: - throw new ArgumentException("Unexpected ConnectionMode"); - } - } - - public void AddOrUpdate(ServerUserInfo user) - { - if (user == null) - { - throw new ArgumentNullException("user"); - } - - // Clone the existing list of users - var list = new List<ServerUserInfo>(); - foreach (ServerUserInfo serverUserInfo in Users) - { - list.Add(serverUserInfo); - } - - var index = FindIndex(list, user.Id); - - if (index != -1) - { - var existing = list[index]; - - // Merge the data - existing.IsSignedInOffline = user.IsSignedInOffline; - } - else - { - list.Add(user); - } - - Users = list; - } - - private int FindIndex(List<ServerUserInfo> users, string id) - { - var index = 0; - - foreach (var user in users) - { - if (StringHelper.EqualsIgnoreCase(id, user.Id)) - { - return index; - } - - index++; - } - - return -1; - } - } -} diff --git a/MediaBrowser.Model/ApiClient/ServerUserInfo.cs b/MediaBrowser.Model/ApiClient/ServerUserInfo.cs deleted file mode 100644 index 812da7402..000000000 --- a/MediaBrowser.Model/ApiClient/ServerUserInfo.cs +++ /dev/null @@ -1,9 +0,0 @@ - -namespace MediaBrowser.Model.ApiClient -{ - public class ServerUserInfo - { - public string Id { get; set; } - public bool IsSignedInOffline { get; set; } - } -} diff --git a/MediaBrowser.Model/Channels/AllChannelMediaQuery.cs b/MediaBrowser.Model/Channels/AllChannelMediaQuery.cs index c5631899e..920f3e4b2 100644 --- a/MediaBrowser.Model/Channels/AllChannelMediaQuery.cs +++ b/MediaBrowser.Model/Channels/AllChannelMediaQuery.cs @@ -52,10 +52,10 @@ namespace MediaBrowser.Model.Channels TrailerTypes = new TrailerType[] { }; Filters = new ItemFilter[] { }; - Fields = new List<ItemFields>(); + Fields = new ItemFields[]{}; } public ItemFilter[] Filters { get; set; } - public List<ItemFields> Fields { get; set; } + public ItemFields[] Fields { get; set; } } }
\ No newline at end of file diff --git a/MediaBrowser.Model/Channels/ChannelFeatures.cs b/MediaBrowser.Model/Channels/ChannelFeatures.cs index 8dfdbcd7a..39b40cabc 100644 --- a/MediaBrowser.Model/Channels/ChannelFeatures.cs +++ b/MediaBrowser.Model/Channels/ChannelFeatures.cs @@ -26,13 +26,13 @@ namespace MediaBrowser.Model.Channels /// Gets or sets the media types. /// </summary> /// <value>The media types.</value> - public List<ChannelMediaType> MediaTypes { get; set; } + public ChannelMediaType[] MediaTypes { get; set; } /// <summary> /// Gets or sets the content types. /// </summary> /// <value>The content types.</value> - public List<ChannelMediaContentType> ContentTypes { get; set; } + public ChannelMediaContentType[] ContentTypes { get; set; } /// <summary> /// Represents the maximum number of records the channel allows retrieving at a time @@ -49,7 +49,7 @@ namespace MediaBrowser.Model.Channels /// Gets or sets the default sort orders. /// </summary> /// <value>The default sort orders.</value> - public List<ChannelItemSortField> DefaultSortFields { get; set; } + public ChannelItemSortField[] DefaultSortFields { get; set; } /// <summary> /// Indicates if a sort ascending/descending toggle is supported or not. @@ -76,10 +76,10 @@ namespace MediaBrowser.Model.Channels public ChannelFeatures() { - MediaTypes = new List<ChannelMediaType>(); - ContentTypes = new List<ChannelMediaContentType>(); + MediaTypes = new ChannelMediaType[] { }; + ContentTypes = new ChannelMediaContentType[] { }; - DefaultSortFields = new List<ChannelItemSortField>(); + DefaultSortFields = new ChannelItemSortField[] { }; } } } diff --git a/MediaBrowser.Model/Channels/ChannelItemQuery.cs b/MediaBrowser.Model/Channels/ChannelItemQuery.cs index 4aacc1619..909d35b38 100644 --- a/MediaBrowser.Model/Channels/ChannelItemQuery.cs +++ b/MediaBrowser.Model/Channels/ChannelItemQuery.cs @@ -1,4 +1,6 @@ -using MediaBrowser.Model.Entities; +using System; +using System.Collections.Generic; +using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; namespace MediaBrowser.Model.Channels @@ -35,16 +37,15 @@ namespace MediaBrowser.Model.Channels /// <value>The limit.</value> public int? Limit { get; set; } - public SortOrder? SortOrder { get; set; } - public string[] SortBy { get; set; } public ItemFilter[] Filters { get; set; } public ItemFields[] Fields { get; set; } + public Tuple<string, SortOrder>[] OrderBy { get; set; } public ChannelItemQuery() { Filters = new ItemFilter[] { }; - SortBy = new string[] { }; Fields = new ItemFields[] { }; + OrderBy = new Tuple<string, SortOrder>[] { }; } } diff --git a/MediaBrowser.Model/Configuration/EncodingOptions.cs b/MediaBrowser.Model/Configuration/EncodingOptions.cs index e1b0514e7..b093d82e3 100644 --- a/MediaBrowser.Model/Configuration/EncodingOptions.cs +++ b/MediaBrowser.Model/Configuration/EncodingOptions.cs @@ -13,8 +13,10 @@ namespace MediaBrowser.Model.Configuration public string VaapiDevice { get; set; } public int H264Crf { get; set; } public string H264Preset { get; set; } - public bool EnableHardwareDecoding { get; set; } public bool EnableHardwareEncoding { get; set; } + public bool EnableSubtitleExtraction { get; set; } + + public string[] HardwareDecodingCodecs { get; set; } public EncodingOptions() { @@ -24,8 +26,9 @@ namespace MediaBrowser.Model.Configuration EncodingThreadCount = -1; VaapiDevice = "/dev/dri/card0"; H264Crf = 23; - EnableHardwareDecoding = true; EnableHardwareEncoding = true; + EnableSubtitleExtraction = true; + HardwareDecodingCodecs = new string[] { "h264", "vc1" }; } } } diff --git a/MediaBrowser.Model/Configuration/MetadataOptions.cs b/MediaBrowser.Model/Configuration/MetadataOptions.cs index ddde688b2..8a41decbf 100644 --- a/MediaBrowser.Model/Configuration/MetadataOptions.cs +++ b/MediaBrowser.Model/Configuration/MetadataOptions.cs @@ -29,7 +29,7 @@ namespace MediaBrowser.Model.Configuration public MetadataOptions(int backdropLimit, int minBackdropWidth) { - List<ImageOption> imageOptions = new List<ImageOption> + ImageOptions = new[] { new ImageOption { @@ -39,7 +39,6 @@ namespace MediaBrowser.Model.Configuration } }; - ImageOptions = imageOptions.ToArray(); DisabledMetadataSavers = new string[] { }; LocalMetadataReaderOrder = new string[] { }; diff --git a/MediaBrowser.Model/Configuration/MetadataPluginSummary.cs b/MediaBrowser.Model/Configuration/MetadataPluginSummary.cs index 90b3933eb..80142cf43 100644 --- a/MediaBrowser.Model/Configuration/MetadataPluginSummary.cs +++ b/MediaBrowser.Model/Configuration/MetadataPluginSummary.cs @@ -15,18 +15,18 @@ namespace MediaBrowser.Model.Configuration /// Gets or sets the plugins. /// </summary> /// <value>The plugins.</value> - public List<MetadataPlugin> Plugins { get; set; } + public MetadataPlugin[] Plugins { get; set; } /// <summary> /// Gets or sets the supported image types. /// </summary> /// <value>The supported image types.</value> - public List<ImageType> SupportedImageTypes { get; set; } + public ImageType[] SupportedImageTypes { get; set; } public MetadataPluginSummary() { - SupportedImageTypes = new List<ImageType>(); - Plugins = new List<MetadataPlugin>(); + SupportedImageTypes = new ImageType[] { }; + Plugins = new MetadataPlugin[] { }; } } }
\ No newline at end of file diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index a570f7b10..5177a757a 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -162,7 +162,6 @@ namespace MediaBrowser.Model.Configuration public bool EnableAutomaticRestart { get; set; } public bool SkipDeserializationForBasicTypes { get; set; } - public bool SkipDeserializationForAudio { get; set; } public string ServerName { get; set; } public string WanDdns { get; set; } @@ -218,6 +217,7 @@ namespace MediaBrowser.Model.Configuration EnableHttps = false; EnableDashboardResponseCaching = true; EnableAnonymousUsageReporting = true; + EnableCaseSensitiveItemIds = true; EnableAutomaticRestart = true; @@ -349,7 +349,9 @@ namespace MediaBrowser.Model.Configuration Limit = 1, Type = ImageType.Logo } - } + }, + + DisabledImageFetchers = new [] {"FanArt"} }, new MetadataOptions(1, 1280) @@ -539,7 +541,8 @@ namespace MediaBrowser.Model.Configuration Type = ImageType.Thumb } }, - DisabledMetadataFetchers = new []{ "TheMovieDb" } + DisabledMetadataFetchers = new []{ "TheMovieDb" }, + DisabledImageFetchers = new [] { "FanArt" } }, new MetadataOptions(0, 1280) diff --git a/MediaBrowser.Model/Configuration/UserConfiguration.cs b/MediaBrowser.Model/Configuration/UserConfiguration.cs index 30b5f384f..15bd003ae 100644 --- a/MediaBrowser.Model/Configuration/UserConfiguration.cs +++ b/MediaBrowser.Model/Configuration/UserConfiguration.cs @@ -25,7 +25,6 @@ namespace MediaBrowser.Model.Configuration public string SubtitleLanguagePreference { get; set; } public bool DisplayMissingEpisodes { get; set; } - public bool DisplayUnairedEpisodes { get; set; } public string[] GroupedFolders { get; set; } diff --git a/MediaBrowser.Model/Devices/ContentUploadHistory.cs b/MediaBrowser.Model/Devices/ContentUploadHistory.cs index cd4858d90..2b344df24 100644 --- a/MediaBrowser.Model/Devices/ContentUploadHistory.cs +++ b/MediaBrowser.Model/Devices/ContentUploadHistory.cs @@ -5,11 +5,11 @@ namespace MediaBrowser.Model.Devices public class ContentUploadHistory { public string DeviceId { get; set; } - public List<LocalFileInfo> FilesUploaded { get; set; } + public LocalFileInfo[] FilesUploaded { get; set; } public ContentUploadHistory() { - FilesUploaded = new List<LocalFileInfo>(); + FilesUploaded = new LocalFileInfo[] { }; } } } diff --git a/MediaBrowser.Model/Dlna/AudioOptions.cs b/MediaBrowser.Model/Dlna/AudioOptions.cs index 24c7aef98..6584bb3cc 100644 --- a/MediaBrowser.Model/Dlna/AudioOptions.cs +++ b/MediaBrowser.Model/Dlna/AudioOptions.cs @@ -22,7 +22,7 @@ namespace MediaBrowser.Model.Dlna public bool ForceDirectStream { get; set; } public string ItemId { get; set; } - public List<MediaSourceInfo> MediaSources { get; set; } + public MediaSourceInfo[] MediaSources { get; set; } public DeviceProfile Profile { get; set; } /// <summary> diff --git a/MediaBrowser.Model/Dlna/CodecProfile.cs b/MediaBrowser.Model/Dlna/CodecProfile.cs index e04e04d21..d75547adb 100644 --- a/MediaBrowser.Model/Dlna/CodecProfile.cs +++ b/MediaBrowser.Model/Dlna/CodecProfile.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Xml.Serialization; using MediaBrowser.Model.Dlna; -using System.Linq; namespace MediaBrowser.Model.Dlna { @@ -27,31 +26,14 @@ namespace MediaBrowser.Model.Dlna ApplyConditions = new ProfileCondition[] { }; } - private static List<string> SplitValue(string value) + public string[] GetCodecs() { - List<string> list = new List<string>(); - foreach (string i in (value ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; - } - - public List<string> GetCodecs() - { - return SplitValue(Codec); - } - - public List<string> GetContainers() - { - return SplitValue(Container); + return ContainerProfile.SplitValue(Codec); } private bool ContainsContainer(string container) { - List<string> containers = GetContainers(); - - return containers.Count == 0 || ListHelper.ContainsIgnoreCase(containers, container ?? string.Empty); + return ContainerProfile.ContainsContainer(Container, container); } public bool ContainsCodec(string codec, string container) @@ -61,10 +43,9 @@ namespace MediaBrowser.Model.Dlna return false; } - List<string> codecs = GetCodecs(); + var codecs = GetCodecs(); - return codecs.Count == 0 || ListHelper.ContainsIgnoreCase(codecs, SplitValue(codec)[0]); - //return codecs.Count == 0 || SplitValue(codec).Any(i => ListHelper.ContainsIgnoreCase(codecs, i)); + return codecs.Length == 0 || ListHelper.ContainsIgnoreCase(codecs, ContainerProfile.SplitValue(codec)[0]); } } } diff --git a/MediaBrowser.Model/Dlna/ConditionProcessor.cs b/MediaBrowser.Model/Dlna/ConditionProcessor.cs index 291096f75..bd3dc6fd2 100644 --- a/MediaBrowser.Model/Dlna/ConditionProcessor.cs +++ b/MediaBrowser.Model/Dlna/ConditionProcessor.cs @@ -3,7 +3,6 @@ using MediaBrowser.Model.MediaInfo; using System; using System.Collections.Generic; using System.Globalization; -using System.Linq; namespace MediaBrowser.Model.Dlna { diff --git a/MediaBrowser.Model/Dlna/ContainerProfile.cs b/MediaBrowser.Model/Dlna/ContainerProfile.cs index 35d7ada6b..23bbf0193 100644 --- a/MediaBrowser.Model/Dlna/ContainerProfile.cs +++ b/MediaBrowser.Model/Dlna/ContainerProfile.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Xml.Serialization; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Extensions; @@ -19,21 +20,53 @@ namespace MediaBrowser.Model.Dlna Conditions = new ProfileCondition[] { }; } - public List<string> GetContainers() + public string[] GetContainers() { - List<string> list = new List<string>(); - foreach (string i in (Container ?? string.Empty).Split(',')) + return SplitValue(Container); + } + + private static readonly string[] EmptyStringArray = new string[] { }; + + public static string[] SplitValue(string value) + { + if (string.IsNullOrWhiteSpace(value)) { - if (!string.IsNullOrEmpty(i)) list.Add(i); + return EmptyStringArray; } - return list; + + return value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); } public bool ContainsContainer(string container) { - List<string> containers = GetContainers(); + var containers = GetContainers(); + + return ContainsContainer(containers, container); + } + + public static bool ContainsContainer(string profileContainers, string inputContainer) + { + return ContainsContainer(SplitValue(profileContainers), inputContainer); + } + + public static bool ContainsContainer(string[] profileContainers, string inputContainer) + { + if (profileContainers.Length == 0) + { + return true; + } + + var allInputContainers = SplitValue(inputContainer); + + foreach (var container in allInputContainers) + { + if (ListHelper.ContainsIgnoreCase(profileContainers, container)) + { + return true; + } + } - return containers.Count == 0 || ListHelper.ContainsIgnoreCase(containers, container ?? string.Empty); + return false; } } } diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.cs index cd7ff08d6..fc976b605 100644 --- a/MediaBrowser.Model/Dlna/DeviceProfile.cs +++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs @@ -17,9 +17,6 @@ namespace MediaBrowser.Model.Dlna [XmlIgnore] public string Id { get; set; } - [XmlIgnore] - public MediaBrowser.Model.Dlna.DeviceProfileType ProfileType { get; set; } - /// <summary> /// Gets or sets the identification. /// </summary> @@ -117,15 +114,9 @@ namespace MediaBrowser.Model.Dlna MusicStreamingTranscodingBitrate = 128000; } - public List<string> GetSupportedMediaTypes() + public string[] GetSupportedMediaTypes() { - List<string> list = new List<string>(); - foreach (string i in (SupportedMediaTypes ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) - list.Add(i); - } - return list; + return ContainerProfile.SplitValue(SupportedMediaTypes); } public TranscodingProfile GetAudioTranscodingProfile(string container, string audioCodec) @@ -187,28 +178,25 @@ namespace MediaBrowser.Model.Dlna public ResponseProfile GetAudioMediaProfile(string container, string audioCodec, int? audioChannels, int? audioBitrate, int? audioSampleRate, int? audioBitDepth) { - container = StringHelper.TrimStart(container ?? string.Empty, '.'); - foreach (var i in ResponseProfiles) { - if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Audio) + if (i.Type != DlnaProfileType.Audio) { continue; } - List<string> containers = i.GetContainers(); - if (containers.Count > 0 && !ListHelper.ContainsIgnoreCase(containers, container)) + if (!ContainerProfile.ContainsContainer(i.GetContainers(), container)) { continue; } - List<string> audioCodecs = i.GetAudioCodecs(); - if (audioCodecs.Count > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty)) + var audioCodecs = i.GetAudioCodecs(); + if (audioCodecs.Length > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty)) { continue; } - var conditionProcessor = new MediaBrowser.Model.Dlna.ConditionProcessor(); + var conditionProcessor = new ConditionProcessor(); var anyOff = false; foreach (ProfileCondition c in i.Conditions) @@ -230,9 +218,9 @@ namespace MediaBrowser.Model.Dlna return null; } - private MediaBrowser.Model.Dlna.ProfileCondition GetModelProfileCondition(ProfileCondition c) + private ProfileCondition GetModelProfileCondition(ProfileCondition c) { - return new MediaBrowser.Model.Dlna.ProfileCondition + return new ProfileCondition { Condition = c.Condition, IsRequired = c.IsRequired, @@ -243,22 +231,19 @@ namespace MediaBrowser.Model.Dlna public ResponseProfile GetImageMediaProfile(string container, int? width, int? height) { - container = StringHelper.TrimStart(container ?? string.Empty, '.'); - foreach (var i in ResponseProfiles) { - if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Photo) + if (i.Type != DlnaProfileType.Photo) { continue; } - List<string> containers = i.GetContainers(); - if (containers.Count > 0 && !ListHelper.ContainsIgnoreCase(containers, container)) + if (!ContainerProfile.ContainsContainer(i.GetContainers(), container)) { continue; } - var conditionProcessor = new MediaBrowser.Model.Dlna.ConditionProcessor(); + var conditionProcessor = new ConditionProcessor(); var anyOff = false; foreach (ProfileCondition c in i.Conditions) @@ -300,34 +285,31 @@ namespace MediaBrowser.Model.Dlna string videoCodecTag, bool? isAvc) { - container = StringHelper.TrimStart(container ?? string.Empty, '.'); - foreach (var i in ResponseProfiles) { - if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Video) + if (i.Type != DlnaProfileType.Video) { continue; } - List<string> containers = i.GetContainers(); - if (containers.Count > 0 && !ListHelper.ContainsIgnoreCase(containers, container ?? string.Empty)) + if (!ContainerProfile.ContainsContainer(i.GetContainers(), container)) { continue; } - List<string> audioCodecs = i.GetAudioCodecs(); - if (audioCodecs.Count > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty)) + var audioCodecs = i.GetAudioCodecs(); + if (audioCodecs.Length > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty)) { continue; } - List<string> videoCodecs = i.GetVideoCodecs(); - if (videoCodecs.Count > 0 && !ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec ?? string.Empty)) + var videoCodecs = i.GetVideoCodecs(); + if (videoCodecs.Length > 0 && !ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec ?? string.Empty)) { continue; } - var conditionProcessor = new MediaBrowser.Model.Dlna.ConditionProcessor(); + var conditionProcessor = new ConditionProcessor(); var anyOff = false; foreach (ProfileCondition c in i.Conditions) diff --git a/MediaBrowser.Model/Dlna/DirectPlayProfile.cs b/MediaBrowser.Model/Dlna/DirectPlayProfile.cs index df511b0da..7430c449f 100644 --- a/MediaBrowser.Model/Dlna/DirectPlayProfile.cs +++ b/MediaBrowser.Model/Dlna/DirectPlayProfile.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Xml.Serialization; namespace MediaBrowser.Model.Dlna @@ -19,47 +18,19 @@ namespace MediaBrowser.Model.Dlna [XmlAttribute("type")] public DlnaProfileType Type { get; set; } - public List<string> GetContainers() - { - List<string> list = new List<string>(); - foreach (string i in (Container ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; - } - public bool SupportsContainer(string container) { - var all = GetContainers(); - - // Only allow unknown container if the profile is all inclusive - if (string.IsNullOrWhiteSpace(container)) - { - return all.Count == 0; - } - - return all.Count == 0 || all.Contains(container, StringComparer.OrdinalIgnoreCase); + return ContainerProfile.ContainsContainer(Container, container); } - public List<string> GetAudioCodecs() + public string[] GetAudioCodecs() { - List<string> list = new List<string>(); - foreach (string i in (AudioCodec ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; + return ContainerProfile.SplitValue(AudioCodec); } - public List<string> GetVideoCodecs() + public string[] GetVideoCodecs() { - List<string> list = new List<string>(); - foreach (string i in (VideoCodec ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; + return ContainerProfile.SplitValue(VideoCodec); } } } diff --git a/MediaBrowser.Model/Dlna/ITranscoderSupport.cs b/MediaBrowser.Model/Dlna/ITranscoderSupport.cs index fd615733d..14723bd27 100644 --- a/MediaBrowser.Model/Dlna/ITranscoderSupport.cs +++ b/MediaBrowser.Model/Dlna/ITranscoderSupport.cs @@ -4,6 +4,7 @@ { bool CanEncodeToAudioCodec(string codec); bool CanEncodeToSubtitleCodec(string codec); + bool CanExtractSubtitles(string codec); } public class FullTranscoderSupport : ITranscoderSupport @@ -16,5 +17,9 @@ { return true; } + public bool CanExtractSubtitles(string codec) + { + return true; + } } } diff --git a/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs b/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs index a464b045b..034e0fe6a 100644 --- a/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs +++ b/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs @@ -7,33 +7,33 @@ namespace MediaBrowser.Model.Dlna { public class MediaFormatProfileResolver { - public List<MediaFormatProfile> ResolveVideoFormat(string container, string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType) + public MediaFormatProfile[] ResolveVideoFormat(string container, string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType) { if (StringHelper.EqualsIgnoreCase(container, "asf")) { MediaFormatProfile? val = ResolveVideoASFFormat(videoCodec, audioCodec, width, height); - return val.HasValue ? new List<MediaFormatProfile> { val.Value } : new List<MediaFormatProfile>(); + return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[]{}; } if (StringHelper.EqualsIgnoreCase(container, "mp4")) { MediaFormatProfile? val = ResolveVideoMP4Format(videoCodec, audioCodec, width, height); - return val.HasValue ? new List<MediaFormatProfile> { val.Value } : new List<MediaFormatProfile>(); + return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { }; } if (StringHelper.EqualsIgnoreCase(container, "avi")) - return new List<MediaFormatProfile> { MediaFormatProfile.AVI }; + return new MediaFormatProfile[] { MediaFormatProfile.AVI }; if (StringHelper.EqualsIgnoreCase(container, "mkv")) - return new List<MediaFormatProfile> { MediaFormatProfile.MATROSKA }; + return new MediaFormatProfile[] { MediaFormatProfile.MATROSKA }; if (StringHelper.EqualsIgnoreCase(container, "mpeg2ps") || StringHelper.EqualsIgnoreCase(container, "ts")) - return new List<MediaFormatProfile> { MediaFormatProfile.MPEG_PS_NTSC, MediaFormatProfile.MPEG_PS_PAL }; + return new MediaFormatProfile[] { MediaFormatProfile.MPEG_PS_NTSC, MediaFormatProfile.MPEG_PS_PAL }; if (StringHelper.EqualsIgnoreCase(container, "mpeg1video")) - return new List<MediaFormatProfile> { MediaFormatProfile.MPEG1 }; + return new MediaFormatProfile[] { MediaFormatProfile.MPEG1 }; if (StringHelper.EqualsIgnoreCase(container, "mpeg2ts") || StringHelper.EqualsIgnoreCase(container, "mpegts") || @@ -44,24 +44,24 @@ namespace MediaBrowser.Model.Dlna } if (StringHelper.EqualsIgnoreCase(container, "flv")) - return new List<MediaFormatProfile> { MediaFormatProfile.FLV }; + return new MediaFormatProfile[] { MediaFormatProfile.FLV }; if (StringHelper.EqualsIgnoreCase(container, "wtv")) - return new List<MediaFormatProfile> { MediaFormatProfile.WTV }; + return new MediaFormatProfile[] { MediaFormatProfile.WTV }; if (StringHelper.EqualsIgnoreCase(container, "3gp")) { MediaFormatProfile? val = ResolveVideo3GPFormat(videoCodec, audioCodec); - return val.HasValue ? new List<MediaFormatProfile> { val.Value } : new List<MediaFormatProfile>(); + return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { }; } if (StringHelper.EqualsIgnoreCase(container, "ogv") || StringHelper.EqualsIgnoreCase(container, "ogg")) - return new List<MediaFormatProfile> { MediaFormatProfile.OGV }; + return new MediaFormatProfile[] { MediaFormatProfile.OGV }; - return new List<MediaFormatProfile>(); + return new MediaFormatProfile[] { }; } - private List<MediaFormatProfile> ResolveVideoMPEG2TSFormat(string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType) + private MediaFormatProfile[] ResolveVideoMPEG2TSFormat(string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType) { string suffix = ""; @@ -93,41 +93,41 @@ namespace MediaBrowser.Model.Dlna { list.Add(MediaFormatProfile.MPEG_TS_JP_T); } - return list; + return list.ToArray(list.Count); } if (StringHelper.EqualsIgnoreCase(videoCodec, "h264")) { if (StringHelper.EqualsIgnoreCase(audioCodec, "lpcm")) - return new List<MediaFormatProfile> { MediaFormatProfile.AVC_TS_HD_50_LPCM_T }; + return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_50_LPCM_T }; if (StringHelper.EqualsIgnoreCase(audioCodec, "dts")) { if (timestampType == TransportStreamTimestamp.None) { - return new List<MediaFormatProfile> { MediaFormatProfile.AVC_TS_HD_DTS_ISO }; + return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_DTS_ISO }; } - return new List<MediaFormatProfile> { MediaFormatProfile.AVC_TS_HD_DTS_T }; + return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_DTS_T }; } if (StringHelper.EqualsIgnoreCase(audioCodec, "mp2")) { if (timestampType == TransportStreamTimestamp.None) { - return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_ISO", resolution)) }; + return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_ISO", resolution)) }; } - return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_T", resolution)) }; + return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_T", resolution)) }; } if (StringHelper.EqualsIgnoreCase(audioCodec, "aac")) - return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_MP_{0}D_AAC_MULT5{1}", resolution, suffix)) }; + return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_AAC_MULT5{1}", resolution, suffix)) }; if (StringHelper.EqualsIgnoreCase(audioCodec, "mp3")) - return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_MP_{0}D_MPEG1_L3{1}", resolution, suffix)) }; + return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_MPEG1_L3{1}", resolution, suffix)) }; if (string.IsNullOrEmpty(audioCodec) || StringHelper.EqualsIgnoreCase(audioCodec, "ac3")) - return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_MP_{0}D_AC3{1}", resolution, suffix)) }; + return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_AC3{1}", resolution, suffix)) }; } else if (StringHelper.EqualsIgnoreCase(videoCodec, "vc1")) { @@ -135,31 +135,31 @@ namespace MediaBrowser.Model.Dlna { if ((width.HasValue && width.Value > 720) || (height.HasValue && height.Value > 576)) { - return new List<MediaFormatProfile> { MediaFormatProfile.VC1_TS_AP_L2_AC3_ISO }; + return new MediaFormatProfile[] { MediaFormatProfile.VC1_TS_AP_L2_AC3_ISO }; } - return new List<MediaFormatProfile> { MediaFormatProfile.VC1_TS_AP_L1_AC3_ISO }; + return new MediaFormatProfile[] { MediaFormatProfile.VC1_TS_AP_L1_AC3_ISO }; } if (StringHelper.EqualsIgnoreCase(audioCodec, "dts")) { suffix = StringHelper.EqualsIgnoreCase(suffix, "_ISO") ? suffix : "_T"; - return new List<MediaFormatProfile> { ValueOf(string.Format("VC1_TS_HD_DTS{0}", suffix)) }; + return new MediaFormatProfile[] { ValueOf(string.Format("VC1_TS_HD_DTS{0}", suffix)) }; } } else if (StringHelper.EqualsIgnoreCase(videoCodec, "mpeg4") || StringHelper.EqualsIgnoreCase(videoCodec, "msmpeg4")) { if (StringHelper.EqualsIgnoreCase(audioCodec, "aac")) - return new List<MediaFormatProfile> { ValueOf(string.Format("MPEG4_P2_TS_ASP_AAC{0}", suffix)) }; + return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AAC{0}", suffix)) }; if (StringHelper.EqualsIgnoreCase(audioCodec, "mp3")) - return new List<MediaFormatProfile> { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG1_L3{0}", suffix)) }; + return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG1_L3{0}", suffix)) }; if (StringHelper.EqualsIgnoreCase(audioCodec, "mp2")) - return new List<MediaFormatProfile> { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG2_L2{0}", suffix)) }; + return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG2_L2{0}", suffix)) }; if (StringHelper.EqualsIgnoreCase(audioCodec, "ac3")) - return new List<MediaFormatProfile> { ValueOf(string.Format("MPEG4_P2_TS_ASP_AC3{0}", suffix)) }; + return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AC3{0}", suffix)) }; } - return new List<MediaFormatProfile>(); + return new MediaFormatProfile[]{}; } private MediaFormatProfile ValueOf(string value) diff --git a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs b/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs index 950d3680d..de832314c 100644 --- a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs +++ b/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs @@ -6,8 +6,8 @@ namespace MediaBrowser.Model.Dlna { public class ResolutionNormalizer { - private static readonly List<ResolutionConfiguration> Configurations = - new List<ResolutionConfiguration> + private static readonly ResolutionConfiguration[] Configurations = + new [] { new ResolutionConfiguration(426, 320000), new ResolutionConfiguration(640, 400000), @@ -58,12 +58,16 @@ namespace MediaBrowser.Model.Dlna private static ResolutionConfiguration GetResolutionConfiguration(int outputBitrate) { + ResolutionConfiguration previousOption = null; + foreach (var config in Configurations) { if (outputBitrate <= config.MaxBitrate) { - return config; + return previousOption ?? config; } + + previousOption = config; } return null; diff --git a/MediaBrowser.Model/Dlna/ResponseProfile.cs b/MediaBrowser.Model/Dlna/ResponseProfile.cs index 1d4791b5c..742253fa3 100644 --- a/MediaBrowser.Model/Dlna/ResponseProfile.cs +++ b/MediaBrowser.Model/Dlna/ResponseProfile.cs @@ -31,34 +31,19 @@ namespace MediaBrowser.Model.Dlna Conditions = new ProfileCondition[] {}; } - public List<string> GetContainers() + public string[] GetContainers() { - List<string> list = new List<string>(); - foreach (string i in (Container ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; + return ContainerProfile.SplitValue(Container); } - public List<string> GetAudioCodecs() + public string[] GetAudioCodecs() { - List<string> list = new List<string>(); - foreach (string i in (AudioCodec ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; + return ContainerProfile.SplitValue(AudioCodec); } - public List<string> GetVideoCodecs() + public string[] GetVideoCodecs() { - List<string> list = new List<string>(); - foreach (string i in (VideoCodec ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; + return ContainerProfile.SplitValue(VideoCodec); } } } diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index 48f9a4212..10c6a05c0 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -31,7 +31,7 @@ namespace MediaBrowser.Model.Dlna { ValidateAudioInput(options); - List<MediaSourceInfo> mediaSources = new List<MediaSourceInfo>(); + var mediaSources = new List<MediaSourceInfo>(); foreach (MediaSourceInfo i in options.MediaSources) { if (string.IsNullOrEmpty(options.MediaSourceId) || @@ -41,7 +41,7 @@ namespace MediaBrowser.Model.Dlna } } - List<StreamInfo> streams = new List<StreamInfo>(); + var streams = new List<StreamInfo>(); foreach (MediaSourceInfo i in mediaSources) { StreamInfo streamInfo = BuildAudioItem(i, options); @@ -64,7 +64,7 @@ namespace MediaBrowser.Model.Dlna { ValidateInput(options); - List<MediaSourceInfo> mediaSources = new List<MediaSourceInfo>(); + var mediaSources = new List<MediaSourceInfo>(); foreach (MediaSourceInfo i in options.MediaSources) { if (string.IsNullOrEmpty(options.MediaSourceId) || @@ -74,7 +74,7 @@ namespace MediaBrowser.Model.Dlna } } - List<StreamInfo> streams = new List<StreamInfo>(); + var streams = new List<StreamInfo>(); foreach (MediaSourceInfo i in mediaSources) { StreamInfo streamInfo = BuildVideoItem(i, options); @@ -95,9 +95,9 @@ namespace MediaBrowser.Model.Dlna private StreamInfo GetOptimalStream(List<StreamInfo> streams, long? maxBitrate) { - streams = StreamInfoSorter.SortMediaSources(streams, maxBitrate); + var sorted = StreamInfoSorter.SortMediaSources(streams, maxBitrate); - foreach (StreamInfo stream in streams) + foreach (StreamInfo stream in sorted) { return stream; } @@ -197,9 +197,43 @@ namespace MediaBrowser.Model.Dlna } } + public static string NormalizeMediaSourceFormatIntoSingleContainer(string inputContainer, DeviceProfile profile, DlnaProfileType type) + { + if (string.IsNullOrWhiteSpace(inputContainer)) + { + return null; + } + + var formats = ContainerProfile.SplitValue(inputContainer); + + if (formats.Length == 1) + { + return formats[0]; + } + + if (profile != null) + { + foreach (var format in formats) + { + foreach (var directPlayProfile in profile.DirectPlayProfiles) + { + if (directPlayProfile.Type == type) + { + if (directPlayProfile.SupportsContainer(format)) + { + return format; + } + } + } + } + } + + return formats[0]; + } + private StreamInfo BuildAudioItem(MediaSourceInfo item, AudioOptions options) { - List<TranscodeReason> transcodeReasons = new List<TranscodeReason>(); + var transcodeReasons = new List<TranscodeReason>(); StreamInfo playlistItem = new StreamInfo { @@ -214,14 +248,14 @@ namespace MediaBrowser.Model.Dlna if (options.ForceDirectPlay) { playlistItem.PlayMethod = PlayMethod.DirectPlay; - playlistItem.Container = item.Container; + playlistItem.Container = NormalizeMediaSourceFormatIntoSingleContainer(item.Container, options.Profile, DlnaProfileType.Audio); return playlistItem; } if (options.ForceDirectStream) { playlistItem.PlayMethod = PlayMethod.DirectStream; - playlistItem.Container = item.Container; + playlistItem.Container = NormalizeMediaSourceFormatIntoSingleContainer(item.Container, options.Profile, DlnaProfileType.Audio); return playlistItem; } @@ -229,7 +263,7 @@ namespace MediaBrowser.Model.Dlna var directPlayInfo = GetAudioDirectPlayMethods(item, audioStream, options); - List<PlayMethod> directPlayMethods = directPlayInfo.Item1; + var directPlayMethods = directPlayInfo.Item1; transcodeReasons.AddRange(directPlayInfo.Item2); ConditionProcessor conditionProcessor = new ConditionProcessor(); @@ -246,7 +280,7 @@ namespace MediaBrowser.Model.Dlna // Make sure audio codec profiles are satisfied if (!string.IsNullOrEmpty(audioCodec)) { - List<ProfileCondition> conditions = new List<ProfileCondition>(); + var conditions = new List<ProfileCondition>(); foreach (CodecProfile i in options.Profile.CodecProfiles) { if (i.Type == CodecType.Audio && i.ContainsCodec(audioCodec, item.Container)) @@ -295,7 +329,7 @@ namespace MediaBrowser.Model.Dlna playlistItem.PlayMethod = PlayMethod.DirectStream; } - playlistItem.Container = item.Container; + playlistItem.Container = NormalizeMediaSourceFormatIntoSingleContainer(item.Container, options.Profile, DlnaProfileType.Audio); return playlistItem; } @@ -338,7 +372,7 @@ namespace MediaBrowser.Model.Dlna playlistItem.SubProtocol = transcodingProfile.Protocol; - List<CodecProfile> audioCodecProfiles = new List<CodecProfile>(); + var audioCodecProfiles = new List<CodecProfile>(); foreach (CodecProfile i in options.Profile.CodecProfiles) { if (i.Type == CodecType.Audio && i.ContainsCodec(transcodingProfile.AudioCodec, transcodingProfile.Container)) @@ -349,7 +383,7 @@ namespace MediaBrowser.Model.Dlna if (audioCodecProfiles.Count >= 1) break; } - List<ProfileCondition> audioTranscodingConditions = new List<ProfileCondition>(); + var audioTranscodingConditions = new List<ProfileCondition>(); foreach (CodecProfile i in audioCodecProfiles) { bool applyConditions = true; @@ -413,7 +447,7 @@ namespace MediaBrowser.Model.Dlna private Tuple<List<PlayMethod>, List<TranscodeReason>> GetAudioDirectPlayMethods(MediaSourceInfo item, MediaStream audioStream, AudioOptions options) { - List<TranscodeReason> transcodeReasons = new List<TranscodeReason>(); + var transcodeReasons = new List<TranscodeReason>(); DirectPlayProfile directPlayProfile = null; foreach (DirectPlayProfile i in options.Profile.DirectPlayProfiles) @@ -425,7 +459,7 @@ namespace MediaBrowser.Model.Dlna } } - List<PlayMethod> playMethods = new List<PlayMethod>(); + var playMethods = new List<PlayMethod>(); if (directPlayProfile != null) { @@ -500,8 +534,8 @@ namespace MediaBrowser.Model.Dlna if (videoStream != null) { // Check video codec - List<string> videoCodecs = profile.GetVideoCodecs(); - if (videoCodecs.Count > 0) + var videoCodecs = profile.GetVideoCodecs(); + if (videoCodecs.Length > 0) { string videoCodec = videoStream.Codec; if (!string.IsNullOrEmpty(videoCodec) && ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec)) @@ -518,8 +552,8 @@ namespace MediaBrowser.Model.Dlna if (audioStream != null) { // Check audio codec - List<string> audioCodecs = profile.GetAudioCodecs(); - if (audioCodecs.Count > 0) + var audioCodecs = profile.GetAudioCodecs(); + if (audioCodecs.Length > 0) { string audioCodec = audioStream.Codec; if (!string.IsNullOrEmpty(audioCodec) && ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec)) @@ -568,7 +602,7 @@ namespace MediaBrowser.Model.Dlna } } - List<MediaStream> topStreams = new List<MediaStream>(); + var topStreams = new List<MediaStream>(); foreach (MediaStream stream in item.MediaStreams) { if (stream.Type == MediaStreamType.Subtitle && stream.Score.HasValue && stream.Score.Value == highestScore) @@ -603,7 +637,7 @@ namespace MediaBrowser.Model.Dlna throw new ArgumentNullException("item"); } - List<TranscodeReason> transcodeReasons = new List<TranscodeReason>(); + var transcodeReasons = new List<TranscodeReason>(); StreamInfo playlistItem = new StreamInfo { @@ -648,11 +682,11 @@ namespace MediaBrowser.Model.Dlna if (directPlay != null) { playlistItem.PlayMethod = directPlay.Value; - playlistItem.Container = item.Container; + playlistItem.Container = NormalizeMediaSourceFormatIntoSingleContainer(item.Container, options.Profile, DlnaProfileType.Video); if (subtitleStream != null) { - SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, directPlay.Value, null, null); + SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, directPlay.Value, _transcoderSupport, null, null); playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method; playlistItem.SubtitleFormat = subtitleProfile.Format; @@ -694,7 +728,7 @@ namespace MediaBrowser.Model.Dlna if (subtitleStream != null) { - SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.Transcode, transcodingProfile.Protocol, transcodingProfile.Container); + SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.Transcode, _transcoderSupport, transcodingProfile.Protocol, transcodingProfile.Container); playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method; playlistItem.SubtitleFormat = subtitleProfile.Format; @@ -735,7 +769,7 @@ namespace MediaBrowser.Model.Dlna playlistItem.AudioStreamIndex = audioStreamIndex; ConditionProcessor conditionProcessor = new ConditionProcessor(); - List<ProfileCondition> videoTranscodingConditions = new List<ProfileCondition>(); + var videoTranscodingConditions = new List<ProfileCondition>(); foreach (CodecProfile i in options.Profile.CodecProfiles) { if (i.Type == CodecType.Video && i.ContainsCodec(transcodingProfile.VideoCodec, transcodingProfile.Container)) @@ -770,7 +804,7 @@ namespace MediaBrowser.Model.Dlna } ApplyTranscodingConditions(playlistItem, videoTranscodingConditions); - List<ProfileCondition> audioTranscodingConditions = new List<ProfileCondition>(); + var audioTranscodingConditions = new List<ProfileCondition>(); foreach (CodecProfile i in options.Profile.CodecProfiles) { if (i.Type == CodecType.VideoAudio && i.ContainsCodec(playlistItem.TargetAudioCodec, transcodingProfile.Container)) @@ -956,7 +990,7 @@ namespace MediaBrowser.Model.Dlna string container = mediaSource.Container; - List<ProfileCondition> conditions = new List<ProfileCondition>(); + var conditions = new List<ProfileCondition>(); foreach (ContainerProfile i in profile.ContainerProfiles) { if (i.Type == DlnaProfileType.Video && @@ -1089,7 +1123,7 @@ namespace MediaBrowser.Model.Dlna { if (!conditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, audioProfile, isSecondaryAudio)) { - LogConditionFailure(profile, "VideoAudioCodecProfile", applyCondition, mediaSource); + LogConditionFailure(profile, "VideoAudioCodecProfile.ApplyConditions", applyCondition, mediaSource); applyConditions = false; break; } @@ -1149,7 +1183,7 @@ namespace MediaBrowser.Model.Dlna { if (subtitleStream != null) { - SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, playMethod, null, null); + SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, playMethod, _transcoderSupport, null, null); if (subtitleProfile.Method != SubtitleDeliveryMethod.External && subtitleProfile.Method != SubtitleDeliveryMethod.Embed) { @@ -1168,7 +1202,7 @@ namespace MediaBrowser.Model.Dlna return new Tuple<bool, TranscodeReason?>(result, TranscodeReason.ContainerBitrateExceedsLimit); } - public static SubtitleProfile GetSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, PlayMethod playMethod, string transcodingSubProtocol, string transcodingContainer) + public static SubtitleProfile GetSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, PlayMethod playMethod, ITranscoderSupport transcoderSupport, string transcodingSubProtocol, string transcodingContainer) { if (!subtitleStream.IsExternal && (playMethod != PlayMethod.Transcode || !string.Equals(transcodingSubProtocol, "hls", StringComparison.OrdinalIgnoreCase))) { @@ -1222,7 +1256,9 @@ namespace MediaBrowser.Model.Dlna } // Look for an external or hls profile that matches the stream type (text/graphical) and doesn't require conversion - return GetExternalSubtitleProfile(subtitleStream, subtitleProfiles, playMethod, false) ?? GetExternalSubtitleProfile(subtitleStream, subtitleProfiles, playMethod, true) ?? new SubtitleProfile + return GetExternalSubtitleProfile(subtitleStream, subtitleProfiles, playMethod, transcoderSupport, false) ?? + GetExternalSubtitleProfile(subtitleStream, subtitleProfiles, playMethod, transcoderSupport, true) ?? + new SubtitleProfile { Method = SubtitleDeliveryMethod.Encode, Format = subtitleStream.Codec @@ -1231,27 +1267,33 @@ namespace MediaBrowser.Model.Dlna private static bool IsSubtitleEmbedSupported(MediaStream subtitleStream, SubtitleProfile subtitleProfile, string transcodingSubProtocol, string transcodingContainer) { - if (string.Equals(transcodingContainer, "ts", StringComparison.OrdinalIgnoreCase)) - { - return false; - } - if (string.Equals(transcodingContainer, "mpegts", StringComparison.OrdinalIgnoreCase)) - { - return false; - } - if (string.Equals(transcodingContainer, "mp4", StringComparison.OrdinalIgnoreCase)) + if (!string.IsNullOrWhiteSpace(transcodingContainer)) { - return false; - } - if (string.Equals(transcodingContainer, "mkv", StringComparison.OrdinalIgnoreCase)) - { - return true; + var normalizedContainers = ContainerProfile.SplitValue(transcodingContainer); + + if (ContainerProfile.ContainsContainer(normalizedContainers, "ts")) + { + return false; + } + if (ContainerProfile.ContainsContainer(normalizedContainers, "mpegts")) + { + return false; + } + if (ContainerProfile.ContainsContainer(normalizedContainers, "mp4")) + { + return false; + } + if (ContainerProfile.ContainsContainer(normalizedContainers, "mkv") || + ContainerProfile.ContainsContainer(normalizedContainers, "matroska")) + { + return true; + } } return false; } - private static SubtitleProfile GetExternalSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, PlayMethod playMethod, bool allowConversion) + private static SubtitleProfile GetExternalSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, PlayMethod playMethod, ITranscoderSupport transcoderSupport, bool allowConversion) { foreach (SubtitleProfile profile in subtitleProfiles) { @@ -1270,6 +1312,11 @@ namespace MediaBrowser.Model.Dlna continue; } + if (!subtitleStream.IsExternal && !transcoderSupport.CanExtractSubtitles(subtitleStream.Codec)) + { + continue; + } + if ((profile.Method == SubtitleDeliveryMethod.External && subtitleStream.IsTextSubtitleStream == MediaStream.IsTextFormat(profile.Format)) || (profile.Method == SubtitleDeliveryMethod.Hls && subtitleStream.IsTextSubtitleStream)) { @@ -1538,8 +1585,8 @@ namespace MediaBrowser.Model.Dlna } // Check audio codec - List<string> audioCodecs = profile.GetAudioCodecs(); - if (audioCodecs.Count > 0) + var audioCodecs = profile.GetAudioCodecs(); + if (audioCodecs.Length > 0) { // Check audio codecs string audioCodec = audioStream == null ? null : audioStream.Codec; @@ -1561,8 +1608,8 @@ namespace MediaBrowser.Model.Dlna } // Check video codec - List<string> videoCodecs = profile.GetVideoCodecs(); - if (videoCodecs.Count > 0) + var videoCodecs = profile.GetVideoCodecs(); + if (videoCodecs.Length > 0) { string videoCodec = videoStream == null ? null : videoStream.Codec; if (string.IsNullOrEmpty(videoCodec) || !ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec)) @@ -1572,14 +1619,17 @@ namespace MediaBrowser.Model.Dlna } // Check audio codec - List<string> audioCodecs = profile.GetAudioCodecs(); - if (audioCodecs.Count > 0) + if (audioStream != null) { - // Check audio codecs - string audioCodec = audioStream == null ? null : audioStream.Codec; - if (string.IsNullOrEmpty(audioCodec) || !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec)) + var audioCodecs = profile.GetAudioCodecs(); + if (audioCodecs.Length > 0) { - return false; + // Check audio codecs + string audioCodec = audioStream == null ? null : audioStream.Codec; + if (string.IsNullOrEmpty(audioCodec) || !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec)) + { + return false; + } } } diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs index 9c8e8b030..c63e74eaf 100644 --- a/MediaBrowser.Model/Dlna/StreamInfo.cs +++ b/MediaBrowser.Model/Dlna/StreamInfo.cs @@ -149,7 +149,7 @@ namespace MediaBrowser.Model.Dlna list.Add(string.Format("{0}={1}", pair.Name, pair.Value)); } - string queryString = string.Join("&", list.ToArray()); + string queryString = string.Join("&", list.ToArray(list.Count)); return GetUrl(baseUrl, queryString); } @@ -203,7 +203,7 @@ namespace MediaBrowser.Model.Dlna list.Add(pair.Value); } - return string.Format("Params={0}", string.Join(";", list.ToArray())); + return string.Format("Params={0}", string.Join(";", list.ToArray(list.Count))); } private static List<NameValuePair> BuildParams(StreamInfo item, string accessToken, bool isDlna) @@ -309,14 +309,14 @@ namespace MediaBrowser.Model.Dlna return list; } - public List<SubtitleStreamInfo> GetExternalSubtitles(bool includeSelectedTrackOnly, string baseUrl, string accessToken) + public List<SubtitleStreamInfo> GetExternalSubtitles(ITranscoderSupport transcoderSupport, bool includeSelectedTrackOnly, string baseUrl, string accessToken) { - return GetExternalSubtitles(includeSelectedTrackOnly, false, baseUrl, accessToken); + return GetExternalSubtitles(transcoderSupport, includeSelectedTrackOnly, false, baseUrl, accessToken); } - public List<SubtitleStreamInfo> GetExternalSubtitles(bool includeSelectedTrackOnly, bool enableAllProfiles, string baseUrl, string accessToken) + public List<SubtitleStreamInfo> GetExternalSubtitles(ITranscoderSupport transcoderSupport, bool includeSelectedTrackOnly, bool enableAllProfiles, string baseUrl, string accessToken) { - List<SubtitleStreamInfo> list = GetSubtitleProfiles(includeSelectedTrackOnly, enableAllProfiles, baseUrl, accessToken); + List<SubtitleStreamInfo> list = GetSubtitleProfiles(transcoderSupport, includeSelectedTrackOnly, enableAllProfiles, baseUrl, accessToken); List<SubtitleStreamInfo> newList = new List<SubtitleStreamInfo>(); // First add the selected track @@ -331,12 +331,12 @@ namespace MediaBrowser.Model.Dlna return newList; } - public List<SubtitleStreamInfo> GetSubtitleProfiles(bool includeSelectedTrackOnly, string baseUrl, string accessToken) + public List<SubtitleStreamInfo> GetSubtitleProfiles(ITranscoderSupport transcoderSupport, bool includeSelectedTrackOnly, string baseUrl, string accessToken) { - return GetSubtitleProfiles(includeSelectedTrackOnly, false, baseUrl, accessToken); + return GetSubtitleProfiles(transcoderSupport, includeSelectedTrackOnly, false, baseUrl, accessToken); } - public List<SubtitleStreamInfo> GetSubtitleProfiles(bool includeSelectedTrackOnly, bool enableAllProfiles, string baseUrl, string accessToken) + public List<SubtitleStreamInfo> GetSubtitleProfiles(ITranscoderSupport transcoderSupport, bool includeSelectedTrackOnly, bool enableAllProfiles, string baseUrl, string accessToken) { List<SubtitleStreamInfo> list = new List<SubtitleStreamInfo>(); @@ -352,7 +352,7 @@ namespace MediaBrowser.Model.Dlna { if (stream.Type == MediaStreamType.Subtitle && stream.Index == SubtitleStreamIndex.Value) { - AddSubtitleProfiles(list, stream, enableAllProfiles, baseUrl, accessToken, startPositionTicks); + AddSubtitleProfiles(list, stream, transcoderSupport, enableAllProfiles, baseUrl, accessToken, startPositionTicks); } } } @@ -363,7 +363,7 @@ namespace MediaBrowser.Model.Dlna { if (stream.Type == MediaStreamType.Subtitle && (!SubtitleStreamIndex.HasValue || stream.Index != SubtitleStreamIndex.Value)) { - AddSubtitleProfiles(list, stream, enableAllProfiles, baseUrl, accessToken, startPositionTicks); + AddSubtitleProfiles(list, stream, transcoderSupport, enableAllProfiles, baseUrl, accessToken, startPositionTicks); } } } @@ -371,28 +371,28 @@ namespace MediaBrowser.Model.Dlna return list; } - private void AddSubtitleProfiles(List<SubtitleStreamInfo> list, MediaStream stream, bool enableAllProfiles, string baseUrl, string accessToken, long startPositionTicks) + private void AddSubtitleProfiles(List<SubtitleStreamInfo> list, MediaStream stream, ITranscoderSupport transcoderSupport, bool enableAllProfiles, string baseUrl, string accessToken, long startPositionTicks) { if (enableAllProfiles) { foreach (SubtitleProfile profile in DeviceProfile.SubtitleProfiles) { - SubtitleStreamInfo info = GetSubtitleStreamInfo(stream, baseUrl, accessToken, startPositionTicks, new[] { profile }); + SubtitleStreamInfo info = GetSubtitleStreamInfo(stream, baseUrl, accessToken, startPositionTicks, new[] { profile }, transcoderSupport); list.Add(info); } } else { - SubtitleStreamInfo info = GetSubtitleStreamInfo(stream, baseUrl, accessToken, startPositionTicks, DeviceProfile.SubtitleProfiles); + SubtitleStreamInfo info = GetSubtitleStreamInfo(stream, baseUrl, accessToken, startPositionTicks, DeviceProfile.SubtitleProfiles, transcoderSupport); list.Add(info); } } - private SubtitleStreamInfo GetSubtitleStreamInfo(MediaStream stream, string baseUrl, string accessToken, long startPositionTicks, SubtitleProfile[] subtitleProfiles) + private SubtitleStreamInfo GetSubtitleStreamInfo(MediaStream stream, string baseUrl, string accessToken, long startPositionTicks, SubtitleProfile[] subtitleProfiles, ITranscoderSupport transcoderSupport) { - SubtitleProfile subtitleProfile = StreamBuilder.GetSubtitleProfile(stream, subtitleProfiles, PlayMethod, SubProtocol, Container); + SubtitleProfile subtitleProfile = StreamBuilder.GetSubtitleProfile(stream, subtitleProfiles, PlayMethod, transcoderSupport, SubProtocol, Container); SubtitleStreamInfo info = new SubtitleStreamInfo { IsForced = stream.IsForced, diff --git a/MediaBrowser.Model/Dlna/StreamInfoSorter.cs b/MediaBrowser.Model/Dlna/StreamInfoSorter.cs index badd3c5b1..e13b32767 100644 --- a/MediaBrowser.Model/Dlna/StreamInfoSorter.cs +++ b/MediaBrowser.Model/Dlna/StreamInfoSorter.cs @@ -8,7 +8,7 @@ namespace MediaBrowser.Model.Dlna { public class StreamInfoSorter { - public static List<StreamInfo> SortMediaSources(List<StreamInfo> streams, long? maxBitrate) + public static StreamInfo[] SortMediaSources(List<StreamInfo> streams, long? maxBitrate) { return streams.OrderBy(i => { @@ -54,7 +54,7 @@ namespace MediaBrowser.Model.Dlna return 0; - }).ToList(); + }).ToArray(); } } } diff --git a/MediaBrowser.Model/Dlna/SubtitleProfile.cs b/MediaBrowser.Model/Dlna/SubtitleProfile.cs index f182541d8..3f639a520 100644 --- a/MediaBrowser.Model/Dlna/SubtitleProfile.cs +++ b/MediaBrowser.Model/Dlna/SubtitleProfile.cs @@ -19,14 +19,9 @@ namespace MediaBrowser.Model.Dlna [XmlAttribute("language")] public string Language { get; set; } - public List<string> GetLanguages() + public string[] GetLanguages() { - List<string> list = new List<string>(); - foreach (string i in (Language ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; + return ContainerProfile.SplitValue(Language); } public bool SupportsLanguage(string subLanguage) @@ -41,8 +36,8 @@ namespace MediaBrowser.Model.Dlna subLanguage = "und"; } - List<string> languages = GetLanguages(); - return languages.Count == 0 || ListHelper.ContainsIgnoreCase(languages, subLanguage); + var languages = GetLanguages(); + return languages.Length == 0 || ListHelper.ContainsIgnoreCase(languages, subLanguage); } } }
\ No newline at end of file diff --git a/MediaBrowser.Model/Dlna/TranscodingProfile.cs b/MediaBrowser.Model/Dlna/TranscodingProfile.cs index 9623a68b0..8453fdf6d 100644 --- a/MediaBrowser.Model/Dlna/TranscodingProfile.cs +++ b/MediaBrowser.Model/Dlna/TranscodingProfile.cs @@ -51,14 +51,9 @@ namespace MediaBrowser.Model.Dlna [XmlAttribute("breakOnNonKeyFrames")] public bool BreakOnNonKeyFrames { get; set; } - public List<string> GetAudioCodecs() + public string[] GetAudioCodecs() { - List<string> list = new List<string>(); - foreach (string i in (AudioCodec ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; + return ContainerProfile.SplitValue(AudioCodec); } } } diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs index afd871be0..8bad650b5 100644 --- a/MediaBrowser.Model/Dto/BaseItemDto.cs +++ b/MediaBrowser.Model/Dto/BaseItemDto.cs @@ -163,7 +163,7 @@ namespace MediaBrowser.Model.Dto public string[] ProductionLocations { get; set; } - public List<string> MultiPartGameFiles { get; set; } + public string[] MultiPartGameFiles { get; set; } /// <summary> /// Gets or sets the path. @@ -201,7 +201,7 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the taglines. /// </summary> /// <value>The taglines.</value> - public List<string> Taglines { get; set; } + public string[] Taglines { get; set; } /// <summary> /// Gets or sets the genres. @@ -210,12 +210,6 @@ namespace MediaBrowser.Model.Dto public List<string> Genres { get; set; } /// <summary> - /// Gets or sets the series genres. - /// </summary> - /// <value>The series genres.</value> - public List<string> SeriesGenres { get; set; } - - /// <summary> /// Gets or sets the community rating. /// </summary> /// <value>The community rating.</value> @@ -228,12 +222,6 @@ namespace MediaBrowser.Model.Dto public long? CumulativeRunTimeTicks { get; set; } /// <summary> - /// Gets or sets the original run time ticks. - /// </summary> - /// <value>The original run time ticks.</value> - public long? OriginalRunTimeTicks { get; set; } - - /// <summary> /// Gets or sets the run time ticks. /// </summary> /// <value>The run time ticks.</value> @@ -258,12 +246,6 @@ namespace MediaBrowser.Model.Dto public int? ProductionYear { get; set; } /// <summary> - /// Gets or sets the players supported by a game. - /// </summary> - /// <value>The players.</value> - public int? Players { get; set; } - - /// <summary> /// Gets or sets a value indicating whether this instance is place holder. /// </summary> /// <value><c>null</c> if [is place holder] contains no value, <c>true</c> if [is place holder]; otherwise, <c>false</c>.</value> @@ -298,7 +280,7 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the trailer urls. /// </summary> /// <value>The trailer urls.</value> - public List<MediaUrl> RemoteTrailers { get; set; } + public MediaUrl[] RemoteTrailers { get; set; } /// <summary> /// Gets or sets the provider ids. @@ -360,7 +342,7 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the parent backdrop image tags. /// </summary> /// <value>The parent backdrop image tags.</value> - public List<string> ParentBackdropImageTags { get; set; } + public string[] ParentBackdropImageTags { get; set; } /// <summary> /// Gets or sets the local trailer count. @@ -432,13 +414,13 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the air days. /// </summary> /// <value>The air days.</value> - public List<DayOfWeek> AirDays { get; set; } + public DayOfWeek[] AirDays { get; set; } /// <summary> /// Gets or sets the tags. /// </summary> /// <value>The tags.</value> - public List<string> Tags { get; set; } + public string[] Tags { get; set; } /// <summary> /// Gets or sets the primary image aspect ratio, after image enhancements. @@ -450,13 +432,13 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the artists. /// </summary> /// <value>The artists.</value> - public List<string> Artists { get; set; } + public string[] Artists { get; set; } /// <summary> /// Gets or sets the artist items. /// </summary> /// <value>The artist items.</value> - public List<NameIdPair> ArtistItems { get; set; } + public NameIdPair[] ArtistItems { get; set; } /// <summary> /// Gets or sets the album. @@ -503,7 +485,7 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the album artists. /// </summary> /// <value>The album artists.</value> - public List<NameIdPair> AlbumArtists { get; set; } + public NameIdPair[] AlbumArtists { get; set; } /// <summary> /// Gets or sets the name of the season. @@ -515,7 +497,7 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the media streams. /// </summary> /// <value>The media streams.</value> - public List<MediaStream> MediaStreams { get; set; } + public MediaStream[] MediaStreams { get; set; } /// <summary> /// Gets or sets the type of the video. @@ -524,12 +506,6 @@ namespace MediaBrowser.Model.Dto public VideoType? VideoType { get; set; } /// <summary> - /// Gets or sets the display type of the media. - /// </summary> - /// <value>The display type of the media.</value> - public string DisplayMediaType { get; set; } - - /// <summary> /// Gets or sets the part count. /// </summary> /// <value>The part count.</value> @@ -566,13 +542,13 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the backdrop image tags. /// </summary> /// <value>The backdrop image tags.</value> - public List<string> BackdropImageTags { get; set; } + public string[] BackdropImageTags { get; set; } /// <summary> /// Gets or sets the screenshot image tags. /// </summary> /// <value>The screenshot image tags.</value> - public List<string> ScreenshotImageTags { get; set; } + public string[] ScreenshotImageTags { get; set; } /// <summary> /// Gets or sets the parent logo image tag. @@ -604,8 +580,6 @@ namespace MediaBrowser.Model.Dto /// <value>The series studio.</value> public string SeriesStudio { get; set; } - public StudioDto SeriesStudioInfo { get; set; } - /// <summary> /// Gets or sets the parent thumb item id. /// </summary> @@ -670,7 +644,7 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the locked fields. /// </summary> /// <value>The locked fields.</value> - public List<MetadataFields> LockedFields { get; set; } + public MetadataFields[] LockedFields { get; set; } /// <summary> /// Gets or sets the trailer count. @@ -748,66 +722,6 @@ namespace MediaBrowser.Model.Dto public string SeriesTimerId { get; set; } /// <summary> - /// Gets a value indicating whether this instance has art. - /// </summary> - /// <value><c>true</c> if this instance has art; otherwise, <c>false</c>.</value> - [IgnoreDataMember] - public bool HasArtImage - { - get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Art); } - } - - /// <summary> - /// Gets a value indicating whether this instance has logo. - /// </summary> - /// <value><c>true</c> if this instance has logo; otherwise, <c>false</c>.</value> - [IgnoreDataMember] - public bool HasLogo - { - get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Logo); } - } - - /// <summary> - /// Gets a value indicating whether this instance has thumb. - /// </summary> - /// <value><c>true</c> if this instance has thumb; otherwise, <c>false</c>.</value> - [IgnoreDataMember] - public bool HasThumb - { - get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Thumb); } - } - - /// <summary> - /// Gets a value indicating whether this instance has thumb. - /// </summary> - /// <value><c>true</c> if this instance has thumb; otherwise, <c>false</c>.</value> - [IgnoreDataMember] - public bool HasBackdrop - { - get { return (BackdropImageTags != null && BackdropImageTags.Count > 0) || (ParentBackdropImageTags != null && ParentBackdropImageTags.Count > 0); } - } - - /// <summary> - /// Gets a value indicating whether this instance has primary image. - /// </summary> - /// <value><c>true</c> if this instance has primary image; otherwise, <c>false</c>.</value> - [IgnoreDataMember] - public bool HasPrimaryImage - { - get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Primary); } - } - - /// <summary> - /// Gets a value indicating whether this instance is video. - /// </summary> - /// <value><c>true</c> if this instance is video; otherwise, <c>false</c>.</value> - [IgnoreDataMember] - public bool IsVideo - { - get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Video); } - } - - /// <summary> /// Gets or sets the program identifier. /// </summary> /// <value>The program identifier.</value> diff --git a/MediaBrowser.Model/Dto/GameSystemSummary.cs b/MediaBrowser.Model/Dto/GameSystemSummary.cs index 1da3bb0ac..2cd9d408d 100644 --- a/MediaBrowser.Model/Dto/GameSystemSummary.cs +++ b/MediaBrowser.Model/Dto/GameSystemSummary.cs @@ -29,7 +29,7 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the game extensions. /// </summary> /// <value>The game extensions.</value> - public List<string> GameFileExtensions { get; set; } + public string[] GameFileExtensions { get; set; } /// <summary> /// Gets or sets the client installed game count. @@ -42,7 +42,7 @@ namespace MediaBrowser.Model.Dto /// </summary> public GameSystemSummary() { - GameFileExtensions = new List<string>(); + GameFileExtensions = new string[] { }; } } } diff --git a/MediaBrowser.Model/Dto/ItemLayout.cs b/MediaBrowser.Model/Dto/ItemLayout.cs deleted file mode 100644 index c85818390..000000000 --- a/MediaBrowser.Model/Dto/ItemLayout.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace MediaBrowser.Model.Dto -{ - public static class ItemLayout - { - public static double? GetDisplayAspectRatio(BaseItemDto item) - { - List<BaseItemDto> items = new List<BaseItemDto>(); - items.Add(item); - return GetDisplayAspectRatio(items); - } - - public static double? GetDisplayAspectRatio(List<BaseItemDto> items) - { - List<double> values = new List<double>(); - - foreach (BaseItemDto item in items) - { - if (item.PrimaryImageAspectRatio.HasValue) - { - values.Add(item.PrimaryImageAspectRatio.Value); - } - } - - if (values.Count == 0) - { - return null; - } - - values.Sort(); - - double halfDouble = values.Count; - halfDouble /= 2; - int half = Convert.ToInt32(Math.Floor(halfDouble)); - - double result; - - if (values.Count % 2 > 0) - result = values[half]; - else - result = (values[half - 1] + values[half]) / 2.0; - - // If really close to 2:3 (poster image), just return 2:3 - if (Math.Abs(0.66666666667 - result) <= .15) - { - return 0.66666666667; - } - - // If really close to 16:9 (episode image), just return 16:9 - if (Math.Abs(1.777777778 - result) <= .2) - { - return 1.777777778; - } - - // If really close to 1 (square image), just return 1 - if (Math.Abs(1 - result) <= .15) - { - return 1.0; - } - - // If really close to 4:3 (poster image), just return 2:3 - if (Math.Abs(1.33333333333 - result) <= .15) - { - return 1.33333333333; - } - - return result; - } - } -} diff --git a/MediaBrowser.Model/Dto/MediaSourceInfo.cs b/MediaBrowser.Model/Dto/MediaSourceInfo.cs index 08824913f..27920bdf3 100644 --- a/MediaBrowser.Model/Dto/MediaSourceInfo.cs +++ b/MediaBrowser.Model/Dto/MediaSourceInfo.cs @@ -2,7 +2,6 @@ using MediaBrowser.Model.Extensions; using MediaBrowser.Model.MediaInfo; using System.Collections.Generic; -using System.Linq; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Session; @@ -41,6 +40,7 @@ namespace MediaBrowser.Model.Dto public string OpenToken { get; set; } public bool RequiresClosing { get; set; } public bool SupportsProbing { get; set; } + public bool EnableMpDecimate { get; set; } public string LiveStreamId { get; set; } public int? BufferMs { get; set; } @@ -53,9 +53,8 @@ namespace MediaBrowser.Model.Dto public Video3DFormat? Video3DFormat { get; set; } public List<MediaStream> MediaStreams { get; set; } - public List<string> PlayableStreamFileNames { get; set; } - public List<string> Formats { get; set; } + public string[] Formats { get; set; } public int? Bitrate { get; set; } @@ -70,10 +69,9 @@ namespace MediaBrowser.Model.Dto public MediaSourceInfo() { - Formats = new List<string>(); + Formats = new string[] { }; MediaStreams = new List<MediaStream>(); RequiredHttpHeaders = new Dictionary<string, string>(); - PlayableStreamFileNames = new List<string>(); SupportsTranscoding = true; SupportsDirectStream = true; SupportsDirectPlay = true; @@ -92,19 +90,15 @@ namespace MediaBrowser.Model.Dto return; } - var internalStreams = MediaStreams - .Where(i => !i.IsExternal) - .ToList(); - - if (internalStreams.Count == 0) + var bitrate = 0; + foreach (var stream in MediaStreams) { - return; + if (!stream.IsExternal) + { + bitrate += stream.BitRate ?? 0; + } } - var bitrate = internalStreams - .Select(m => m.BitRate ?? 0) - .Sum(); - if (bitrate > 0) { Bitrate = bitrate; @@ -164,7 +158,7 @@ namespace MediaBrowser.Model.Dto { foreach (MediaStream i in MediaStreams) { - if (i.Type == MediaStreamType.Video && StringHelper.IndexOfIgnoreCase(i.Codec ?? string.Empty, "jpeg") == -1) + if (i.Type == MediaStreamType.Video) { return i; } diff --git a/MediaBrowser.Model/Dto/MetadataEditorInfo.cs b/MediaBrowser.Model/Dto/MetadataEditorInfo.cs index 9bd15fc8f..aa8b33c81 100644 --- a/MediaBrowser.Model/Dto/MetadataEditorInfo.cs +++ b/MediaBrowser.Model/Dto/MetadataEditorInfo.cs @@ -7,21 +7,21 @@ namespace MediaBrowser.Model.Dto { public class MetadataEditorInfo { - public List<ParentalRating> ParentalRatingOptions { get; set; } - public List<CountryInfo> Countries { get; set; } - public List<CultureDto> Cultures { get; set; } - public List<ExternalIdInfo> ExternalIdInfos { get; set; } + public ParentalRating[] ParentalRatingOptions { get; set; } + public CountryInfo[] Countries { get; set; } + public CultureDto[] Cultures { get; set; } + public ExternalIdInfo[] ExternalIdInfos { get; set; } public string ContentType { get; set; } - public List<NameValuePair> ContentTypeOptions { get; set; } + public NameValuePair[] ContentTypeOptions { get; set; } public MetadataEditorInfo() { - ParentalRatingOptions = new List<ParentalRating>(); - Countries = new List<CountryInfo>(); - Cultures = new List<CultureDto>(); - ExternalIdInfos = new List<ExternalIdInfo>(); - ContentTypeOptions = new List<NameValuePair>(); + ParentalRatingOptions = new ParentalRating[] { }; + Countries = new CountryInfo[] { }; + Cultures = new CultureDto[] { }; + ExternalIdInfos = new ExternalIdInfo[] { }; + ContentTypeOptions = new NameValuePair[] { }; } } } diff --git a/MediaBrowser.Model/Dto/StudioDto.cs b/MediaBrowser.Model/Dto/StudioDto.cs deleted file mode 100644 index 10dc60699..000000000 --- a/MediaBrowser.Model/Dto/StudioDto.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Diagnostics; - -namespace MediaBrowser.Model.Dto -{ - /// <summary> - /// Class StudioDto - /// </summary> - [DebuggerDisplay("Name = {Name}")] - public class StudioDto - { - /// <summary> - /// Gets or sets the name. - /// </summary> - /// <value>The name.</value> - public string Name { get; set; } - - /// <summary> - /// Gets or sets the identifier. - /// </summary> - /// <value>The identifier.</value> - public string Id { get; set; } - - /// <summary> - /// Gets or sets the primary image tag. - /// </summary> - /// <value>The primary image tag.</value> - public string PrimaryImageTag { get; set; } - } -}
\ No newline at end of file diff --git a/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs b/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs index 07a4b5f60..b3d3be70e 100644 --- a/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs +++ b/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; - + namespace MediaBrowser.Model.Entities { /// <summary> @@ -11,41 +10,41 @@ namespace MediaBrowser.Model.Entities /// Gets or sets the folders added to. /// </summary> /// <value>The folders added to.</value> - public List<string> FoldersAddedTo { get; set; } + public string[] FoldersAddedTo { get; set; } /// <summary> /// Gets or sets the folders removed from. /// </summary> /// <value>The folders removed from.</value> - public List<string> FoldersRemovedFrom { get; set; } + public string[] FoldersRemovedFrom { get; set; } /// <summary> /// Gets or sets the items added. /// </summary> /// <value>The items added.</value> - public List<string> ItemsAdded { get; set; } + public string[] ItemsAdded { get; set; } /// <summary> /// Gets or sets the items removed. /// </summary> /// <value>The items removed.</value> - public List<string> ItemsRemoved { get; set; } + public string[] ItemsRemoved { get; set; } /// <summary> /// Gets or sets the items updated. /// </summary> /// <value>The items updated.</value> - public List<string> ItemsUpdated { get; set; } + public string[] ItemsUpdated { get; set; } /// <summary> /// Initializes a new instance of the <see cref="LibraryUpdateInfo"/> class. /// </summary> public LibraryUpdateInfo() { - FoldersAddedTo = new List<string>(); - FoldersRemovedFrom = new List<string>(); - ItemsAdded = new List<string>(); - ItemsRemoved = new List<string>(); - ItemsUpdated = new List<string>(); + FoldersAddedTo = new string[] { }; + FoldersRemovedFrom = new string[] { }; + ItemsAdded = new string[] { }; + ItemsRemoved = new string[] { }; + ItemsUpdated = new string[] { }; } } } diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index 3cd3e7dde..747528cbf 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -81,7 +81,7 @@ namespace MediaBrowser.Model.Entities attributes.Add("Default"); } - return string.Join(" ", attributes.ToArray()); + return string.Join(" ", attributes.ToArray(attributes.Count)); } if (Type == MediaStreamType.Subtitle) @@ -107,7 +107,7 @@ namespace MediaBrowser.Model.Entities attributes.Add("Forced"); } - string name = string.Join(" ", attributes.ToArray()); + string name = string.Join(" ", attributes.ToArray(attributes.Count)); return name; } diff --git a/MediaBrowser.Model/Entities/VideoType.cs b/MediaBrowser.Model/Entities/VideoType.cs index aa9a3c55f..05c2fa32c 100644 --- a/MediaBrowser.Model/Entities/VideoType.cs +++ b/MediaBrowser.Model/Entities/VideoType.cs @@ -21,10 +21,6 @@ namespace MediaBrowser.Model.Entities /// <summary> /// The blu ray /// </summary> - BluRay, - /// <summary> - /// The hd DVD - /// </summary> - HdDvd + BluRay } } diff --git a/MediaBrowser.Model/Entities/VirtualFolderInfo.cs b/MediaBrowser.Model/Entities/VirtualFolderInfo.cs index 374d8d028..901090717 100644 --- a/MediaBrowser.Model/Entities/VirtualFolderInfo.cs +++ b/MediaBrowser.Model/Entities/VirtualFolderInfo.cs @@ -18,7 +18,7 @@ namespace MediaBrowser.Model.Entities /// Gets or sets the locations. /// </summary> /// <value>The locations.</value> - public List<string> Locations { get; set; } + public string[] Locations { get; set; } /// <summary> /// Gets or sets the type of the collection. @@ -33,7 +33,7 @@ namespace MediaBrowser.Model.Entities /// </summary> public VirtualFolderInfo() { - Locations = new List<string>(); + Locations = new string[] { }; } /// <summary> diff --git a/MediaBrowser.Model/Extensions/LinqExtensions.cs b/MediaBrowser.Model/Extensions/LinqExtensions.cs index 6b2bdb4c7..09ace42e8 100644 --- a/MediaBrowser.Model/Extensions/LinqExtensions.cs +++ b/MediaBrowser.Model/Extensions/LinqExtensions.cs @@ -42,6 +42,19 @@ namespace MediaBrowser.Model.Extensions return source.DistinctBy(keySelector, null); } + public static TSource[] ToArray<TSource>(this IEnumerable<TSource> source, int count) + { + if (source == null) throw new ArgumentNullException("source"); + if (count < 0) throw new ArgumentOutOfRangeException("count"); + var array = new TSource[count]; + int i = 0; + foreach (var item in source) + { + array[i++] = item; + } + return array; + } + /// <summary> /// Returns all distinct elements of the given source, where "distinctness" /// is determined via a projection and the specified comparer for the projected type. diff --git a/MediaBrowser.Model/Extensions/ListHelper.cs b/MediaBrowser.Model/Extensions/ListHelper.cs index 741f07469..6fe1793db 100644 --- a/MediaBrowser.Model/Extensions/ListHelper.cs +++ b/MediaBrowser.Model/Extensions/ListHelper.cs @@ -1,28 +1,24 @@ using System; -using System.Collections.Generic; -using System.Linq; namespace MediaBrowser.Model.Extensions { public static class ListHelper { - public static bool ContainsIgnoreCase(List<string> list, string value) + public static bool ContainsIgnoreCase(string[] list, string value) { if (value == null) { throw new ArgumentNullException("value"); } - return list.Contains(value, StringComparer.OrdinalIgnoreCase); - } - public static bool ContainsIgnoreCase(string[] list, string value) - { - if (value == null) + foreach (var item in list) { - throw new ArgumentNullException("value"); + if (string.Equals(item, value, StringComparison.OrdinalIgnoreCase)) + { + return true; + } } - - return list.Contains(value, StringComparer.OrdinalIgnoreCase); + return false; } public static bool ContainsAnyIgnoreCase(string[] list, string[] values) diff --git a/MediaBrowser.Model/Globalization/ILocalizationManager.cs b/MediaBrowser.Model/Globalization/ILocalizationManager.cs index 4477d8de3..2356a2fa1 100644 --- a/MediaBrowser.Model/Globalization/ILocalizationManager.cs +++ b/MediaBrowser.Model/Globalization/ILocalizationManager.cs @@ -12,17 +12,17 @@ namespace MediaBrowser.Model.Globalization /// Gets the cultures. /// </summary> /// <returns>IEnumerable{CultureDto}.</returns> - IEnumerable<CultureDto> GetCultures(); + CultureDto[] GetCultures(); /// <summary> /// Gets the countries. /// </summary> /// <returns>IEnumerable{CountryInfo}.</returns> - IEnumerable<CountryInfo> GetCountries(); + CountryInfo[] GetCountries(); /// <summary> /// Gets the parental ratings. /// </summary> /// <returns>IEnumerable{ParentalRating}.</returns> - IEnumerable<ParentalRating> GetParentalRatings(); + ParentalRating[] GetParentalRatings(); /// <summary> /// Gets the rating level. /// </summary> @@ -49,7 +49,7 @@ namespace MediaBrowser.Model.Globalization /// Gets the localization options. /// </summary> /// <returns>IEnumerable{LocalizatonOption}.</returns> - IEnumerable<LocalizatonOption> GetLocalizationOptions(); + LocalizatonOption[] GetLocalizationOptions(); string RemoveDiacritics(string text); diff --git a/MediaBrowser.Model/Health/IHealthMonitor.cs b/MediaBrowser.Model/Health/IHealthMonitor.cs deleted file mode 100644 index a4f95c1bc..000000000 --- a/MediaBrowser.Model/Health/IHealthMonitor.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using MediaBrowser.Model.Notifications; - -namespace MediaBrowser.Model.Health -{ - public interface IHealthMonitor - { - Task<List<Notification>> GetNotifications(CancellationToken cancellationToken); - } -} diff --git a/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs b/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs index 9d7fdd129..7c9fe0790 100644 --- a/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs @@ -113,7 +113,7 @@ namespace MediaBrowser.Model.LiveTv /// Gets or sets the parent backdrop image tags. /// </summary> /// <value>The parent backdrop image tags.</value> - public List<string> ParentBackdropImageTags { get; set; } + public string[] ParentBackdropImageTags { get; set; } /// <summary> /// Gets or sets a value indicating whether this instance is post padding required. diff --git a/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs b/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs index a8ea86494..67e3d44da 100644 --- a/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs @@ -41,7 +41,7 @@ namespace MediaBrowser.Model.LiveTv /// Gets or sets the media sources. /// </summary> /// <value>The media sources.</value> - public List<MediaSourceInfo> MediaSources { get; set; } + public MediaSourceInfo[] MediaSources { get; set; } /// <summary> /// Gets or sets the image tags. @@ -116,7 +116,7 @@ namespace MediaBrowser.Model.LiveTv public ChannelInfoDto() { ImageTags = new Dictionary<ImageType, string>(); - MediaSources = new List<MediaSourceInfo>(); + MediaSources = new MediaSourceInfo[] { }; } } } diff --git a/MediaBrowser.Model/LiveTv/LiveTvInfo.cs b/MediaBrowser.Model/LiveTv/LiveTvInfo.cs index f4d3e21d9..4620fbf0c 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvInfo.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvInfo.cs @@ -8,7 +8,7 @@ namespace MediaBrowser.Model.LiveTv /// Gets or sets the services. /// </summary> /// <value>The services.</value> - public List<LiveTvServiceInfo> Services { get; set; } + public LiveTvServiceInfo[] Services { get; set; } /// <summary> /// Gets or sets a value indicating whether this instance is enabled. @@ -20,12 +20,12 @@ namespace MediaBrowser.Model.LiveTv /// Gets or sets the enabled users. /// </summary> /// <value>The enabled users.</value> - public List<string> EnabledUsers { get; set; } + public string[] EnabledUsers { get; set; } public LiveTvInfo() { - Services = new List<LiveTvServiceInfo>(); - EnabledUsers = new List<string>(); + Services = new LiveTvServiceInfo[] { }; + EnabledUsers = new string[] { }; } } }
\ No newline at end of file diff --git a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs index 8555f9c38..2c2f22e86 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs @@ -15,8 +15,8 @@ namespace MediaBrowser.Model.LiveTv public bool EnableOriginalAudioWithEncodedRecordings { get; set; } public string RecordedVideoCodec { get; set; } - public List<TunerHostInfo> TunerHosts { get; set; } - public List<ListingsProviderInfo> ListingProviders { get; set; } + public TunerHostInfo[] TunerHosts { get; set; } + public ListingsProviderInfo[] ListingProviders { get; set; } public int PrePaddingSeconds { get; set; } public int PostPaddingSeconds { get; set; } @@ -28,8 +28,8 @@ namespace MediaBrowser.Model.LiveTv public LiveTvOptions() { - TunerHosts = new List<TunerHostInfo>(); - ListingProviders = new List<ListingsProviderInfo>(); + TunerHosts = new TunerHostInfo[] { }; + ListingProviders = new ListingsProviderInfo[] { }; MediaLocationsCreated = new string[] { }; RecordingEncodingFormat = "mkv"; RecordingPostProcessorArguments = "\"{path}\""; @@ -46,13 +46,14 @@ namespace MediaBrowser.Model.LiveTv public string FriendlyName { get; set; } public bool ImportFavoritesOnly { get; set; } public bool AllowHWTranscoding { get; set; } - public bool EnableTvgId { get; set; } public bool EnableStreamLooping { get; set; } + public bool EnableMpDecimate { get; set; } + public bool EnableNewHdhrChannelIds { get; set; } + public string Source { get; set; } public TunerHostInfo() { AllowHWTranscoding = true; - EnableTvgId = true; } } diff --git a/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs b/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs index 25d3b289f..09ec4b931 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs @@ -48,11 +48,11 @@ namespace MediaBrowser.Model.LiveTv /// <value><c>true</c> if this instance is visible; otherwise, <c>false</c>.</value> public bool IsVisible { get; set; } - public List<LiveTvTunerInfoDto> Tuners { get; set; } + public LiveTvTunerInfoDto[] Tuners { get; set; } public LiveTvServiceInfo() { - Tuners = new List<LiveTvTunerInfoDto>(); + Tuners = new LiveTvTunerInfoDto[] { }; } } } diff --git a/MediaBrowser.Model/LiveTv/LiveTvTunerInfoDto.cs b/MediaBrowser.Model/LiveTv/LiveTvTunerInfoDto.cs index 9af96df43..937cef057 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvTunerInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvTunerInfoDto.cs @@ -62,7 +62,7 @@ namespace MediaBrowser.Model.LiveTv /// Gets or sets the clients. /// </summary> /// <value>The clients.</value> - public List<string> Clients { get; set; } + public string[] Clients { get; set; } /// <summary> /// Gets or sets a value indicating whether this instance can reset. @@ -72,7 +72,7 @@ namespace MediaBrowser.Model.LiveTv public LiveTvTunerInfoDto() { - Clients = new List<string>(); + Clients = new string[] { }; } } }
\ No newline at end of file diff --git a/MediaBrowser.Model/LiveTv/ProgramQuery.cs b/MediaBrowser.Model/LiveTv/ProgramQuery.cs index 1fd995760..c0959635f 100644 --- a/MediaBrowser.Model/LiveTv/ProgramQuery.cs +++ b/MediaBrowser.Model/LiveTv/ProgramQuery.cs @@ -12,7 +12,7 @@ namespace MediaBrowser.Model.LiveTv public ProgramQuery() { ChannelIds = new string[] { }; - SortBy = new string[] { }; + OrderBy = new Tuple<string, SortOrder>[] { }; Genres = new string[] { }; EnableTotalRecordCount = true; EnableUserData = true; @@ -104,17 +104,7 @@ namespace MediaBrowser.Model.LiveTv /// </summary> public int? Limit { get; set; } - /// <summary> - /// What to sort the results by - /// </summary> - /// <value>The sort by.</value> - public string[] SortBy { get; set; } - - /// <summary> - /// The sort order to return results with - /// </summary> - /// <value>The sort order.</value> - public SortOrder? SortOrder { get; set; } + public Tuple<string, SortOrder>[] OrderBy { get; set; } /// <summary> /// Limit results to items containing specific genres diff --git a/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs b/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs index 388001287..743caa97e 100644 --- a/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs @@ -15,7 +15,7 @@ namespace MediaBrowser.Model.LiveTv public SeriesTimerInfoDto() { ImageTags = new Dictionary<ImageType, string>(); - Days = new List<DayOfWeek>(); + Days = new DayOfWeek[] { }; Type = "SeriesTimer"; } @@ -45,7 +45,7 @@ namespace MediaBrowser.Model.LiveTv /// Gets or sets the days. /// </summary> /// <value>The days.</value> - public List<DayOfWeek> Days { get; set; } + public DayOfWeek[] Days { get; set; } /// <summary> /// Gets or sets the day pattern. @@ -60,16 +60,6 @@ namespace MediaBrowser.Model.LiveTv public Dictionary<ImageType, string> ImageTags { get; set; } /// <summary> - /// Gets a value indicating whether this instance has primary image. - /// </summary> - /// <value><c>true</c> if this instance has primary image; otherwise, <c>false</c>.</value> - [IgnoreDataMember] - public bool HasPrimaryImage - { - get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Primary); } - } - - /// <summary> /// Gets or sets the parent thumb item id. /// </summary> /// <value>The parent thumb item id.</value> diff --git a/MediaBrowser.Model/Logging/ILogManager.cs b/MediaBrowser.Model/Logging/ILogManager.cs index 59bb86756..218f13eb4 100644 --- a/MediaBrowser.Model/Logging/ILogManager.cs +++ b/MediaBrowser.Model/Logging/ILogManager.cs @@ -32,12 +32,6 @@ namespace MediaBrowser.Model.Logging void ReloadLogger(LogSeverity severity); /// <summary> - /// Gets the log file path. - /// </summary> - /// <value>The log file path.</value> - string LogFilePath { get; } - - /// <summary> /// Occurs when [logger loaded]. /// </summary> event EventHandler LoggerLoaded; diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 249e970dd..b36a773eb 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -40,25 +40,10 @@ <Compile Include="Activity\ActivityLogEntry.cs" /> <Compile Include="Activity\IActivityManager.cs" /> <Compile Include="Activity\IActivityRepository.cs" /> - <Compile Include="ApiClient\ApiHelpers.cs" /> - <Compile Include="ApiClient\ConnectionMode.cs" /> - <Compile Include="ApiClient\ConnectionResult.cs" /> - <Compile Include="ApiClient\ConnectionState.cs" /> <Compile Include="ApiClient\ConnectSignupResponse.cs" /> <Compile Include="ApiClient\HttpResponseEventArgs.cs" /> - <Compile Include="ApiClient\IApiClient.cs" /> - <Compile Include="ApiClient\ApiClientExtensions.cs" /> - <Compile Include="ApiClient\IClientWebSocket.cs" /> - <Compile Include="ApiClient\IConnectionManager.cs" /> - <Compile Include="ApiClient\IDevice.cs" /> - <Compile Include="ApiClient\IServerEvents.cs" /> <Compile Include="ApiClient\GeneralCommandEventArgs.cs" /> - <Compile Include="ApiClient\NetworkStatus.cs" /> - <Compile Include="ApiClient\RemoteLogoutReason.cs" /> - <Compile Include="ApiClient\ServerCredentials.cs" /> <Compile Include="ApiClient\ServerDiscoveryInfo.cs" /> - <Compile Include="ApiClient\ServerInfo.cs" /> - <Compile Include="ApiClient\ServerUserInfo.cs" /> <Compile Include="ApiClient\SessionUpdatesEventArgs.cs" /> <Compile Include="ApiClient\WakeOnLanInfo.cs" /> <Compile Include="Branding\BrandingOptions.cs" /> @@ -85,7 +70,6 @@ <Compile Include="Connect\ConnectAuthenticationResult.cs" /> <Compile Include="Connect\ConnectAuthorization.cs" /> <Compile Include="Connect\ConnectAuthorizationRequest.cs" /> - <Compile Include="ApiClient\ConnectionOptions.cs" /> <Compile Include="Connect\ConnectPassword.cs" /> <Compile Include="Connect\ConnectUser.cs" /> <Compile Include="Connect\ConnectUserQuery.cs" /> @@ -127,7 +111,6 @@ <Compile Include="Drawing\ImageOrientation.cs" /> <Compile Include="Dto\IHasServerId.cs" /> <Compile Include="Dto\IHasSyncInfo.cs" /> - <Compile Include="Dto\ItemLayout.cs" /> <Compile Include="Dto\MetadataEditorInfo.cs" /> <Compile Include="Dto\NameIdPair.cs" /> <Compile Include="Dto\NameValuePair.cs" /> @@ -143,7 +126,6 @@ <Compile Include="System\IPowerManagement.cs" /> <Compile Include="Text\ITextEncoding.cs" /> <Compile Include="Extensions\LinqExtensions.cs" /> - <Compile Include="Health\IHealthMonitor.cs" /> <Compile Include="IO\FileSystemMetadata.cs" /> <Compile Include="IO\IFileSystem.cs" /> <Compile Include="IO\IMemoryStreamFactory.cs" /> @@ -284,7 +266,6 @@ <Compile Include="Providers\ExternalUrl.cs" /> <Compile Include="Providers\ImageProviderInfo.cs" /> <Compile Include="Providers\RemoteImageInfo.cs" /> - <Compile Include="Dto\StudioDto.cs" /> <Compile Include="Entities\CollectionType.cs" /> <Compile Include="Entities\ItemReview.cs" /> <Compile Include="Entities\MediaUrl.cs" /> @@ -319,7 +300,6 @@ <Compile Include="Querying\NextUpQuery.cs" /> <Compile Include="Querying\QueryFilters.cs" /> <Compile Include="Querying\QueryResult.cs" /> - <Compile Include="Querying\SeasonQuery.cs" /> <Compile Include="Querying\SessionQuery.cs" /> <Compile Include="Querying\SimilarItemsQuery.cs" /> <Compile Include="Querying\UpcomingEpisodesQuery.cs" /> @@ -356,7 +336,6 @@ <Compile Include="IO\FileSystemEntryInfo.cs" /> <Compile Include="Dto\ImageOptions.cs" /> <Compile Include="Querying\ItemFilter.cs" /> - <Compile Include="Querying\ItemQuery.cs" /> <Compile Include="Entities\LibraryUpdateInfo.cs" /> <Compile Include="Entities\ParentalRating.cs" /> <Compile Include="Entities\VirtualFolderInfo.cs" /> @@ -432,7 +411,6 @@ <Compile Include="Querying\ItemSortBy.cs" /> <Compile Include="Dto\BaseItemDto.cs" /> <Compile Include="Dto\UserDto.cs" /> - <Compile Include="Querying\ItemsResult.cs" /> <Compile Include="Entities\DisplayPreferences.cs" /> <Compile Include="Entities\ImageType.cs" /> <Compile Include="Entities\IHasProviderIds.cs" /> diff --git a/MediaBrowser.Model/MediaInfo/BlurayDiscInfo.cs b/MediaBrowser.Model/MediaInfo/BlurayDiscInfo.cs index 963e8dd95..1b573fba7 100644 --- a/MediaBrowser.Model/MediaInfo/BlurayDiscInfo.cs +++ b/MediaBrowser.Model/MediaInfo/BlurayDiscInfo.cs @@ -12,7 +12,7 @@ namespace MediaBrowser.Model.MediaInfo /// Gets or sets the media streams. /// </summary> /// <value>The media streams.</value> - public List<MediaStream> MediaStreams { get; set; } + public MediaStream[] MediaStreams { get; set; } /// <summary> /// Gets or sets the run time ticks. @@ -24,7 +24,7 @@ namespace MediaBrowser.Model.MediaInfo /// Gets or sets the files. /// </summary> /// <value>The files.</value> - public List<string> Files { get; set; } + public string[] Files { get; set; } public string PlaylistName { get; set; } @@ -32,6 +32,6 @@ namespace MediaBrowser.Model.MediaInfo /// Gets or sets the chapters. /// </summary> /// <value>The chapters.</value> - public List<double> Chapters { get; set; } + public double[] Chapters { get; set; } } } diff --git a/MediaBrowser.Model/MediaInfo/MediaInfo.cs b/MediaBrowser.Model/MediaInfo/MediaInfo.cs index 126710197..63b1c9cfd 100644 --- a/MediaBrowser.Model/MediaInfo/MediaInfo.cs +++ b/MediaBrowser.Model/MediaInfo/MediaInfo.cs @@ -7,7 +7,9 @@ namespace MediaBrowser.Model.MediaInfo { public class MediaInfo : MediaSourceInfo, IHasProviderIds { - public List<ChapterInfo> Chapters { get; set; } + private static readonly string[] EmptyStringArray = new string[] { }; + + public ChapterInfo[] Chapters { get; set; } /// <summary> /// Gets or sets the album. @@ -18,23 +20,23 @@ namespace MediaBrowser.Model.MediaInfo /// Gets or sets the artists. /// </summary> /// <value>The artists.</value> - public List<string> Artists { get; set; } + public string[] Artists { get; set; } /// <summary> /// Gets or sets the album artists. /// </summary> /// <value>The album artists.</value> - public List<string> AlbumArtists { get; set; } + public string[] AlbumArtists { get; set; } /// <summary> /// Gets or sets the studios. /// </summary> /// <value>The studios.</value> - public List<string> Studios { get; set; } - public List<string> Genres { get; set; } + public string[] Studios { get; set; } + public string[] Genres { get; set; } public int? IndexNumber { get; set; } public int? ParentIndexNumber { get; set; } public int? ProductionYear { get; set; } public DateTime? PremiereDate { get; set; } - public List<BaseItemPerson> People { get; set; } + public BaseItemPerson[] People { get; set; } public Dictionary<string, string> ProviderIds { get; set; } /// <summary> /// Gets or sets the official rating. @@ -54,12 +56,12 @@ namespace MediaBrowser.Model.MediaInfo public MediaInfo() { - Chapters = new List<ChapterInfo>(); - Artists = new List<string>(); - AlbumArtists = new List<string>(); - Studios = new List<string>(); - Genres = new List<string>(); - People = new List<BaseItemPerson>(); + Chapters = new ChapterInfo[] { }; + Artists = new string[] { }; + AlbumArtists = EmptyStringArray; + Studios = new string[] { }; + Genres = new string[] { }; + People = new BaseItemPerson[] { }; ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); } } diff --git a/MediaBrowser.Model/MediaInfo/PlaybackInfoResponse.cs b/MediaBrowser.Model/MediaInfo/PlaybackInfoResponse.cs index 1f8936d01..b38fec7d4 100644 --- a/MediaBrowser.Model/MediaInfo/PlaybackInfoResponse.cs +++ b/MediaBrowser.Model/MediaInfo/PlaybackInfoResponse.cs @@ -10,7 +10,7 @@ namespace MediaBrowser.Model.MediaInfo /// Gets or sets the media sources. /// </summary> /// <value>The media sources.</value> - public List<MediaSourceInfo> MediaSources { get; set; } + public MediaSourceInfo[] MediaSources { get; set; } /// <summary> /// Gets or sets the play session identifier. @@ -26,7 +26,7 @@ namespace MediaBrowser.Model.MediaInfo public PlaybackInfoResponse() { - MediaSources = new List<MediaSourceInfo>(); + MediaSources = new MediaSourceInfo[] { }; } } } diff --git a/MediaBrowser.Model/MediaInfo/SubtitleTrackInfo.cs b/MediaBrowser.Model/MediaInfo/SubtitleTrackInfo.cs index 765cfe32f..d3a3bb1d0 100644 --- a/MediaBrowser.Model/MediaInfo/SubtitleTrackInfo.cs +++ b/MediaBrowser.Model/MediaInfo/SubtitleTrackInfo.cs @@ -4,11 +4,11 @@ namespace MediaBrowser.Model.MediaInfo { public class SubtitleTrackInfo { - public List<SubtitleTrackEvent> TrackEvents { get; set; } + public SubtitleTrackEvent[] TrackEvents { get; set; } public SubtitleTrackInfo() { - TrackEvents = new List<SubtitleTrackEvent>(); + TrackEvents = new SubtitleTrackEvent[] { }; } } } diff --git a/MediaBrowser.Model/Net/HttpResponse.cs b/MediaBrowser.Model/Net/HttpResponse.cs index f4bd8e681..7c3d1d73d 100644 --- a/MediaBrowser.Model/Net/HttpResponse.cs +++ b/MediaBrowser.Model/Net/HttpResponse.cs @@ -59,6 +59,7 @@ namespace MediaBrowser.Model.Net { _disposable.Dispose(); } + GC.SuppressFinalize(this); } } } diff --git a/MediaBrowser.Model/Net/IAcceptSocket.cs b/MediaBrowser.Model/Net/IAcceptSocket.cs index 2b5d33dce..343e12ab6 100644 --- a/MediaBrowser.Model/Net/IAcceptSocket.cs +++ b/MediaBrowser.Model/Net/IAcceptSocket.cs @@ -12,9 +12,6 @@ namespace MediaBrowser.Model.Net void Listen(int backlog); void Bind(IpEndPointInfo endpoint); void Connect(IpEndPointInfo endPoint); - void StartAccept(Action<IAcceptSocket> onAccept, Func<bool> isClosed); - IAsyncResult BeginSendFile(string path, byte[] preBuffer, byte[] postBuffer, AsyncCallback callback, object state); - void EndSendFile(IAsyncResult result); } public class SocketCreateException : Exception diff --git a/MediaBrowser.Model/Net/ISocket.cs b/MediaBrowser.Model/Net/ISocket.cs index 71eb9914b..42550340b 100644 --- a/MediaBrowser.Model/Net/ISocket.cs +++ b/MediaBrowser.Model/Net/ISocket.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.Model/Net/MimeTypes.cs b/MediaBrowser.Model/Net/MimeTypes.cs index 2f132cb37..c4dfd25ca 100644 --- a/MediaBrowser.Model/Net/MimeTypes.cs +++ b/MediaBrowser.Model/Net/MimeTypes.cs @@ -14,7 +14,7 @@ namespace MediaBrowser.Model.Net /// <summary> /// Any extension in this list is considered a video file - can be added to at runtime for extensibility /// </summary> - private static readonly List<string> VideoFileExtensions = new List<string> + private static readonly string[] VideoFileExtensions = new string[] { ".mkv", ".m2t", @@ -106,14 +106,15 @@ namespace MediaBrowser.Model.Net return dict; } + public static string GetMimeType(string path) + { + return GetMimeType(path, true); + } + /// <summary> /// Gets the type of the MIME. /// </summary> - /// <param name="path">The path.</param> - /// <returns>System.String.</returns> - /// <exception cref="ArgumentNullException">path</exception> - /// <exception cref="InvalidOperationException">Argument not supported: + path</exception> - public static string GetMimeType(string path) + public static string GetMimeType(string path, bool enableStreamDefault) { if (string.IsNullOrEmpty(path)) { @@ -329,7 +330,12 @@ namespace MediaBrowser.Model.Net return "application/ttml+xml"; } - return "application/octet-stream"; + if (enableStreamDefault) + { + return "application/octet-stream"; + } + + return null; } public static string ToExtension(string mimeType) diff --git a/MediaBrowser.Model/Notifications/NotificationTypeInfo.cs b/MediaBrowser.Model/Notifications/NotificationTypeInfo.cs index 59b39fbc7..ee5101011 100644 --- a/MediaBrowser.Model/Notifications/NotificationTypeInfo.cs +++ b/MediaBrowser.Model/Notifications/NotificationTypeInfo.cs @@ -18,11 +18,11 @@ namespace MediaBrowser.Model.Notifications public string DefaultDescription { get; set; } - public List<string> Variables { get; set; } + public string[] Variables { get; set; } public NotificationTypeInfo() { - Variables = new List<string>(); + Variables = new string[] { }; } } }
\ No newline at end of file diff --git a/MediaBrowser.Model/Playlists/PlaylistCreationRequest.cs b/MediaBrowser.Model/Playlists/PlaylistCreationRequest.cs index 63deb19dc..5314e791a 100644 --- a/MediaBrowser.Model/Playlists/PlaylistCreationRequest.cs +++ b/MediaBrowser.Model/Playlists/PlaylistCreationRequest.cs @@ -6,7 +6,7 @@ namespace MediaBrowser.Model.Playlists { public string Name { get; set; } - public List<string> ItemIdList { get; set; } + public string[] ItemIdList { get; set; } public string MediaType { get; set; } @@ -14,7 +14,7 @@ namespace MediaBrowser.Model.Playlists public PlaylistCreationRequest() { - ItemIdList = new List<string>(); + ItemIdList = new string[] { }; } } } diff --git a/MediaBrowser.Model/Providers/ImageProviderInfo.cs b/MediaBrowser.Model/Providers/ImageProviderInfo.cs index c519d66cb..199552640 100644 --- a/MediaBrowser.Model/Providers/ImageProviderInfo.cs +++ b/MediaBrowser.Model/Providers/ImageProviderInfo.cs @@ -14,11 +14,11 @@ namespace MediaBrowser.Model.Providers /// <value>The name.</value> public string Name { get; set; } - public List<ImageType> SupportedImages { get; set; } + public ImageType[] SupportedImages { get; set; } public ImageProviderInfo() { - SupportedImages = new List<ImageType>(); + SupportedImages = new ImageType[] { }; } } } diff --git a/MediaBrowser.Model/Providers/RemoteImageResult.cs b/MediaBrowser.Model/Providers/RemoteImageResult.cs index 1c60db6ae..7e38badfc 100644 --- a/MediaBrowser.Model/Providers/RemoteImageResult.cs +++ b/MediaBrowser.Model/Providers/RemoteImageResult.cs @@ -11,7 +11,7 @@ namespace MediaBrowser.Model.Providers /// Gets or sets the images. /// </summary> /// <value>The images.</value> - public List<RemoteImageInfo> Images { get; set; } + public RemoteImageInfo[] Images { get; set; } /// <summary> /// Gets or sets the total record count. @@ -23,6 +23,6 @@ namespace MediaBrowser.Model.Providers /// Gets or sets the providers. /// </summary> /// <value>The providers.</value> - public List<string> Providers { get; set; } + public string[] Providers { get; set; } } } diff --git a/MediaBrowser.Model/Querying/ItemFields.cs b/MediaBrowser.Model/Querying/ItemFields.cs index e088771b5..f9829c329 100644 --- a/MediaBrowser.Model/Querying/ItemFields.cs +++ b/MediaBrowser.Model/Querying/ItemFields.cs @@ -63,11 +63,6 @@ DisplayPreferencesId, /// <summary> - /// The display media type - /// </summary> - DisplayMediaType, - - /// <summary> /// The etag /// </summary> Etag, @@ -153,11 +148,6 @@ /// </summary> ScreenshotImageTags, - /// <summary> - /// The series genres - /// </summary> - SeriesGenres, - SeriesPrimaryImage, /// <summary> @@ -224,6 +214,7 @@ SeriesPresentationUniqueKey, DateLastRefreshed, DateLastSaved, - RefreshState + RefreshState, + ChannelImage } } diff --git a/MediaBrowser.Model/Querying/ItemQuery.cs b/MediaBrowser.Model/Querying/ItemQuery.cs deleted file mode 100644 index 11c046452..000000000 --- a/MediaBrowser.Model/Querying/ItemQuery.cs +++ /dev/null @@ -1,332 +0,0 @@ -using MediaBrowser.Model.Entities; -using System; - -namespace MediaBrowser.Model.Querying -{ - /// <summary> - /// Contains all the possible parameters that can be used to query for items - /// </summary> - public class ItemQuery - { - /// <summary> - /// The user to localize search results for - /// </summary> - /// <value>The user id.</value> - public string UserId { get; set; } - - /// <summary> - /// Specify this to localize the search to a specific item or folder. Omit to use the root. - /// </summary> - /// <value>The parent id.</value> - public string ParentId { get; set; } - - /// <summary> - /// Skips over a given number of items within the results. Use for paging. - /// </summary> - /// <value>The start index.</value> - public int? StartIndex { get; set; } - - /// <summary> - /// The maximum number of items to return - /// </summary> - /// <value>The limit.</value> - public int? Limit { get; set; } - - /// <summary> - /// What to sort the results by - /// </summary> - /// <value>The sort by.</value> - public string[] SortBy { get; set; } - - /// <summary> - /// Gets or sets the artist ids. - /// </summary> - /// <value>The artist ids.</value> - public string[] ArtistIds { get; set; } - - /// <summary> - /// The sort order to return results with - /// </summary> - /// <value>The sort order.</value> - public SortOrder? SortOrder { get; set; } - - /// <summary> - /// Filters to apply to the results - /// </summary> - /// <value>The filters.</value> - public ItemFilter[] Filters { get; set; } - - /// <summary> - /// Fields to return within the items, in addition to basic information - /// </summary> - /// <value>The fields.</value> - public ItemFields[] Fields { get; set; } - - /// <summary> - /// Gets or sets the media types. - /// </summary> - /// <value>The media types.</value> - public string[] MediaTypes { get; set; } - - /// <summary> - /// Gets or sets the video formats. - /// </summary> - /// <value>The video formats.</value> - public bool? Is3D { get; set; } - - /// <summary> - /// Gets or sets the video types. - /// </summary> - /// <value>The video types.</value> - public VideoType[] VideoTypes { get; set; } - - /// <summary> - /// Whether or not to perform the query recursively - /// </summary> - /// <value><c>true</c> if recursive; otherwise, <c>false</c>.</value> - public bool Recursive { get; set; } - - /// <summary> - /// Limit results to items containing specific genres - /// </summary> - /// <value>The genres.</value> - public string[] Genres { get; set; } - - /// <summary> - /// Gets or sets the studio ids. - /// </summary> - /// <value>The studio ids.</value> - public string[] StudioIds { get; set; } - - /// <summary> - /// Gets or sets the exclude item types. - /// </summary> - /// <value>The exclude item types.</value> - public string[] ExcludeItemTypes { get; set; } - - /// <summary> - /// Gets or sets the include item types. - /// </summary> - /// <value>The include item types.</value> - public string[] IncludeItemTypes { get; set; } - - /// <summary> - /// Limit results to items containing specific years - /// </summary> - /// <value>The years.</value> - public int[] Years { get; set; } - - /// <summary> - /// Limit results to items containing a specific person - /// </summary> - /// <value>The person.</value> - public string[] PersonIds { get; set; } - - /// <summary> - /// If the Person filter is used, this can also be used to restrict to a specific person type - /// </summary> - /// <value>The type of the person.</value> - public string[] PersonTypes { get; set; } - - /// <summary> - /// Search characters used to find items - /// </summary> - /// <value>The index by.</value> - public string SearchTerm { get; set; } - - /// <summary> - /// Gets or sets the image types. - /// </summary> - /// <value>The image types.</value> - public ImageType[] ImageTypes { get; set; } - - /// <summary> - /// Gets or sets the air days. - /// </summary> - /// <value>The air days.</value> - public DayOfWeek[] AirDays { get; set; } - - /// <summary> - /// Gets or sets the series status. - /// </summary> - /// <value>The series status.</value> - public SeriesStatus[] SeriesStatuses { get; set; } - - /// <summary> - /// Gets or sets the ids, which are specific items to retrieve - /// </summary> - /// <value>The ids.</value> - public string[] Ids { get; set; } - - /// <summary> - /// Gets or sets the min official rating. - /// </summary> - /// <value>The min official rating.</value> - public string MinOfficialRating { get; set; } - - /// <summary> - /// Gets or sets the max official rating. - /// </summary> - /// <value>The max official rating.</value> - public string MaxOfficialRating { get; set; } - - /// <summary> - /// Gets or sets the min index number. - /// </summary> - /// <value>The min index number.</value> - public int? MinIndexNumber { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether this instance has parental rating. - /// </summary> - /// <value><c>null</c> if [has parental rating] contains no value, <c>true</c> if [has parental rating]; otherwise, <c>false</c>.</value> - public bool? HasParentalRating { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether this instance is HD. - /// </summary> - /// <value><c>null</c> if [is HD] contains no value, <c>true</c> if [is HD]; otherwise, <c>false</c>.</value> - public bool? IsHD { get; set; } - - /// <summary> - /// Gets or sets the parent index number. - /// </summary> - /// <value>The parent index number.</value> - public int? ParentIndexNumber { get; set; } - - /// <summary> - /// Gets or sets the min players. - /// </summary> - /// <value>The min players.</value> - public int? MinPlayers { get; set; } - - /// <summary> - /// Gets or sets the max players. - /// </summary> - /// <value>The max players.</value> - public int? MaxPlayers { get; set; } - - /// <summary> - /// Gets or sets the name starts with or greater. - /// </summary> - /// <value>The name starts with or greater.</value> - public string NameStartsWithOrGreater { get; set; } - - /// <summary> - /// Gets or sets the name starts with. - /// </summary> - /// <value>The name starts with or greater.</value> - public string NameStartsWith { get; set; } - - /// <summary> - /// Gets or sets the name starts with. - /// </summary> - /// <value>The name lessthan.</value> - public string NameLessThan { get; set; } - - /// <summary> - /// Gets or sets the album artist starts with or greater. - /// </summary> - /// <value>The album artist starts with or greater.</value> - public string AlbumArtistStartsWithOrGreater { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether [include index containers]. - /// </summary> - /// <value><c>true</c> if [include index containers]; otherwise, <c>false</c>.</value> - public bool IncludeIndexContainers { get; set; } - - /// <summary> - /// Gets or sets the location types. - /// </summary> - /// <value>The location types.</value> - public LocationType[] LocationTypes { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether this instance is missing episode. - /// </summary> - /// <value><c>null</c> if [is missing episode] contains no value, <c>true</c> if [is missing episode]; otherwise, <c>false</c>.</value> - public bool? IsMissing { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether this instance is unaired episode. - /// </summary> - /// <value><c>null</c> if [is unaired episode] contains no value, <c>true</c> if [is unaired episode]; otherwise, <c>false</c>.</value> - public bool? IsUnaired { get; set; } - - public bool? IsVirtualUnaired { get; set; } - - public bool? IsInBoxSet { get; set; } - - public bool? CollapseBoxSetItems { get; set; } - - public bool? IsPlayed { get; set; } - - /// <summary> - /// Gets or sets the exclude location types. - /// </summary> - /// <value>The exclude location types.</value> - public LocationType[] ExcludeLocationTypes { get; set; } - - public double? MinCommunityRating { get; set; } - public double? MinCriticRating { get; set; } - - public int? AiredDuringSeason { get; set; } - - public DateTime? MinPremiereDate { get; set; } - - public DateTime? MaxPremiereDate { get; set; } - - public bool? EnableImages { get; set; } - public int? ImageTypeLimit { get; set; } - public ImageType[] EnableImageTypes { get; set; } - - [Obsolete] - public string[] Artists { get; set; } - [Obsolete] - public string[] Studios { get; set; } - [Obsolete] - public string Person { get; set; } - - public bool EnableTotalRecordCount { get; set; } - - /// <summary> - /// Initializes a new instance of the <see cref="ItemQuery" /> class. - /// </summary> - public ItemQuery() - { - LocationTypes = new LocationType[] { }; - ExcludeLocationTypes = new LocationType[] { }; - - SortBy = new string[] { }; - - Filters = new ItemFilter[] { }; - - Fields = new ItemFields[] { }; - - MediaTypes = new string[] { }; - - VideoTypes = new VideoType[] { }; - - EnableTotalRecordCount = true; - - Artists = new string[] { }; - Studios = new string[] { }; - - Genres = new string[] { }; - StudioIds = new string[] { }; - IncludeItemTypes = new string[] { }; - ExcludeItemTypes = new string[] { }; - Years = new int[] { }; - PersonTypes = new string[] { }; - Ids = new string[] { }; - ArtistIds = new string[] { }; - PersonIds = new string[] { }; - - ImageTypes = new ImageType[] { }; - AirDays = new DayOfWeek[] { }; - SeriesStatuses = new SeriesStatus[] { }; - EnableImageTypes = new ImageType[] { }; - } - } -} diff --git a/MediaBrowser.Model/Querying/ItemsResult.cs b/MediaBrowser.Model/Querying/ItemsResult.cs deleted file mode 100644 index 3b9c59733..000000000 --- a/MediaBrowser.Model/Querying/ItemsResult.cs +++ /dev/null @@ -1,11 +0,0 @@ -using MediaBrowser.Model.Dto; - -namespace MediaBrowser.Model.Querying -{ - /// <summary> - /// Represents the result of a query for items - /// </summary> - public class ItemsResult : QueryResult<BaseItemDto> - { - } -} diff --git a/MediaBrowser.Model/Querying/QueryResult.cs b/MediaBrowser.Model/Querying/QueryResult.cs index 1ecc1de6c..6f9923d08 100644 --- a/MediaBrowser.Model/Querying/QueryResult.cs +++ b/MediaBrowser.Model/Querying/QueryResult.cs @@ -15,9 +15,6 @@ namespace MediaBrowser.Model.Querying /// <value>The total record count.</value> public int TotalRecordCount { get; set; } - /// <summary> - /// Initializes a new instance of the <see cref="ItemsResult" /> class. - /// </summary> public QueryResult() { Items = new T[] { }; diff --git a/MediaBrowser.Model/Querying/SeasonQuery.cs b/MediaBrowser.Model/Querying/SeasonQuery.cs deleted file mode 100644 index b1fe635bb..000000000 --- a/MediaBrowser.Model/Querying/SeasonQuery.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace MediaBrowser.Model.Querying -{ - public class SeasonQuery - { - public string UserId { get; set; } - - public string SeriesId { get; set; } - - public bool? IsMissing { get; set; } - - public bool? IsVirtualUnaired { get; set; } - - public ItemFields[] Fields { get; set; } - - public bool? IsSpecialSeason { get; set; } - - public SeasonQuery() - { - Fields = new ItemFields[] { }; - } - } -}
\ No newline at end of file diff --git a/MediaBrowser.Model/Querying/ThemeMediaResult.cs b/MediaBrowser.Model/Querying/ThemeMediaResult.cs index 80478a910..0d7eb502f 100644 --- a/MediaBrowser.Model/Querying/ThemeMediaResult.cs +++ b/MediaBrowser.Model/Querying/ThemeMediaResult.cs @@ -1,10 +1,11 @@ - +using MediaBrowser.Model.Dto; + namespace MediaBrowser.Model.Querying { /// <summary> /// Class ThemeMediaResult /// </summary> - public class ThemeMediaResult : ItemsResult + public class ThemeMediaResult : QueryResult<BaseItemDto> { /// <summary> /// Gets or sets the owner id. diff --git a/MediaBrowser.Model/Search/SearchHint.cs b/MediaBrowser.Model/Search/SearchHint.cs index 3ca0eafe6..5c5637481 100644 --- a/MediaBrowser.Model/Search/SearchHint.cs +++ b/MediaBrowser.Model/Search/SearchHint.cs @@ -91,12 +91,6 @@ namespace MediaBrowser.Model.Search /// <value>The type of the media.</value> public string MediaType { get; set; } - /// <summary> - /// Gets or sets the display type of the media. - /// </summary> - /// <value>The display type of the media.</value> - public string DisplayMediaType { get; set; } - public DateTime? StartDate { get; set; } public DateTime? EndDate { get; set; } diff --git a/MediaBrowser.Model/Services/IHttpRequest.cs b/MediaBrowser.Model/Services/IHttpRequest.cs index 46c0240cd..e1480f30a 100644 --- a/MediaBrowser.Model/Services/IHttpRequest.cs +++ b/MediaBrowser.Model/Services/IHttpRequest.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/MediaBrowser.Model/Services/IHttpResponse.cs b/MediaBrowser.Model/Services/IHttpResponse.cs index 377f303a7..cd9c07d46 100644 --- a/MediaBrowser.Model/Services/IHttpResponse.cs +++ b/MediaBrowser.Model/Services/IHttpResponse.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; diff --git a/MediaBrowser.Model/Services/IHttpResult.cs b/MediaBrowser.Model/Services/IHttpResult.cs index fcb137c6b..90afb0f27 100644 --- a/MediaBrowser.Model/Services/IHttpResult.cs +++ b/MediaBrowser.Model/Services/IHttpResult.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; diff --git a/MediaBrowser.Model/Services/IRequest.cs b/MediaBrowser.Model/Services/IRequest.cs index f056c7410..5a895815e 100644 --- a/MediaBrowser.Model/Services/IRequest.cs +++ b/MediaBrowser.Model/Services/IRequest.cs @@ -49,11 +49,6 @@ namespace MediaBrowser.Model.Services string ResponseContentType { get; set; } /// <summary> - /// Whether the ResponseContentType has been explicitly overrided or whether it was just the default - /// </summary> - bool HasExplicitResponseContentType { get; } - - /// <summary> /// Attach any data to this request that all filters and services can access. /// </summary> Dictionary<string, object> Items { get; } diff --git a/MediaBrowser.Model/Services/QueryParamCollection.cs b/MediaBrowser.Model/Services/QueryParamCollection.cs index dfea62821..e13e5feca 100644 --- a/MediaBrowser.Model/Services/QueryParamCollection.cs +++ b/MediaBrowser.Model/Services/QueryParamCollection.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Extensions; namespace MediaBrowser.Model.Services { @@ -57,9 +58,7 @@ namespace MediaBrowser.Model.Services { if (string.IsNullOrWhiteSpace(value)) { - var stringComparison = GetStringComparison(); - - var parameters = this.Where(p => string.Equals(key, p.Name, stringComparison)).ToArray(); + var parameters = GetItems(key); foreach (var p in parameters) { @@ -84,14 +83,6 @@ namespace MediaBrowser.Model.Services } /// <summary> - /// True if the collection contains a query parameter with the given name. - /// </summary> - public bool ContainsKey(string name) - { - return this.Any(p => p.Name == name); - } - - /// <summary> /// Removes all parameters of the given name. /// </summary> /// <returns>The number of parameters that were removed</returns> @@ -105,16 +96,49 @@ namespace MediaBrowser.Model.Services { var stringComparison = GetStringComparison(); - return this.Where(p => string.Equals(p.Name, name, stringComparison)) - .Select(p => p.Value) - .FirstOrDefault(); + foreach (var pair in this) + { + if (string.Equals(pair.Name, name, stringComparison)) + { + return pair.Value; + } + } + + return null; + } + + public virtual List<NameValuePair> GetItems(string name) + { + var stringComparison = GetStringComparison(); + + var list = new List<NameValuePair>(); + + foreach (var pair in this) + { + if (string.Equals(pair.Name, name, stringComparison)) + { + list.Add(pair); + } + } + + return list; } - public virtual string[] GetValues(string name) + public virtual List<string> GetValues(string name) { var stringComparison = GetStringComparison(); - return this.Where(p => string.Equals(p.Name, name, stringComparison)).Select(p => p.Value).ToArray(); + var list = new List<string>(); + + foreach (var pair in this) + { + if (string.Equals(pair.Name, name, stringComparison)) + { + list.Add(pair.Value); + } + } + + return list; } public Dictionary<string, string> ToDictionary() @@ -133,7 +157,17 @@ namespace MediaBrowser.Model.Services public IEnumerable<string> Keys { - get { return this.Select(i => i.Name); } + get + { + var keys = new string[this.Count]; + + for (var i = 0; i < keys.Length; i++) + { + keys[i] = this[i].Name; + } + + return keys; + } } /// <summary> @@ -187,7 +221,7 @@ namespace MediaBrowser.Model.Services public override String ToString() { - var vals = this.Select(GetQueryStringValue).ToArray(); + var vals = this.Select(GetQueryStringValue).ToArray(this.Count); return string.Join("&", vals); } diff --git a/MediaBrowser.Model/Session/ClientCapabilities.cs b/MediaBrowser.Model/Session/ClientCapabilities.cs index 222c1bd64..9ae1fae9f 100644 --- a/MediaBrowser.Model/Session/ClientCapabilities.cs +++ b/MediaBrowser.Model/Session/ClientCapabilities.cs @@ -5,9 +5,9 @@ namespace MediaBrowser.Model.Session { public class ClientCapabilities { - public List<string> PlayableMediaTypes { get; set; } + public string[] PlayableMediaTypes { get; set; } - public List<string> SupportedCommands { get; set; } + public string[] SupportedCommands { get; set; } public bool SupportsMediaControl { get; set; } public bool SupportsContentUploading { get; set; } @@ -17,17 +17,17 @@ namespace MediaBrowser.Model.Session public bool SupportsSync { get; set; } public DeviceProfile DeviceProfile { get; set; } - public List<string> SupportedLiveMediaTypes { get; set; } + public string[] SupportedLiveMediaTypes { get; set; } public string AppStoreUrl { get; set; } public string IconUrl { get; set; } public ClientCapabilities() { - PlayableMediaTypes = new List<string>(); - SupportedCommands = new List<string>(); + PlayableMediaTypes = new string[] { }; + SupportedCommands = new string[] { }; SupportsPersistentIdentifier = true; - SupportedLiveMediaTypes = new List<string>(); + SupportedLiveMediaTypes = new string[] { }; } } }
\ No newline at end of file diff --git a/MediaBrowser.Model/Session/PlaybackProgressInfo.cs b/MediaBrowser.Model/Session/PlaybackProgressInfo.cs index 5f81f7269..0319f6711 100644 --- a/MediaBrowser.Model/Session/PlaybackProgressInfo.cs +++ b/MediaBrowser.Model/Session/PlaybackProgressInfo.cs @@ -67,7 +67,7 @@ namespace MediaBrowser.Model.Session /// <value>The position ticks.</value> public long? PositionTicks { get; set; } - public long? playbackStartTimeTicks { get; set; } + public long? PlaybackStartTimeTicks { get; set; } /// <summary> /// Gets or sets the volume level. diff --git a/MediaBrowser.Model/Session/SessionInfoDto.cs b/MediaBrowser.Model/Session/SessionInfoDto.cs index 3081d7ee3..78ee72f61 100644 --- a/MediaBrowser.Model/Session/SessionInfoDto.cs +++ b/MediaBrowser.Model/Session/SessionInfoDto.cs @@ -12,13 +12,13 @@ namespace MediaBrowser.Model.Session /// Gets or sets the supported commands. /// </summary> /// <value>The supported commands.</value> - public List<string> SupportedCommands { get; set; } + public string[] SupportedCommands { get; set; } /// <summary> /// Gets or sets the playable media types. /// </summary> /// <value>The playable media types.</value> - public List<string> PlayableMediaTypes { get; set; } + public string[] PlayableMediaTypes { get; set; } /// <summary> /// Gets or sets the id. @@ -50,7 +50,7 @@ namespace MediaBrowser.Model.Session /// Gets or sets the additional users present. /// </summary> /// <value>The additional users present.</value> - public List<SessionUserInfo> AdditionalUsers { get; set; } + public SessionUserInfo[] AdditionalUsers { get; set; } /// <summary> /// Gets or sets the application version. @@ -112,10 +112,10 @@ namespace MediaBrowser.Model.Session public SessionInfoDto() { - AdditionalUsers = new List<SessionUserInfo>(); + AdditionalUsers = new SessionUserInfo[] { }; - PlayableMediaTypes = new List<string>(); - SupportedCommands = new List<string>(); + PlayableMediaTypes = new string[] { }; + SupportedCommands = new string[] { }; } } } diff --git a/MediaBrowser.Model/Session/TranscodingInfo.cs b/MediaBrowser.Model/Session/TranscodingInfo.cs index f58e605b2..70c299bc2 100644 --- a/MediaBrowser.Model/Session/TranscodingInfo.cs +++ b/MediaBrowser.Model/Session/TranscodingInfo.cs @@ -18,11 +18,11 @@ namespace MediaBrowser.Model.Session public int? Height { get; set; } public int? AudioChannels { get; set; } - public List<TranscodeReason> TranscodeReasons { get; set; } + public TranscodeReason[] TranscodeReasons { get; set; } public TranscodingInfo() { - TranscodeReasons = new List<TranscodeReason>(); + TranscodeReasons = new TranscodeReason[] { }; } } diff --git a/MediaBrowser.Model/Session/UserDataChangeInfo.cs b/MediaBrowser.Model/Session/UserDataChangeInfo.cs index f92f44586..c6b03200d 100644 --- a/MediaBrowser.Model/Session/UserDataChangeInfo.cs +++ b/MediaBrowser.Model/Session/UserDataChangeInfo.cs @@ -18,6 +18,6 @@ namespace MediaBrowser.Model.Session /// Gets or sets the user data list. /// </summary> /// <value>The user data list.</value> - public List<UserItemDataDto> UserDataList { get; set; } + public UserItemDataDto[] UserDataList { get; set; } } } diff --git a/MediaBrowser.Model/Social/ISharingManager.cs b/MediaBrowser.Model/Social/ISharingManager.cs index 94c22baba..28c8c7db2 100644 --- a/MediaBrowser.Model/Social/ISharingManager.cs +++ b/MediaBrowser.Model/Social/ISharingManager.cs @@ -22,6 +22,6 @@ namespace MediaBrowser.Model.Social /// </summary> /// <param name="id">The identifier.</param> /// <returns>Task.</returns> - Task DeleteShare(string id); + void DeleteShare(string id); } } diff --git a/MediaBrowser.Model/Social/ISharingRepository.cs b/MediaBrowser.Model/Social/ISharingRepository.cs index 069b6e1fe..dd88ddd04 100644 --- a/MediaBrowser.Model/Social/ISharingRepository.cs +++ b/MediaBrowser.Model/Social/ISharingRepository.cs @@ -1,15 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - + namespace MediaBrowser.Model.Social { public interface ISharingRepository { - Task CreateShare(SocialShareInfo info); - Task DeleteShare(string id); + void CreateShare(SocialShareInfo info); + void DeleteShare(string id); SocialShareInfo GetShareInfo(string id); } } diff --git a/MediaBrowser.Model/Sync/CompleteSyncJobInfo.cs b/MediaBrowser.Model/Sync/CompleteSyncJobInfo.cs index 52d3fab3c..adfb84b05 100644 --- a/MediaBrowser.Model/Sync/CompleteSyncJobInfo.cs +++ b/MediaBrowser.Model/Sync/CompleteSyncJobInfo.cs @@ -5,11 +5,11 @@ namespace MediaBrowser.Model.Sync public class CompleteSyncJobInfo { public SyncJob Job { get; set; } - public List<SyncJobItem> JobItems { get; set; } + public SyncJobItem[] JobItems { get; set; } public CompleteSyncJobInfo() { - JobItems = new List<SyncJobItem>(); + JobItems = new SyncJobItem[] { }; } } } diff --git a/MediaBrowser.Model/Sync/LocalItem.cs b/MediaBrowser.Model/Sync/LocalItem.cs index c5728ac97..3d625aa99 100644 --- a/MediaBrowser.Model/Sync/LocalItem.cs +++ b/MediaBrowser.Model/Sync/LocalItem.cs @@ -44,17 +44,17 @@ namespace MediaBrowser.Model.Sync /// Gets or sets the user ids with access. /// </summary> /// <value>The user ids with access.</value> - public List<string> UserIdsWithAccess { get; set; } + public string[] UserIdsWithAccess { get; set; } /// <summary> /// Gets or sets the additional files. /// </summary> /// <value>The additional files.</value> - public List<string> AdditionalFiles { get; set; } + public string[] AdditionalFiles { get; set; } public LocalItem() { - AdditionalFiles = new List<string>(); - UserIdsWithAccess = new List<string>(); + AdditionalFiles = new string[] { }; + UserIdsWithAccess = new string[] { }; } } } diff --git a/MediaBrowser.Model/Sync/SyncDataRequest.cs b/MediaBrowser.Model/Sync/SyncDataRequest.cs index 0df4de86d..79d1842e1 100644 --- a/MediaBrowser.Model/Sync/SyncDataRequest.cs +++ b/MediaBrowser.Model/Sync/SyncDataRequest.cs @@ -1,19 +1,16 @@ -using System.Collections.Generic; - + namespace MediaBrowser.Model.Sync { public class SyncDataRequest { - public List<string> LocalItemIds { get; set; } - public List<string> OfflineUserIds { get; set; } - public List<string> SyncJobItemIds { get; set; } + public string[] LocalItemIds { get; set; } + public string[] SyncJobItemIds { get; set; } public string TargetId { get; set; } public SyncDataRequest() { - LocalItemIds = new List<string>(); - OfflineUserIds = new List<string>(); + LocalItemIds = new string[] { }; } } } diff --git a/MediaBrowser.Model/Sync/SyncDataResponse.cs b/MediaBrowser.Model/Sync/SyncDataResponse.cs index 3799e9455..0b017af6e 100644 --- a/MediaBrowser.Model/Sync/SyncDataResponse.cs +++ b/MediaBrowser.Model/Sync/SyncDataResponse.cs @@ -1,16 +1,13 @@ -using System.Collections.Generic; - + namespace MediaBrowser.Model.Sync { public class SyncDataResponse { - public List<string> ItemIdsToRemove { get; set; } - public Dictionary<string, List<string>> ItemUserAccess { get; set; } + public string[] ItemIdsToRemove { get; set; } public SyncDataResponse() { - ItemIdsToRemove = new List<string>(); - ItemUserAccess = new Dictionary<string, List<string>>(); + ItemIdsToRemove = new string[] { }; } } } diff --git a/MediaBrowser.Model/Sync/SyncDialogOptions.cs b/MediaBrowser.Model/Sync/SyncDialogOptions.cs index a987a6cd6..e55ca4f08 100644 --- a/MediaBrowser.Model/Sync/SyncDialogOptions.cs +++ b/MediaBrowser.Model/Sync/SyncDialogOptions.cs @@ -8,29 +8,29 @@ namespace MediaBrowser.Model.Sync /// Gets or sets the targets. /// </summary> /// <value>The targets.</value> - public List<SyncTarget> Targets { get; set; } + public SyncTarget[] Targets { get; set; } /// <summary> /// Gets or sets the options. /// </summary> /// <value>The options.</value> - public List<SyncJobOption> Options { get; set; } + public SyncJobOption[] Options { get; set; } /// <summary> /// Gets or sets the quality options. /// </summary> /// <value>The quality options.</value> - public List<SyncQualityOption> QualityOptions { get; set; } + public SyncQualityOption[] QualityOptions { get; set; } /// <summary> /// Gets or sets the profile options. /// </summary> /// <value>The profile options.</value> - public List<SyncProfileOption> ProfileOptions { get; set; } + public SyncProfileOption[] ProfileOptions { get; set; } public SyncDialogOptions() { - Targets = new List<SyncTarget>(); - Options = new List<SyncJobOption>(); - QualityOptions = new List<SyncQualityOption>(); - ProfileOptions = new List<SyncProfileOption>(); + Targets = new SyncTarget[] { }; + Options = new SyncJobOption[] { }; + QualityOptions = new SyncQualityOption[] { }; + ProfileOptions = new SyncProfileOption[] { }; } } } diff --git a/MediaBrowser.Model/Sync/SyncJob.cs b/MediaBrowser.Model/Sync/SyncJob.cs index f0e262c50..e8b698f62 100644 --- a/MediaBrowser.Model/Sync/SyncJob.cs +++ b/MediaBrowser.Model/Sync/SyncJob.cs @@ -84,7 +84,7 @@ namespace MediaBrowser.Model.Sync /// Gets or sets the requested item ids. /// </summary> /// <value>The requested item ids.</value> - public List<string> RequestedItemIds { get; set; } + public string[] RequestedItemIds { get; set; } /// <summary> /// Gets or sets the date created. /// </summary> @@ -105,12 +105,9 @@ namespace MediaBrowser.Model.Sync public string PrimaryImageItemId { get; set; } public string PrimaryImageTag { get; set; } - public bool EnableAutomaticResync { get; set; } - public SyncJob() { - RequestedItemIds = new List<string>(); - EnableAutomaticResync = true; + RequestedItemIds = new string[] { }; } } } diff --git a/MediaBrowser.Model/Sync/SyncJobCreationResult.cs b/MediaBrowser.Model/Sync/SyncJobCreationResult.cs index 6723aa2cf..ee46bc155 100644 --- a/MediaBrowser.Model/Sync/SyncJobCreationResult.cs +++ b/MediaBrowser.Model/Sync/SyncJobCreationResult.cs @@ -5,11 +5,11 @@ namespace MediaBrowser.Model.Sync public class SyncJobCreationResult { public SyncJob Job { get; set; } - public List<SyncJobItem> JobItems { get; set; } + public SyncJobItem[] JobItems { get; set; } public SyncJobCreationResult() { - JobItems = new List<SyncJobItem>(); + JobItems = new SyncJobItem[] { }; } } } diff --git a/MediaBrowser.Model/Sync/SyncJobItem.cs b/MediaBrowser.Model/Sync/SyncJobItem.cs index 1c72ccd52..5a97bc92e 100644 --- a/MediaBrowser.Model/Sync/SyncJobItem.cs +++ b/MediaBrowser.Model/Sync/SyncJobItem.cs @@ -90,12 +90,7 @@ namespace MediaBrowser.Model.Sync /// Gets or sets the additional files. /// </summary> /// <value>The additional files.</value> - public List<ItemFileInfo> AdditionalFiles { get; set; } - /// <summary> - /// Gets or sets a value indicating whether this instance is marked for removal. - /// </summary> - /// <value><c>true</c> if this instance is marked for removal; otherwise, <c>false</c>.</value> - public bool IsMarkedForRemoval { get; set; } + public ItemFileInfo[] AdditionalFiles { get; set; } /// <summary> /// Gets or sets the index of the job item. /// </summary> @@ -106,7 +101,7 @@ namespace MediaBrowser.Model.Sync public SyncJobItem() { - AdditionalFiles = new List<ItemFileInfo>(); + AdditionalFiles = new ItemFileInfo[] { }; } } } diff --git a/MediaBrowser.Model/Sync/SyncJobItemStatus.cs b/MediaBrowser.Model/Sync/SyncJobItemStatus.cs index c4e23c63c..2a968869f 100644 --- a/MediaBrowser.Model/Sync/SyncJobItemStatus.cs +++ b/MediaBrowser.Model/Sync/SyncJobItemStatus.cs @@ -8,8 +8,6 @@ namespace MediaBrowser.Model.Sync ReadyToTransfer = 2, Transferring = 3, Synced = 4, - RemovedFromDevice = 5, - Failed = 6, - Cancelled = 7 + Failed = 5 } } diff --git a/MediaBrowser.Model/Sync/SyncJobRequest.cs b/MediaBrowser.Model/Sync/SyncJobRequest.cs index a96c86ed9..3dc863b75 100644 --- a/MediaBrowser.Model/Sync/SyncJobRequest.cs +++ b/MediaBrowser.Model/Sync/SyncJobRequest.cs @@ -13,7 +13,7 @@ namespace MediaBrowser.Model.Sync /// Gets or sets the item ids. /// </summary> /// <value>The item ids.</value> - public List<string> ItemIds { get; set; } + public string[] ItemIds { get; set; } /// <summary> /// Gets or sets the category. /// </summary> @@ -67,7 +67,7 @@ namespace MediaBrowser.Model.Sync public SyncJobRequest() { - ItemIds = new List<string>(); + ItemIds = new string[] { }; SyncNewContent = true; } } diff --git a/MediaBrowser.Model/Sync/SyncJobStatus.cs b/MediaBrowser.Model/Sync/SyncJobStatus.cs index ac211a32a..2d1d30802 100644 --- a/MediaBrowser.Model/Sync/SyncJobStatus.cs +++ b/MediaBrowser.Model/Sync/SyncJobStatus.cs @@ -9,7 +9,6 @@ namespace MediaBrowser.Model.Sync Transferring = 3, Completed = 4, CompletedWithError = 5, - Failed = 6, - Cancelled = 7 + Failed = 6 } } diff --git a/MediaBrowser.Model/Sync/SyncedItem.cs b/MediaBrowser.Model/Sync/SyncedItem.cs index 4dedcfd2d..68bd8a2eb 100644 --- a/MediaBrowser.Model/Sync/SyncedItem.cs +++ b/MediaBrowser.Model/Sync/SyncedItem.cs @@ -50,11 +50,11 @@ namespace MediaBrowser.Model.Sync /// Gets or sets the additional files. /// </summary> /// <value>The additional files.</value> - public List<ItemFileInfo> AdditionalFiles { get; set; } + public ItemFileInfo[] AdditionalFiles { get; set; } public SyncedItem() { - AdditionalFiles = new List<ItemFileInfo>(); + AdditionalFiles = new ItemFileInfo[] { }; } } } diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.cs index 4154093cb..fce9dea4f 100644 --- a/MediaBrowser.Model/System/SystemInfo.cs +++ b/MediaBrowser.Model/System/SystemInfo.cs @@ -46,7 +46,7 @@ namespace MediaBrowser.Model.System /// Gets or sets the in progress installations. /// </summary> /// <value>The in progress installations.</value> - public List<InstallationInfo> InProgressInstallations { get; set; } + public InstallationInfo[] InProgressInstallations { get; set; } /// <summary> /// Gets or sets the web socket port number. @@ -58,7 +58,7 @@ namespace MediaBrowser.Model.System /// Gets or sets the completed installations. /// </summary> /// <value>The completed installations.</value> - public List<InstallationInfo> CompletedInstallations { get; set; } + public InstallationInfo[] CompletedInstallations { get; set; } /// <summary> /// Gets or sets a value indicating whether this instance can self restart. @@ -76,7 +76,7 @@ namespace MediaBrowser.Model.System /// Gets or sets plugin assemblies that failed to load. /// </summary> /// <value>The failed assembly loads.</value> - public List<string> FailedPluginAssemblies { get; set; } + public string[] FailedPluginAssemblies { get; set; } /// <summary> /// Gets or sets the program data path. @@ -153,11 +153,11 @@ namespace MediaBrowser.Model.System /// </summary> public SystemInfo() { - InProgressInstallations = new List<InstallationInfo>(); + InProgressInstallations = new InstallationInfo[] { }; - CompletedInstallations = new List<InstallationInfo>(); + CompletedInstallations = new InstallationInfo[] { }; - FailedPluginAssemblies = new List<string>(); + FailedPluginAssemblies = new string[] { }; } } } diff --git a/MediaBrowser.Model/Tasks/ScheduledTaskHelpers.cs b/MediaBrowser.Model/Tasks/ScheduledTaskHelpers.cs index 66f5294e7..2dec79e93 100644 --- a/MediaBrowser.Model/Tasks/ScheduledTaskHelpers.cs +++ b/MediaBrowser.Model/Tasks/ScheduledTaskHelpers.cs @@ -1,6 +1,4 @@ -using System; -using System.Linq; - + namespace MediaBrowser.Model.Tasks { /// <summary> @@ -26,12 +24,6 @@ namespace MediaBrowser.Model.Tasks string key = task.ScheduledTask.Key; - var triggers = task.Triggers - .OrderBy(i => i.Type) - .ThenBy(i => i.DayOfWeek ?? DayOfWeek.Sunday) - .ThenBy(i => i.TimeOfDayTicks ?? 0) - .ToList(); - return new TaskInfo { Name = task.Name, @@ -40,7 +32,7 @@ namespace MediaBrowser.Model.Tasks Id = task.Id, LastExecutionResult = task.LastExecutionResult, - Triggers = triggers, + Triggers = task.Triggers, Description = task.Description, Category = task.Category, diff --git a/MediaBrowser.Model/Tasks/TaskInfo.cs b/MediaBrowser.Model/Tasks/TaskInfo.cs index 50276f8eb..8792ce952 100644 --- a/MediaBrowser.Model/Tasks/TaskInfo.cs +++ b/MediaBrowser.Model/Tasks/TaskInfo.cs @@ -41,7 +41,7 @@ namespace MediaBrowser.Model.Tasks /// Gets or sets the triggers. /// </summary> /// <value>The triggers.</value> - public List<TaskTriggerInfo> Triggers { get; set; } + public TaskTriggerInfo[] Triggers { get; set; } /// <summary> /// Gets or sets the description. @@ -72,7 +72,7 @@ namespace MediaBrowser.Model.Tasks /// </summary> public TaskInfo() { - Triggers = new List<TaskTriggerInfo>(); + Triggers = new TaskTriggerInfo[]{}; } } } diff --git a/MediaBrowser.Model/Text/ITextEncoding.cs b/MediaBrowser.Model/Text/ITextEncoding.cs index 96dca0c04..619d90a2b 100644 --- a/MediaBrowser.Model/Text/ITextEncoding.cs +++ b/MediaBrowser.Model/Text/ITextEncoding.cs @@ -7,8 +7,8 @@ namespace MediaBrowser.Model.Text { Encoding GetASCIIEncoding(); - string GetDetectedEncodingName(byte[] bytes, string language, bool enableLanguageDetection); - Encoding GetDetectedEncoding(byte[] bytes, string language, bool enableLanguageDetection); + string GetDetectedEncodingName(byte[] bytes, int size, string language, bool enableLanguageDetection); + Encoding GetDetectedEncoding(byte[] bytes, int size, string language, bool enableLanguageDetection); Encoding GetEncodingFromCharset(string charset); } } diff --git a/MediaBrowser.Model/Updates/PackageInfo.cs b/MediaBrowser.Model/Updates/PackageInfo.cs index 208d5b784..e46d59fc0 100644 --- a/MediaBrowser.Model/Updates/PackageInfo.cs +++ b/MediaBrowser.Model/Updates/PackageInfo.cs @@ -151,7 +151,7 @@ namespace MediaBrowser.Model.Updates /// Gets or sets the versions. /// </summary> /// <value>The versions.</value> - public List<PackageVersionInfo> versions { get; set; } + public PackageVersionInfo[] versions { get; set; } /// <summary> /// Gets or sets a value indicating whether [enable in application store]. @@ -170,7 +170,7 @@ namespace MediaBrowser.Model.Updates /// </summary> public PackageInfo() { - versions = new List<PackageVersionInfo>(); + versions = new PackageVersionInfo[] { }; } } } diff --git a/MediaBrowser.Model/Updates/PackageVersionInfo.cs b/MediaBrowser.Model/Updates/PackageVersionInfo.cs index 5e0631b3b..3ac518187 100644 --- a/MediaBrowser.Model/Updates/PackageVersionInfo.cs +++ b/MediaBrowser.Model/Updates/PackageVersionInfo.cs @@ -89,5 +89,7 @@ namespace MediaBrowser.Model.Updates public string targetFilename { get; set; } public string infoUrl { get; set; } + + public string runtimes { get; set; } } }
\ No newline at end of file diff --git a/MediaBrowser.Model/Users/UserPolicy.cs b/MediaBrowser.Model/Users/UserPolicy.cs index e2a75c56b..84ee5d637 100644 --- a/MediaBrowser.Model/Users/UserPolicy.cs +++ b/MediaBrowser.Model/Users/UserPolicy.cs @@ -68,6 +68,8 @@ namespace MediaBrowser.Model.Users public string[] BlockedMediaFolders { get; set; } public string[] BlockedChannels { get; set; } + public int RemoteClientBitrateLimit { get; set; } + public UserPolicy() { EnableContentDeletion = true; |
