From a86b71899ec52c44ddc6c3018e8cc5e9d7ff4d62 Mon Sep 17 00:00:00 2001 From: Andrew Rabert Date: Thu, 27 Dec 2018 18:27:57 -0500 Subject: [PATCH] Add GPL modules --- Emby.Notifications/Notifications.cs | 2 +- .../ApplicationHost.cs | 12 +- .../Channels/ChannelManager.cs | 4 +- .../Data/SqliteItemRepository.cs | 6 +- .../HttpServer/Security/AuthService.cs | 4 +- .../Security/AuthorizationContext.cs | 4 +- .../Library/ConnectManager.cs | 46 - .../Library/UserManager.cs | 4 +- MediaBrowser.Api/PackageService.cs | 40 +- MediaBrowser.Api/Playback/StreamState.cs | 5 +- MediaBrowser.Api/SearchService.cs | 2 +- MediaBrowser.Api/StartupWizardService.cs | 4 +- .../ConfigurationUpdateEventArgs.cs | 18 + .../Configuration/IApplicationPaths.cs | 84 + .../Configuration/IConfigurationFactory.cs | 22 + .../Configuration/IConfigurationManager.cs | 82 + MediaBrowser.Common/Events/EventHelper.cs | 108 + .../Extensions/BaseExtensions.cs | 58 + .../Extensions/ResourceNotFoundException.cs | 63 + MediaBrowser.Common/IApplicationHost.cs | 147 + .../MediaBrowser.Common.csproj | 16 + MediaBrowser.Common/Net/HttpRequestOptions.cs | 157 + MediaBrowser.Common/Net/HttpResponseInfo.cs | 75 + MediaBrowser.Common/Net/IHttpClient.cs | 59 + MediaBrowser.Common/Net/INetworkManager.cs | 66 + MediaBrowser.Common/Plugins/BasePlugin.cs | 276 ++ MediaBrowser.Common/Plugins/IPlugin.cs | 83 + .../Progress/ActionableProgress.cs | 54 + .../Properties/AssemblyInfo.cs | 27 + .../Security/IRequiresRegistration.cs | 15 + .../Security/ISecurityManager.cs | 32 + .../Security/PaymentRequiredException.cs | 8 + MediaBrowser.Common/Updates/GithubUpdater.cs | 278 ++ .../Updates/IInstallationManager.cs | 121 + .../Updates/InstallationEventArgs.cs | 11 + .../Updates/InstallationFailedEventArgs.cs | 9 + .../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 + .../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 + .../IServerConfigurationManager.cs | 25 + .../Connect/IConnectManager.cs | 45 + .../Connect/UserLinkResult.cs | 10 + .../Devices/CameraImageUploadInfo.cs | 10 + .../Devices/IDeviceManager.cs | 73 + MediaBrowser.Controller/Dlna/IDlnaManager.cs | 76 + .../Drawing/IImageEncoder.cs | 49 + .../Drawing/IImageProcessor.cs | 118 + .../Drawing/ImageCollageOptions.cs | 27 + .../Drawing/ImageHelper.cs | 72 + .../Drawing/ImageProcessingOptions.cs | 114 + .../Drawing/ImageProcessorExtensions.cs | 25 + .../Drawing/ImageStream.cs | 28 + MediaBrowser.Controller/Dto/DtoOptions.cs | 72 + MediaBrowser.Controller/Dto/IDtoService.cs | 70 + .../Entities/AggregateFolder.cs | 219 ++ .../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 + .../Entities/Extensions.cs | 46 + MediaBrowser.Controller/Entities/Folder.cs | 1803 ++++++++++ MediaBrowser.Controller/Entities/Game.cs | 129 + MediaBrowser.Controller/Entities/GameGenre.cs | 128 + .../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 + .../Entities/IHasSeries.cs | 20 + .../Entities/IHasSpecialFeatures.cs | 13 + .../Entities/IHasStartDate.cs | 9 + .../Entities/IHasTrailers.cs | 39 + .../Entities/IItemByName.cs | 17 + .../Entities/IMetadataContainer.cs | 19 + .../Entities/ISupportsBoxSetGrouping.cs | 12 + .../Entities/ISupportsPlaceHolders.cs | 12 + .../Entities/InternalItemsQuery.cs | 261 ++ .../Entities/InternalPeopleQuery.cs | 21 + .../Entities/ItemImageInfo.cs | 46 + .../Entities/LinkedChild.cs | 73 + .../Entities/Movies/BoxSet.cs | 263 ++ .../Entities/Movies/Movie.cs | 203 ++ .../Entities/MusicVideo.cs | 79 + .../Entities/PeopleHelper.cs | 119 + MediaBrowser.Controller/Entities/Person.cs | 216 ++ MediaBrowser.Controller/Entities/Photo.cs | 104 + .../Entities/PhotoAlbum.cs | 34 + MediaBrowser.Controller/Entities/Share.cs | 15 + .../Entities/SourceType.cs | 10 + MediaBrowser.Controller/Entities/Studio.cs | 141 + .../Entities/TV/Episode.cs | 374 +++ MediaBrowser.Controller/Entities/TV/Season.cs | 273 ++ MediaBrowser.Controller/Entities/TV/Series.cs | 540 +++ .../Entities/TagExtensions.cs | 35 + MediaBrowser.Controller/Entities/Trailer.cs | 111 + MediaBrowser.Controller/Entities/User.cs | 342 ++ .../Entities/UserItemData.cs | 124 + .../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 + .../IResourceFileManager.cs | 32 + .../IServerApplicationHost.cs | 100 + .../IServerApplicationPaths.cs | 109 + .../Library/DeleteOptions.cs | 14 + .../Library/IIntroProvider.cs | 32 + .../Library/ILibraryManager.cs | 550 +++ .../Library/ILibraryMonitor.cs | 43 + .../Library/ILibraryPostScanTask.cs | 20 + .../Library/ILiveStream.cs | 21 + .../Library/IMediaSourceManager.cs | 100 + .../Library/IMediaSourceProvider.cs | 25 + .../Library/IMetadataFileSaver.cs | 19 + .../Library/IMetadataSaver.cs | 33 + .../Library/IMusicManager.cs | 25 + .../Library/ISearchEngine.cs | 18 + .../Library/IUserDataManager.cs | 67 + .../Library/IUserManager.cs | 207 ++ .../Library/IUserViewManager.cs | 19 + MediaBrowser.Controller/Library/IntroInfo.cs | 19 + .../Library/ItemChangeEventArgs.cs | 24 + .../Library/ItemResolveArgs.cs | 281 ++ .../Library/ItemUpdateType.cs | 14 + .../Library/LibraryManagerExtensions.cs | 13 + .../Library/MetadataConfigurationStore.cs | 29 + .../Library/NameExtensions.cs | 26 + .../Library/PlaybackProgressEventArgs.cs | 34 + .../Library/PlaybackStopEventArgs.cs | 11 + MediaBrowser.Controller/Library/Profiler.cs | 76 + .../Library/SearchHintInfo.cs | 22 + MediaBrowser.Controller/Library/TVUtils.cs | 59 + .../Library/UserDataSaveEventArgs.cs | 39 + MediaBrowser.Controller/LiveTv/ChannelInfo.cs | 74 + .../LiveTv/IListingsProvider.cs | 19 + .../LiveTv/ILiveTvManager.cs | 293 ++ .../LiveTv/ILiveTvService.cs | 190 ++ MediaBrowser.Controller/LiveTv/ITunerHost.cs | 62 + .../LiveTv/LiveTvChannel.cs | 197 ++ .../LiveTv/LiveTvConflictException.cs | 20 + .../LiveTv/LiveTvProgram.cs | 349 ++ .../LiveTv/LiveTvServiceStatusInfo.cs | 49 + .../LiveTv/LiveTvTunerInfo.cs | 73 + MediaBrowser.Controller/LiveTv/ProgramInfo.cs | 213 ++ .../LiveTv/RecordingInfo.cs | 205 ++ .../LiveTv/RecordingStatusChangedEventArgs.cs | 12 + .../LiveTv/SeriesTimerInfo.cs | 119 + .../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 + .../MediaEncoding/JobLogger.cs | 149 + .../MediaEncoding/MediaEncoderHelpers.cs | 53 + .../MediaEncoding/MediaInfoRequest.cs | 24 + .../Net/AuthenticatedAttribute.cs | 69 + .../Net/AuthorizationInfo.cs | 52 + .../Net/BasePeriodicWebSocketListener.cs | 322 ++ MediaBrowser.Controller/Net/IAuthService.cs | 9 + .../Net/IAuthorizationContext.cs | 21 + .../Net/IHasResultFactory.cs | 17 + .../Net/IHttpResultFactory.cs | 80 + MediaBrowser.Controller/Net/IHttpServer.cs | 39 + .../Net/ISessionContext.cs | 16 + .../Net/IWebSocketConnection.cs | 85 + .../Net/IWebSocketListener.cs | 17 + .../Net/SecurityException.cs | 21 + .../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 + .../IDisplayPreferencesRepository.cs | 49 + .../Persistence/IItemRepository.cs | 159 + .../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 + .../Properties/AssemblyInfo.cs | 27 + .../Providers/AlbumInfo.cs | 28 + .../Providers/ArtistInfo.cs | 14 + MediaBrowser.Controller/Providers/BookInfo.cs | 7 + .../Providers/BoxSetInfo.cs | 7 + .../Providers/DirectoryService.cs | 106 + .../Providers/DynamicImageInfo.cs | 10 + .../Providers/DynamicImageResponse.cs | 36 + .../Providers/EpisodeInfo.cs | 20 + .../Providers/ExtraInfo.cs | 15 + .../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 + .../Providers/IExternalId.cs | 15 + .../Providers/IExtrasProvider.cs | 20 + .../Providers/IForcedProvider.cs | 10 + .../Providers/IHasItemChangeMonitor.cs | 15 + .../Providers/IHasLookupInfo.cs | 8 + .../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 + .../Providers/MovieInfo.cs | 7 + .../Providers/MusicVideoInfo.cs | 7 + .../Providers/PersonLookupInfo.cs | 7 + .../Providers/RemoteSearchQuery.cs | 21 + .../Providers/SeasonInfo.cs | 15 + .../Providers/SeriesInfo.cs | 6 + MediaBrowser.Controller/Providers/SongInfo.cs | 16 + .../Providers/TrailerInfo.cs | 6 + .../Providers/VideoContentType.cs | 19 + .../Resolvers/BaseItemResolver.cs | 61 + .../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 + .../Session/ISessionManager.cs | 328 ++ .../Session/SessionEventArgs.cs | 9 + .../Session/SessionInfo.cs | 396 +++ .../Sorting/IBaseItemComparer.cs | 17 + .../Sorting/IUserBaseItemComparer.cs | 29 + .../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 + .../Sync/IHasDynamicAccess.cs | 18 + .../Sync/IRemoteSyncProvider.cs | 10 + .../Sync/IServerSyncProvider.cs | 29 + MediaBrowser.Controller/Sync/ISyncProvider.cs | 27 + .../Sync/SyncedFileInfo.cs | 35 + .../TV/ITVSeriesManager.cs | 20 + .../Encoder/EncodingJob.cs | 1 - .../Encoder/MediaEncoder.cs | 6 +- .../Activity/ActivityLogEntry.cs | 68 + .../Activity/IActivityManager.cs | 17 + .../Activity/IActivityRepository.cs | 12 + .../ApiClient/ServerDiscoveryInfo.cs | 27 + .../Branding/BrandingOptions.cs | 17 + .../Channels/ChannelFeatures.cs | 85 + .../Channels/ChannelFolderType.cs | 17 + MediaBrowser.Model/Channels/ChannelInfo.cs | 30 + .../Channels/ChannelItemSortField.cs | 13 + .../Channels/ChannelMediaContentType.cs | 23 + .../Channels/ChannelMediaType.cs | 11 + MediaBrowser.Model/Channels/ChannelQuery.cs | 52 + .../Collections/CollectionCreationResult.cs | 9 + .../Configuration/AccessSchedule.cs | 22 + .../BaseApplicationConfiguration.cs | 57 + .../Configuration/DynamicDayOfWeek.cs | 17 + .../Configuration/EncodingOptions.cs | 36 + .../Configuration/FanartOptions.cs | 12 + .../Configuration/ImageOption.cs | 29 + .../Configuration/ImageSavingConvention.cs | 8 + .../Configuration/LibraryOptions.cs | 444 +++ .../Configuration/MetadataConfiguration.cs | 13 + .../Configuration/MetadataOptions.cs | 38 + .../Configuration/MetadataPlugin.cs | 17 + .../Configuration/MetadataPluginSummary.cs | 32 + .../Configuration/MetadataPluginType.cs | 16 + .../Configuration/ServerConfiguration.cs | 313 ++ .../Configuration/SubtitlePlaybackMode.cs | 11 + .../Configuration/UnratedItem.cs | 16 + .../Configuration/UserConfiguration.cs | 66 + .../Configuration/XbmcMetadataOptions.cs | 23 + .../ConnectAuthenticationExchangeResult.cs | 17 + .../Connect/ConnectAuthenticationResult.cs | 17 + .../Connect/ConnectAuthorization.cs | 21 + .../Connect/ConnectAuthorizationRequest.cs | 19 + MediaBrowser.Model/Connect/ConnectUser.cs | 12 + .../Connect/ConnectUserQuery.cs | 11 + MediaBrowser.Model/Connect/UserLinkType.cs | 15 + .../Cryptography/ICryptoProvider.cs | 13 + .../Devices/ContentUploadHistory.cs | 15 + MediaBrowser.Model/Devices/DeviceInfo.cs | 69 + MediaBrowser.Model/Devices/DeviceQuery.cs | 22 + MediaBrowser.Model/Devices/DevicesOptions.cs | 24 + MediaBrowser.Model/Devices/LocalFileInfo.cs | 11 + MediaBrowser.Model/Diagnostics/IProcess.cs | 21 + .../Diagnostics/IProcessFactory.cs | 24 + MediaBrowser.Model/Dlna/AudioOptions.cs | 87 + MediaBrowser.Model/Dlna/CodecProfile.cs | 68 + MediaBrowser.Model/Dlna/CodecType.cs | 9 + MediaBrowser.Model/Dlna/ConditionProcessor.cs | 284 ++ MediaBrowser.Model/Dlna/ContainerProfile.cs | 101 + .../Dlna/ContentFeatureBuilder.cs | 236 ++ .../Dlna/DeviceIdentification.cs | 61 + MediaBrowser.Model/Dlna/DeviceProfile.cs | 327 ++ MediaBrowser.Model/Dlna/DeviceProfileInfo.cs | 24 + MediaBrowser.Model/Dlna/DeviceProfileType.cs | 8 + MediaBrowser.Model/Dlna/DirectPlayProfile.cs | 36 + MediaBrowser.Model/Dlna/DlnaFlags.cs | 48 + MediaBrowser.Model/Dlna/DlnaMaps.cs | 56 + MediaBrowser.Model/Dlna/DlnaProfileType.cs | 9 + MediaBrowser.Model/Dlna/EncodingContext.cs | 8 + MediaBrowser.Model/Dlna/HeaderMatchType.cs | 9 + MediaBrowser.Model/Dlna/HttpHeaderInfo.cs | 17 + MediaBrowser.Model/Dlna/IDeviceDiscovery.cs | 11 + MediaBrowser.Model/Dlna/ITranscoderSupport.cs | 25 + MediaBrowser.Model/Dlna/MediaFormatProfile.cs | 113 + .../Dlna/MediaFormatProfileResolver.cs | 439 +++ MediaBrowser.Model/Dlna/PlaybackErrorCode.cs | 10 + MediaBrowser.Model/Dlna/ProfileCondition.cs | 38 + .../Dlna/ProfileConditionType.cs | 11 + .../Dlna/ProfileConditionValue.cs | 29 + .../Dlna/ResolutionConfiguration.cs | 14 + .../Dlna/ResolutionNormalizer.cs | 99 + MediaBrowser.Model/Dlna/ResolutionOptions.cs | 8 + MediaBrowser.Model/Dlna/ResponseProfile.cs | 49 + MediaBrowser.Model/Dlna/SearchCriteria.cs | 75 + MediaBrowser.Model/Dlna/SearchType.cs | 12 + MediaBrowser.Model/Dlna/SortCriteria.cs | 17 + MediaBrowser.Model/Dlna/StreamBuilder.cs | 1900 +++++++++++ MediaBrowser.Model/Dlna/StreamInfo.cs | 1092 ++++++ .../Dlna/SubtitleDeliveryMethod.cs | 22 + MediaBrowser.Model/Dlna/SubtitleProfile.cs | 46 + MediaBrowser.Model/Dlna/SubtitleStreamInfo.cs | 15 + MediaBrowser.Model/Dlna/TranscodeSeekInfo.cs | 8 + MediaBrowser.Model/Dlna/TranscodingProfile.cs | 59 + MediaBrowser.Model/Dlna/UpnpDeviceInfo.cs | 14 + MediaBrowser.Model/Dlna/VideoOptions.cs | 11 + MediaBrowser.Model/Dlna/XmlAttribute.cs | 13 + MediaBrowser.Model/Drawing/DrawingUtils.cs | 91 + MediaBrowser.Model/Drawing/ImageFormat.cs | 30 + .../Drawing/ImageOrientation.cs | 15 + MediaBrowser.Model/Drawing/ImageSize.cs | 93 + MediaBrowser.Model/Dto/BaseItemDto.cs | 791 +++++ MediaBrowser.Model/Dto/BaseItemPerson.cs | 53 + MediaBrowser.Model/Dto/ChapterInfoDto.cs | 38 + MediaBrowser.Model/Dto/GameSystemSummary.cs | 49 + MediaBrowser.Model/Dto/IHasServerId.cs | 8 + MediaBrowser.Model/Dto/IItemDto.cs | 15 + MediaBrowser.Model/Dto/ImageByNameInfo.cs | 32 + MediaBrowser.Model/Dto/ImageInfo.cs | 51 + MediaBrowser.Model/Dto/ImageOptions.cs | 110 + MediaBrowser.Model/Dto/ItemCounts.cs | 67 + MediaBrowser.Model/Dto/ItemIndex.cs | 21 + MediaBrowser.Model/Dto/MediaSourceInfo.cs | 236 ++ MediaBrowser.Model/Dto/MediaSourceType.cs | 9 + MediaBrowser.Model/Dto/MetadataEditorInfo.cs | 27 + MediaBrowser.Model/Dto/NameIdPair.cs | 24 + MediaBrowser.Model/Dto/NameValuePair.cs | 28 + MediaBrowser.Model/Dto/RatingType.cs | 8 + MediaBrowser.Model/Dto/RecommendationDto.cs | 15 + MediaBrowser.Model/Dto/RecommendationType.cs | 17 + MediaBrowser.Model/Dto/UserDto.cs | 125 + MediaBrowser.Model/Dto/UserItemDataDto.cs | 76 + MediaBrowser.Model/Entities/ChapterInfo.cs | 31 + MediaBrowser.Model/Entities/CollectionType.cs | 58 + .../Entities/DisplayPreferences.cs | 99 + .../Entities/EmptyRequestResult.cs | 7 + MediaBrowser.Model/Entities/ExtraType.cs | 16 + .../Entities/IHasProviderIds.cs | 16 + MediaBrowser.Model/Entities/ImageType.cs | 58 + MediaBrowser.Model/Entities/IsoType.cs | 17 + .../Entities/LibraryUpdateInfo.cs | 62 + MediaBrowser.Model/Entities/LocationType.cs | 26 + .../Entities/MBRegistrationRecord.cs | 14 + MediaBrowser.Model/Entities/MediaStream.cs | 475 +++ .../Entities/MediaStreamType.cs | 25 + MediaBrowser.Model/Entities/MediaType.cs | 30 + MediaBrowser.Model/Entities/MediaUrl.cs | 9 + MediaBrowser.Model/Entities/MetadataFields.cs | 46 + .../Entities/MetadataProviders.cs | 41 + .../Entities/PackageReviewInfo.cs | 38 + MediaBrowser.Model/Entities/ParentalRating.cs | 32 + MediaBrowser.Model/Entities/PersonType.cs | 42 + .../Entities/PluginSecurityInfo.cs | 21 + .../Entities/ProviderIdsExtensions.cs | 103 + .../Entities/ScrollDirection.cs | 17 + MediaBrowser.Model/Entities/SeriesStatus.cs | 18 + MediaBrowser.Model/Entities/SortOrder.cs | 17 + MediaBrowser.Model/Entities/TrailerType.cs | 11 + .../Entities/UserDataSaveReason.cs | 34 + MediaBrowser.Model/Entities/Video3DFormat.cs | 12 + MediaBrowser.Model/Entities/VideoType.cs | 26 + .../Entities/VirtualFolderInfo.cs | 55 + MediaBrowser.Model/Events/GenericEventArgs.cs | 33 + .../Extensions/LinqExtensions.cs | 97 + MediaBrowser.Model/Extensions/ListHelper.cs | 24 + MediaBrowser.Model/Extensions/StringHelper.cs | 57 + .../Globalization/CountryInfo.cs | 33 + .../Globalization/CultureDto.cs | 52 + .../Globalization/ILocalizationManager.cs | 63 + .../Globalization/LocalizatonOption.cs | 8 + MediaBrowser.Model/IO/FileSystemEntryInfo.cs | 27 + MediaBrowser.Model/IO/FileSystemEntryType.cs | 25 + MediaBrowser.Model/IO/FileSystemMetadata.cs | 54 + MediaBrowser.Model/IO/IFileSystem.cs | 454 +++ MediaBrowser.Model/IO/IIsoManager.cs | 34 + MediaBrowser.Model/IO/IIsoMount.cs | 22 + MediaBrowser.Model/IO/IIsoMounter.cs | 32 + MediaBrowser.Model/IO/IShortcutHandler.cs | 25 + MediaBrowser.Model/IO/IStreamHelper.cs | 19 + MediaBrowser.Model/IO/IZipClient.cs | 69 + MediaBrowser.Model/IO/StreamDefaults.cs | 19 + MediaBrowser.Model/Library/PlayAccess.cs | 9 + MediaBrowser.Model/Library/UserViewQuery.cs | 33 + MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs | 127 + MediaBrowser.Model/LiveTv/ChannelType.cs | 19 + MediaBrowser.Model/LiveTv/DayPattern.cs | 9 + MediaBrowser.Model/LiveTv/GuideInfo.cs | 19 + .../LiveTv/LiveTvChannelQuery.cs | 104 + MediaBrowser.Model/LiveTv/LiveTvInfo.cs | 32 + MediaBrowser.Model/LiveTv/LiveTvOptions.cs | 88 + .../LiveTv/LiveTvServiceInfo.cs | 58 + .../LiveTv/LiveTvServiceStatus.cs | 8 + .../LiveTv/LiveTvTunerStatus.cs | 10 + MediaBrowser.Model/LiveTv/ProgramAudio.cs | 12 + MediaBrowser.Model/LiveTv/ProgramQuery.cs | 117 + .../LiveTv/RecommendedProgramQuery.cs | 73 + MediaBrowser.Model/LiveTv/RecordingQuery.cs | 82 + MediaBrowser.Model/LiveTv/RecordingStatus.cs | 14 + .../LiveTv/SeriesTimerInfoDto.cs | 92 + MediaBrowser.Model/LiveTv/SeriesTimerQuery.cs | 19 + MediaBrowser.Model/LiveTv/TimerInfoDto.cs | 43 + MediaBrowser.Model/LiveTv/TimerQuery.cs | 23 + MediaBrowser.Model/Logging/IConsoleLogger.cs | 7 + MediaBrowser.Model/Logging/ILogManager.cs | 56 + MediaBrowser.Model/Logging/ILogger.cs | 78 + MediaBrowser.Model/Logging/LogHelper.cs | 97 + MediaBrowser.Model/Logging/LogSeverity.cs | 30 + MediaBrowser.Model/Logging/NullLogger.cs | 44 + MediaBrowser.Model/MediaBrowser.Model.csproj | 12 + MediaBrowser.Model/MediaInfo/AudioCodec.cs | 26 + .../MediaInfo/BlurayDiscInfo.cs | 37 + MediaBrowser.Model/MediaInfo/Container.cs | 9 + .../MediaInfo/IBlurayExaminer.cs | 16 + .../MediaInfo/LiveStreamRequest.cs | 47 + .../MediaInfo/LiveStreamResponse.cs | 9 + MediaBrowser.Model/MediaInfo/MediaInfo.cs | 68 + MediaBrowser.Model/MediaInfo/MediaProtocol.cs | 13 + .../MediaInfo/PlaybackInfoRequest.cs | 50 + .../MediaInfo/PlaybackInfoResponse.cs | 32 + .../MediaInfo/SubtitleFormat.cs | 13 + .../MediaInfo/SubtitleTrackEvent.cs | 11 + .../MediaInfo/SubtitleTrackInfo.cs | 14 + .../MediaInfo/TransportStreamTimestamp.cs | 9 + MediaBrowser.Model/MediaInfo/VideoCodec.cs | 14 + MediaBrowser.Model/Net/EndPointInfo.cs | 8 + MediaBrowser.Model/Net/HttpException.cs | 43 + MediaBrowser.Model/Net/HttpResponse.cs | 64 + MediaBrowser.Model/Net/IAcceptSocket.cs | 15 + MediaBrowser.Model/Net/ISocket.cs | 28 + MediaBrowser.Model/Net/ISocketFactory.cs | 49 + MediaBrowser.Model/Net/IpAddressInfo.cs | 37 + MediaBrowser.Model/Net/IpEndPointInfo.cs | 30 + MediaBrowser.Model/Net/MimeTypes.cs | 346 ++ MediaBrowser.Model/Net/NetworkShare.cs | 31 + MediaBrowser.Model/Net/NetworkShareType.cs | 30 + MediaBrowser.Model/Net/SocketReceiveResult.cs | 25 + MediaBrowser.Model/Net/WebSocketMessage.cs | 24 + MediaBrowser.Model/News/INewsService.cs | 17 + MediaBrowser.Model/News/NewsItem.cs | 14 + MediaBrowser.Model/News/NewsQuery.cs | 9 + .../Notifications/NotificationLevel.cs | 10 + .../Notifications/NotificationOption.cs | 56 + .../Notifications/NotificationOptions.cs | 132 + .../Notifications/NotificationRequest.cs | 35 + .../Notifications/NotificationServiceInfo.cs | 8 + .../Notifications/NotificationType.cs | 24 + .../Notifications/NotificationTypeInfo.cs | 29 + .../Notifications/SendToUserType.cs | 9 + .../Playlists/PlaylistCreationRequest.cs | 21 + .../Playlists/PlaylistCreationResult.cs | 8 + .../Playlists/PlaylistItemQuery.cs | 37 + .../Plugins/BasePluginConfiguration.cs | 10 + MediaBrowser.Model/Plugins/IHasWebPages.cs | 9 + MediaBrowser.Model/Plugins/PluginInfo.cs | 45 + MediaBrowser.Model/Plugins/PluginPageInfo.cs | 17 + MediaBrowser.Model/Properties/AssemblyInfo.cs | 23 + .../Providers/ExternalIdInfo.cs | 24 + MediaBrowser.Model/Providers/ExternalUrl.cs | 17 + .../Providers/ImageProviderInfo.cs | 24 + .../Providers/RemoteImageInfo.cs | 71 + .../Providers/RemoteImageQuery.cs | 15 + .../Providers/RemoteImageResult.cs | 28 + .../Providers/RemoteSearchResult.cs | 46 + .../Providers/RemoteSubtitleInfo.cs | 19 + .../Providers/SubtitleOptions.cs | 27 + .../Providers/SubtitleProviderInfo.cs | 8 + .../Querying/AllThemeMediaResult.cs | 20 + MediaBrowser.Model/Querying/EpisodeQuery.cs | 62 + .../Querying/ItemCountsQuery.cs | 21 + MediaBrowser.Model/Querying/ItemFields.cs | 222 ++ MediaBrowser.Model/Querying/ItemFilter.cs | 46 + MediaBrowser.Model/Querying/ItemSortBy.cs | 81 + .../Querying/LatestItemsQuery.cs | 76 + .../Querying/MovieRecommendationQuery.cs | 39 + MediaBrowser.Model/Querying/NextUpQuery.cs | 67 + MediaBrowser.Model/Querying/QueryFilters.cs | 32 + MediaBrowser.Model/Querying/QueryResult.cs | 23 + MediaBrowser.Model/Querying/SessionQuery.cs | 14 + .../Querying/SimilarItemsQuery.cs | 29 + .../Querying/ThemeMediaResult.cs | 17 + .../Querying/UpcomingEpisodesQuery.cs | 57 + MediaBrowser.Model/Querying/UserQuery.cs | 9 + .../Reflection/IAssemblyInfo.cs | 14 + MediaBrowser.Model/Search/SearchHint.cs | 158 + MediaBrowser.Model/Search/SearchHintResult.cs | 21 + MediaBrowser.Model/Search/SearchQuery.cs | 65 + .../Serialization/IJsonSerializer.cs | 91 + .../Serialization/IXmlSerializer.cs | 46 + .../IgnoreDataMemberAttribute.cs | 12 + .../Services/ApiMemberAttribute.cs | 61 + MediaBrowser.Model/Services/HttpUtility.cs | 923 +++++ .../Services/IAsyncStreamWriter.cs | 11 + MediaBrowser.Model/Services/IHasHeaders.cs | 9 + .../Services/IHasRequestFilter.cs | 21 + MediaBrowser.Model/Services/IHttpRequest.cs | 45 + MediaBrowser.Model/Services/IHttpResponse.cs | 24 + MediaBrowser.Model/Services/IHttpResult.cs | 36 + MediaBrowser.Model/Services/IRequest.cs | 159 + .../Services/IRequiresRequestStream.cs | 12 + MediaBrowser.Model/Services/IService.cs | 12 + MediaBrowser.Model/Services/IStreamWriter.cs | 9 + .../Services/QueryParamCollection.cs | 229 ++ MediaBrowser.Model/Services/RouteAttribute.cs | 148 + MediaBrowser.Model/Session/BrowseRequest.cs | 27 + .../Session/ClientCapabilities.cs | 33 + MediaBrowser.Model/Session/GeneralCommand.cs | 19 + .../Session/GeneralCommandType.cs | 46 + MediaBrowser.Model/Session/MessageCommand.cs | 12 + MediaBrowser.Model/Session/PlayCommand.cs | 29 + MediaBrowser.Model/Session/PlayMethod.cs | 9 + MediaBrowser.Model/Session/PlayRequest.cs | 43 + .../Session/PlaybackProgressInfo.cs | 119 + .../Session/PlaybackStartInfo.cs | 10 + .../Session/PlaybackStopInfo.cs | 57 + MediaBrowser.Model/Session/PlayerStateInfo.cs | 65 + .../Session/PlaystateCommand.cs | 43 + .../Session/PlaystateRequest.cs | 15 + MediaBrowser.Model/Session/SessionInfoDto.cs | 117 + MediaBrowser.Model/Session/SessionUserInfo.cs | 21 + MediaBrowser.Model/Session/TranscodingInfo.cs | 55 + .../Session/UserDataChangeInfo.cs | 23 + MediaBrowser.Model/Sync/SyncCategory.cs | 19 + MediaBrowser.Model/Sync/SyncJob.cs | 114 + MediaBrowser.Model/Sync/SyncJobStatus.cs | 14 + MediaBrowser.Model/Sync/SyncTarget.cs | 17 + MediaBrowser.Model/System/Architecture.cs | 10 + MediaBrowser.Model/System/IEnvironmentInfo.cs | 24 + MediaBrowser.Model/System/IPowerManagement.cs | 11 + MediaBrowser.Model/System/ISystemEvents.cs | 12 + MediaBrowser.Model/System/LogFile.cs | 31 + MediaBrowser.Model/System/PublicSystemInfo.cs | 41 + MediaBrowser.Model/System/SystemInfo.cs | 140 + MediaBrowser.Model/System/WakeOnLanInfo.cs | 13 + .../Tasks/IConfigurableScheduledTask.cs | 18 + MediaBrowser.Model/Tasks/IScheduledTask.cs | 47 + .../Tasks/IScheduledTaskWorker.cs | 76 + MediaBrowser.Model/Tasks/ITaskManager.cs | 78 + MediaBrowser.Model/Tasks/ITaskTrigger.cs | 32 + .../Tasks/ScheduledTaskHelpers.cs | 44 + MediaBrowser.Model/Tasks/SystemEvent.cs | 14 + .../Tasks/TaskCompletionEventArgs.cs | 11 + .../Tasks/TaskCompletionStatus.cs | 29 + MediaBrowser.Model/Tasks/TaskInfo.cs | 78 + MediaBrowser.Model/Tasks/TaskOptions.cs | 8 + MediaBrowser.Model/Tasks/TaskResult.cs | 58 + MediaBrowser.Model/Tasks/TaskState.cs | 22 + MediaBrowser.Model/Tasks/TaskTriggerInfo.cs | 52 + MediaBrowser.Model/Text/ITextEncoding.cs | 14 + MediaBrowser.Model/Threading/ITimer.cs | 10 + MediaBrowser.Model/Threading/ITimerFactory.cs | 10 + .../Updates/CheckForUpdateResult.cs | 30 + .../Updates/InstallationInfo.cs | 46 + MediaBrowser.Model/Updates/PackageInfo.cs | 176 + .../Updates/PackageTargetSystem.cs | 21 + .../Updates/PackageVersionClass.cs | 21 + .../Updates/PackageVersionInfo.cs | 95 + .../Users/ForgotPasswordAction.cs | 10 + .../Users/ForgotPasswordResult.cs | 23 + MediaBrowser.Model/Users/PinRedeemResult.cs | 17 + MediaBrowser.Model/Users/UserAction.cs | 15 + MediaBrowser.Model/Users/UserActionType.cs | 8 + MediaBrowser.Model/Users/UserPolicy.cs | 121 + .../Xml/IXmlReaderSettingsFactory.cs | 9 + MediaBrowser.Server.Mono/MonoAppHost.cs | 5 - 648 files changed, 50005 insertions(+), 123 deletions(-) delete mode 100644 Emby.Server.Implementations/Library/ConnectManager.cs create mode 100644 MediaBrowser.Common/Configuration/ConfigurationUpdateEventArgs.cs create mode 100644 MediaBrowser.Common/Configuration/IApplicationPaths.cs create mode 100644 MediaBrowser.Common/Configuration/IConfigurationFactory.cs create mode 100644 MediaBrowser.Common/Configuration/IConfigurationManager.cs create mode 100644 MediaBrowser.Common/Events/EventHelper.cs create mode 100644 MediaBrowser.Common/Extensions/BaseExtensions.cs create mode 100644 MediaBrowser.Common/Extensions/ResourceNotFoundException.cs create mode 100644 MediaBrowser.Common/IApplicationHost.cs create mode 100644 MediaBrowser.Common/MediaBrowser.Common.csproj create mode 100644 MediaBrowser.Common/Net/HttpRequestOptions.cs create mode 100644 MediaBrowser.Common/Net/HttpResponseInfo.cs create mode 100644 MediaBrowser.Common/Net/IHttpClient.cs create mode 100644 MediaBrowser.Common/Net/INetworkManager.cs create mode 100644 MediaBrowser.Common/Plugins/BasePlugin.cs create mode 100644 MediaBrowser.Common/Plugins/IPlugin.cs create mode 100644 MediaBrowser.Common/Progress/ActionableProgress.cs create mode 100644 MediaBrowser.Common/Properties/AssemblyInfo.cs create mode 100644 MediaBrowser.Common/Security/IRequiresRegistration.cs create mode 100644 MediaBrowser.Common/Security/ISecurityManager.cs create mode 100644 MediaBrowser.Common/Security/PaymentRequiredException.cs create mode 100644 MediaBrowser.Common/Updates/GithubUpdater.cs create mode 100644 MediaBrowser.Common/Updates/IInstallationManager.cs create mode 100644 MediaBrowser.Common/Updates/InstallationEventArgs.cs create mode 100644 MediaBrowser.Common/Updates/InstallationFailedEventArgs.cs 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 create mode 100644 MediaBrowser.Model/Activity/ActivityLogEntry.cs create mode 100644 MediaBrowser.Model/Activity/IActivityManager.cs create mode 100644 MediaBrowser.Model/Activity/IActivityRepository.cs create mode 100644 MediaBrowser.Model/ApiClient/ServerDiscoveryInfo.cs create mode 100644 MediaBrowser.Model/Branding/BrandingOptions.cs create mode 100644 MediaBrowser.Model/Channels/ChannelFeatures.cs create mode 100644 MediaBrowser.Model/Channels/ChannelFolderType.cs create mode 100644 MediaBrowser.Model/Channels/ChannelInfo.cs create mode 100644 MediaBrowser.Model/Channels/ChannelItemSortField.cs create mode 100644 MediaBrowser.Model/Channels/ChannelMediaContentType.cs create mode 100644 MediaBrowser.Model/Channels/ChannelMediaType.cs create mode 100644 MediaBrowser.Model/Channels/ChannelQuery.cs create mode 100644 MediaBrowser.Model/Collections/CollectionCreationResult.cs create mode 100644 MediaBrowser.Model/Configuration/AccessSchedule.cs create mode 100644 MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs create mode 100644 MediaBrowser.Model/Configuration/DynamicDayOfWeek.cs create mode 100644 MediaBrowser.Model/Configuration/EncodingOptions.cs create mode 100644 MediaBrowser.Model/Configuration/FanartOptions.cs create mode 100644 MediaBrowser.Model/Configuration/ImageOption.cs create mode 100644 MediaBrowser.Model/Configuration/ImageSavingConvention.cs create mode 100644 MediaBrowser.Model/Configuration/LibraryOptions.cs create mode 100644 MediaBrowser.Model/Configuration/MetadataConfiguration.cs create mode 100644 MediaBrowser.Model/Configuration/MetadataOptions.cs create mode 100644 MediaBrowser.Model/Configuration/MetadataPlugin.cs create mode 100644 MediaBrowser.Model/Configuration/MetadataPluginSummary.cs create mode 100644 MediaBrowser.Model/Configuration/MetadataPluginType.cs create mode 100644 MediaBrowser.Model/Configuration/ServerConfiguration.cs create mode 100644 MediaBrowser.Model/Configuration/SubtitlePlaybackMode.cs create mode 100644 MediaBrowser.Model/Configuration/UnratedItem.cs create mode 100644 MediaBrowser.Model/Configuration/UserConfiguration.cs create mode 100644 MediaBrowser.Model/Configuration/XbmcMetadataOptions.cs create mode 100644 MediaBrowser.Model/Connect/ConnectAuthenticationExchangeResult.cs create mode 100644 MediaBrowser.Model/Connect/ConnectAuthenticationResult.cs create mode 100644 MediaBrowser.Model/Connect/ConnectAuthorization.cs create mode 100644 MediaBrowser.Model/Connect/ConnectAuthorizationRequest.cs create mode 100644 MediaBrowser.Model/Connect/ConnectUser.cs create mode 100644 MediaBrowser.Model/Connect/ConnectUserQuery.cs create mode 100644 MediaBrowser.Model/Connect/UserLinkType.cs create mode 100644 MediaBrowser.Model/Cryptography/ICryptoProvider.cs create mode 100644 MediaBrowser.Model/Devices/ContentUploadHistory.cs create mode 100644 MediaBrowser.Model/Devices/DeviceInfo.cs create mode 100644 MediaBrowser.Model/Devices/DeviceQuery.cs create mode 100644 MediaBrowser.Model/Devices/DevicesOptions.cs create mode 100644 MediaBrowser.Model/Devices/LocalFileInfo.cs create mode 100644 MediaBrowser.Model/Diagnostics/IProcess.cs create mode 100644 MediaBrowser.Model/Diagnostics/IProcessFactory.cs create mode 100644 MediaBrowser.Model/Dlna/AudioOptions.cs create mode 100644 MediaBrowser.Model/Dlna/CodecProfile.cs create mode 100644 MediaBrowser.Model/Dlna/CodecType.cs create mode 100644 MediaBrowser.Model/Dlna/ConditionProcessor.cs create mode 100644 MediaBrowser.Model/Dlna/ContainerProfile.cs create mode 100644 MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs create mode 100644 MediaBrowser.Model/Dlna/DeviceIdentification.cs create mode 100644 MediaBrowser.Model/Dlna/DeviceProfile.cs create mode 100644 MediaBrowser.Model/Dlna/DeviceProfileInfo.cs create mode 100644 MediaBrowser.Model/Dlna/DeviceProfileType.cs create mode 100644 MediaBrowser.Model/Dlna/DirectPlayProfile.cs create mode 100644 MediaBrowser.Model/Dlna/DlnaFlags.cs create mode 100644 MediaBrowser.Model/Dlna/DlnaMaps.cs create mode 100644 MediaBrowser.Model/Dlna/DlnaProfileType.cs create mode 100644 MediaBrowser.Model/Dlna/EncodingContext.cs create mode 100644 MediaBrowser.Model/Dlna/HeaderMatchType.cs create mode 100644 MediaBrowser.Model/Dlna/HttpHeaderInfo.cs create mode 100644 MediaBrowser.Model/Dlna/IDeviceDiscovery.cs create mode 100644 MediaBrowser.Model/Dlna/ITranscoderSupport.cs create mode 100644 MediaBrowser.Model/Dlna/MediaFormatProfile.cs create mode 100644 MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs create mode 100644 MediaBrowser.Model/Dlna/PlaybackErrorCode.cs create mode 100644 MediaBrowser.Model/Dlna/ProfileCondition.cs create mode 100644 MediaBrowser.Model/Dlna/ProfileConditionType.cs create mode 100644 MediaBrowser.Model/Dlna/ProfileConditionValue.cs create mode 100644 MediaBrowser.Model/Dlna/ResolutionConfiguration.cs create mode 100644 MediaBrowser.Model/Dlna/ResolutionNormalizer.cs create mode 100644 MediaBrowser.Model/Dlna/ResolutionOptions.cs create mode 100644 MediaBrowser.Model/Dlna/ResponseProfile.cs create mode 100644 MediaBrowser.Model/Dlna/SearchCriteria.cs create mode 100644 MediaBrowser.Model/Dlna/SearchType.cs create mode 100644 MediaBrowser.Model/Dlna/SortCriteria.cs create mode 100644 MediaBrowser.Model/Dlna/StreamBuilder.cs create mode 100644 MediaBrowser.Model/Dlna/StreamInfo.cs create mode 100644 MediaBrowser.Model/Dlna/SubtitleDeliveryMethod.cs create mode 100644 MediaBrowser.Model/Dlna/SubtitleProfile.cs create mode 100644 MediaBrowser.Model/Dlna/SubtitleStreamInfo.cs create mode 100644 MediaBrowser.Model/Dlna/TranscodeSeekInfo.cs create mode 100644 MediaBrowser.Model/Dlna/TranscodingProfile.cs create mode 100644 MediaBrowser.Model/Dlna/UpnpDeviceInfo.cs create mode 100644 MediaBrowser.Model/Dlna/VideoOptions.cs create mode 100644 MediaBrowser.Model/Dlna/XmlAttribute.cs create mode 100644 MediaBrowser.Model/Drawing/DrawingUtils.cs create mode 100644 MediaBrowser.Model/Drawing/ImageFormat.cs create mode 100644 MediaBrowser.Model/Drawing/ImageOrientation.cs create mode 100644 MediaBrowser.Model/Drawing/ImageSize.cs create mode 100644 MediaBrowser.Model/Dto/BaseItemDto.cs create mode 100644 MediaBrowser.Model/Dto/BaseItemPerson.cs create mode 100644 MediaBrowser.Model/Dto/ChapterInfoDto.cs create mode 100644 MediaBrowser.Model/Dto/GameSystemSummary.cs create mode 100644 MediaBrowser.Model/Dto/IHasServerId.cs create mode 100644 MediaBrowser.Model/Dto/IItemDto.cs create mode 100644 MediaBrowser.Model/Dto/ImageByNameInfo.cs create mode 100644 MediaBrowser.Model/Dto/ImageInfo.cs create mode 100644 MediaBrowser.Model/Dto/ImageOptions.cs create mode 100644 MediaBrowser.Model/Dto/ItemCounts.cs create mode 100644 MediaBrowser.Model/Dto/ItemIndex.cs create mode 100644 MediaBrowser.Model/Dto/MediaSourceInfo.cs create mode 100644 MediaBrowser.Model/Dto/MediaSourceType.cs create mode 100644 MediaBrowser.Model/Dto/MetadataEditorInfo.cs create mode 100644 MediaBrowser.Model/Dto/NameIdPair.cs create mode 100644 MediaBrowser.Model/Dto/NameValuePair.cs create mode 100644 MediaBrowser.Model/Dto/RatingType.cs create mode 100644 MediaBrowser.Model/Dto/RecommendationDto.cs create mode 100644 MediaBrowser.Model/Dto/RecommendationType.cs create mode 100644 MediaBrowser.Model/Dto/UserDto.cs create mode 100644 MediaBrowser.Model/Dto/UserItemDataDto.cs create mode 100644 MediaBrowser.Model/Entities/ChapterInfo.cs create mode 100644 MediaBrowser.Model/Entities/CollectionType.cs create mode 100644 MediaBrowser.Model/Entities/DisplayPreferences.cs create mode 100644 MediaBrowser.Model/Entities/EmptyRequestResult.cs create mode 100644 MediaBrowser.Model/Entities/ExtraType.cs create mode 100644 MediaBrowser.Model/Entities/IHasProviderIds.cs create mode 100644 MediaBrowser.Model/Entities/ImageType.cs create mode 100644 MediaBrowser.Model/Entities/IsoType.cs create mode 100644 MediaBrowser.Model/Entities/LibraryUpdateInfo.cs create mode 100644 MediaBrowser.Model/Entities/LocationType.cs create mode 100644 MediaBrowser.Model/Entities/MBRegistrationRecord.cs create mode 100644 MediaBrowser.Model/Entities/MediaStream.cs create mode 100644 MediaBrowser.Model/Entities/MediaStreamType.cs create mode 100644 MediaBrowser.Model/Entities/MediaType.cs create mode 100644 MediaBrowser.Model/Entities/MediaUrl.cs create mode 100644 MediaBrowser.Model/Entities/MetadataFields.cs create mode 100644 MediaBrowser.Model/Entities/MetadataProviders.cs create mode 100644 MediaBrowser.Model/Entities/PackageReviewInfo.cs create mode 100644 MediaBrowser.Model/Entities/ParentalRating.cs create mode 100644 MediaBrowser.Model/Entities/PersonType.cs create mode 100644 MediaBrowser.Model/Entities/PluginSecurityInfo.cs create mode 100644 MediaBrowser.Model/Entities/ProviderIdsExtensions.cs create mode 100644 MediaBrowser.Model/Entities/ScrollDirection.cs create mode 100644 MediaBrowser.Model/Entities/SeriesStatus.cs create mode 100644 MediaBrowser.Model/Entities/SortOrder.cs create mode 100644 MediaBrowser.Model/Entities/TrailerType.cs create mode 100644 MediaBrowser.Model/Entities/UserDataSaveReason.cs create mode 100644 MediaBrowser.Model/Entities/Video3DFormat.cs create mode 100644 MediaBrowser.Model/Entities/VideoType.cs create mode 100644 MediaBrowser.Model/Entities/VirtualFolderInfo.cs create mode 100644 MediaBrowser.Model/Events/GenericEventArgs.cs create mode 100644 MediaBrowser.Model/Extensions/LinqExtensions.cs create mode 100644 MediaBrowser.Model/Extensions/ListHelper.cs create mode 100644 MediaBrowser.Model/Extensions/StringHelper.cs create mode 100644 MediaBrowser.Model/Globalization/CountryInfo.cs create mode 100644 MediaBrowser.Model/Globalization/CultureDto.cs create mode 100644 MediaBrowser.Model/Globalization/ILocalizationManager.cs create mode 100644 MediaBrowser.Model/Globalization/LocalizatonOption.cs create mode 100644 MediaBrowser.Model/IO/FileSystemEntryInfo.cs create mode 100644 MediaBrowser.Model/IO/FileSystemEntryType.cs create mode 100644 MediaBrowser.Model/IO/FileSystemMetadata.cs create mode 100644 MediaBrowser.Model/IO/IFileSystem.cs create mode 100644 MediaBrowser.Model/IO/IIsoManager.cs create mode 100644 MediaBrowser.Model/IO/IIsoMount.cs create mode 100644 MediaBrowser.Model/IO/IIsoMounter.cs create mode 100644 MediaBrowser.Model/IO/IShortcutHandler.cs create mode 100644 MediaBrowser.Model/IO/IStreamHelper.cs create mode 100644 MediaBrowser.Model/IO/IZipClient.cs create mode 100644 MediaBrowser.Model/IO/StreamDefaults.cs create mode 100644 MediaBrowser.Model/Library/PlayAccess.cs create mode 100644 MediaBrowser.Model/Library/UserViewQuery.cs create mode 100644 MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs create mode 100644 MediaBrowser.Model/LiveTv/ChannelType.cs create mode 100644 MediaBrowser.Model/LiveTv/DayPattern.cs create mode 100644 MediaBrowser.Model/LiveTv/GuideInfo.cs create mode 100644 MediaBrowser.Model/LiveTv/LiveTvChannelQuery.cs create mode 100644 MediaBrowser.Model/LiveTv/LiveTvInfo.cs create mode 100644 MediaBrowser.Model/LiveTv/LiveTvOptions.cs create mode 100644 MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs create mode 100644 MediaBrowser.Model/LiveTv/LiveTvServiceStatus.cs create mode 100644 MediaBrowser.Model/LiveTv/LiveTvTunerStatus.cs create mode 100644 MediaBrowser.Model/LiveTv/ProgramAudio.cs create mode 100644 MediaBrowser.Model/LiveTv/ProgramQuery.cs create mode 100644 MediaBrowser.Model/LiveTv/RecommendedProgramQuery.cs create mode 100644 MediaBrowser.Model/LiveTv/RecordingQuery.cs create mode 100644 MediaBrowser.Model/LiveTv/RecordingStatus.cs create mode 100644 MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs create mode 100644 MediaBrowser.Model/LiveTv/SeriesTimerQuery.cs create mode 100644 MediaBrowser.Model/LiveTv/TimerInfoDto.cs create mode 100644 MediaBrowser.Model/LiveTv/TimerQuery.cs create mode 100644 MediaBrowser.Model/Logging/IConsoleLogger.cs create mode 100644 MediaBrowser.Model/Logging/ILogManager.cs create mode 100644 MediaBrowser.Model/Logging/ILogger.cs create mode 100644 MediaBrowser.Model/Logging/LogHelper.cs create mode 100644 MediaBrowser.Model/Logging/LogSeverity.cs create mode 100644 MediaBrowser.Model/Logging/NullLogger.cs create mode 100644 MediaBrowser.Model/MediaBrowser.Model.csproj create mode 100644 MediaBrowser.Model/MediaInfo/AudioCodec.cs create mode 100644 MediaBrowser.Model/MediaInfo/BlurayDiscInfo.cs create mode 100644 MediaBrowser.Model/MediaInfo/Container.cs create mode 100644 MediaBrowser.Model/MediaInfo/IBlurayExaminer.cs create mode 100644 MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs create mode 100644 MediaBrowser.Model/MediaInfo/LiveStreamResponse.cs create mode 100644 MediaBrowser.Model/MediaInfo/MediaInfo.cs create mode 100644 MediaBrowser.Model/MediaInfo/MediaProtocol.cs create mode 100644 MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs create mode 100644 MediaBrowser.Model/MediaInfo/PlaybackInfoResponse.cs create mode 100644 MediaBrowser.Model/MediaInfo/SubtitleFormat.cs create mode 100644 MediaBrowser.Model/MediaInfo/SubtitleTrackEvent.cs create mode 100644 MediaBrowser.Model/MediaInfo/SubtitleTrackInfo.cs create mode 100644 MediaBrowser.Model/MediaInfo/TransportStreamTimestamp.cs create mode 100644 MediaBrowser.Model/MediaInfo/VideoCodec.cs create mode 100644 MediaBrowser.Model/Net/EndPointInfo.cs create mode 100644 MediaBrowser.Model/Net/HttpException.cs create mode 100644 MediaBrowser.Model/Net/HttpResponse.cs create mode 100644 MediaBrowser.Model/Net/IAcceptSocket.cs create mode 100644 MediaBrowser.Model/Net/ISocket.cs create mode 100644 MediaBrowser.Model/Net/ISocketFactory.cs create mode 100644 MediaBrowser.Model/Net/IpAddressInfo.cs create mode 100644 MediaBrowser.Model/Net/IpEndPointInfo.cs create mode 100644 MediaBrowser.Model/Net/MimeTypes.cs create mode 100644 MediaBrowser.Model/Net/NetworkShare.cs create mode 100644 MediaBrowser.Model/Net/NetworkShareType.cs create mode 100644 MediaBrowser.Model/Net/SocketReceiveResult.cs create mode 100644 MediaBrowser.Model/Net/WebSocketMessage.cs create mode 100644 MediaBrowser.Model/News/INewsService.cs create mode 100644 MediaBrowser.Model/News/NewsItem.cs create mode 100644 MediaBrowser.Model/News/NewsQuery.cs create mode 100644 MediaBrowser.Model/Notifications/NotificationLevel.cs create mode 100644 MediaBrowser.Model/Notifications/NotificationOption.cs create mode 100644 MediaBrowser.Model/Notifications/NotificationOptions.cs create mode 100644 MediaBrowser.Model/Notifications/NotificationRequest.cs create mode 100644 MediaBrowser.Model/Notifications/NotificationServiceInfo.cs create mode 100644 MediaBrowser.Model/Notifications/NotificationType.cs create mode 100644 MediaBrowser.Model/Notifications/NotificationTypeInfo.cs create mode 100644 MediaBrowser.Model/Notifications/SendToUserType.cs create mode 100644 MediaBrowser.Model/Playlists/PlaylistCreationRequest.cs create mode 100644 MediaBrowser.Model/Playlists/PlaylistCreationResult.cs create mode 100644 MediaBrowser.Model/Playlists/PlaylistItemQuery.cs create mode 100644 MediaBrowser.Model/Plugins/BasePluginConfiguration.cs create mode 100644 MediaBrowser.Model/Plugins/IHasWebPages.cs create mode 100644 MediaBrowser.Model/Plugins/PluginInfo.cs create mode 100644 MediaBrowser.Model/Plugins/PluginPageInfo.cs create mode 100644 MediaBrowser.Model/Properties/AssemblyInfo.cs create mode 100644 MediaBrowser.Model/Providers/ExternalIdInfo.cs create mode 100644 MediaBrowser.Model/Providers/ExternalUrl.cs create mode 100644 MediaBrowser.Model/Providers/ImageProviderInfo.cs create mode 100644 MediaBrowser.Model/Providers/RemoteImageInfo.cs create mode 100644 MediaBrowser.Model/Providers/RemoteImageQuery.cs create mode 100644 MediaBrowser.Model/Providers/RemoteImageResult.cs create mode 100644 MediaBrowser.Model/Providers/RemoteSearchResult.cs create mode 100644 MediaBrowser.Model/Providers/RemoteSubtitleInfo.cs create mode 100644 MediaBrowser.Model/Providers/SubtitleOptions.cs create mode 100644 MediaBrowser.Model/Providers/SubtitleProviderInfo.cs create mode 100644 MediaBrowser.Model/Querying/AllThemeMediaResult.cs create mode 100644 MediaBrowser.Model/Querying/EpisodeQuery.cs create mode 100644 MediaBrowser.Model/Querying/ItemCountsQuery.cs create mode 100644 MediaBrowser.Model/Querying/ItemFields.cs create mode 100644 MediaBrowser.Model/Querying/ItemFilter.cs create mode 100644 MediaBrowser.Model/Querying/ItemSortBy.cs create mode 100644 MediaBrowser.Model/Querying/LatestItemsQuery.cs create mode 100644 MediaBrowser.Model/Querying/MovieRecommendationQuery.cs create mode 100644 MediaBrowser.Model/Querying/NextUpQuery.cs create mode 100644 MediaBrowser.Model/Querying/QueryFilters.cs create mode 100644 MediaBrowser.Model/Querying/QueryResult.cs create mode 100644 MediaBrowser.Model/Querying/SessionQuery.cs create mode 100644 MediaBrowser.Model/Querying/SimilarItemsQuery.cs create mode 100644 MediaBrowser.Model/Querying/ThemeMediaResult.cs create mode 100644 MediaBrowser.Model/Querying/UpcomingEpisodesQuery.cs create mode 100644 MediaBrowser.Model/Querying/UserQuery.cs create mode 100644 MediaBrowser.Model/Reflection/IAssemblyInfo.cs create mode 100644 MediaBrowser.Model/Search/SearchHint.cs create mode 100644 MediaBrowser.Model/Search/SearchHintResult.cs create mode 100644 MediaBrowser.Model/Search/SearchQuery.cs create mode 100644 MediaBrowser.Model/Serialization/IJsonSerializer.cs create mode 100644 MediaBrowser.Model/Serialization/IXmlSerializer.cs create mode 100644 MediaBrowser.Model/Serialization/IgnoreDataMemberAttribute.cs create mode 100644 MediaBrowser.Model/Services/ApiMemberAttribute.cs create mode 100644 MediaBrowser.Model/Services/HttpUtility.cs create mode 100644 MediaBrowser.Model/Services/IAsyncStreamWriter.cs create mode 100644 MediaBrowser.Model/Services/IHasHeaders.cs create mode 100644 MediaBrowser.Model/Services/IHasRequestFilter.cs create mode 100644 MediaBrowser.Model/Services/IHttpRequest.cs create mode 100644 MediaBrowser.Model/Services/IHttpResponse.cs create mode 100644 MediaBrowser.Model/Services/IHttpResult.cs create mode 100644 MediaBrowser.Model/Services/IRequest.cs create mode 100644 MediaBrowser.Model/Services/IRequiresRequestStream.cs create mode 100644 MediaBrowser.Model/Services/IService.cs create mode 100644 MediaBrowser.Model/Services/IStreamWriter.cs create mode 100644 MediaBrowser.Model/Services/QueryParamCollection.cs create mode 100644 MediaBrowser.Model/Services/RouteAttribute.cs create mode 100644 MediaBrowser.Model/Session/BrowseRequest.cs create mode 100644 MediaBrowser.Model/Session/ClientCapabilities.cs create mode 100644 MediaBrowser.Model/Session/GeneralCommand.cs create mode 100644 MediaBrowser.Model/Session/GeneralCommandType.cs create mode 100644 MediaBrowser.Model/Session/MessageCommand.cs create mode 100644 MediaBrowser.Model/Session/PlayCommand.cs create mode 100644 MediaBrowser.Model/Session/PlayMethod.cs create mode 100644 MediaBrowser.Model/Session/PlayRequest.cs create mode 100644 MediaBrowser.Model/Session/PlaybackProgressInfo.cs create mode 100644 MediaBrowser.Model/Session/PlaybackStartInfo.cs create mode 100644 MediaBrowser.Model/Session/PlaybackStopInfo.cs create mode 100644 MediaBrowser.Model/Session/PlayerStateInfo.cs create mode 100644 MediaBrowser.Model/Session/PlaystateCommand.cs create mode 100644 MediaBrowser.Model/Session/PlaystateRequest.cs create mode 100644 MediaBrowser.Model/Session/SessionInfoDto.cs create mode 100644 MediaBrowser.Model/Session/SessionUserInfo.cs create mode 100644 MediaBrowser.Model/Session/TranscodingInfo.cs create mode 100644 MediaBrowser.Model/Session/UserDataChangeInfo.cs create mode 100644 MediaBrowser.Model/Sync/SyncCategory.cs create mode 100644 MediaBrowser.Model/Sync/SyncJob.cs create mode 100644 MediaBrowser.Model/Sync/SyncJobStatus.cs create mode 100644 MediaBrowser.Model/Sync/SyncTarget.cs create mode 100644 MediaBrowser.Model/System/Architecture.cs create mode 100644 MediaBrowser.Model/System/IEnvironmentInfo.cs create mode 100644 MediaBrowser.Model/System/IPowerManagement.cs create mode 100644 MediaBrowser.Model/System/ISystemEvents.cs create mode 100644 MediaBrowser.Model/System/LogFile.cs create mode 100644 MediaBrowser.Model/System/PublicSystemInfo.cs create mode 100644 MediaBrowser.Model/System/SystemInfo.cs create mode 100644 MediaBrowser.Model/System/WakeOnLanInfo.cs create mode 100644 MediaBrowser.Model/Tasks/IConfigurableScheduledTask.cs create mode 100644 MediaBrowser.Model/Tasks/IScheduledTask.cs create mode 100644 MediaBrowser.Model/Tasks/IScheduledTaskWorker.cs create mode 100644 MediaBrowser.Model/Tasks/ITaskManager.cs create mode 100644 MediaBrowser.Model/Tasks/ITaskTrigger.cs create mode 100644 MediaBrowser.Model/Tasks/ScheduledTaskHelpers.cs create mode 100644 MediaBrowser.Model/Tasks/SystemEvent.cs create mode 100644 MediaBrowser.Model/Tasks/TaskCompletionEventArgs.cs create mode 100644 MediaBrowser.Model/Tasks/TaskCompletionStatus.cs create mode 100644 MediaBrowser.Model/Tasks/TaskInfo.cs create mode 100644 MediaBrowser.Model/Tasks/TaskOptions.cs create mode 100644 MediaBrowser.Model/Tasks/TaskResult.cs create mode 100644 MediaBrowser.Model/Tasks/TaskState.cs create mode 100644 MediaBrowser.Model/Tasks/TaskTriggerInfo.cs create mode 100644 MediaBrowser.Model/Text/ITextEncoding.cs create mode 100644 MediaBrowser.Model/Threading/ITimer.cs create mode 100644 MediaBrowser.Model/Threading/ITimerFactory.cs create mode 100644 MediaBrowser.Model/Updates/CheckForUpdateResult.cs create mode 100644 MediaBrowser.Model/Updates/InstallationInfo.cs create mode 100644 MediaBrowser.Model/Updates/PackageInfo.cs create mode 100644 MediaBrowser.Model/Updates/PackageTargetSystem.cs create mode 100644 MediaBrowser.Model/Updates/PackageVersionClass.cs create mode 100644 MediaBrowser.Model/Updates/PackageVersionInfo.cs create mode 100644 MediaBrowser.Model/Users/ForgotPasswordAction.cs create mode 100644 MediaBrowser.Model/Users/ForgotPasswordResult.cs create mode 100644 MediaBrowser.Model/Users/PinRedeemResult.cs create mode 100644 MediaBrowser.Model/Users/UserAction.cs create mode 100644 MediaBrowser.Model/Users/UserActionType.cs create mode 100644 MediaBrowser.Model/Users/UserPolicy.cs create mode 100644 MediaBrowser.Model/Xml/IXmlReaderSettingsFactory.cs diff --git a/Emby.Notifications/Notifications.cs b/Emby.Notifications/Notifications.cs index 64863eb39e..3cadad6c8d 100644 --- a/Emby.Notifications/Notifications.cs +++ b/Emby.Notifications/Notifications.cs @@ -231,7 +231,7 @@ namespace Emby.Notifications } } - var hasSeries = item as IHasSeriesName; + var hasSeries = item as IHasSeries; if (hasSeries != null) { diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 011f3a0fba..c6cfe72141 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -318,7 +318,6 @@ namespace Emby.Server.Implementations private IMediaEncoder MediaEncoder { get; set; } private ISubtitleEncoder SubtitleEncoder { get; set; } - private IConnectManager ConnectManager { get; set; } private ISessionManager SessionManager { get; set; } private ILiveTvManager LiveTvManager { get; set; } @@ -839,8 +838,6 @@ namespace Emby.Server.Implementations } } - protected abstract IConnectManager CreateConnectManager(); - protected virtual IHttpClient CreateHttpClient() { return new HttpClientManager.HttpClientManager(ApplicationPaths, LogManager.GetLogger("HttpClient"), FileSystemManager, GetDefaultUserAgent); @@ -947,7 +944,7 @@ namespace Emby.Server.Implementations AuthenticationRepository = GetAuthenticationRepository(); RegisterSingleInstance(AuthenticationRepository); - UserManager = new UserManager(LogManager.GetLogger("UserManager"), ServerConfigurationManager, UserRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService, () => ConnectManager, this, JsonSerializer, FileSystemManager, CryptographyProvider); + UserManager = new UserManager(LogManager.GetLogger("UserManager"), ServerConfigurationManager, UserRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService, this, JsonSerializer, FileSystemManager, CryptographyProvider); RegisterSingleInstance(UserManager); LibraryManager = new LibraryManager(this, Logger, TaskManager, UserManager, ServerConfigurationManager, UserDataManager, () => LibraryMonitor, FileSystemManager, () => ProviderManager, () => UserViewManager); @@ -986,9 +983,6 @@ namespace Emby.Server.Implementations var encryptionManager = new EncryptionManager(); RegisterSingleInstance(encryptionManager); - ConnectManager = CreateConnectManager(); - RegisterSingleInstance(ConnectManager); - DeviceManager = new DeviceManager(AuthenticationRepository, JsonSerializer, LibraryManager, LocalizationManager, UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager, LogManager.GetLogger("DeviceManager"), NetworkManager); RegisterSingleInstance(DeviceManager); @@ -1045,11 +1039,11 @@ namespace Emby.Server.Implementations RegisterSingleInstance(activityLogRepo); RegisterSingleInstance(new ActivityManager(LogManager.GetLogger("ActivityManager"), activityLogRepo, UserManager)); - var authContext = new AuthorizationContext(AuthenticationRepository, ConnectManager, UserManager); + var authContext = new AuthorizationContext(AuthenticationRepository, UserManager); RegisterSingleInstance(authContext); RegisterSingleInstance(new SessionContext(UserManager, authContext, SessionManager)); - AuthService = new AuthService(UserManager, authContext, ServerConfigurationManager, ConnectManager, SessionManager, NetworkManager); + AuthService = new AuthService(UserManager, authContext, ServerConfigurationManager, SessionManager, NetworkManager); RegisterSingleInstance(AuthService); SubtitleEncoder = new MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder(LibraryManager, LogManager.GetLogger("SubtitleEncoder"), ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer, HttpClient, MediaSourceManager, ProcessFactory, TextEncoding); diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs index e832c7c6f8..e61c5e2832 100644 --- a/Emby.Server.Implementations/Channels/ChannelManager.cs +++ b/Emby.Server.Implementations/Channels/ChannelManager.cs @@ -1086,7 +1086,7 @@ namespace Emby.Server.Implementations.Channels } item.ParentId = parentFolderId; - var hasSeries = item as IHasSeriesName; + var hasSeries = item as IHasSeries; if (hasSeries != null) { if (!string.Equals(hasSeries.SeriesName, info.SeriesName, StringComparison.OrdinalIgnoreCase)) @@ -1215,4 +1215,4 @@ namespace Emby.Server.Implementations.Channels return result; } } -} \ No newline at end of file +} diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index bde28c923d..c9495c5747 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -942,7 +942,7 @@ namespace Emby.Server.Implementations.Data saveItemStatement.TryBind("@Album", item.Album); saveItemStatement.TryBind("@IsVirtualItem", item.IsVirtualItem); - var hasSeriesName = item as IHasSeriesName; + var hasSeriesName = item as IHasSeries; if (hasSeriesName != null) { saveItemStatement.TryBind("@SeriesName", hasSeriesName.SeriesName); @@ -1757,7 +1757,7 @@ namespace Emby.Server.Implementations.Data } index++; - var hasSeriesName = item as IHasSeriesName; + var hasSeriesName = item as IHasSeries; if (hasSeriesName != null) { if (!reader.IsDBNull(index)) @@ -6441,4 +6441,4 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type } } -} \ No newline at end of file +} diff --git a/Emby.Server.Implementations/HttpServer/Security/AuthService.cs b/Emby.Server.Implementations/HttpServer/Security/AuthService.cs index 9dfb8cf034..e153d6f71f 100644 --- a/Emby.Server.Implementations/HttpServer/Security/AuthService.cs +++ b/Emby.Server.Implementations/HttpServer/Security/AuthService.cs @@ -17,19 +17,17 @@ namespace Emby.Server.Implementations.HttpServer.Security { private readonly IServerConfigurationManager _config; - public AuthService(IUserManager userManager, IAuthorizationContext authorizationContext, IServerConfigurationManager config, IConnectManager connectManager, ISessionManager sessionManager, INetworkManager networkManager) + public AuthService(IUserManager userManager, IAuthorizationContext authorizationContext, IServerConfigurationManager config, ISessionManager sessionManager, INetworkManager networkManager) { AuthorizationContext = authorizationContext; _config = config; SessionManager = sessionManager; - ConnectManager = connectManager; UserManager = userManager; NetworkManager = networkManager; } public IUserManager UserManager { get; private set; } public IAuthorizationContext AuthorizationContext { get; private set; } - public IConnectManager ConnectManager { get; private set; } public ISessionManager SessionManager { get; private set; } public INetworkManager NetworkManager { get; private set; } diff --git a/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs b/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs index 75dfa95d98..c3e2d31708 100644 --- a/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs +++ b/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs @@ -13,13 +13,11 @@ namespace Emby.Server.Implementations.HttpServer.Security public class AuthorizationContext : IAuthorizationContext { private readonly IAuthenticationRepository _authRepo; - private readonly IConnectManager _connectManager; private readonly IUserManager _userManager; - public AuthorizationContext(IAuthenticationRepository authRepo, IConnectManager connectManager, IUserManager userManager) + public AuthorizationContext(IAuthenticationRepository authRepo, IUserManager userManager) { _authRepo = authRepo; - _connectManager = connectManager; _userManager = userManager; } diff --git a/Emby.Server.Implementations/Library/ConnectManager.cs b/Emby.Server.Implementations/Library/ConnectManager.cs deleted file mode 100644 index 5df45aa440..0000000000 --- a/Emby.Server.Implementations/Library/ConnectManager.cs +++ /dev/null @@ -1,46 +0,0 @@ -using MediaBrowser.Common.Events; -using MediaBrowser.Common.Net; -using MediaBrowser.Controller; -using MediaBrowser.Controller.Configuration; -using MediaBrowser.Controller.Connect; -using MediaBrowser.Controller.Drawing; -using MediaBrowser.Controller.Dto; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Net; -using MediaBrowser.Controller.Persistence; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Connect; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Events; -using MediaBrowser.Model.Logging; -using MediaBrowser.Model.Serialization; -using MediaBrowser.Model.Users; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using MediaBrowser.Model.Cryptography; -using MediaBrowser.Model.IO; -using MediaBrowser.Controller.Authentication; -using MediaBrowser.Controller.Security; -using MediaBrowser.Controller.Devices; -using MediaBrowser.Controller.Session; -using MediaBrowser.Controller.Plugins; - -namespace Emby.Server.Implementations.Library -{ - public class ConnectManager : IConnectManager - { - public ConnectManager() - { - } - - } -} diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs index 317b64693e..da80a48247 100644 --- a/Emby.Server.Implementations/Library/UserManager.cs +++ b/Emby.Server.Implementations/Library/UserManager.cs @@ -74,7 +74,6 @@ namespace Emby.Server.Implementations.Library private readonly Func _imageProcessorFactory; private readonly Func _dtoServiceFactory; - private readonly Func _connectFactory; private readonly IServerApplicationHost _appHost; private readonly IFileSystem _fileSystem; private readonly ICryptoProvider _cryptographyProvider; @@ -82,7 +81,7 @@ namespace Emby.Server.Implementations.Library private IAuthenticationProvider[] _authenticationProviders; private DefaultAuthenticationProvider _defaultAuthenticationProvider; - public UserManager(ILogger logger, IServerConfigurationManager configurationManager, IUserRepository userRepository, IXmlSerializer xmlSerializer, INetworkManager networkManager, Func imageProcessorFactory, Func dtoServiceFactory, Func connectFactory, IServerApplicationHost appHost, IJsonSerializer jsonSerializer, IFileSystem fileSystem, ICryptoProvider cryptographyProvider) + public UserManager(ILogger logger, IServerConfigurationManager configurationManager, IUserRepository userRepository, IXmlSerializer xmlSerializer, INetworkManager networkManager, Func imageProcessorFactory, Func dtoServiceFactory, IServerApplicationHost appHost, IJsonSerializer jsonSerializer, IFileSystem fileSystem, ICryptoProvider cryptographyProvider) { _logger = logger; UserRepository = userRepository; @@ -90,7 +89,6 @@ namespace Emby.Server.Implementations.Library _networkManager = networkManager; _imageProcessorFactory = imageProcessorFactory; _dtoServiceFactory = dtoServiceFactory; - _connectFactory = connectFactory; _appHost = appHost; _jsonSerializer = jsonSerializer; _fileSystem = fileSystem; diff --git a/MediaBrowser.Api/PackageService.cs b/MediaBrowser.Api/PackageService.cs index 366d1318bf..0b1dc083d9 100644 --- a/MediaBrowser.Api/PackageService.cs +++ b/MediaBrowser.Api/PackageService.cs @@ -61,21 +61,6 @@ namespace MediaBrowser.Api public bool? IsAppStoreEnabled { get; set; } } - /// - /// Class GetPackageVersionUpdates - /// - [Route("/Packages/Updates", "GET", Summary = "Gets available package updates for currently installed packages")] - [Authenticated(Roles = "Admin")] - public class GetPackageVersionUpdates : IReturn - { - /// - /// Gets or sets the name. - /// - /// The name. - [ApiMember(Name = "PackageType", Description = "Package type filter (System/UserInstalled)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] - public string PackageType { get; set; } - } - /// /// Class InstallPackage /// @@ -146,30 +131,7 @@ namespace MediaBrowser.Api /// /// The request. /// System.Object. - public async Task Get(GetPackageVersionUpdates request) - { - PackageVersionInfo[] result = null; - - if (string.Equals(request.PackageType, "UserInstalled", StringComparison.OrdinalIgnoreCase) || string.Equals(request.PackageType, "All", StringComparison.OrdinalIgnoreCase)) - { - result = (await _installationManager.GetAvailablePluginUpdates(_appHost.ApplicationVersion, false, CancellationToken.None).ConfigureAwait(false)).ToArray(); - } - - else if (string.Equals(request.PackageType, "System", StringComparison.OrdinalIgnoreCase) || - string.Equals(request.PackageType, "All", StringComparison.OrdinalIgnoreCase)) - { - var updateCheckResult = await _appHost - .CheckForApplicationUpdate(CancellationToken.None, new SimpleProgress()).ConfigureAwait(false); - - if (updateCheckResult.IsUpdateAvailable) - { - result = new PackageVersionInfo[] { updateCheckResult.Package }; - } - } - - return ToOptimizedResult(result ?? new PackageVersionInfo[] { }); - } - + /// /// /// Gets the specified request. /// diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs index ac20b5e337..db5d256c47 100644 --- a/MediaBrowser.Api/Playback/StreamState.cs +++ b/MediaBrowser.Api/Playback/StreamState.cs @@ -148,7 +148,6 @@ namespace MediaBrowser.Api.Playback DisposeTranscodingThrottler(); DisposeLiveStream(); DisposeLogStream(); - DisposeIsoMount(); TranscodingJob = null; } @@ -251,9 +250,9 @@ namespace MediaBrowser.Api.Playback public DeviceProfile DeviceProfile { get; set; } public TranscodingJob TranscodingJob; - public override void ReportTranscodingProgress(TimeSpan? transcodingPosition, float? framerate, double? percentComplete, long? bytesTranscoded, int? bitRate) + public override void ReportTranscodingProgress(TimeSpan? transcodingPosition, float framerate, double? percentComplete, long bytesTranscoded, int? bitRate) { - ApiEntryPoint.Instance.ReportTranscodingProgress(TranscodingJob, this, transcodingPosition, framerate, percentComplete, bytesTranscoded, bitRate); + ApiEntryPoint.Instance.ReportTranscodingProgress(TranscodingJob, this, transcodingPosition, 0, percentComplete, 0, bitRate); } } } diff --git a/MediaBrowser.Api/SearchService.cs b/MediaBrowser.Api/SearchService.cs index 2e363136b3..0473dd9245 100644 --- a/MediaBrowser.Api/SearchService.cs +++ b/MediaBrowser.Api/SearchService.cs @@ -230,7 +230,7 @@ namespace MediaBrowser.Api result.StartDate = program.StartDate; } - var hasSeries = item as IHasSeriesName; + var hasSeries = item as IHasSeries; if (hasSeries != null) { result.Series = hasSeries.SeriesName; diff --git a/MediaBrowser.Api/StartupWizardService.cs b/MediaBrowser.Api/StartupWizardService.cs index b4891ba1a8..7fccbcc9b0 100644 --- a/MediaBrowser.Api/StartupWizardService.cs +++ b/MediaBrowser.Api/StartupWizardService.cs @@ -51,16 +51,14 @@ namespace MediaBrowser.Api private readonly IServerConfigurationManager _config; private readonly IServerApplicationHost _appHost; private readonly IUserManager _userManager; - private readonly IConnectManager _connectManager; private readonly IMediaEncoder _mediaEncoder; private readonly IHttpClient _httpClient; - public StartupWizardService(IServerConfigurationManager config, IHttpClient httpClient, IServerApplicationHost appHost, IUserManager userManager, IConnectManager connectManager, IMediaEncoder mediaEncoder) + public StartupWizardService(IServerConfigurationManager config, IHttpClient httpClient, IServerApplicationHost appHost, IUserManager userManager, IMediaEncoder mediaEncoder) { _config = config; _appHost = appHost; _userManager = userManager; - _connectManager = connectManager; _mediaEncoder = mediaEncoder; _httpClient = httpClient; } diff --git a/MediaBrowser.Common/Configuration/ConfigurationUpdateEventArgs.cs b/MediaBrowser.Common/Configuration/ConfigurationUpdateEventArgs.cs new file mode 100644 index 0000000000..310e2aa638 --- /dev/null +++ b/MediaBrowser.Common/Configuration/ConfigurationUpdateEventArgs.cs @@ -0,0 +1,18 @@ +using System; + +namespace MediaBrowser.Common.Configuration +{ + public class ConfigurationUpdateEventArgs : EventArgs + { + /// + /// Gets or sets the key. + /// + /// The key. + public string Key { get; set; } + /// + /// Gets or sets the new configuration. + /// + /// The new configuration. + public object NewConfiguration { get; set; } + } +} diff --git a/MediaBrowser.Common/Configuration/IApplicationPaths.cs b/MediaBrowser.Common/Configuration/IApplicationPaths.cs new file mode 100644 index 0000000000..c6256bc5a4 --- /dev/null +++ b/MediaBrowser.Common/Configuration/IApplicationPaths.cs @@ -0,0 +1,84 @@ + +namespace MediaBrowser.Common.Configuration +{ + /// + /// Interface IApplicationPaths + /// + public interface IApplicationPaths + { + /// + /// Gets the path to the program data folder + /// + /// The program data path. + string ProgramDataPath { get; } + + /// + /// Gets the path to the program system folder + /// + /// The program data path. + string ProgramSystemPath { get; } + + /// + /// Gets the folder path to the data directory + /// + /// The data directory. + string DataPath { get; } + + /// + /// Gets the image cache path. + /// + /// The image cache path. + string ImageCachePath { get; } + + /// + /// Gets the path to the plugin directory + /// + /// The plugins path. + string PluginsPath { get; } + + /// + /// Gets the path to the plugin configurations directory + /// + /// The plugin configurations path. + string PluginConfigurationsPath { get; } + + /// + /// Gets the path to where temporary update files will be stored + /// + /// The plugin configurations path. + string TempUpdatePath { get; } + + /// + /// Gets the path to the log directory + /// + /// The log directory path. + string LogDirectoryPath { get; } + + /// + /// Gets the path to the application configuration root directory + /// + /// The configuration directory path. + string ConfigurationDirectoryPath { get; } + + /// + /// Gets the path to the system configuration file + /// + /// The system configuration file path. + string SystemConfigurationFilePath { get; } + + /// + /// Gets the folder path to the cache directory + /// + /// The cache directory. + string CachePath { get; } + + /// + /// Gets the folder path to the temp directory within the cache folder + /// + /// The temp directory. + string TempDirectory { get; } + + string VirtualDataPath { get; } + } + +} diff --git a/MediaBrowser.Common/Configuration/IConfigurationFactory.cs b/MediaBrowser.Common/Configuration/IConfigurationFactory.cs new file mode 100644 index 0000000000..6ed6385360 --- /dev/null +++ b/MediaBrowser.Common/Configuration/IConfigurationFactory.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; + +namespace MediaBrowser.Common.Configuration +{ + public interface IConfigurationFactory + { + IEnumerable GetConfigurations(); + } + + public class ConfigurationStore + { + public string Key { get; set; } + + public Type ConfigurationType { get; set; } + } + + public interface IValidatingConfiguration + { + void Validate(object oldConfig, object newConfig); + } +} diff --git a/MediaBrowser.Common/Configuration/IConfigurationManager.cs b/MediaBrowser.Common/Configuration/IConfigurationManager.cs new file mode 100644 index 0000000000..d826a3ee78 --- /dev/null +++ b/MediaBrowser.Common/Configuration/IConfigurationManager.cs @@ -0,0 +1,82 @@ +using MediaBrowser.Model.Configuration; +using System; +using System.Collections.Generic; + +namespace MediaBrowser.Common.Configuration +{ + public interface IConfigurationManager + { + /// + /// Occurs when [configuration updating]. + /// + event EventHandler NamedConfigurationUpdating; + + /// + /// Occurs when [configuration updated]. + /// + event EventHandler ConfigurationUpdated; + + /// + /// Occurs when [named configuration updated]. + /// + event EventHandler NamedConfigurationUpdated; + + /// + /// Gets or sets the application paths. + /// + /// The application paths. + IApplicationPaths CommonApplicationPaths { get; } + + /// + /// Gets the configuration. + /// + /// The configuration. + BaseApplicationConfiguration CommonConfiguration { get; } + + /// + /// Saves the configuration. + /// + void SaveConfiguration(); + + /// + /// Replaces the configuration. + /// + /// The new configuration. + void ReplaceConfiguration(BaseApplicationConfiguration newConfiguration); + + /// + /// Gets the configuration. + /// + /// The key. + /// System.Object. + object GetConfiguration(string key); + + /// + /// Gets the type of the configuration. + /// + /// The key. + /// Type. + Type GetConfigurationType(string key); + + /// + /// Saves the configuration. + /// + /// The key. + /// The configuration. + void SaveConfiguration(string key, object configuration); + + /// + /// Adds the parts. + /// + /// The factories. + void AddParts(IEnumerable factories); + } + + public static class ConfigurationManagerExtensions + { + public static T GetConfiguration(this IConfigurationManager manager, string key) + { + return (T)manager.GetConfiguration(key); + } + } +} diff --git a/MediaBrowser.Common/Events/EventHelper.cs b/MediaBrowser.Common/Events/EventHelper.cs new file mode 100644 index 0000000000..2bb52f0ae5 --- /dev/null +++ b/MediaBrowser.Common/Events/EventHelper.cs @@ -0,0 +1,108 @@ +using MediaBrowser.Model.Logging; +using System; +using System.Threading.Tasks; + +namespace MediaBrowser.Common.Events +{ + /// + /// Class EventHelper + /// + public static class EventHelper + { + /// + /// Fires the event. + /// + /// The handler. + /// The sender. + /// The instance containing the event data. + /// The logger. + public static void QueueEventIfNotNull(EventHandler handler, object sender, EventArgs args, ILogger logger) + { + if (handler != null) + { + Task.Run(() => + { + try + { + handler(sender, args); + } + catch (Exception ex) + { + logger.ErrorException("Error in event handler", ex); + } + }); + } + } + + /// + /// Queues the event. + /// + /// + /// The handler. + /// The sender. + /// The args. + /// The logger. + public static void QueueEventIfNotNull(EventHandler handler, object sender, T args, ILogger logger) + { + if (handler != null) + { + Task.Run(() => + { + try + { + handler(sender, args); + } + catch (Exception ex) + { + logger.ErrorException("Error in event handler", ex); + } + }); + } + } + + /// + /// Fires the event. + /// + /// The handler. + /// The sender. + /// The instance containing the event data. + /// The logger. + public static void FireEventIfNotNull(EventHandler handler, object sender, EventArgs args, ILogger logger) + { + if (handler != null) + { + try + { + handler(sender, args); + } + catch (Exception ex) + { + logger.ErrorException("Error in event handler", ex); + } + } + } + + /// + /// Fires the event. + /// + /// + /// The handler. + /// The sender. + /// The args. + /// The logger. + public static void FireEventIfNotNull(EventHandler handler, object sender, T args, ILogger logger) + { + if (handler != null) + { + try + { + handler(sender, args); + } + catch (Exception ex) + { + logger.ErrorException("Error in event handler", ex); + } + } + } + } +} diff --git a/MediaBrowser.Common/Extensions/BaseExtensions.cs b/MediaBrowser.Common/Extensions/BaseExtensions.cs new file mode 100644 index 0000000000..d7f4424faa --- /dev/null +++ b/MediaBrowser.Common/Extensions/BaseExtensions.cs @@ -0,0 +1,58 @@ +using System; +using System.Globalization; +using System.Text.RegularExpressions; +using MediaBrowser.Model.Cryptography; + +namespace MediaBrowser.Common.Extensions +{ + /// + /// Class BaseExtensions + /// + public static class BaseExtensions + { + public static ICryptoProvider CryptographyProvider { get; set; } + + /// + /// Strips the HTML. + /// + /// The HTML string. + /// System.String. + public static string StripHtml(this string htmlString) + { + // http://stackoverflow.com/questions/1349023/how-can-i-strip-html-from-text-in-net + const string pattern = @"<(.|\n)*?>"; + + return Regex.Replace(htmlString, pattern, string.Empty).Trim(); + } + + /// + /// Gets the M d5. + /// + /// The STR. + /// Guid. + public static Guid GetMD5(this string str) + { + return CryptographyProvider.GetMD5(str); + } + + /// + /// Gets the MB id. + /// + /// The STR. + /// The type. + /// Guid. + /// type + [Obsolete("Use LibraryManager.GetNewItemId")] + public static Guid GetMBId(this string str, Type type) + { + if (type == null) + { + throw new ArgumentNullException("type"); + } + + var key = type.FullName + str.ToLower(); + + return key.GetMD5(); + } + } +} diff --git a/MediaBrowser.Common/Extensions/ResourceNotFoundException.cs b/MediaBrowser.Common/Extensions/ResourceNotFoundException.cs new file mode 100644 index 0000000000..89e20b1b41 --- /dev/null +++ b/MediaBrowser.Common/Extensions/ResourceNotFoundException.cs @@ -0,0 +1,63 @@ +using System; + +namespace MediaBrowser.Common.Extensions +{ + /// + /// Class ResourceNotFoundException + /// + public class ResourceNotFoundException : Exception + { + /// + /// Initializes a new instance of the class. + /// + public ResourceNotFoundException() + { + + } + + /// + /// Initializes a new instance of the class. + /// + /// The message. + public ResourceNotFoundException(string message) + : base(message) + { + + } + } + + public class RemoteServiceUnavailableException : Exception + { + public RemoteServiceUnavailableException() + { + + } + + public RemoteServiceUnavailableException(string message) + : base(message) + { + + } + } + + public class RateLimitExceededException : Exception + { + /// + /// Initializes a new instance of the class. + /// + public RateLimitExceededException() + { + + } + + /// + /// Initializes a new instance of the class. + /// + /// The message. + public RateLimitExceededException(string message) + : base(message) + { + + } + } +} diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs new file mode 100644 index 0000000000..32b942b60d --- /dev/null +++ b/MediaBrowser.Common/IApplicationHost.cs @@ -0,0 +1,147 @@ +using MediaBrowser.Common.Plugins; +using MediaBrowser.Model.Events; +using MediaBrowser.Model.Updates; +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Common +{ + /// + /// An interface to be implemented by the applications hosting a kernel + /// + public interface IApplicationHost + { + /// + /// Gets the display name of the operating system. + /// + /// The display name of the operating system. + string OperatingSystemDisplayName { get; } + + /// + /// Gets the name. + /// + /// The name. + string Name { get; } + + /// + /// Gets the device identifier. + /// + /// The device identifier. + string SystemId { get; } + + /// + /// Occurs when [application updated]. + /// + event EventHandler> ApplicationUpdated; + + /// + /// Gets or sets a value indicating whether this instance has pending kernel reload. + /// + /// true if this instance has pending kernel reload; otherwise, false. + bool HasPendingRestart { get; } + + bool IsShuttingDown { get; } + + /// + /// Gets a value indicating whether this instance can self restart. + /// + /// true if this instance can self restart; otherwise, false. + bool CanSelfRestart { get; } + + /// + /// Occurs when [has pending restart changed]. + /// + event EventHandler HasPendingRestartChanged; + + /// + /// Notifies the pending restart. + /// + void NotifyPendingRestart(); + + /// + /// Restarts this instance. + /// + void Restart(); + + /// + /// Gets the application version. + /// + /// The application version. + Version ApplicationVersion { get; } + + /// + /// Gets or sets a value indicating whether this instance can self update. + /// + /// true if this instance can self update; otherwise, false. + bool CanSelfUpdate { get; } + + /// + /// Gets the exports. + /// + /// + /// if set to true [manage liftime]. + /// IEnumerable{``0}. + IEnumerable GetExports(bool manageLiftime = true); + + /// + /// Checks for update. + /// + /// Task{CheckForUpdateResult}. + Task CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress progress); + + /// + /// Updates the application. + /// + /// Task. + Task UpdateApplication(PackageVersionInfo package, CancellationToken cancellationToken, IProgress progress); + + /// + /// Resolves this instance. + /// + /// + /// ``0. + T Resolve(); + + /// + /// Resolves this instance. + /// + /// + /// ``0. + T TryResolve(); + + /// + /// Shuts down. + /// + Task Shutdown(); + + /// + /// Gets the plugins. + /// + /// The plugins. + IPlugin[] Plugins { get; } + + /// + /// Removes the plugin. + /// + /// The plugin. + void RemovePlugin(IPlugin plugin); + + /// + /// Inits this instance. + /// + void Init(); + + /// + /// Creates the instance. + /// + /// The type. + /// System.Object. + object CreateInstance(Type type); + + PackageVersionClass SystemUpdateLevel { get; } + + string GetValue(string name); + } +} diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj new file mode 100644 index 0000000000..43f3b0be7a --- /dev/null +++ b/MediaBrowser.Common/MediaBrowser.Common.csproj @@ -0,0 +1,16 @@ + + + + + + + + + + + + netstandard2.0 + false + + + diff --git a/MediaBrowser.Common/Net/HttpRequestOptions.cs b/MediaBrowser.Common/Net/HttpRequestOptions.cs new file mode 100644 index 0000000000..c61e88c878 --- /dev/null +++ b/MediaBrowser.Common/Net/HttpRequestOptions.cs @@ -0,0 +1,157 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Threading; +using System.Text; + +namespace MediaBrowser.Common.Net +{ + /// + /// Class HttpRequestOptions + /// + public class HttpRequestOptions + { + /// + /// Gets or sets the URL. + /// + /// The URL. + public string Url { get; set; } + + public CompressionMethod? DecompressionMethod { get; set; } + + /// + /// Gets or sets the accept header. + /// + /// The accept header. + public string AcceptHeader + { + get { return GetHeaderValue("Accept"); } + set + { + RequestHeaders["Accept"] = value; + } + } + /// + /// Gets or sets the cancellation token. + /// + /// The cancellation token. + public CancellationToken CancellationToken { get; set; } + + /// + /// Gets or sets the resource pool. + /// + /// The resource pool. + public SemaphoreSlim ResourcePool { get; set; } + + /// + /// Gets or sets the user agent. + /// + /// The user agent. + public string UserAgent + { + get { return GetHeaderValue("User-Agent"); } + set + { + RequestHeaders["User-Agent"] = value; + } + } + + /// + /// Gets or sets the referrer. + /// + /// The referrer. + public string Referer { get; set; } + + /// + /// Gets or sets the host. + /// + /// The host. + public string Host { get; set; } + + /// + /// Gets or sets the progress. + /// + /// The progress. + public IProgress Progress { get; set; } + + /// + /// Gets or sets a value indicating whether [enable HTTP compression]. + /// + /// true if [enable HTTP compression]; otherwise, false. + public bool EnableHttpCompression { get; set; } + + public Dictionary RequestHeaders { get; private set; } + + public string RequestContentType { get; set; } + + public string RequestContent { get; set; } + public byte[] RequestContentBytes { get; set; } + + public bool BufferContent { get; set; } + + public bool LogRequest { get; set; } + public bool LogRequestAsDebug { get; set; } + public bool LogErrors { get; set; } + public bool LogResponse { get; set; } + public bool LogResponseHeaders { get; set; } + + public bool LogErrorResponseBody { get; set; } + public bool EnableKeepAlive { get; set; } + + public CacheMode CacheMode { get; set; } + public TimeSpan CacheLength { get; set; } + + public int TimeoutMs { get; set; } + public bool EnableDefaultUserAgent { get; set; } + + public bool AppendCharsetToMimeType { get; set; } + public string DownloadFilePath { get; set; } + + private string GetHeaderValue(string name) + { + string value; + + RequestHeaders.TryGetValue(name, out value); + + return value; + } + + /// + /// Initializes a new instance of the class. + /// + public HttpRequestOptions() + { + EnableHttpCompression = true; + + RequestHeaders = new Dictionary(StringComparer.OrdinalIgnoreCase); + + LogRequest = true; + LogErrors = true; + CacheMode = CacheMode.None; + + TimeoutMs = 20000; + } + + public void SetPostData(IDictionary values) + { + var strings = values.Keys.Select(key => string.Format("{0}={1}", key, values[key])); + var postContent = string.Join("&", strings.ToArray()); + + RequestContent = postContent; + RequestContentType = "application/x-www-form-urlencoded"; + } + } + + public enum CacheMode + { + None = 0, + Unconditional = 1 + } + + public enum CompressionMethod + { + Deflate, + Gzip + } +} diff --git a/MediaBrowser.Common/Net/HttpResponseInfo.cs b/MediaBrowser.Common/Net/HttpResponseInfo.cs new file mode 100644 index 0000000000..ed941a4474 --- /dev/null +++ b/MediaBrowser.Common/Net/HttpResponseInfo.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; + +namespace MediaBrowser.Common.Net +{ + /// + /// Class HttpResponseInfo + /// + public class HttpResponseInfo : IDisposable + { + /// + /// Gets or sets the type of the content. + /// + /// The type of the content. + public string ContentType { get; set; } + + /// + /// Gets or sets the response URL. + /// + /// The response URL. + public string ResponseUrl { get; set; } + + /// + /// Gets or sets the content. + /// + /// The content. + public Stream Content { get; set; } + + /// + /// Gets or sets the status code. + /// + /// The status code. + public HttpStatusCode StatusCode { get; set; } + + /// + /// Gets or sets the temp file path. + /// + /// The temp file path. + public string TempFilePath { get; set; } + + /// + /// Gets or sets the length of the content. + /// + /// The length of the content. + public long? ContentLength { get; set; } + + /// + /// Gets or sets the headers. + /// + /// The headers. + public Dictionary Headers { get; set; } + + private readonly IDisposable _disposable; + + public HttpResponseInfo(IDisposable disposable) + { + _disposable = disposable; + Headers = new Dictionary(StringComparer.OrdinalIgnoreCase); + } + public HttpResponseInfo() + { + Headers = new Dictionary(StringComparer.OrdinalIgnoreCase); + } + + public void Dispose() + { + if (_disposable != null) + { + _disposable.Dispose(); + } + } + } +} diff --git a/MediaBrowser.Common/Net/IHttpClient.cs b/MediaBrowser.Common/Net/IHttpClient.cs new file mode 100644 index 0000000000..cf55119653 --- /dev/null +++ b/MediaBrowser.Common/Net/IHttpClient.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Common.Net +{ + /// + /// Interface IHttpClient + /// + public interface IHttpClient + { + /// + /// Gets the response. + /// + /// The options. + /// Task{HttpResponseInfo}. + Task GetResponse(HttpRequestOptions options); + + /// + /// Gets the specified options. + /// + /// The options. + /// Task{Stream}. + Task Get(HttpRequestOptions options); + + /// + /// Sends the asynchronous. + /// + /// The options. + /// The HTTP method. + /// Task{HttpResponseInfo}. + Task SendAsync(HttpRequestOptions options, string httpMethod); + + /// + /// Posts the specified options. + /// + /// The options. + /// Task{HttpResponseInfo}. + Task Post(HttpRequestOptions options); + + /// + /// Downloads the contents of a given url into a temporary location + /// + /// The options. + /// Task{System.String}. + /// progress + /// + Task GetTempFile(HttpRequestOptions options); + + /// + /// Gets the temporary file response. + /// + /// The options. + /// Task{HttpResponseInfo}. + Task GetTempFileResponse(HttpRequestOptions options); + } +} \ No newline at end of file diff --git a/MediaBrowser.Common/Net/INetworkManager.cs b/MediaBrowser.Common/Net/INetworkManager.cs new file mode 100644 index 0000000000..b2ff797bcf --- /dev/null +++ b/MediaBrowser.Common/Net/INetworkManager.cs @@ -0,0 +1,66 @@ +using MediaBrowser.Model.IO; +using MediaBrowser.Model.Net; +using System.Collections.Generic; +using System; +using System.Threading.Tasks; + +namespace MediaBrowser.Common.Net +{ + public interface INetworkManager + { + event EventHandler NetworkChanged; + + /// + /// Gets a random port number that is currently available + /// + /// System.Int32. + int GetRandomUnusedTcpPort(); + + int GetRandomUnusedUdpPort(); + + Func LocalSubnetsFn { get; set; } + + /// + /// Returns MAC Address from first Network Card in Computer + /// + /// [string] MAC Address + List GetMacAddresses(); + + /// + /// Determines whether [is in private address space] [the specified endpoint]. + /// + /// The endpoint. + /// true if [is in private address space] [the specified endpoint]; otherwise, false. + bool IsInPrivateAddressSpace(string endpoint); + + /// + /// Gets the network shares. + /// + /// The path. + /// IEnumerable{NetworkShare}. + IEnumerable GetNetworkShares(string path); + + /// + /// Gets available devices within the domain + /// + /// PC's in the Domain + IEnumerable GetNetworkDevices(); + + /// + /// Determines whether [is in local network] [the specified endpoint]. + /// + /// The endpoint. + /// true if [is in local network] [the specified endpoint]; otherwise, false. + bool IsInLocalNetwork(string endpoint); + + IpAddressInfo[] GetLocalIpAddresses(); + + IpAddressInfo ParseIpAddress(string ipAddress); + + bool TryParseIpAddress(string ipAddress, out IpAddressInfo ipAddressInfo); + + Task GetHostAddressesAsync(string host); + + bool IsAddressInSubnets(string addressString, string[] subnets); + } +} \ No newline at end of file diff --git a/MediaBrowser.Common/Plugins/BasePlugin.cs b/MediaBrowser.Common/Plugins/BasePlugin.cs new file mode 100644 index 0000000000..82eb6ba4bf --- /dev/null +++ b/MediaBrowser.Common/Plugins/BasePlugin.cs @@ -0,0 +1,276 @@ +using MediaBrowser.Common.Configuration; +using MediaBrowser.Model.Plugins; +using MediaBrowser.Model.Serialization; +using System; +using System.IO; + +namespace MediaBrowser.Common.Plugins +{ + public abstract class BasePlugin : IPlugin, IPluginAssembly + { + /// + /// Gets the name of the plugin + /// + /// The name. + public abstract string Name { get; } + + /// + /// Gets the description. + /// + /// The description. + public virtual string Description + { + get { return string.Empty; } + } + + /// + /// Gets the unique id. + /// + /// The unique id. + public virtual Guid Id { get; private set; } + + /// + /// Gets the plugin version + /// + /// The version. + public Version Version { get; private set; } + + /// + /// Gets the path to the assembly file + /// + /// The assembly file path. + public string AssemblyFilePath { get; private set; } + + /// + /// Gets the plugin info. + /// + /// PluginInfo. + public virtual PluginInfo GetPluginInfo() + { + var info = new PluginInfo + { + Name = Name, + Version = Version.ToString(), + Description = Description, + Id = Id.ToString() + }; + + return info; + } + + /// + /// Called when just before the plugin is uninstalled from the server. + /// + public virtual void OnUninstalling() + { + + } + + public void SetAttributes(string assemblyFilePath, string dataFolderPath, Version assemblyVersion) + { + AssemblyFilePath = assemblyFilePath; + DataFolderPath = dataFolderPath; + Version = assemblyVersion; + } + + public void SetId(Guid assemblyId) + { + Id = assemblyId; + } + + /// + /// Gets the full path to the data folder, where the plugin can store any miscellaneous files needed + /// + /// The data folder path. + public string DataFolderPath { get; private set; } + } + + /// + /// Provides a common base class for all plugins + /// + /// The type of the T configuration type. + public abstract class BasePlugin : BasePlugin, IHasPluginConfiguration + where TConfigurationType : BasePluginConfiguration + { + /// + /// Gets the application paths. + /// + /// The application paths. + protected IApplicationPaths ApplicationPaths { get; private set; } + + /// + /// Gets the XML serializer. + /// + /// The XML serializer. + protected IXmlSerializer XmlSerializer { get; private set; } + + /// + /// Gets the type of configuration this plugin uses + /// + /// The type of the configuration. + public Type ConfigurationType + { + get { return typeof(TConfigurationType); } + } + + private Action _directoryCreateFn; + public void SetStartupInfo(Action directoryCreateFn) + { + // hack alert, until the .net core transition is complete + _directoryCreateFn = directoryCreateFn; + } + + /// + /// Gets the name the assembly file + /// + /// The name of the assembly file. + protected string AssemblyFileName + { + get + { + return Path.GetFileName(AssemblyFilePath); + } + } + + /// + /// The _configuration sync lock + /// + private readonly object _configurationSyncLock = new object(); + /// + /// The _configuration + /// + private TConfigurationType _configuration; + /// + /// Gets the plugin's configuration + /// + /// The configuration. + public TConfigurationType Configuration + { + get + { + // Lazy load + if (_configuration == null) + { + lock (_configurationSyncLock) + { + if (_configuration == null) + { + _configuration = LoadConfiguration(); + } + } + } + return _configuration; + } + protected set + { + _configuration = value; + } + } + + private TConfigurationType LoadConfiguration() + { + var path = ConfigurationFilePath; + + try + { + return (TConfigurationType)XmlSerializer.DeserializeFromFile(typeof(TConfigurationType), path); + } + catch + { + return (TConfigurationType)Activator.CreateInstance(typeof(TConfigurationType)); + } + } + + /// + /// Gets the name of the configuration file. Subclasses should override + /// + /// The name of the configuration file. + public virtual string ConfigurationFileName + { + get { return Path.ChangeExtension(AssemblyFileName, ".xml"); } + } + + /// + /// Gets the full path to the configuration file + /// + /// The configuration file path. + public string ConfigurationFilePath + { + get + { + return Path.Combine(ApplicationPaths.PluginConfigurationsPath, ConfigurationFileName); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// The application paths. + /// The XML serializer. + protected BasePlugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) + { + ApplicationPaths = applicationPaths; + XmlSerializer = xmlSerializer; + } + + /// + /// The _save lock + /// + private readonly object _configurationSaveLock = new object(); + + /// + /// Saves the current configuration to the file system + /// + public virtual void SaveConfiguration() + { + lock (_configurationSaveLock) + { + _directoryCreateFn(Path.GetDirectoryName(ConfigurationFilePath)); + + XmlSerializer.SerializeToFile(Configuration, ConfigurationFilePath); + } + } + + /// + /// Completely overwrites the current configuration with a new copy + /// Returns true or false indicating success or failure + /// + /// The configuration. + /// configuration + public virtual void UpdateConfiguration(BasePluginConfiguration configuration) + { + if (configuration == null) + { + throw new ArgumentNullException("configuration"); + } + + Configuration = (TConfigurationType)configuration; + + SaveConfiguration(); + } + + /// + /// Gets the plugin's configuration + /// + /// The configuration. + BasePluginConfiguration IHasPluginConfiguration.Configuration + { + get { return Configuration; } + } + + public override PluginInfo GetPluginInfo() + { + var info = base.GetPluginInfo(); + + info.ConfigurationFileName = ConfigurationFileName; + + return info; + } + } + + public interface IPluginAssembly + { + void SetAttributes(string assemblyFilePath, string dataFolderPath, Version assemblyVersion); + void SetId(Guid assemblyId); + } +} diff --git a/MediaBrowser.Common/Plugins/IPlugin.cs b/MediaBrowser.Common/Plugins/IPlugin.cs new file mode 100644 index 0000000000..bffd211439 --- /dev/null +++ b/MediaBrowser.Common/Plugins/IPlugin.cs @@ -0,0 +1,83 @@ +using MediaBrowser.Model.Plugins; +using System; + +namespace MediaBrowser.Common.Plugins +{ + /// + /// Interface IPlugin + /// + public interface IPlugin + { + /// + /// Gets the name of the plugin + /// + /// The name. + string Name { get; } + + /// + /// Gets the description. + /// + /// The description. + string Description { get; } + + /// + /// Gets the unique id. + /// + /// The unique id. + Guid Id { get; } + + /// + /// Gets the plugin version + /// + /// The version. + Version Version { get; } + + /// + /// Gets the path to the assembly file + /// + /// The assembly file path. + string AssemblyFilePath { get; } + + /// + /// Gets the full path to the data folder, where the plugin can store any miscellaneous files needed + /// + /// The data folder path. + string DataFolderPath { get; } + + /// + /// Gets the plugin info. + /// + /// PluginInfo. + PluginInfo GetPluginInfo(); + + /// + /// Called when just before the plugin is uninstalled from the server. + /// + void OnUninstalling(); + } + + public interface IHasPluginConfiguration + { + /// + /// Gets the type of configuration this plugin uses + /// + /// The type of the configuration. + Type ConfigurationType { get; } + + /// + /// Completely overwrites the current configuration with a new copy + /// Returns true or false indicating success or failure + /// + /// The configuration. + /// configuration + void UpdateConfiguration(BasePluginConfiguration configuration); + + /// + /// Gets the plugin's configuration + /// + /// The configuration. + BasePluginConfiguration Configuration { get; } + + void SetStartupInfo(Action directoryCreateFn); + } +} \ No newline at end of file diff --git a/MediaBrowser.Common/Progress/ActionableProgress.cs b/MediaBrowser.Common/Progress/ActionableProgress.cs new file mode 100644 index 0000000000..67347bc157 --- /dev/null +++ b/MediaBrowser.Common/Progress/ActionableProgress.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; + +namespace MediaBrowser.Common.Progress +{ + /// + /// Class ActionableProgress + /// + /// + public class ActionableProgress : IProgress + { + /// + /// The _actions + /// + private Action _action; + public event EventHandler ProgressChanged; + + /// + /// Registers the action. + /// + /// The action. + public void RegisterAction(Action action) + { + _action = action; + } + + public void Report(T value) + { + if (ProgressChanged != null) + { + ProgressChanged(this, value); + } + + var action = _action; + if (action != null) + { + action(value); + } + } + } + + public class SimpleProgress : IProgress + { + public event EventHandler ProgressChanged; + + public void Report(T value) + { + if (ProgressChanged != null) + { + ProgressChanged(this, value); + } + } + } +} diff --git a/MediaBrowser.Common/Properties/AssemblyInfo.cs b/MediaBrowser.Common/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..09fd68f93a --- /dev/null +++ b/MediaBrowser.Common/Properties/AssemblyInfo.cs @@ -0,0 +1,27 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("MediaBrowser.Common")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MediaBrowser.Common")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// \ No newline at end of file diff --git a/MediaBrowser.Common/Security/IRequiresRegistration.cs b/MediaBrowser.Common/Security/IRequiresRegistration.cs new file mode 100644 index 0000000000..7b1667c2e2 --- /dev/null +++ b/MediaBrowser.Common/Security/IRequiresRegistration.cs @@ -0,0 +1,15 @@ +using System.Threading.Tasks; + +namespace MediaBrowser.Common.Security +{ + public interface IRequiresRegistration + { + /// + /// Load all registration information required for this entity. + /// Your class should re-load all MBRegistrationRecords when this is called even if they were + /// previously loaded. + /// + /// + Task LoadRegistrationInfoAsync(); + } +} diff --git a/MediaBrowser.Common/Security/ISecurityManager.cs b/MediaBrowser.Common/Security/ISecurityManager.cs new file mode 100644 index 0000000000..b63a9efd09 --- /dev/null +++ b/MediaBrowser.Common/Security/ISecurityManager.cs @@ -0,0 +1,32 @@ +using MediaBrowser.Model.Entities; +using System.Threading.Tasks; + +namespace MediaBrowser.Common.Security +{ + public interface ISecurityManager + { + /// + /// Gets a value indicating whether this instance is MB supporter. + /// + /// true if this instance is MB supporter; otherwise, false. + Task IsSupporter(); + + /// + /// Gets or sets the supporter key. + /// + /// The supporter key. + string SupporterKey { get; } + + /// + /// Gets the registration status. Overload to support existing plug-ins. + /// + Task GetRegistrationStatus(string feature); + + /// + /// Register and app store sale with our back-end + /// + /// Json parameters to pass to admin server + Task RegisterAppStoreSale(string parameters); + Task UpdateSupporterKey(string newValue); + } +} \ No newline at end of file diff --git a/MediaBrowser.Common/Security/PaymentRequiredException.cs b/MediaBrowser.Common/Security/PaymentRequiredException.cs new file mode 100644 index 0000000000..27b3e69613 --- /dev/null +++ b/MediaBrowser.Common/Security/PaymentRequiredException.cs @@ -0,0 +1,8 @@ +using System; + +namespace MediaBrowser.Common.Security +{ + public class PaymentRequiredException : Exception + { + } +} diff --git a/MediaBrowser.Common/Updates/GithubUpdater.cs b/MediaBrowser.Common/Updates/GithubUpdater.cs new file mode 100644 index 0000000000..4275799a98 --- /dev/null +++ b/MediaBrowser.Common/Updates/GithubUpdater.cs @@ -0,0 +1,278 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using MediaBrowser.Common.Net; +using MediaBrowser.Model.Serialization; +using MediaBrowser.Model.Updates; + +namespace MediaBrowser.Common.Updates +{ + public class GithubUpdater + { + private readonly IHttpClient _httpClient; + private readonly IJsonSerializer _jsonSerializer; + + public GithubUpdater(IHttpClient httpClient, IJsonSerializer jsonSerializer) + { + _httpClient = httpClient; + _jsonSerializer = jsonSerializer; + } + + public async Task CheckForUpdateResult(string organzation, string repository, Version minVersion, PackageVersionClass updateLevel, string assetFilename, string packageName, string targetFilename, TimeSpan cacheLength, CancellationToken cancellationToken) + { + var url = string.Format("https://api.github.com/repos/{0}/{1}/releases", organzation, repository); + + var options = new HttpRequestOptions + { + Url = url, + EnableKeepAlive = false, + CancellationToken = cancellationToken, + UserAgent = "Emby/3.0", + BufferContent = false + }; + + if (cacheLength.Ticks > 0) + { + options.CacheMode = CacheMode.Unconditional; + options.CacheLength = cacheLength; + } + + using (var response = await _httpClient.SendAsync(options, "GET").ConfigureAwait(false)) + { + using (var stream = response.Content) + { + var obj = _jsonSerializer.DeserializeFromStream(stream); + + return CheckForUpdateResult(obj, minVersion, updateLevel, assetFilename, packageName, targetFilename); + } + } + } + + private CheckForUpdateResult CheckForUpdateResult(RootObject[] obj, Version minVersion, PackageVersionClass updateLevel, string assetFilename, string packageName, string targetFilename) + { + if (updateLevel == PackageVersionClass.Release) + { + // Technically all we need to do is check that it's not pre-release + // But let's addititional checks for -beta and -dev to handle builds that might be temporarily tagged incorrectly. + obj = obj.Where(i => !i.prerelease && !i.name.EndsWith("-beta", StringComparison.OrdinalIgnoreCase) && !i.name.EndsWith("-dev", StringComparison.OrdinalIgnoreCase)).ToArray(); + } + else if (updateLevel == PackageVersionClass.Beta) + { + obj = obj.Where(i => i.prerelease && i.name.EndsWith("-beta", StringComparison.OrdinalIgnoreCase)).ToArray(); + } + else if (updateLevel == PackageVersionClass.Dev) + { + obj = obj.Where(i => !i.prerelease || i.name.EndsWith("-beta", StringComparison.OrdinalIgnoreCase) || i.name.EndsWith("-dev", StringComparison.OrdinalIgnoreCase)).ToArray(); + } + + var availableUpdate = obj + .Select(i => CheckForUpdateResult(i, minVersion, assetFilename, packageName, targetFilename)) + .Where(i => i != null) + .OrderByDescending(i => Version.Parse(i.AvailableVersion)) + .FirstOrDefault(); + + return availableUpdate ?? new CheckForUpdateResult + { + IsUpdateAvailable = false + }; + } + + private bool MatchesUpdateLevel(RootObject i, PackageVersionClass updateLevel) + { + if (updateLevel == PackageVersionClass.Beta) + { + return i.prerelease && i.name.EndsWith("-beta", StringComparison.OrdinalIgnoreCase); + } + if (updateLevel == PackageVersionClass.Dev) + { + return !i.prerelease || i.name.EndsWith("-beta", StringComparison.OrdinalIgnoreCase) || + i.name.EndsWith("-dev", StringComparison.OrdinalIgnoreCase); + } + + // Technically all we need to do is check that it's not pre-release + // But let's addititional checks for -beta and -dev to handle builds that might be temporarily tagged incorrectly. + return !i.prerelease && !i.name.EndsWith("-beta", StringComparison.OrdinalIgnoreCase) && + !i.name.EndsWith("-dev", StringComparison.OrdinalIgnoreCase); + } + + public async Task> GetLatestReleases(string organzation, string repository, string assetFilename, CancellationToken cancellationToken) + { + var list = new List(); + + var url = string.Format("https://api.github.com/repos/{0}/{1}/releases", organzation, repository); + + var options = new HttpRequestOptions + { + Url = url, + EnableKeepAlive = false, + CancellationToken = cancellationToken, + UserAgent = "Emby/3.0", + BufferContent = false + }; + + using (var response = await _httpClient.SendAsync(options, "GET").ConfigureAwait(false)) + { + using (var stream = response.Content) + { + var obj = _jsonSerializer.DeserializeFromStream(stream); + + obj = obj.Where(i => (i.assets ?? new List()).Any(a => IsAsset(a, assetFilename, i.tag_name))).ToArray(); + + list.AddRange(obj.Where(i => MatchesUpdateLevel(i, PackageVersionClass.Release)).OrderByDescending(GetVersion).Take(1)); + list.AddRange(obj.Where(i => MatchesUpdateLevel(i, PackageVersionClass.Beta)).OrderByDescending(GetVersion).Take(1)); + list.AddRange(obj.Where(i => MatchesUpdateLevel(i, PackageVersionClass.Dev)).OrderByDescending(GetVersion).Take(1)); + + return list; + } + } + } + + public Version GetVersion(RootObject obj) + { + Version version; + if (!Version.TryParse(obj.tag_name, out version)) + { + return new Version(1, 0); + } + + return version; + } + + private CheckForUpdateResult CheckForUpdateResult(RootObject obj, Version minVersion, string assetFilename, string packageName, string targetFilename) + { + Version version; + var versionString = obj.tag_name; + if (!Version.TryParse(versionString, out version)) + { + return null; + } + + if (version < minVersion) + { + return null; + } + + var asset = (obj.assets ?? new List()).FirstOrDefault(i => IsAsset(i, assetFilename, versionString)); + + if (asset == null) + { + return null; + } + + return new CheckForUpdateResult + { + AvailableVersion = version.ToString(), + IsUpdateAvailable = version > minVersion, + Package = new PackageVersionInfo + { + classification = obj.prerelease ? + (obj.name.EndsWith("-dev", StringComparison.OrdinalIgnoreCase) ? PackageVersionClass.Dev : PackageVersionClass.Beta) : + PackageVersionClass.Release, + name = packageName, + sourceUrl = asset.browser_download_url, + targetFilename = targetFilename, + versionStr = version.ToString(), + requiredVersionStr = "1.0.0", + description = obj.body, + infoUrl = obj.html_url + } + }; + } + + private bool IsAsset(Asset asset, string assetFilename, string version) + { + var downloadFilename = Path.GetFileName(asset.browser_download_url) ?? string.Empty; + + assetFilename = assetFilename.Replace("{version}", version); + + if (downloadFilename.IndexOf(assetFilename, StringComparison.OrdinalIgnoreCase) != -1) + { + return true; + } + + return string.Equals(assetFilename, downloadFilename, StringComparison.OrdinalIgnoreCase); + } + + public class Uploader + { + public string login { get; set; } + public int id { get; set; } + public string avatar_url { get; set; } + public string gravatar_id { get; set; } + public string url { get; set; } + public string html_url { get; set; } + public string followers_url { get; set; } + public string following_url { get; set; } + public string gists_url { get; set; } + public string starred_url { get; set; } + public string subscriptions_url { get; set; } + public string organizations_url { get; set; } + public string repos_url { get; set; } + public string events_url { get; set; } + public string received_events_url { get; set; } + public string type { get; set; } + public bool site_admin { get; set; } + } + + public class Asset + { + public string url { get; set; } + public int id { get; set; } + public string name { get; set; } + public object label { get; set; } + public Uploader uploader { get; set; } + public string content_type { get; set; } + public string state { get; set; } + public int size { get; set; } + public int download_count { get; set; } + public string created_at { get; set; } + public string updated_at { get; set; } + public string browser_download_url { get; set; } + } + + public class Author + { + public string login { get; set; } + public int id { get; set; } + public string avatar_url { get; set; } + public string gravatar_id { get; set; } + public string url { get; set; } + public string html_url { get; set; } + public string followers_url { get; set; } + public string following_url { get; set; } + public string gists_url { get; set; } + public string starred_url { get; set; } + public string subscriptions_url { get; set; } + public string organizations_url { get; set; } + public string repos_url { get; set; } + public string events_url { get; set; } + public string received_events_url { get; set; } + public string type { get; set; } + public bool site_admin { get; set; } + } + + public class RootObject + { + public string url { get; set; } + public string assets_url { get; set; } + public string upload_url { get; set; } + public string html_url { get; set; } + public int id { get; set; } + public string tag_name { get; set; } + public string target_commitish { get; set; } + public string name { get; set; } + public bool draft { get; set; } + public Author author { get; set; } + public bool prerelease { get; set; } + public string created_at { get; set; } + public string published_at { get; set; } + public List assets { get; set; } + public string tarball_url { get; set; } + public string zipball_url { get; set; } + public string body { get; set; } + } + } +} diff --git a/MediaBrowser.Common/Updates/IInstallationManager.cs b/MediaBrowser.Common/Updates/IInstallationManager.cs new file mode 100644 index 0000000000..dab38b27c2 --- /dev/null +++ b/MediaBrowser.Common/Updates/IInstallationManager.cs @@ -0,0 +1,121 @@ +using MediaBrowser.Common.Plugins; +using MediaBrowser.Model.Events; +using MediaBrowser.Model.Updates; +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Common.Updates +{ + public interface IInstallationManager : IDisposable + { + event EventHandler PackageInstalling; + event EventHandler PackageInstallationCompleted; + event EventHandler PackageInstallationFailed; + event EventHandler PackageInstallationCancelled; + + /// + /// The current installations + /// + List> CurrentInstallations { get; set; } + + /// + /// The completed installations + /// + IEnumerable CompletedInstallations { get; } + + /// + /// Occurs when [plugin uninstalled]. + /// + event EventHandler> PluginUninstalled; + + /// + /// Occurs when [plugin updated]. + /// + event EventHandler>> PluginUpdated; + + /// + /// Occurs when [plugin updated]. + /// + event EventHandler> PluginInstalled; + + /// + /// Gets all available packages. + /// + /// The cancellation token. + /// if set to true [with registration]. + /// Type of the package. + /// The application version. + /// Task{List{PackageInfo}}. + Task> GetAvailablePackages(CancellationToken cancellationToken, + bool withRegistration = true, + string packageType = null, + Version applicationVersion = null); + + /// + /// Gets all available packages from a static resource. + /// + /// The cancellation token. + /// Task{List{PackageInfo}}. + Task> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken); + + /// + /// Gets the package. + /// + /// The name. + /// The assembly guid + /// The classification. + /// The version. + /// Task{PackageVersionInfo}. + Task GetPackage(string name, string guid, PackageVersionClass classification, Version version); + + /// + /// Gets the latest compatible version. + /// + /// The name. + /// The assembly guid + /// The current server version. + /// The classification. + /// Task{PackageVersionInfo}. + Task GetLatestCompatibleVersion(string name, string guid, Version currentServerVersion, PackageVersionClass classification = PackageVersionClass.Release); + + /// + /// Gets the latest compatible version. + /// + /// The available packages. + /// The name. + /// The assembly guid + /// The current server version. + /// The classification. + /// PackageVersionInfo. + PackageVersionInfo GetLatestCompatibleVersion(IEnumerable availablePackages, string name, string guid, Version currentServerVersion, PackageVersionClass classification = PackageVersionClass.Release); + + /// + /// Gets the available plugin updates. + /// + /// The current server version. + /// if set to true [with auto update enabled]. + /// The cancellation token. + /// Task{IEnumerable{PackageVersionInfo}}. + Task> GetAvailablePluginUpdates(Version applicationVersion, bool withAutoUpdateEnabled, CancellationToken cancellationToken); + + /// + /// Installs the package. + /// + /// The package. + /// if set to true [is plugin]. + /// The progress. + /// The cancellation token. + /// Task. + /// package + Task InstallPackage(PackageVersionInfo package, bool isPlugin, IProgress progress, CancellationToken cancellationToken); + + /// + /// Uninstalls a plugin + /// + /// The plugin. + /// + void UninstallPlugin(IPlugin plugin); + } +} \ No newline at end of file diff --git a/MediaBrowser.Common/Updates/InstallationEventArgs.cs b/MediaBrowser.Common/Updates/InstallationEventArgs.cs new file mode 100644 index 0000000000..9dc8ead835 --- /dev/null +++ b/MediaBrowser.Common/Updates/InstallationEventArgs.cs @@ -0,0 +1,11 @@ +using MediaBrowser.Model.Updates; + +namespace MediaBrowser.Common.Updates +{ + public class InstallationEventArgs + { + public InstallationInfo InstallationInfo { get; set; } + + public PackageVersionInfo PackageVersionInfo { get; set; } + } +} diff --git a/MediaBrowser.Common/Updates/InstallationFailedEventArgs.cs b/MediaBrowser.Common/Updates/InstallationFailedEventArgs.cs new file mode 100644 index 0000000000..69dc1ee982 --- /dev/null +++ b/MediaBrowser.Common/Updates/InstallationFailedEventArgs.cs @@ -0,0 +1,9 @@ +using System; + +namespace MediaBrowser.Common.Updates +{ + public class InstallationFailedEventArgs : InstallationEventArgs + { + public Exception Exception { get; set; } + } +} \ No newline at end of file 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