From a86b71899ec52c44ddc6c3018e8cc5e9d7ff4d62 Mon Sep 17 00:00:00 2001 From: Andrew Rabert Date: Thu, 27 Dec 2018 18:27:57 -0500 Subject: Add GPL modules --- .../Authentication/AuthenticationResult.cs | 14 + .../Authentication/IAuthenticationProvider.cs | 35 + MediaBrowser.Controller/Channels/Channel.cs | 94 + .../Channels/ChannelItemInfo.cs | 82 + .../Channels/ChannelItemResult.cs | 16 + .../Channels/ChannelItemType.cs | 9 + .../Channels/ChannelParentalRating.cs | 15 + .../Channels/ChannelSearchInfo.cs | 14 + MediaBrowser.Controller/Channels/IChannel.cs | 76 + .../Channels/IChannelManager.cs | 89 + MediaBrowser.Controller/Channels/IHasCacheKey.cs | 13 + .../Channels/IRequiresMediaInfoCallback.cs | 15 + .../Channels/ISearchableChannel.cs | 50 + .../Channels/InternalChannelFeatures.cs | 61 + .../Channels/InternalChannelItemQuery.cs | 21 + .../Chapters/IChapterManager.cs | 23 + .../Collections/CollectionCreationOptions.cs | 27 + .../Collections/CollectionEvents.cs | 37 + .../Collections/ICollectionManager.cs | 57 + .../Configuration/IServerConfigurationManager.cs | 25 + MediaBrowser.Controller/Connect/IConnectManager.cs | 45 + MediaBrowser.Controller/Connect/UserLinkResult.cs | 10 + .../Devices/CameraImageUploadInfo.cs | 10 + MediaBrowser.Controller/Devices/IDeviceManager.cs | 73 + MediaBrowser.Controller/Dlna/IDlnaManager.cs | 76 + MediaBrowser.Controller/Drawing/IImageEncoder.cs | 49 + MediaBrowser.Controller/Drawing/IImageProcessor.cs | 118 + .../Drawing/ImageCollageOptions.cs | 27 + MediaBrowser.Controller/Drawing/ImageHelper.cs | 72 + .../Drawing/ImageProcessingOptions.cs | 114 + .../Drawing/ImageProcessorExtensions.cs | 25 + MediaBrowser.Controller/Drawing/ImageStream.cs | 28 + MediaBrowser.Controller/Dto/DtoOptions.cs | 72 + MediaBrowser.Controller/Dto/IDtoService.cs | 70 + .../Entities/AggregateFolder.cs | 219 ++ MediaBrowser.Controller/Entities/Audio/Audio.cs | 216 ++ .../Entities/Audio/IHasAlbumArtist.cs | 15 + .../Entities/Audio/IHasMusicGenres.cs | 9 + .../Entities/Audio/MusicAlbum.cs | 272 ++ .../Entities/Audio/MusicArtist.cs | 275 ++ .../Entities/Audio/MusicGenre.cs | 145 + MediaBrowser.Controller/Entities/AudioBook.cs | 69 + MediaBrowser.Controller/Entities/BaseItem.cs | 2960 ++++++++++++++++++++ .../Entities/BaseItemExtensions.cs | 65 + .../Entities/BasePluginFolder.cs | 54 + MediaBrowser.Controller/Entities/Book.cs | 72 + .../Entities/CollectionFolder.cs | 405 +++ .../Entities/DayOfWeekHelper.cs | 71 + MediaBrowser.Controller/Entities/Extensions.cs | 46 + MediaBrowser.Controller/Entities/Folder.cs | 1803 ++++++++++++ MediaBrowser.Controller/Entities/Game.cs | 129 + MediaBrowser.Controller/Entities/GameGenre.cs | 128 + MediaBrowser.Controller/Entities/GameSystem.cs | 101 + MediaBrowser.Controller/Entities/Genre.cs | 140 + .../Entities/ICollectionFolder.cs | 27 + .../Entities/IHasAspectRatio.cs | 14 + .../Entities/IHasDisplayOrder.cs | 15 + .../Entities/IHasMediaSources.cs | 19 + .../Entities/IHasProgramAttributes.cs | 17 + .../Entities/IHasScreenshots.cs | 10 + MediaBrowser.Controller/Entities/IHasSeries.cs | 20 + .../Entities/IHasSpecialFeatures.cs | 13 + MediaBrowser.Controller/Entities/IHasStartDate.cs | 9 + MediaBrowser.Controller/Entities/IHasTrailers.cs | 39 + MediaBrowser.Controller/Entities/IItemByName.cs | 17 + .../Entities/IMetadataContainer.cs | 19 + .../Entities/ISupportsBoxSetGrouping.cs | 12 + .../Entities/ISupportsPlaceHolders.cs | 12 + .../Entities/InternalItemsQuery.cs | 261 ++ .../Entities/InternalPeopleQuery.cs | 21 + MediaBrowser.Controller/Entities/ItemImageInfo.cs | 46 + MediaBrowser.Controller/Entities/LinkedChild.cs | 73 + MediaBrowser.Controller/Entities/Movies/BoxSet.cs | 263 ++ MediaBrowser.Controller/Entities/Movies/Movie.cs | 203 ++ MediaBrowser.Controller/Entities/MusicVideo.cs | 79 + MediaBrowser.Controller/Entities/PeopleHelper.cs | 119 + MediaBrowser.Controller/Entities/Person.cs | 216 ++ MediaBrowser.Controller/Entities/Photo.cs | 104 + MediaBrowser.Controller/Entities/PhotoAlbum.cs | 34 + MediaBrowser.Controller/Entities/Share.cs | 15 + MediaBrowser.Controller/Entities/SourceType.cs | 10 + MediaBrowser.Controller/Entities/Studio.cs | 141 + MediaBrowser.Controller/Entities/TV/Episode.cs | 374 +++ MediaBrowser.Controller/Entities/TV/Season.cs | 273 ++ MediaBrowser.Controller/Entities/TV/Series.cs | 540 ++++ MediaBrowser.Controller/Entities/TagExtensions.cs | 35 + MediaBrowser.Controller/Entities/Trailer.cs | 111 + MediaBrowser.Controller/Entities/User.cs | 342 +++ MediaBrowser.Controller/Entities/UserItemData.cs | 124 + MediaBrowser.Controller/Entities/UserRootFolder.cs | 158 ++ MediaBrowser.Controller/Entities/UserView.cs | 210 ++ .../Entities/UserViewBuilder.cs | 1070 +++++++ MediaBrowser.Controller/Entities/Video.cs | 626 +++++ MediaBrowser.Controller/Entities/Year.cs | 147 + .../Extensions/StringExtensions.cs | 17 + MediaBrowser.Controller/IO/FileData.cs | 123 + MediaBrowser.Controller/IResourceFileManager.cs | 32 + MediaBrowser.Controller/IServerApplicationHost.cs | 100 + MediaBrowser.Controller/IServerApplicationPaths.cs | 109 + MediaBrowser.Controller/Library/DeleteOptions.cs | 14 + MediaBrowser.Controller/Library/IIntroProvider.cs | 32 + MediaBrowser.Controller/Library/ILibraryManager.cs | 550 ++++ MediaBrowser.Controller/Library/ILibraryMonitor.cs | 43 + .../Library/ILibraryPostScanTask.cs | 20 + MediaBrowser.Controller/Library/ILiveStream.cs | 21 + .../Library/IMediaSourceManager.cs | 100 + .../Library/IMediaSourceProvider.cs | 25 + .../Library/IMetadataFileSaver.cs | 19 + MediaBrowser.Controller/Library/IMetadataSaver.cs | 33 + MediaBrowser.Controller/Library/IMusicManager.cs | 25 + MediaBrowser.Controller/Library/ISearchEngine.cs | 18 + .../Library/IUserDataManager.cs | 67 + MediaBrowser.Controller/Library/IUserManager.cs | 207 ++ .../Library/IUserViewManager.cs | 19 + MediaBrowser.Controller/Library/IntroInfo.cs | 19 + .../Library/ItemChangeEventArgs.cs | 24 + MediaBrowser.Controller/Library/ItemResolveArgs.cs | 281 ++ MediaBrowser.Controller/Library/ItemUpdateType.cs | 14 + .../Library/LibraryManagerExtensions.cs | 13 + .../Library/MetadataConfigurationStore.cs | 29 + MediaBrowser.Controller/Library/NameExtensions.cs | 26 + .../Library/PlaybackProgressEventArgs.cs | 34 + .../Library/PlaybackStopEventArgs.cs | 11 + MediaBrowser.Controller/Library/Profiler.cs | 76 + MediaBrowser.Controller/Library/SearchHintInfo.cs | 22 + MediaBrowser.Controller/Library/TVUtils.cs | 59 + .../Library/UserDataSaveEventArgs.cs | 39 + MediaBrowser.Controller/LiveTv/ChannelInfo.cs | 74 + .../LiveTv/IListingsProvider.cs | 19 + MediaBrowser.Controller/LiveTv/ILiveTvManager.cs | 293 ++ MediaBrowser.Controller/LiveTv/ILiveTvService.cs | 190 ++ MediaBrowser.Controller/LiveTv/ITunerHost.cs | 62 + MediaBrowser.Controller/LiveTv/LiveTvChannel.cs | 197 ++ .../LiveTv/LiveTvConflictException.cs | 20 + MediaBrowser.Controller/LiveTv/LiveTvProgram.cs | 349 +++ .../LiveTv/LiveTvServiceStatusInfo.cs | 49 + MediaBrowser.Controller/LiveTv/LiveTvTunerInfo.cs | 73 + MediaBrowser.Controller/LiveTv/ProgramInfo.cs | 213 ++ MediaBrowser.Controller/LiveTv/RecordingInfo.cs | 205 ++ .../LiveTv/RecordingStatusChangedEventArgs.cs | 12 + MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs | 119 + MediaBrowser.Controller/LiveTv/TimerEventInfo.cs | 10 + MediaBrowser.Controller/LiveTv/TimerInfo.cs | 175 ++ .../LiveTv/TunerChannelMapping.cs | 10 + .../MediaBrowser.Controller.csproj | 17 + .../DroidSansFallback.ttf.REMOVED.git-id | 1 + .../MediaEncoding/EncodingHelper.cs | 2503 +++++++++++++++++ .../MediaEncoding/EncodingJobInfo.cs | 775 +++++ .../MediaEncoding/EncodingJobOptions.cs | 265 ++ .../MediaEncoding/IEncodingManager.cs | 17 + .../MediaEncoding/IMediaEncoder.cs | 124 + .../MediaEncoding/ISubtitleEncoder.cs | 33 + .../MediaEncoding/ImageEncodingOptions.cs | 20 + MediaBrowser.Controller/MediaEncoding/JobLogger.cs | 149 + .../MediaEncoding/MediaEncoderHelpers.cs | 53 + .../MediaEncoding/MediaInfoRequest.cs | 24 + .../Net/AuthenticatedAttribute.cs | 69 + MediaBrowser.Controller/Net/AuthorizationInfo.cs | 52 + .../Net/BasePeriodicWebSocketListener.cs | 322 +++ MediaBrowser.Controller/Net/IAuthService.cs | 9 + .../Net/IAuthorizationContext.cs | 21 + MediaBrowser.Controller/Net/IHasResultFactory.cs | 17 + MediaBrowser.Controller/Net/IHttpResultFactory.cs | 80 + MediaBrowser.Controller/Net/IHttpServer.cs | 39 + MediaBrowser.Controller/Net/ISessionContext.cs | 16 + .../Net/IWebSocketConnection.cs | 85 + MediaBrowser.Controller/Net/IWebSocketListener.cs | 17 + MediaBrowser.Controller/Net/SecurityException.cs | 21 + MediaBrowser.Controller/Net/StaticResultOptions.cs | 41 + .../Net/WebSocketConnectEventArgs.cs | 41 + .../Net/WebSocketMessageInfo.cs | 16 + .../Notifications/INotificationManager.cs | 41 + .../Notifications/INotificationService.cs | 30 + .../Notifications/INotificationTypeFactory.cs | 14 + .../Notifications/UserNotification.cs | 21 + .../Persistence/IDisplayPreferencesRepository.cs | 49 + .../Persistence/IItemRepository.cs | 159 ++ MediaBrowser.Controller/Persistence/IRepository.cs | 16 + .../Persistence/IUserDataRepository.cs | 50 + .../Persistence/IUserRepository.cs | 29 + .../Persistence/MediaStreamQuery.cs | 26 + .../Playlists/IPlaylistManager.cs | 59 + MediaBrowser.Controller/Playlists/Playlist.cs | 315 +++ .../Plugins/ILocalizablePlugin.cs | 20 + .../Plugins/IPluginConfigurationPage.cs | 50 + .../Plugins/IServerEntryPoint.cs | 20 + MediaBrowser.Controller/Properties/AssemblyInfo.cs | 27 + MediaBrowser.Controller/Providers/AlbumInfo.cs | 28 + MediaBrowser.Controller/Providers/ArtistInfo.cs | 14 + MediaBrowser.Controller/Providers/BookInfo.cs | 7 + MediaBrowser.Controller/Providers/BoxSetInfo.cs | 7 + .../Providers/DirectoryService.cs | 106 + .../Providers/DynamicImageInfo.cs | 10 + .../Providers/DynamicImageResponse.cs | 36 + MediaBrowser.Controller/Providers/EpisodeInfo.cs | 20 + MediaBrowser.Controller/Providers/ExtraInfo.cs | 15 + MediaBrowser.Controller/Providers/ExtraSource.cs | 9 + MediaBrowser.Controller/Providers/GameInfo.cs | 11 + .../Providers/GameSystemInfo.cs | 11 + .../Providers/ICustomMetadataProvider.cs | 24 + .../Providers/IDirectoryService.cs | 15 + .../Providers/IDynamicImageProvider.cs | 27 + MediaBrowser.Controller/Providers/IExternalId.cs | 15 + .../Providers/IExtrasProvider.cs | 20 + .../Providers/IForcedProvider.cs | 10 + .../Providers/IHasItemChangeMonitor.cs | 15 + .../Providers/IHasLookupInfo.cs | 8 + MediaBrowser.Controller/Providers/IHasOrder.cs | 7 + .../Providers/IImageEnhancer.cs | 61 + .../Providers/IImageProvider.cs | 23 + .../Providers/ILocalImageFileProvider.cs | 10 + .../Providers/ILocalImageProvider.cs | 9 + .../Providers/ILocalMetadataProvider.cs | 25 + .../Providers/IMetadataProvider.cs | 21 + .../Providers/IMetadataService.cs | 34 + .../Providers/IPreRefreshProvider.cs | 7 + .../Providers/IProviderManager.cs | 178 ++ .../Providers/IRemoteImageProvider.cs | 39 + .../Providers/IRemoteMetadataProvider.cs | 25 + .../Providers/IRemoteSearchProvider.cs | 17 + .../Providers/ImageRefreshOptions.cs | 33 + MediaBrowser.Controller/Providers/ItemInfo.cs | 32 + .../Providers/ItemLookupInfo.cs | 47 + .../Providers/LocalImageInfo.cs | 13 + .../Providers/MetadataProviderPriority.cs | 40 + .../Providers/MetadataRefreshMode.cs | 25 + .../Providers/MetadataRefreshOptions.cs | 72 + .../Providers/MetadataResult.cs | 77 + MediaBrowser.Controller/Providers/MovieInfo.cs | 7 + .../Providers/MusicVideoInfo.cs | 7 + .../Providers/PersonLookupInfo.cs | 7 + .../Providers/RemoteSearchQuery.cs | 21 + MediaBrowser.Controller/Providers/SeasonInfo.cs | 15 + MediaBrowser.Controller/Providers/SeriesInfo.cs | 6 + MediaBrowser.Controller/Providers/SongInfo.cs | 16 + MediaBrowser.Controller/Providers/TrailerInfo.cs | 6 + .../Providers/VideoContentType.cs | 19 + .../Resolvers/BaseItemResolver.cs | 61 + MediaBrowser.Controller/Resolvers/IItemResolver.cs | 48 + .../Resolvers/IResolverIgnoreRule.cs | 15 + .../Resolvers/ResolverPriority.cs | 27 + .../Security/AuthenticationInfo.cs | 70 + .../Security/AuthenticationInfoQuery.cs | 49 + .../Security/IAuthenticationRepository.cs | 37 + .../Security/IEncryptionManager.cs | 20 + .../Session/AuthenticationRequest.cs | 19 + .../Session/ISessionController.cs | 25 + MediaBrowser.Controller/Session/ISessionManager.cs | 328 +++ .../Session/SessionEventArgs.cs | 9 + MediaBrowser.Controller/Session/SessionInfo.cs | 396 +++ .../Sorting/IBaseItemComparer.cs | 17 + .../Sorting/IUserBaseItemComparer.cs | 29 + MediaBrowser.Controller/Sorting/SortExtensions.cs | 143 + MediaBrowser.Controller/Sorting/SortHelper.cs | 25 + .../Subtitles/ISubtitleManager.cs | 74 + .../Subtitles/ISubtitleProvider.cs | 40 + .../Subtitles/SubtitleDownloadEventArgs.cs | 27 + .../Subtitles/SubtitleResponse.cs | 12 + .../Subtitles/SubtitleSearchRequest.cs | 39 + MediaBrowser.Controller/Sync/IHasDynamicAccess.cs | 18 + .../Sync/IRemoteSyncProvider.cs | 10 + .../Sync/IServerSyncProvider.cs | 29 + MediaBrowser.Controller/Sync/ISyncProvider.cs | 27 + MediaBrowser.Controller/Sync/SyncedFileInfo.cs | 35 + MediaBrowser.Controller/TV/ITVSeriesManager.cs | 20 + 265 files changed, 27594 insertions(+) create mode 100644 MediaBrowser.Controller/Authentication/AuthenticationResult.cs create mode 100644 MediaBrowser.Controller/Authentication/IAuthenticationProvider.cs create mode 100644 MediaBrowser.Controller/Channels/Channel.cs create mode 100644 MediaBrowser.Controller/Channels/ChannelItemInfo.cs create mode 100644 MediaBrowser.Controller/Channels/ChannelItemResult.cs create mode 100644 MediaBrowser.Controller/Channels/ChannelItemType.cs create mode 100644 MediaBrowser.Controller/Channels/ChannelParentalRating.cs create mode 100644 MediaBrowser.Controller/Channels/ChannelSearchInfo.cs create mode 100644 MediaBrowser.Controller/Channels/IChannel.cs create mode 100644 MediaBrowser.Controller/Channels/IChannelManager.cs create mode 100644 MediaBrowser.Controller/Channels/IHasCacheKey.cs create mode 100644 MediaBrowser.Controller/Channels/IRequiresMediaInfoCallback.cs create mode 100644 MediaBrowser.Controller/Channels/ISearchableChannel.cs create mode 100644 MediaBrowser.Controller/Channels/InternalChannelFeatures.cs create mode 100644 MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs create mode 100644 MediaBrowser.Controller/Chapters/IChapterManager.cs create mode 100644 MediaBrowser.Controller/Collections/CollectionCreationOptions.cs create mode 100644 MediaBrowser.Controller/Collections/CollectionEvents.cs create mode 100644 MediaBrowser.Controller/Collections/ICollectionManager.cs create mode 100644 MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs create mode 100644 MediaBrowser.Controller/Connect/IConnectManager.cs create mode 100644 MediaBrowser.Controller/Connect/UserLinkResult.cs create mode 100644 MediaBrowser.Controller/Devices/CameraImageUploadInfo.cs create mode 100644 MediaBrowser.Controller/Devices/IDeviceManager.cs create mode 100644 MediaBrowser.Controller/Dlna/IDlnaManager.cs create mode 100644 MediaBrowser.Controller/Drawing/IImageEncoder.cs create mode 100644 MediaBrowser.Controller/Drawing/IImageProcessor.cs create mode 100644 MediaBrowser.Controller/Drawing/ImageCollageOptions.cs create mode 100644 MediaBrowser.Controller/Drawing/ImageHelper.cs create mode 100644 MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs create mode 100644 MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs create mode 100644 MediaBrowser.Controller/Drawing/ImageStream.cs create mode 100644 MediaBrowser.Controller/Dto/DtoOptions.cs create mode 100644 MediaBrowser.Controller/Dto/IDtoService.cs create mode 100644 MediaBrowser.Controller/Entities/AggregateFolder.cs create mode 100644 MediaBrowser.Controller/Entities/Audio/Audio.cs create mode 100644 MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs create mode 100644 MediaBrowser.Controller/Entities/Audio/IHasMusicGenres.cs create mode 100644 MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs create mode 100644 MediaBrowser.Controller/Entities/Audio/MusicArtist.cs create mode 100644 MediaBrowser.Controller/Entities/Audio/MusicGenre.cs create mode 100644 MediaBrowser.Controller/Entities/AudioBook.cs create mode 100644 MediaBrowser.Controller/Entities/BaseItem.cs create mode 100644 MediaBrowser.Controller/Entities/BaseItemExtensions.cs create mode 100644 MediaBrowser.Controller/Entities/BasePluginFolder.cs create mode 100644 MediaBrowser.Controller/Entities/Book.cs create mode 100644 MediaBrowser.Controller/Entities/CollectionFolder.cs create mode 100644 MediaBrowser.Controller/Entities/DayOfWeekHelper.cs create mode 100644 MediaBrowser.Controller/Entities/Extensions.cs create mode 100644 MediaBrowser.Controller/Entities/Folder.cs create mode 100644 MediaBrowser.Controller/Entities/Game.cs create mode 100644 MediaBrowser.Controller/Entities/GameGenre.cs create mode 100644 MediaBrowser.Controller/Entities/GameSystem.cs create mode 100644 MediaBrowser.Controller/Entities/Genre.cs create mode 100644 MediaBrowser.Controller/Entities/ICollectionFolder.cs create mode 100644 MediaBrowser.Controller/Entities/IHasAspectRatio.cs create mode 100644 MediaBrowser.Controller/Entities/IHasDisplayOrder.cs create mode 100644 MediaBrowser.Controller/Entities/IHasMediaSources.cs create mode 100644 MediaBrowser.Controller/Entities/IHasProgramAttributes.cs create mode 100644 MediaBrowser.Controller/Entities/IHasScreenshots.cs create mode 100644 MediaBrowser.Controller/Entities/IHasSeries.cs create mode 100644 MediaBrowser.Controller/Entities/IHasSpecialFeatures.cs create mode 100644 MediaBrowser.Controller/Entities/IHasStartDate.cs create mode 100644 MediaBrowser.Controller/Entities/IHasTrailers.cs create mode 100644 MediaBrowser.Controller/Entities/IItemByName.cs create mode 100644 MediaBrowser.Controller/Entities/IMetadataContainer.cs create mode 100644 MediaBrowser.Controller/Entities/ISupportsBoxSetGrouping.cs create mode 100644 MediaBrowser.Controller/Entities/ISupportsPlaceHolders.cs create mode 100644 MediaBrowser.Controller/Entities/InternalItemsQuery.cs create mode 100644 MediaBrowser.Controller/Entities/InternalPeopleQuery.cs create mode 100644 MediaBrowser.Controller/Entities/ItemImageInfo.cs create mode 100644 MediaBrowser.Controller/Entities/LinkedChild.cs create mode 100644 MediaBrowser.Controller/Entities/Movies/BoxSet.cs create mode 100644 MediaBrowser.Controller/Entities/Movies/Movie.cs create mode 100644 MediaBrowser.Controller/Entities/MusicVideo.cs create mode 100644 MediaBrowser.Controller/Entities/PeopleHelper.cs create mode 100644 MediaBrowser.Controller/Entities/Person.cs create mode 100644 MediaBrowser.Controller/Entities/Photo.cs create mode 100644 MediaBrowser.Controller/Entities/PhotoAlbum.cs create mode 100644 MediaBrowser.Controller/Entities/Share.cs create mode 100644 MediaBrowser.Controller/Entities/SourceType.cs create mode 100644 MediaBrowser.Controller/Entities/Studio.cs create mode 100644 MediaBrowser.Controller/Entities/TV/Episode.cs create mode 100644 MediaBrowser.Controller/Entities/TV/Season.cs create mode 100644 MediaBrowser.Controller/Entities/TV/Series.cs create mode 100644 MediaBrowser.Controller/Entities/TagExtensions.cs create mode 100644 MediaBrowser.Controller/Entities/Trailer.cs create mode 100644 MediaBrowser.Controller/Entities/User.cs create mode 100644 MediaBrowser.Controller/Entities/UserItemData.cs create mode 100644 MediaBrowser.Controller/Entities/UserRootFolder.cs create mode 100644 MediaBrowser.Controller/Entities/UserView.cs create mode 100644 MediaBrowser.Controller/Entities/UserViewBuilder.cs create mode 100644 MediaBrowser.Controller/Entities/Video.cs create mode 100644 MediaBrowser.Controller/Entities/Year.cs create mode 100644 MediaBrowser.Controller/Extensions/StringExtensions.cs create mode 100644 MediaBrowser.Controller/IO/FileData.cs create mode 100644 MediaBrowser.Controller/IResourceFileManager.cs create mode 100644 MediaBrowser.Controller/IServerApplicationHost.cs create mode 100644 MediaBrowser.Controller/IServerApplicationPaths.cs create mode 100644 MediaBrowser.Controller/Library/DeleteOptions.cs create mode 100644 MediaBrowser.Controller/Library/IIntroProvider.cs create mode 100644 MediaBrowser.Controller/Library/ILibraryManager.cs create mode 100644 MediaBrowser.Controller/Library/ILibraryMonitor.cs create mode 100644 MediaBrowser.Controller/Library/ILibraryPostScanTask.cs create mode 100644 MediaBrowser.Controller/Library/ILiveStream.cs create mode 100644 MediaBrowser.Controller/Library/IMediaSourceManager.cs create mode 100644 MediaBrowser.Controller/Library/IMediaSourceProvider.cs create mode 100644 MediaBrowser.Controller/Library/IMetadataFileSaver.cs create mode 100644 MediaBrowser.Controller/Library/IMetadataSaver.cs create mode 100644 MediaBrowser.Controller/Library/IMusicManager.cs create mode 100644 MediaBrowser.Controller/Library/ISearchEngine.cs create mode 100644 MediaBrowser.Controller/Library/IUserDataManager.cs create mode 100644 MediaBrowser.Controller/Library/IUserManager.cs create mode 100644 MediaBrowser.Controller/Library/IUserViewManager.cs create mode 100644 MediaBrowser.Controller/Library/IntroInfo.cs create mode 100644 MediaBrowser.Controller/Library/ItemChangeEventArgs.cs create mode 100644 MediaBrowser.Controller/Library/ItemResolveArgs.cs create mode 100644 MediaBrowser.Controller/Library/ItemUpdateType.cs create mode 100644 MediaBrowser.Controller/Library/LibraryManagerExtensions.cs create mode 100644 MediaBrowser.Controller/Library/MetadataConfigurationStore.cs create mode 100644 MediaBrowser.Controller/Library/NameExtensions.cs create mode 100644 MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs create mode 100644 MediaBrowser.Controller/Library/PlaybackStopEventArgs.cs create mode 100644 MediaBrowser.Controller/Library/Profiler.cs create mode 100644 MediaBrowser.Controller/Library/SearchHintInfo.cs create mode 100644 MediaBrowser.Controller/Library/TVUtils.cs create mode 100644 MediaBrowser.Controller/Library/UserDataSaveEventArgs.cs create mode 100644 MediaBrowser.Controller/LiveTv/ChannelInfo.cs create mode 100644 MediaBrowser.Controller/LiveTv/IListingsProvider.cs create mode 100644 MediaBrowser.Controller/LiveTv/ILiveTvManager.cs create mode 100644 MediaBrowser.Controller/LiveTv/ILiveTvService.cs create mode 100644 MediaBrowser.Controller/LiveTv/ITunerHost.cs create mode 100644 MediaBrowser.Controller/LiveTv/LiveTvChannel.cs create mode 100644 MediaBrowser.Controller/LiveTv/LiveTvConflictException.cs create mode 100644 MediaBrowser.Controller/LiveTv/LiveTvProgram.cs create mode 100644 MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs create mode 100644 MediaBrowser.Controller/LiveTv/LiveTvTunerInfo.cs create mode 100644 MediaBrowser.Controller/LiveTv/ProgramInfo.cs create mode 100644 MediaBrowser.Controller/LiveTv/RecordingInfo.cs create mode 100644 MediaBrowser.Controller/LiveTv/RecordingStatusChangedEventArgs.cs create mode 100644 MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs create mode 100644 MediaBrowser.Controller/LiveTv/TimerEventInfo.cs create mode 100644 MediaBrowser.Controller/LiveTv/TimerInfo.cs create mode 100644 MediaBrowser.Controller/LiveTv/TunerChannelMapping.cs create mode 100644 MediaBrowser.Controller/MediaBrowser.Controller.csproj create mode 100644 MediaBrowser.Controller/MediaEncoding/DroidSansFallback.ttf.REMOVED.git-id create mode 100644 MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs create mode 100644 MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs create mode 100644 MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs create mode 100644 MediaBrowser.Controller/MediaEncoding/IEncodingManager.cs create mode 100644 MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs create mode 100644 MediaBrowser.Controller/MediaEncoding/ISubtitleEncoder.cs create mode 100644 MediaBrowser.Controller/MediaEncoding/ImageEncodingOptions.cs create mode 100644 MediaBrowser.Controller/MediaEncoding/JobLogger.cs create mode 100644 MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs create mode 100644 MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs create mode 100644 MediaBrowser.Controller/Net/AuthenticatedAttribute.cs create mode 100644 MediaBrowser.Controller/Net/AuthorizationInfo.cs create mode 100644 MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs create mode 100644 MediaBrowser.Controller/Net/IAuthService.cs create mode 100644 MediaBrowser.Controller/Net/IAuthorizationContext.cs create mode 100644 MediaBrowser.Controller/Net/IHasResultFactory.cs create mode 100644 MediaBrowser.Controller/Net/IHttpResultFactory.cs create mode 100644 MediaBrowser.Controller/Net/IHttpServer.cs create mode 100644 MediaBrowser.Controller/Net/ISessionContext.cs create mode 100644 MediaBrowser.Controller/Net/IWebSocketConnection.cs create mode 100644 MediaBrowser.Controller/Net/IWebSocketListener.cs create mode 100644 MediaBrowser.Controller/Net/SecurityException.cs create mode 100644 MediaBrowser.Controller/Net/StaticResultOptions.cs create mode 100644 MediaBrowser.Controller/Net/WebSocketConnectEventArgs.cs create mode 100644 MediaBrowser.Controller/Net/WebSocketMessageInfo.cs create mode 100644 MediaBrowser.Controller/Notifications/INotificationManager.cs create mode 100644 MediaBrowser.Controller/Notifications/INotificationService.cs create mode 100644 MediaBrowser.Controller/Notifications/INotificationTypeFactory.cs create mode 100644 MediaBrowser.Controller/Notifications/UserNotification.cs create mode 100644 MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs create mode 100644 MediaBrowser.Controller/Persistence/IItemRepository.cs create mode 100644 MediaBrowser.Controller/Persistence/IRepository.cs create mode 100644 MediaBrowser.Controller/Persistence/IUserDataRepository.cs create mode 100644 MediaBrowser.Controller/Persistence/IUserRepository.cs create mode 100644 MediaBrowser.Controller/Persistence/MediaStreamQuery.cs create mode 100644 MediaBrowser.Controller/Playlists/IPlaylistManager.cs create mode 100644 MediaBrowser.Controller/Playlists/Playlist.cs create mode 100644 MediaBrowser.Controller/Plugins/ILocalizablePlugin.cs create mode 100644 MediaBrowser.Controller/Plugins/IPluginConfigurationPage.cs create mode 100644 MediaBrowser.Controller/Plugins/IServerEntryPoint.cs create mode 100644 MediaBrowser.Controller/Properties/AssemblyInfo.cs create mode 100644 MediaBrowser.Controller/Providers/AlbumInfo.cs create mode 100644 MediaBrowser.Controller/Providers/ArtistInfo.cs create mode 100644 MediaBrowser.Controller/Providers/BookInfo.cs create mode 100644 MediaBrowser.Controller/Providers/BoxSetInfo.cs create mode 100644 MediaBrowser.Controller/Providers/DirectoryService.cs create mode 100644 MediaBrowser.Controller/Providers/DynamicImageInfo.cs create mode 100644 MediaBrowser.Controller/Providers/DynamicImageResponse.cs create mode 100644 MediaBrowser.Controller/Providers/EpisodeInfo.cs create mode 100644 MediaBrowser.Controller/Providers/ExtraInfo.cs create mode 100644 MediaBrowser.Controller/Providers/ExtraSource.cs create mode 100644 MediaBrowser.Controller/Providers/GameInfo.cs create mode 100644 MediaBrowser.Controller/Providers/GameSystemInfo.cs create mode 100644 MediaBrowser.Controller/Providers/ICustomMetadataProvider.cs create mode 100644 MediaBrowser.Controller/Providers/IDirectoryService.cs create mode 100644 MediaBrowser.Controller/Providers/IDynamicImageProvider.cs create mode 100644 MediaBrowser.Controller/Providers/IExternalId.cs create mode 100644 MediaBrowser.Controller/Providers/IExtrasProvider.cs create mode 100644 MediaBrowser.Controller/Providers/IForcedProvider.cs create mode 100644 MediaBrowser.Controller/Providers/IHasItemChangeMonitor.cs create mode 100644 MediaBrowser.Controller/Providers/IHasLookupInfo.cs create mode 100644 MediaBrowser.Controller/Providers/IHasOrder.cs create mode 100644 MediaBrowser.Controller/Providers/IImageEnhancer.cs create mode 100644 MediaBrowser.Controller/Providers/IImageProvider.cs create mode 100644 MediaBrowser.Controller/Providers/ILocalImageFileProvider.cs create mode 100644 MediaBrowser.Controller/Providers/ILocalImageProvider.cs create mode 100644 MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs create mode 100644 MediaBrowser.Controller/Providers/IMetadataProvider.cs create mode 100644 MediaBrowser.Controller/Providers/IMetadataService.cs create mode 100644 MediaBrowser.Controller/Providers/IPreRefreshProvider.cs create mode 100644 MediaBrowser.Controller/Providers/IProviderManager.cs create mode 100644 MediaBrowser.Controller/Providers/IRemoteImageProvider.cs create mode 100644 MediaBrowser.Controller/Providers/IRemoteMetadataProvider.cs create mode 100644 MediaBrowser.Controller/Providers/IRemoteSearchProvider.cs create mode 100644 MediaBrowser.Controller/Providers/ImageRefreshOptions.cs create mode 100644 MediaBrowser.Controller/Providers/ItemInfo.cs create mode 100644 MediaBrowser.Controller/Providers/ItemLookupInfo.cs create mode 100644 MediaBrowser.Controller/Providers/LocalImageInfo.cs create mode 100644 MediaBrowser.Controller/Providers/MetadataProviderPriority.cs create mode 100644 MediaBrowser.Controller/Providers/MetadataRefreshMode.cs create mode 100644 MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs create mode 100644 MediaBrowser.Controller/Providers/MetadataResult.cs create mode 100644 MediaBrowser.Controller/Providers/MovieInfo.cs create mode 100644 MediaBrowser.Controller/Providers/MusicVideoInfo.cs create mode 100644 MediaBrowser.Controller/Providers/PersonLookupInfo.cs create mode 100644 MediaBrowser.Controller/Providers/RemoteSearchQuery.cs create mode 100644 MediaBrowser.Controller/Providers/SeasonInfo.cs create mode 100644 MediaBrowser.Controller/Providers/SeriesInfo.cs create mode 100644 MediaBrowser.Controller/Providers/SongInfo.cs create mode 100644 MediaBrowser.Controller/Providers/TrailerInfo.cs create mode 100644 MediaBrowser.Controller/Providers/VideoContentType.cs create mode 100644 MediaBrowser.Controller/Resolvers/BaseItemResolver.cs create mode 100644 MediaBrowser.Controller/Resolvers/IItemResolver.cs create mode 100644 MediaBrowser.Controller/Resolvers/IResolverIgnoreRule.cs create mode 100644 MediaBrowser.Controller/Resolvers/ResolverPriority.cs create mode 100644 MediaBrowser.Controller/Security/AuthenticationInfo.cs create mode 100644 MediaBrowser.Controller/Security/AuthenticationInfoQuery.cs create mode 100644 MediaBrowser.Controller/Security/IAuthenticationRepository.cs create mode 100644 MediaBrowser.Controller/Security/IEncryptionManager.cs create mode 100644 MediaBrowser.Controller/Session/AuthenticationRequest.cs create mode 100644 MediaBrowser.Controller/Session/ISessionController.cs create mode 100644 MediaBrowser.Controller/Session/ISessionManager.cs create mode 100644 MediaBrowser.Controller/Session/SessionEventArgs.cs create mode 100644 MediaBrowser.Controller/Session/SessionInfo.cs create mode 100644 MediaBrowser.Controller/Sorting/IBaseItemComparer.cs create mode 100644 MediaBrowser.Controller/Sorting/IUserBaseItemComparer.cs create mode 100644 MediaBrowser.Controller/Sorting/SortExtensions.cs create mode 100644 MediaBrowser.Controller/Sorting/SortHelper.cs create mode 100644 MediaBrowser.Controller/Subtitles/ISubtitleManager.cs create mode 100644 MediaBrowser.Controller/Subtitles/ISubtitleProvider.cs create mode 100644 MediaBrowser.Controller/Subtitles/SubtitleDownloadEventArgs.cs create mode 100644 MediaBrowser.Controller/Subtitles/SubtitleResponse.cs create mode 100644 MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs create mode 100644 MediaBrowser.Controller/Sync/IHasDynamicAccess.cs create mode 100644 MediaBrowser.Controller/Sync/IRemoteSyncProvider.cs create mode 100644 MediaBrowser.Controller/Sync/IServerSyncProvider.cs create mode 100644 MediaBrowser.Controller/Sync/ISyncProvider.cs create mode 100644 MediaBrowser.Controller/Sync/SyncedFileInfo.cs create mode 100644 MediaBrowser.Controller/TV/ITVSeriesManager.cs (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Authentication/AuthenticationResult.cs b/MediaBrowser.Controller/Authentication/AuthenticationResult.cs new file mode 100644 index 0000000000..6dd8f02d8b --- /dev/null +++ b/MediaBrowser.Controller/Authentication/AuthenticationResult.cs @@ -0,0 +1,14 @@ +using MediaBrowser.Controller.Session; +using MediaBrowser.Model.Dto; + + +namespace MediaBrowser.Controller.Authentication +{ + public class AuthenticationResult + { + public UserDto User { get; set; } + public SessionInfo SessionInfo { get; set; } + public string AccessToken { get; set; } + public string ServerId { get; set; } + } +} diff --git a/MediaBrowser.Controller/Authentication/IAuthenticationProvider.cs b/MediaBrowser.Controller/Authentication/IAuthenticationProvider.cs new file mode 100644 index 0000000000..becb3ea627 --- /dev/null +++ b/MediaBrowser.Controller/Authentication/IAuthenticationProvider.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Users; + +namespace MediaBrowser.Controller.Authentication +{ + public interface IAuthenticationProvider + { + string Name { get; } + bool IsEnabled { get; } + Task Authenticate(string username, string password); + Task HasPassword(User user); + Task ChangePassword(User user, string newPassword); + } + + public interface IRequiresResolvedUser + { + Task Authenticate(string username, string password, User resolvedUser); + } + + public interface IHasNewUserPolicy + { + UserPolicy GetNewUserPolicy(); + } + + public class ProviderAuthenticationResult + { + public string Username { get; set; } + public string DisplayName { get; set; } + } +} diff --git a/MediaBrowser.Controller/Channels/Channel.cs b/MediaBrowser.Controller/Channels/Channel.cs new file mode 100644 index 0000000000..9cd50db17a --- /dev/null +++ b/MediaBrowser.Controller/Channels/Channel.cs @@ -0,0 +1,94 @@ +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Channels; +using MediaBrowser.Model.Querying; +using System; +using System.Linq; +using MediaBrowser.Model.Serialization; +using System.Threading; +using System.Threading.Tasks; +using MediaBrowser.Common.Progress; + +namespace MediaBrowser.Controller.Channels +{ + public class Channel : Folder + { + public override bool IsVisible(User user) + { + if (user.Policy.BlockedChannels != null) + { + if (user.Policy.BlockedChannels.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase)) + { + return false; + } + } + else + { + if (!user.Policy.EnableAllChannels && !user.Policy.EnabledChannels.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase)) + { + return false; + } + } + + return base.IsVisible(user); + } + + [IgnoreDataMember] + public override bool SupportsInheritedParentImages + { + get + { + return false; + } + } + + [IgnoreDataMember] + public override SourceType SourceType + { + get { return SourceType.Channel; } + } + + protected override QueryResult GetItemsInternal(InternalItemsQuery query) + { + try + { + query.Parent = this; + query.ChannelIds = new Guid[] { Id }; + + // Don't blow up here because it could cause parent screens with other content to fail + return ChannelManager.GetChannelItemsInternal(query, new SimpleProgress(), CancellationToken.None).Result; + } + catch + { + // Already logged at lower levels + return new QueryResult(); + } + } + + protected override string GetInternalMetadataPath(string basePath) + { + return GetInternalMetadataPath(basePath, Id); + } + + public static string GetInternalMetadataPath(string basePath, Guid id) + { + return System.IO.Path.Combine(basePath, "channels", id.ToString("N"), "metadata"); + } + + public override bool CanDelete() + { + return false; + } + + protected override bool IsAllowTagFilterEnforced() + { + return false; + } + + internal static bool IsChannelVisible(BaseItem channelItem, User user) + { + var channel = ChannelManager.GetChannel(channelItem.ChannelId.ToString("")); + + return channel.IsVisible(user); + } + } +} diff --git a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs new file mode 100644 index 0000000000..0de2b9a0cb --- /dev/null +++ b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs @@ -0,0 +1,82 @@ +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Channels; +using MediaBrowser.Model.Entities; +using System; +using System.Collections.Generic; +using MediaBrowser.Model.Dto; + +namespace MediaBrowser.Controller.Channels +{ + public class ChannelItemInfo : IHasProviderIds + { + public string Name { get; set; } + + public string SeriesName { get; set; } + + public string Id { get; set; } + + public DateTime DateModified { get; set; } + + public ChannelItemType Type { get; set; } + + public string OfficialRating { get; set; } + + public string Overview { get; set; } + + public List Genres { get; set; } + public List Studios { get; set; } + public List Tags { get; set; } + + public List People { get; set; } + + public float? CommunityRating { get; set; } + + public long? RunTimeTicks { get; set; } + + public string ImageUrl { get; set; } + public string OriginalTitle { get; set; } + + public ChannelMediaType MediaType { get; set; } + public ChannelFolderType FolderType { get; set; } + + public ChannelMediaContentType ContentType { get; set; } + public ExtraType ExtraType { get; set; } + public List TrailerTypes { get; set; } + + public Dictionary ProviderIds { get; set; } + + public DateTime? PremiereDate { get; set; } + public int? ProductionYear { get; set; } + + public DateTime? DateCreated { get; set; } + + public DateTime? StartDate { get; set; } + public DateTime? EndDate { get; set; } + + public int? IndexNumber { get; set; } + public int? ParentIndexNumber { get; set; } + + public List MediaSources { get; set; } + + public string HomePageUrl { get; set; } + + public List Artists { get; set; } + + public List AlbumArtists { get; set; } + public bool IsLiveStream { get; set; } + public string Etag { get; set; } + + public ChannelItemInfo() + { + MediaSources = new List(); + TrailerTypes = new List(); + Genres = new List(); + Studios = new List(); + People = new List(); + Tags = new List(); + ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); + Artists = new List(); + AlbumArtists = new List(); + } + } +} diff --git a/MediaBrowser.Controller/Channels/ChannelItemResult.cs b/MediaBrowser.Controller/Channels/ChannelItemResult.cs new file mode 100644 index 0000000000..f888818118 --- /dev/null +++ b/MediaBrowser.Controller/Channels/ChannelItemResult.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Channels +{ + public class ChannelItemResult + { + public List Items { get; set; } + + public int? TotalRecordCount { get; set; } + + public ChannelItemResult() + { + Items = new List(); + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Controller/Channels/ChannelItemType.cs b/MediaBrowser.Controller/Channels/ChannelItemType.cs new file mode 100644 index 0000000000..184ce8a767 --- /dev/null +++ b/MediaBrowser.Controller/Channels/ChannelItemType.cs @@ -0,0 +1,9 @@ +namespace MediaBrowser.Controller.Channels +{ + public enum ChannelItemType + { + Media = 0, + + Folder = 1 + } +} \ No newline at end of file diff --git a/MediaBrowser.Controller/Channels/ChannelParentalRating.cs b/MediaBrowser.Controller/Channels/ChannelParentalRating.cs new file mode 100644 index 0000000000..d9cc521b38 --- /dev/null +++ b/MediaBrowser.Controller/Channels/ChannelParentalRating.cs @@ -0,0 +1,15 @@ +namespace MediaBrowser.Controller.Channels +{ + public enum ChannelParentalRating + { + GeneralAudience = 0, + + UsPG = 1, + + UsPG13 = 2, + + UsR = 3, + + Adult = 4 + } +} \ No newline at end of file diff --git a/MediaBrowser.Controller/Channels/ChannelSearchInfo.cs b/MediaBrowser.Controller/Channels/ChannelSearchInfo.cs new file mode 100644 index 0000000000..c2a51654c7 --- /dev/null +++ b/MediaBrowser.Controller/Channels/ChannelSearchInfo.cs @@ -0,0 +1,14 @@ +namespace MediaBrowser.Controller.Channels +{ + public class ChannelSearchInfo + { + public string SearchTerm { get; set; } + + public string UserId { get; set; } + } + + public class ChannelLatestMediaSearch + { + public string UserId { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Controller/Channels/IChannel.cs b/MediaBrowser.Controller/Channels/IChannel.cs new file mode 100644 index 0000000000..dc1d9b00a3 --- /dev/null +++ b/MediaBrowser.Controller/Channels/IChannel.cs @@ -0,0 +1,76 @@ +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Entities; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Controller.Channels +{ + public interface IChannel + { + /// + /// Gets the name. + /// + /// The name. + string Name { get; } + + /// + /// Gets the description. + /// + /// The description. + string Description { get; } + + /// + /// Gets the data version. + /// + /// The data version. + string DataVersion { get; } + + /// + /// Gets the home page URL. + /// + /// The home page URL. + string HomePageUrl { get; } + + /// + /// Gets the parental rating. + /// + /// The parental rating. + ChannelParentalRating ParentalRating { get; } + + /// + /// Gets the channel information. + /// + /// ChannelFeatures. + InternalChannelFeatures GetChannelFeatures(); + + /// + /// Determines whether [is enabled for] [the specified user]. + /// + /// The user identifier. + /// true if [is enabled for] [the specified user]; otherwise, false. + bool IsEnabledFor(string userId); + + /// + /// Gets the channel items. + /// + /// The query. + /// The cancellation token. + /// Task{IEnumerable{ChannelItem}}. + Task GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken); + + /// + /// Gets the channel image. + /// + /// The type. + /// The cancellation token. + /// Task{DynamicImageInfo}. + Task GetChannelImage(ImageType type, CancellationToken cancellationToken); + + /// + /// Gets the supported channel images. + /// + /// IEnumerable{ImageType}. + IEnumerable GetSupportedChannelImages(); + } +} diff --git a/MediaBrowser.Controller/Channels/IChannelManager.cs b/MediaBrowser.Controller/Channels/IChannelManager.cs new file mode 100644 index 0000000000..a9839e1fb9 --- /dev/null +++ b/MediaBrowser.Controller/Channels/IChannelManager.cs @@ -0,0 +1,89 @@ +using System; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Channels; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Querying; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Controller.Channels +{ + public interface IChannelManager + { + /// + /// Adds the parts. + /// + /// The channels. + void AddParts(IEnumerable channels); + + /// + /// Gets the channel features. + /// + /// The identifier. + /// ChannelFeatures. + ChannelFeatures GetChannelFeatures(string id); + + /// + /// Gets all channel features. + /// + /// IEnumerable{ChannelFeatures}. + ChannelFeatures[] GetAllChannelFeatures(); + + bool EnableMediaSourceDisplay(BaseItem item); + bool CanDelete(BaseItem item); + + Task DeleteItem(BaseItem item); + + /// + /// Gets the channel. + /// + /// The identifier. + /// Channel. + Channel GetChannel(string id); + + /// + /// Gets the channels internal. + /// + /// The query. + /// The cancellation token. + QueryResult GetChannelsInternal(ChannelQuery query); + + /// + /// Gets the channels. + /// + /// The query. + /// The cancellation token. + QueryResult GetChannels(ChannelQuery query); + + /// + /// Gets the latest media. + /// + Task> GetLatestChannelItems(InternalItemsQuery query, CancellationToken cancellationToken); + + /// + /// Gets the latest media. + /// + Task> GetLatestChannelItemsInternal(InternalItemsQuery query, CancellationToken cancellationToken); + + /// + /// Gets the channel items. + /// + Task> GetChannelItems(InternalItemsQuery query, CancellationToken cancellationToken); + + /// + /// Gets the channel items internal. + /// + Task> GetChannelItemsInternal(InternalItemsQuery query, IProgress progress, CancellationToken cancellationToken); + + /// + /// Gets the channel item media sources. + /// + /// The item. + /// The cancellation token. + /// Task{IEnumerable{MediaSourceInfo}}. + IEnumerable GetStaticMediaSources(BaseItem item, CancellationToken cancellationToken); + + bool EnableMediaProbe(BaseItem item); + } +} diff --git a/MediaBrowser.Controller/Channels/IHasCacheKey.cs b/MediaBrowser.Controller/Channels/IHasCacheKey.cs new file mode 100644 index 0000000000..6376d2f914 --- /dev/null +++ b/MediaBrowser.Controller/Channels/IHasCacheKey.cs @@ -0,0 +1,13 @@ + +namespace MediaBrowser.Controller.Channels +{ + public interface IHasCacheKey + { + /// + /// Gets the cache key. + /// + /// The user identifier. + /// System.String. + string GetCacheKey(string userId); + } +} diff --git a/MediaBrowser.Controller/Channels/IRequiresMediaInfoCallback.cs b/MediaBrowser.Controller/Channels/IRequiresMediaInfoCallback.cs new file mode 100644 index 0000000000..a2c63586b1 --- /dev/null +++ b/MediaBrowser.Controller/Channels/IRequiresMediaInfoCallback.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using MediaBrowser.Model.Dto; + +namespace MediaBrowser.Controller.Channels +{ + public interface IRequiresMediaInfoCallback + { + /// + /// Gets the channel item media information. + /// + Task> GetChannelItemMediaInfo(string id, CancellationToken cancellationToken); + } +} \ No newline at end of file diff --git a/MediaBrowser.Controller/Channels/ISearchableChannel.cs b/MediaBrowser.Controller/Channels/ISearchableChannel.cs new file mode 100644 index 0000000000..bf9842eb4f --- /dev/null +++ b/MediaBrowser.Controller/Channels/ISearchableChannel.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using MediaBrowser.Controller.Entities; + +namespace MediaBrowser.Controller.Channels +{ + public interface ISearchableChannel + { + /// + /// Searches the specified search term. + /// + /// The search information. + /// The cancellation token. + /// Task{IEnumerable{ChannelItemInfo}}. + Task> Search(ChannelSearchInfo searchInfo, CancellationToken cancellationToken); + } + + public interface ISupportsLatestMedia + { + /// + /// Gets the latest media. + /// + /// The request. + /// The cancellation token. + /// Task{IEnumerable{ChannelItemInfo}}. + Task> GetLatestMedia(ChannelLatestMediaSearch request, CancellationToken cancellationToken); + } + + public interface ISupportsDelete + { + bool CanDelete(BaseItem item); + Task DeleteItem(string id, CancellationToken cancellationToken); + } + + public interface IDisableMediaSourceDisplay + { + + } + + public interface ISupportsMediaProbe + { + + } + + public interface IHasFolderAttributes + { + string[] Attributes { get; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs b/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs new file mode 100644 index 0000000000..976808aad9 --- /dev/null +++ b/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs @@ -0,0 +1,61 @@ +using System; +using MediaBrowser.Model.Channels; +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Channels +{ + public class InternalChannelFeatures + { + /// + /// Gets or sets the media types. + /// + /// The media types. + public List MediaTypes { get; set; } + + /// + /// Gets or sets the content types. + /// + /// The content types. + public List ContentTypes { get; set; } + + /// + /// Represents the maximum number of records the channel allows retrieving at a time + /// + public int? MaxPageSize { get; set; } + + /// + /// Gets or sets the default sort orders. + /// + /// The default sort orders. + public List DefaultSortFields { get; set; } + + /// + /// Indicates if a sort ascending/descending toggle is supported or not. + /// + public bool SupportsSortOrderToggle { get; set; } + /// + /// Gets or sets the automatic refresh levels. + /// + /// The automatic refresh levels. + public int? AutoRefreshLevels { get; set; } + + /// + /// Gets or sets the daily download limit. + /// + /// The daily download limit. + public int? DailyDownloadLimit { get; set; } + /// + /// Gets or sets a value indicating whether [supports downloading]. + /// + /// true if [supports downloading]; otherwise, false. + public bool SupportsContentDownloading { get; set; } + + public InternalChannelFeatures() + { + MediaTypes = new List(); + ContentTypes = new List(); + + DefaultSortFields = new List(); + } + } +} diff --git a/MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs b/MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs new file mode 100644 index 0000000000..c69a1f6c32 --- /dev/null +++ b/MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs @@ -0,0 +1,21 @@ +using MediaBrowser.Model.Channels; +using System; + + +namespace MediaBrowser.Controller.Channels +{ + public class InternalChannelItemQuery + { + public string FolderId { get; set; } + + public Guid UserId { get; set; } + + public int? StartIndex { get; set; } + + public int? Limit { get; set; } + + public ChannelItemSortField? SortBy { get; set; } + + public bool SortDescending { get; set; } + } +} diff --git a/MediaBrowser.Controller/Chapters/IChapterManager.cs b/MediaBrowser.Controller/Chapters/IChapterManager.cs new file mode 100644 index 0000000000..2a20eb365d --- /dev/null +++ b/MediaBrowser.Controller/Chapters/IChapterManager.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using MediaBrowser.Model.Entities; + +namespace MediaBrowser.Controller.Chapters +{ + /// + /// Interface IChapterManager + /// + public interface IChapterManager + { + /// + /// Gets the chapters. + /// + /// The item identifier. + /// List{ChapterInfo}. + + /// + /// Saves the chapters. + /// + void SaveChapters(string itemId, List chapters); + } +} diff --git a/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs b/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs new file mode 100644 index 0000000000..727b487a79 --- /dev/null +++ b/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs @@ -0,0 +1,27 @@ +using MediaBrowser.Model.Entities; +using System; +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Collections +{ + public class CollectionCreationOptions : IHasProviderIds + { + public string Name { get; set; } + + public Guid? ParentId { get; set; } + + public bool IsLocked { get; set; } + + public Dictionary ProviderIds { get; set; } + + public string[] ItemIdList { get; set; } + public Guid[] UserIds { get; set; } + + public CollectionCreationOptions() + { + ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); + ItemIdList = new string[] {}; + UserIds = new Guid[] {}; + } + } +} diff --git a/MediaBrowser.Controller/Collections/CollectionEvents.cs b/MediaBrowser.Controller/Collections/CollectionEvents.cs new file mode 100644 index 0000000000..80f66a444a --- /dev/null +++ b/MediaBrowser.Controller/Collections/CollectionEvents.cs @@ -0,0 +1,37 @@ +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities.Movies; +using System; +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Collections +{ + public class CollectionCreatedEventArgs : EventArgs + { + /// + /// Gets or sets the collection. + /// + /// The collection. + public BoxSet Collection { get; set; } + + /// + /// Gets or sets the options. + /// + /// The options. + public CollectionCreationOptions Options { get; set; } + } + + public class CollectionModifiedEventArgs : EventArgs + { + /// + /// Gets or sets the collection. + /// + /// The collection. + public BoxSet Collection { get; set; } + + /// + /// Gets or sets the items changed. + /// + /// The items changed. + public List ItemsChanged { get; set; } + } +} diff --git a/MediaBrowser.Controller/Collections/ICollectionManager.cs b/MediaBrowser.Controller/Collections/ICollectionManager.cs new file mode 100644 index 0000000000..05bc927ba0 --- /dev/null +++ b/MediaBrowser.Controller/Collections/ICollectionManager.cs @@ -0,0 +1,57 @@ +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities.Movies; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace MediaBrowser.Controller.Collections +{ + public interface ICollectionManager + { + /// + /// Occurs when [collection created]. + /// + event EventHandler CollectionCreated; + + /// + /// Occurs when [items added to collection]. + /// + event EventHandler ItemsAddedToCollection; + + /// + /// Occurs when [items removed from collection]. + /// + event EventHandler ItemsRemovedFromCollection; + + /// + /// Creates the collection. + /// + /// The options. + BoxSet CreateCollection(CollectionCreationOptions options); + + /// + /// Adds to collection. + /// + /// The collection identifier. + /// The item ids. + void AddToCollection(Guid collectionId, IEnumerable itemIds); + + /// + /// Removes from collection. + /// + /// The collection identifier. + /// The item ids. + void RemoveFromCollection(Guid collectionId, IEnumerable itemIds); + + void AddToCollection(Guid collectionId, IEnumerable itemIds); + void RemoveFromCollection(Guid collectionId, IEnumerable itemIds); + + /// + /// Collapses the items within box sets. + /// + /// The items. + /// The user. + /// IEnumerable{BaseItem}. + IEnumerable CollapseItemsWithinBoxSets(IEnumerable items, User user); + } +} diff --git a/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs b/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs new file mode 100644 index 0000000000..af57149322 --- /dev/null +++ b/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs @@ -0,0 +1,25 @@ +using MediaBrowser.Common.Configuration; +using MediaBrowser.Model.Configuration; + +namespace MediaBrowser.Controller.Configuration +{ + /// + /// Interface IServerConfigurationManager + /// + public interface IServerConfigurationManager : IConfigurationManager + { + /// + /// Gets the application paths. + /// + /// The application paths. + IServerApplicationPaths ApplicationPaths { get; } + + /// + /// Gets the configuration. + /// + /// The configuration. + ServerConfiguration Configuration { get; } + + bool SetOptimalValues(); + } +} diff --git a/MediaBrowser.Controller/Connect/IConnectManager.cs b/MediaBrowser.Controller/Connect/IConnectManager.cs new file mode 100644 index 0000000000..8ac61bf2b1 --- /dev/null +++ b/MediaBrowser.Controller/Connect/IConnectManager.cs @@ -0,0 +1,45 @@ +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Connect; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace MediaBrowser.Controller.Connect +{ + public interface IConnectManager + { + /// + /// Gets the wan API address. + /// + /// The wan API address. + string WanApiAddress { get; } + + /// + /// Links the user. + /// + /// The user identifier. + /// The connect username. + /// Task. + Task LinkUser(string userId, string connectUsername); + + /// + /// Removes the link. + /// + /// The user identifier. + /// Task. + Task RemoveConnect(string userId); + + User GetUserFromExchangeToken(string token); + + /// + /// Authenticates the specified username. + /// + Task Authenticate(string username, string password, string passwordMd5); + + /// + /// Determines whether [is authorization token valid] [the specified token]. + /// + /// The token. + /// true if [is authorization token valid] [the specified token]; otherwise, false. + bool IsAuthorizationTokenValid(string token); + } +} diff --git a/MediaBrowser.Controller/Connect/UserLinkResult.cs b/MediaBrowser.Controller/Connect/UserLinkResult.cs new file mode 100644 index 0000000000..16ebfc70a3 --- /dev/null +++ b/MediaBrowser.Controller/Connect/UserLinkResult.cs @@ -0,0 +1,10 @@ + +namespace MediaBrowser.Controller.Connect +{ + public class UserLinkResult + { + public bool IsPending { get; set; } + public bool IsNewUserInvitation { get; set; } + public string GuestDisplayName { get; set; } + } +} diff --git a/MediaBrowser.Controller/Devices/CameraImageUploadInfo.cs b/MediaBrowser.Controller/Devices/CameraImageUploadInfo.cs new file mode 100644 index 0000000000..b3f3bb9025 --- /dev/null +++ b/MediaBrowser.Controller/Devices/CameraImageUploadInfo.cs @@ -0,0 +1,10 @@ +using MediaBrowser.Model.Devices; + +namespace MediaBrowser.Controller.Devices +{ + public class CameraImageUploadInfo + { + public LocalFileInfo FileInfo { get; set; } + public DeviceInfo Device { get; set; } + } +} diff --git a/MediaBrowser.Controller/Devices/IDeviceManager.cs b/MediaBrowser.Controller/Devices/IDeviceManager.cs new file mode 100644 index 0000000000..d29fb8ded0 --- /dev/null +++ b/MediaBrowser.Controller/Devices/IDeviceManager.cs @@ -0,0 +1,73 @@ +using MediaBrowser.Model.Devices; +using MediaBrowser.Model.Events; +using MediaBrowser.Model.Querying; +using MediaBrowser.Model.Session; +using System; +using System.IO; +using System.Threading.Tasks; +using MediaBrowser.Controller.Entities; + +namespace MediaBrowser.Controller.Devices +{ + public interface IDeviceManager + { + /// + /// Occurs when [camera image uploaded]. + /// + event EventHandler> CameraImageUploaded; + + /// + /// Saves the capabilities. + /// + /// The reported identifier. + /// The capabilities. + /// Task. + void SaveCapabilities(string reportedId, ClientCapabilities capabilities); + + /// + /// Gets the capabilities. + /// + /// The reported identifier. + /// ClientCapabilities. + ClientCapabilities GetCapabilities(string reportedId); + + /// + /// Gets the device information. + /// + /// The identifier. + /// DeviceInfo. + DeviceInfo GetDevice(string id); + + /// + /// Gets the devices. + /// + /// The query. + /// IEnumerable<DeviceInfo>. + QueryResult GetDevices(DeviceQuery query); + + /// + /// Gets the upload history. + /// + /// The device identifier. + /// ContentUploadHistory. + ContentUploadHistory GetCameraUploadHistory(string deviceId); + + /// + /// Accepts the upload. + /// + /// The device identifier. + /// The stream. + /// The file. + /// Task. + Task AcceptCameraUpload(string deviceId, Stream stream, LocalFileInfo file); + + /// + /// Determines whether this instance [can access device] the specified user identifier. + /// + bool CanAccessDevice(User user, string deviceId); + + void UpdateDeviceOptions(string deviceId, DeviceOptions options); + DeviceOptions GetDeviceOptions(string deviceId); + event EventHandler>> DeviceOptionsUpdated; + } +} diff --git a/MediaBrowser.Controller/Dlna/IDlnaManager.cs b/MediaBrowser.Controller/Dlna/IDlnaManager.cs new file mode 100644 index 0000000000..2f64cd1946 --- /dev/null +++ b/MediaBrowser.Controller/Dlna/IDlnaManager.cs @@ -0,0 +1,76 @@ +using MediaBrowser.Controller.Drawing; +using MediaBrowser.Model.Dlna; +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Dlna +{ + public interface IDlnaManager + { + /// + /// Gets the profile infos. + /// + /// IEnumerable{DeviceProfileInfo}. + IEnumerable GetProfileInfos(); + + /// + /// Gets the profile. + /// + /// The headers. + /// DeviceProfile. + DeviceProfile GetProfile(IDictionary headers); + + /// + /// Gets the default profile. + /// + /// DeviceProfile. + DeviceProfile GetDefaultProfile(); + + /// + /// Creates the profile. + /// + /// The profile. + void CreateProfile(DeviceProfile profile); + + /// + /// Updates the profile. + /// + /// The profile. + void UpdateProfile(DeviceProfile profile); + + /// + /// Deletes the profile. + /// + /// The identifier. + void DeleteProfile(string id); + + /// + /// Gets the profile. + /// + /// The identifier. + /// DeviceProfile. + DeviceProfile GetProfile(string id); + + /// + /// Gets the profile. + /// + /// The device information. + /// DeviceProfile. + DeviceProfile GetProfile(DeviceIdentification deviceInfo); + + /// + /// Gets the server description XML. + /// + /// The headers. + /// The server uu identifier. + /// The server address. + /// System.String. + string GetServerDescriptionXml(IDictionary headers, string serverUuId, string serverAddress); + + /// + /// Gets the icon. + /// + /// The filename. + /// DlnaIconResponse. + ImageStream GetIcon(string filename); + } +} diff --git a/MediaBrowser.Controller/Drawing/IImageEncoder.cs b/MediaBrowser.Controller/Drawing/IImageEncoder.cs new file mode 100644 index 0000000000..757448eb26 --- /dev/null +++ b/MediaBrowser.Controller/Drawing/IImageEncoder.cs @@ -0,0 +1,49 @@ +using System; +using MediaBrowser.Model.Drawing; + +namespace MediaBrowser.Controller.Drawing +{ + public interface IImageEncoder + { + /// + /// Gets the supported input formats. + /// + /// The supported input formats. + string[] SupportedInputFormats { get; } + /// + /// Gets the supported output formats. + /// + /// The supported output formats. + ImageFormat[] SupportedOutputFormats { get; } + + /// + /// Encodes the image. + /// + string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, ImageOrientation? orientation, int quality, ImageProcessingOptions options, ImageFormat outputFormat); + + /// + /// Creates the image collage. + /// + /// The options. + void CreateImageCollage(ImageCollageOptions options); + /// + /// Gets the name. + /// + /// The name. + string Name { get; } + + /// + /// Gets a value indicating whether [supports image collage creation]. + /// + /// true if [supports image collage creation]; otherwise, false. + bool SupportsImageCollageCreation { get; } + + /// + /// Gets a value indicating whether [supports image encoding]. + /// + /// true if [supports image encoding]; otherwise, false. + bool SupportsImageEncoding { get; } + + ImageSize GetImageSize(string path); + } +} diff --git a/MediaBrowser.Controller/Drawing/IImageProcessor.cs b/MediaBrowser.Controller/Drawing/IImageProcessor.cs new file mode 100644 index 0000000000..fdf10e2238 --- /dev/null +++ b/MediaBrowser.Controller/Drawing/IImageProcessor.cs @@ -0,0 +1,118 @@ +using System; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Drawing; +using MediaBrowser.Model.Entities; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; + +namespace MediaBrowser.Controller.Drawing +{ + /// + /// Interface IImageProcessor + /// + public interface IImageProcessor + { + /// + /// Gets the supported input formats. + /// + /// The supported input formats. + string[] SupportedInputFormats { get; } + + /// + /// Gets the image enhancers. + /// + /// The image enhancers. + IImageEnhancer[] ImageEnhancers { get; } + + ImageSize GetImageSize(string path); + + /// + /// Gets the size of the image. + /// + /// The information. + /// ImageSize. + ImageSize GetImageSize(BaseItem item, ItemImageInfo info); + + ImageSize GetImageSize(BaseItem item, ItemImageInfo info, bool allowSlowMethods, bool updateItem); + + /// + /// Adds the parts. + /// + /// The enhancers. + void AddParts(IEnumerable enhancers); + + /// + /// Gets the supported enhancers. + /// + /// The item. + /// Type of the image. + /// IEnumerable{IImageEnhancer}. + IImageEnhancer[] GetSupportedEnhancers(BaseItem item, ImageType imageType); + + /// + /// Gets the image cache tag. + /// + /// The item. + /// The image. + /// Guid. + string GetImageCacheTag(BaseItem item, ItemImageInfo image); + string GetImageCacheTag(BaseItem item, ChapterInfo info); + + /// + /// Gets the image cache tag. + /// + /// The item. + /// The image. + /// The image enhancers. + /// Guid. + string GetImageCacheTag(BaseItem item, ItemImageInfo image, IImageEnhancer[] imageEnhancers); + + /// + /// Processes the image. + /// + /// The options. + /// To stream. + /// Task. + Task ProcessImage(ImageProcessingOptions options, Stream toStream); + + /// + /// Processes the image. + /// + /// The options. + /// Task. + Task> ProcessImage(ImageProcessingOptions options); + + /// + /// Gets the enhanced image. + /// + /// The item. + /// Type of the image. + /// Index of the image. + /// Task{System.String}. + Task GetEnhancedImage(BaseItem item, ImageType imageType, int imageIndex); + + /// + /// Gets the supported image output formats. + /// + /// ImageOutputFormat[]. + ImageFormat[] GetSupportedImageOutputFormats(); + + /// + /// Creates the image collage. + /// + /// The options. + void CreateImageCollage(ImageCollageOptions options); + + /// + /// Gets a value indicating whether [supports image collage creation]. + /// + /// true if [supports image collage creation]; otherwise, false. + bool SupportsImageCollageCreation { get; } + + IImageEncoder ImageEncoder { get; set; } + + bool SupportsTransparency(string path); + } +} diff --git a/MediaBrowser.Controller/Drawing/ImageCollageOptions.cs b/MediaBrowser.Controller/Drawing/ImageCollageOptions.cs new file mode 100644 index 0000000000..92a7f5ac92 --- /dev/null +++ b/MediaBrowser.Controller/Drawing/ImageCollageOptions.cs @@ -0,0 +1,27 @@ + +namespace MediaBrowser.Controller.Drawing +{ + public class ImageCollageOptions + { + /// + /// Gets or sets the input paths. + /// + /// The input paths. + public string[] InputPaths { get; set; } + /// + /// Gets or sets the output path. + /// + /// The output path. + public string OutputPath { get; set; } + /// + /// Gets or sets the width. + /// + /// The width. + public int Width { get; set; } + /// + /// Gets or sets the height. + /// + /// The height. + public int Height { get; set; } + } +} diff --git a/MediaBrowser.Controller/Drawing/ImageHelper.cs b/MediaBrowser.Controller/Drawing/ImageHelper.cs new file mode 100644 index 0000000000..6fb9f256e3 --- /dev/null +++ b/MediaBrowser.Controller/Drawing/ImageHelper.cs @@ -0,0 +1,72 @@ +using System; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Drawing; +using MediaBrowser.Model.Entities; + +namespace MediaBrowser.Controller.Drawing +{ + public static class ImageHelper + { + public static ImageSize GetNewImageSize(ImageProcessingOptions options, ImageSize? originalImageSize) + { + if (originalImageSize.HasValue) + { + // Determine the output size based on incoming parameters + var newSize = DrawingUtils.Resize(originalImageSize.Value, options.Width ?? 0, options.Height ?? 0, options.MaxWidth ?? 0, options.MaxHeight ?? 0); + + return newSize; + } + return GetSizeEstimate(options); + } + + public static IImageProcessor ImageProcessor { get; set; } + + private static ImageSize GetSizeEstimate(ImageProcessingOptions options) + { + if (options.Width.HasValue && options.Height.HasValue) + { + return new ImageSize(options.Width.Value, options.Height.Value); + } + + var aspect = GetEstimatedAspectRatio(options.Image.Type, options.Item); + + var width = options.Width ?? options.MaxWidth; + + if (width.HasValue) + { + var heightValue = width.Value / aspect; + return new ImageSize(width.Value, heightValue); + } + + var height = options.Height ?? options.MaxHeight ?? 200; + var widthValue = aspect * height; + return new ImageSize(widthValue, height); + } + + private static double GetEstimatedAspectRatio(ImageType type, BaseItem item) + { + switch (type) + { + case ImageType.Art: + case ImageType.Backdrop: + case ImageType.Chapter: + case ImageType.Screenshot: + case ImageType.Thumb: + return 1.78; + case ImageType.Banner: + return 5.4; + case ImageType.Box: + case ImageType.BoxRear: + case ImageType.Disc: + case ImageType.Menu: + return 1; + case ImageType.Logo: + return 2.58; + case ImageType.Primary: + return item.GetDefaultPrimaryImageAspectRatio(); + default: + return 1; + } + } + } +} diff --git a/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs b/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs new file mode 100644 index 0000000000..ffc3e6cc02 --- /dev/null +++ b/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs @@ -0,0 +1,114 @@ +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Drawing; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +namespace MediaBrowser.Controller.Drawing +{ + public class ImageProcessingOptions + { + public ImageProcessingOptions() + { + RequiresAutoOrientation = true; + } + + public Guid ItemId { get; set; } + public BaseItem Item { get; set; } + + public ItemImageInfo Image { get; set; } + + public int ImageIndex { get; set; } + + public bool CropWhiteSpace { get; set; } + + public int? Width { get; set; } + + public int? Height { get; set; } + + public int? MaxWidth { get; set; } + + public int? MaxHeight { get; set; } + + public int Quality { get; set; } + + public IImageEnhancer[] Enhancers { get; set; } + + public ImageFormat[] SupportedOutputFormats { get; set; } + + public bool AddPlayedIndicator { get; set; } + + public int? UnplayedCount { get; set; } + public int? Blur { get; set; } + + public double PercentPlayed { get; set; } + + public string BackgroundColor { get; set; } + public string ForegroundLayer { get; set; } + public bool RequiresAutoOrientation { get; set; } + + private bool HasDefaultOptions(string originalImagePath) + { + return HasDefaultOptionsWithoutSize(originalImagePath) && + !Width.HasValue && + !Height.HasValue && + !MaxWidth.HasValue && + !MaxHeight.HasValue; + } + + public bool HasDefaultOptions(string originalImagePath, ImageSize? size) + { + if (!size.HasValue) + { + return HasDefaultOptions(originalImagePath); + } + + if (!HasDefaultOptionsWithoutSize(originalImagePath)) + { + return false; + } + + var sizeValue = size.Value; + + if (Width.HasValue && !sizeValue.Width.Equals(Width.Value)) + { + return false; + } + if (Height.HasValue && !sizeValue.Height.Equals(Height.Value)) + { + return false; + } + if (MaxWidth.HasValue && sizeValue.Width > MaxWidth.Value) + { + return false; + } + if (MaxHeight.HasValue && sizeValue.Height > MaxHeight.Value) + { + return false; + } + + return true; + } + + private bool HasDefaultOptionsWithoutSize(string originalImagePath) + { + return (Quality >= 90) && + IsFormatSupported(originalImagePath) && + !AddPlayedIndicator && + PercentPlayed.Equals(0) && + !UnplayedCount.HasValue && + !Blur.HasValue && + !CropWhiteSpace && + string.IsNullOrEmpty(BackgroundColor) && + string.IsNullOrEmpty(ForegroundLayer); + } + + private bool IsFormatSupported(string originalImagePath) + { + var ext = Path.GetExtension(originalImagePath); + return SupportedOutputFormats.Any(outputFormat => string.Equals(ext, "." + outputFormat, StringComparison.OrdinalIgnoreCase)); + } + } +} diff --git a/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs b/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs new file mode 100644 index 0000000000..948219bf55 --- /dev/null +++ b/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs @@ -0,0 +1,25 @@ +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Entities; + +namespace MediaBrowser.Controller.Drawing +{ + public static class ImageProcessorExtensions + { + public static string GetImageCacheTag(this IImageProcessor processor, BaseItem item, ImageType imageType) + { + return processor.GetImageCacheTag(item, imageType, 0); + } + + public static string GetImageCacheTag(this IImageProcessor processor, BaseItem item, ImageType imageType, int imageIndex) + { + var imageInfo = item.GetImageInfo(imageType, imageIndex); + + if (imageInfo == null) + { + return null; + } + + return processor.GetImageCacheTag(item, imageInfo); + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Controller/Drawing/ImageStream.cs b/MediaBrowser.Controller/Drawing/ImageStream.cs new file mode 100644 index 0000000000..353abaca33 --- /dev/null +++ b/MediaBrowser.Controller/Drawing/ImageStream.cs @@ -0,0 +1,28 @@ +using MediaBrowser.Model.Drawing; +using System; +using System.IO; + +namespace MediaBrowser.Controller.Drawing +{ + public class ImageStream : IDisposable + { + /// + /// Gets or sets the stream. + /// + /// The stream. + public Stream Stream { get; set; } + /// + /// Gets or sets the format. + /// + /// The format. + public ImageFormat Format { get; set; } + + public void Dispose() + { + if (Stream != null) + { + Stream.Dispose(); + } + } + } +} diff --git a/MediaBrowser.Controller/Dto/DtoOptions.cs b/MediaBrowser.Controller/Dto/DtoOptions.cs new file mode 100644 index 0000000000..b5ce090288 --- /dev/null +++ b/MediaBrowser.Controller/Dto/DtoOptions.cs @@ -0,0 +1,72 @@ +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Querying; +using System; +using System.Linq; + +namespace MediaBrowser.Controller.Dto +{ + public class DtoOptions + { + private static readonly ItemFields[] DefaultExcludedFields = new [] + { + ItemFields.SeasonUserData, + ItemFields.RefreshState + }; + + public ItemFields[] Fields { get; set; } + public ImageType[] ImageTypes { get; set; } + public int ImageTypeLimit { get; set; } + public bool EnableImages { get; set; } + public bool AddProgramRecordingInfo { get; set; } + public bool EnableUserData { get; set; } + public bool AddCurrentProgram { get; set; } + + public DtoOptions() + : this(true) + { + } + + private static readonly ImageType[] AllImageTypes = Enum.GetNames(typeof(ImageType)) + .Select(i => (ImageType)Enum.Parse(typeof(ImageType), i, true)) + .ToArray(); + + private static readonly ItemFields[] AllItemFields = Enum.GetNames(typeof(ItemFields)) + .Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true)) + .Except(DefaultExcludedFields) + .ToArray(); + + public bool ContainsField(ItemFields field) + { + return AllItemFields.Contains(field); + } + + public DtoOptions(bool allFields) + { + ImageTypeLimit = int.MaxValue; + EnableImages = true; + EnableUserData = true; + AddCurrentProgram = true; + + if (allFields) + { + Fields = AllItemFields; + } + else + { + Fields = new ItemFields[] { }; + } + + ImageTypes = AllImageTypes; + } + + public int GetImageLimit(ImageType type) + { + if (EnableImages && ImageTypes.Contains(type)) + { + return ImageTypeLimit; + } + + return 0; + } + } +} diff --git a/MediaBrowser.Controller/Dto/IDtoService.cs b/MediaBrowser.Controller/Dto/IDtoService.cs new file mode 100644 index 0000000000..219b367891 --- /dev/null +++ b/MediaBrowser.Controller/Dto/IDtoService.cs @@ -0,0 +1,70 @@ +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Querying; +using System.Collections.Generic; +using MediaBrowser.Controller.Sync; + +namespace MediaBrowser.Controller.Dto +{ + /// + /// Interface IDtoService + /// + public interface IDtoService + { + /// + /// Gets the dto id. + /// + /// The item. + /// System.String. + string GetDtoId(BaseItem item); + + /// + /// Attaches the primary image aspect ratio. + /// + /// The dto. + /// The item. + void AttachPrimaryImageAspectRatio(IItemDto dto, BaseItem item); + + /// + /// Gets the primary image aspect ratio. + /// + /// The item. + /// System.Nullable<System.Double>. + double? GetPrimaryImageAspectRatio(BaseItem item); + + /// + /// Gets the base item dto. + /// + /// The item. + /// The fields. + /// The user. + /// The owner. + BaseItemDto GetBaseItemDto(BaseItem item, ItemFields[] fields, User user = null, BaseItem owner = null); + + /// + /// Gets the base item dto. + /// + /// The item. + /// The options. + /// The user. + /// The owner. + /// BaseItemDto. + BaseItemDto GetBaseItemDto(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null); + + /// + /// Gets the base item dtos. + /// + /// The items. + /// The options. + /// The user. + /// The owner. + BaseItemDto[] GetBaseItemDtos(BaseItem[] items, DtoOptions options, User user = null, BaseItem owner = null); + + BaseItemDto[] GetBaseItemDtos(List items, DtoOptions options, User user = null, BaseItem owner = null); + + /// + /// Gets the item by name dto. + /// + BaseItemDto GetItemByNameDto(BaseItem item, DtoOptions options, List taggedItems, User user = null); + } +} diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs new file mode 100644 index 0000000000..4f4b3483cf --- /dev/null +++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs @@ -0,0 +1,219 @@ +using MediaBrowser.Controller.IO; +using MediaBrowser.Controller.Library; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.IO; +using MediaBrowser.Model.Serialization; + +namespace MediaBrowser.Controller.Entities +{ + /// + /// Specialized folder that can have items added to it's children by external entities. + /// Used for our RootFolder so plug-ins can add items. + /// + public class AggregateFolder : Folder + { + public AggregateFolder() + { + PhysicalLocationsList = new string[] { }; + } + + [IgnoreDataMember] + public override bool IsPhysicalRoot + { + get { return true; } + } + + public override bool CanDelete() + { + return false; + } + + [IgnoreDataMember] + public override bool SupportsPlayedStatus + { + get + { + return false; + } + } + + /// + /// The _virtual children + /// + private readonly ConcurrentBag _virtualChildren = new ConcurrentBag(); + + /// + /// Gets the virtual children. + /// + /// The virtual children. + public ConcurrentBag VirtualChildren + { + get { return _virtualChildren; } + } + + [IgnoreDataMember] + public override string[] PhysicalLocations + { + get + { + return PhysicalLocationsList; + } + } + + public string[] PhysicalLocationsList { get; set; } + + protected override FileSystemMetadata[] GetFileSystemChildren(IDirectoryService directoryService) + { + return CreateResolveArgs(directoryService, true).FileSystemChildren; + } + + private Guid[] _childrenIds = null; + private readonly object _childIdsLock = new object(); + protected override List LoadChildren() + { + lock (_childIdsLock) + { + if (_childrenIds == null || _childrenIds.Length == 0) + { + var list = base.LoadChildren(); + _childrenIds = list.Select(i => i.Id).ToArray(); + return list; + } + + return _childrenIds.Select(LibraryManager.GetItemById).Where(i => i != null).ToList(); + } + } + + private void ClearCache() + { + lock (_childIdsLock) + { + _childrenIds = null; + } + } + + private bool _requiresRefresh; + public override bool RequiresRefresh() + { + var changed = base.RequiresRefresh() || _requiresRefresh; + + if (!changed) + { + var locations = PhysicalLocations; + + var newLocations = CreateResolveArgs(new DirectoryService(Logger, FileSystem), false).PhysicalLocations; + + if (!locations.SequenceEqual(newLocations)) + { + changed = true; + } + } + + return changed; + } + + public override bool BeforeMetadataRefresh(bool replaceAllMetdata) + { + ClearCache(); + + var changed = base.BeforeMetadataRefresh(replaceAllMetdata) || _requiresRefresh; + _requiresRefresh = false; + return changed; + } + + private ItemResolveArgs CreateResolveArgs(IDirectoryService directoryService, bool setPhysicalLocations) + { + ClearCache(); + + var path = ContainingFolderPath; + + var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, directoryService) + { + FileInfo = FileSystem.GetDirectoryInfo(path), + Path = path + }; + + // Gather child folder and files + if (args.IsDirectory) + { + // When resolving the root, we need it's grandchildren (children of user views) + var flattenFolderDepth = 2; + + var files = FileData.GetFilteredFileSystemEntries(directoryService, args.Path, FileSystem, CollectionFolder.ApplicationHost, Logger, args, flattenFolderDepth: flattenFolderDepth, resolveShortcuts: true); + + // Need to remove subpaths that may have been resolved from shortcuts + // Example: if \\server\movies exists, then strip out \\server\movies\action + files = LibraryManager.NormalizeRootPathList(files).ToArray(); + + args.FileSystemChildren = files; + } + + _requiresRefresh = _requiresRefresh || !args.PhysicalLocations.SequenceEqual(PhysicalLocations); + if (setPhysicalLocations) + { + PhysicalLocationsList = args.PhysicalLocations; + } + + return args; + } + + protected override IEnumerable GetNonCachedChildren(IDirectoryService directoryService) + { + return base.GetNonCachedChildren(directoryService).Concat(_virtualChildren); + } + + protected override async Task ValidateChildrenInternal(IProgress progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService) + { + ClearCache(); + + await base.ValidateChildrenInternal(progress, cancellationToken, recursive, refreshChildMetadata, refreshOptions, directoryService) + .ConfigureAwait(false); + + ClearCache(); + } + + /// + /// Adds the virtual child. + /// + /// The child. + /// + public void AddVirtualChild(BaseItem child) + { + if (child == null) + { + throw new ArgumentNullException(); + } + + _virtualChildren.Add(child); + } + + /// + /// Finds the virtual child. + /// + /// The id. + /// BaseItem. + /// id + public BaseItem FindVirtualChild(Guid id) + { + if (id.Equals(Guid.Empty)) + { + throw new ArgumentNullException("id"); + } + + foreach (var child in _virtualChildren) + { + if (child.Id == id) + { + return child; + } + } + return null; + } + } +} diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs new file mode 100644 index 0000000000..d07e31d8a4 --- /dev/null +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -0,0 +1,216 @@ +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.MediaInfo; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using MediaBrowser.Common.Extensions; +using MediaBrowser.Controller.Persistence; +using MediaBrowser.Model.Serialization; + +namespace MediaBrowser.Controller.Entities.Audio +{ + /// + /// Class Audio + /// + public class Audio : BaseItem, + IHasAlbumArtist, + IHasArtist, + IHasMusicGenres, + IHasLookupInfo, + IHasMediaSources + { + /// + /// Gets or sets the artist. + /// + /// The artist. + [IgnoreDataMember] + public string[] Artists { get; set; } + + [IgnoreDataMember] + public string[] AlbumArtists { get; set; } + + public Audio() + { + Artists = new string[] {}; + AlbumArtists = new string[] {}; + } + + public override double GetDefaultPrimaryImageAspectRatio() + { + return 1; + } + + [IgnoreDataMember] + public override bool SupportsPlayedStatus + { + get + { + return true; + } + } + + [IgnoreDataMember] + public override bool SupportsPeople + { + get { return false; } + } + + [IgnoreDataMember] + public override bool SupportsAddingToPlaylist + { + get { return true; } + } + + [IgnoreDataMember] + public override bool SupportsInheritedParentImages + { + get { return true; } + } + + [IgnoreDataMember] + protected override bool SupportsOwnedItems + { + get + { + return false; + } + } + + [IgnoreDataMember] + public override Folder LatestItemsIndexContainer + { + get + { + return AlbumEntity; + } + } + + public override bool CanDownload() + { + return IsFileProtocol; + } + + [IgnoreDataMember] + public string[] AllArtists + { + get + { + var list = new string[AlbumArtists.Length + Artists.Length]; + + var index = 0; + foreach (var artist in AlbumArtists) + { + list[index] = artist; + index++; + } + foreach (var artist in Artists) + { + list[index] = artist; + index++; + } + + return list; + + } + } + + [IgnoreDataMember] + public MusicAlbum AlbumEntity + { + get { return FindParent(); } + } + + /// + /// Gets the type of the media. + /// + /// The type of the media. + [IgnoreDataMember] + public override string MediaType + { + get + { + return Model.Entities.MediaType.Audio; + } + } + + /// + /// Creates the name of the sort. + /// + /// System.String. + protected override string CreateSortName() + { + return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "") + + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name; + } + + public override List GetUserDataKeys() + { + var list = base.GetUserDataKeys(); + + var songKey = IndexNumber.HasValue ? IndexNumber.Value.ToString("0000") : string.Empty; + + + if (ParentIndexNumber.HasValue) + { + songKey = ParentIndexNumber.Value.ToString("0000") + "-" + songKey; + } + songKey += Name; + + if (!string.IsNullOrEmpty(Album)) + { + songKey = Album + "-" + songKey; + } + + var albumArtist = AlbumArtists.Length == 0 ? null : AlbumArtists[0]; + if (!string.IsNullOrEmpty(albumArtist)) + { + songKey = albumArtist + "-" + songKey; + } + + list.Insert(0, songKey); + + return list; + } + + public override UnratedItem GetBlockUnratedType() + { + if (SourceType == SourceType.Library) + { + return UnratedItem.Music; + } + return base.GetBlockUnratedType(); + } + + public List GetMediaStreams(MediaStreamType type) + { + return MediaSourceManager.GetMediaStreams(new MediaStreamQuery + { + ItemId = Id, + Type = type + }); + } + + public SongInfo GetLookupInfo() + { + var info = GetItemLookupInfo(); + + info.AlbumArtists = AlbumArtists; + info.Album = Album; + info.Artists = Artists; + + return info; + } + + protected override List> GetAllItemsForMediaSources() + { + var list = new List>(); + list.Add(new Tuple(this, MediaSourceType.Default)); + return list; + } + } +} diff --git a/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs b/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs new file mode 100644 index 0000000000..b2dedada47 --- /dev/null +++ b/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs @@ -0,0 +1,15 @@ + +namespace MediaBrowser.Controller.Entities.Audio +{ + public interface IHasAlbumArtist + { + string[] AlbumArtists { get; set; } + } + + public interface IHasArtist + { + string[] AllArtists { get; } + + string[] Artists { get; set; } + } +} diff --git a/MediaBrowser.Controller/Entities/Audio/IHasMusicGenres.cs b/MediaBrowser.Controller/Entities/Audio/IHasMusicGenres.cs new file mode 100644 index 0000000000..2200d4b759 --- /dev/null +++ b/MediaBrowser.Controller/Entities/Audio/IHasMusicGenres.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Entities.Audio +{ + public interface IHasMusicGenres + { + string[] Genres { get; } + } +} diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs new file mode 100644 index 0000000000..48b5c64b21 --- /dev/null +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -0,0 +1,272 @@ +using System; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Users; +using System.Collections.Generic; +using System.Linq; +using MediaBrowser.Model.Serialization; +using System.Threading; +using System.Threading.Tasks; +using MediaBrowser.Controller.Dto; +using MediaBrowser.Controller.Library; + +namespace MediaBrowser.Controller.Entities.Audio +{ + /// + /// Class MusicAlbum + /// + public class MusicAlbum : Folder, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasLookupInfo, IMetadataContainer + { + public string[] AlbumArtists { get; set; } + public string[] Artists { get; set; } + + public MusicAlbum() + { + Artists = new string[] {}; + AlbumArtists = new string[] {}; + } + + [IgnoreDataMember] + public override bool SupportsAddingToPlaylist + { + get { return true; } + } + + [IgnoreDataMember] + public override bool SupportsInheritedParentImages + { + get { return true; } + } + + [IgnoreDataMember] + public MusicArtist MusicArtist + { + get { return GetMusicArtist(new DtoOptions(true)); } + } + + public MusicArtist GetMusicArtist(DtoOptions options) + { + var parents = GetParents(); + foreach (var parent in parents) + { + var artist = parent as MusicArtist; + if (artist != null) + { + return artist; + } + } + + var name = AlbumArtist; + if (!string.IsNullOrEmpty(name)) + { + return LibraryManager.GetArtist(name, options); + } + return null; + } + + [IgnoreDataMember] + public override bool SupportsPlayedStatus + { + get + { + return false; + } + } + + [IgnoreDataMember] + public override bool SupportsCumulativeRunTimeTicks + { + get + { + return true; + } + } + + [IgnoreDataMember] + public string[] AllArtists + { + get + { + var list = new string[AlbumArtists.Length + Artists.Length]; + + var index = 0; + foreach (var artist in AlbumArtists) + { + list[index] = artist; + index++; + } + foreach (var artist in Artists) + { + list[index] = artist; + index++; + } + + return list; + } + } + + [IgnoreDataMember] + public string AlbumArtist + { + get { return AlbumArtists.Length == 0 ? null : AlbumArtists[0]; } + } + + [IgnoreDataMember] + public override bool SupportsPeople + { + get { return false; } + } + + /// + /// Gets the tracks. + /// + /// The tracks. + [IgnoreDataMember] + public IEnumerable Tracks + { + get + { + return GetRecursiveChildren(i => i is Audio); + } + } + + protected override IEnumerable GetEligibleChildrenForRecursiveChildren(User user) + { + return Tracks; + } + + public override double GetDefaultPrimaryImageAspectRatio() + { + return 1; + } + + public override List GetUserDataKeys() + { + var list = base.GetUserDataKeys(); + + var albumArtist = AlbumArtist; + if (!string.IsNullOrEmpty(albumArtist)) + { + list.Insert(0, albumArtist + "-" + Name); + } + + var id = this.GetProviderId(MetadataProviders.MusicBrainzAlbum); + + if (!string.IsNullOrEmpty(id)) + { + list.Insert(0, "MusicAlbum-Musicbrainz-" + id); + } + + id = this.GetProviderId(MetadataProviders.MusicBrainzReleaseGroup); + + if (!string.IsNullOrEmpty(id)) + { + list.Insert(0, "MusicAlbum-MusicBrainzReleaseGroup-" + id); + } + + return list; + } + + protected override bool GetBlockUnratedValue(UserPolicy config) + { + return config.BlockUnratedItems.Contains(UnratedItem.Music); + } + + public override UnratedItem GetBlockUnratedType() + { + return UnratedItem.Music; + } + + public AlbumInfo GetLookupInfo() + { + var id = GetItemLookupInfo(); + + id.AlbumArtists = AlbumArtists; + + var artist = GetMusicArtist(new DtoOptions(false)); + + if (artist != null) + { + id.ArtistProviderIds = artist.ProviderIds; + } + + id.SongInfos = GetRecursiveChildren(i => i is Audio) + .Cast