Exemple #1
0
 public Device(DeviceInfo deviceProperties, IHttpClient httpClient, ILogger logger, IServerConfigurationManager config)
 {
     Properties = deviceProperties;
     _httpClient = httpClient;
     _logger = logger;
     _config = config;
 }
        public MusicBrainzAlbumProvider(ILogManager logManager, IServerConfigurationManager configurationManager, IHttpClient httpClient)
            : base(logManager, configurationManager)
        {
            _httpClient = httpClient;

            Current = this;
        }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ImageSaver" /> class.
 /// </summary>
 /// <param name="config">The config.</param>
 /// <param name="libraryMonitor">The directory watchers.</param>
 /// <param name="fileSystem">The file system.</param>
 /// <param name="logger">The logger.</param>
 public ImageSaver(IServerConfigurationManager config, ILibraryMonitor libraryMonitor, IFileSystem fileSystem, ILogger logger)
 {
     _config = config;
     _libraryMonitor = libraryMonitor;
     _fileSystem = fileSystem;
     _logger = logger;
 }
 public FanArtSeasonProvider(IServerConfigurationManager config, IHttpClient httpClient, IFileSystem fileSystem, IJsonSerializer json)
 {
     _config = config;
     _httpClient = httpClient;
     _fileSystem = fileSystem;
     _json = json;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ImageSaver"/> class.
 /// </summary>
 /// <param name="config">The config.</param>
 /// <param name="directoryWatchers">The directory watchers.</param>
 public ImageSaver(IServerConfigurationManager config, IDirectoryWatchers directoryWatchers, IFileSystem fileSystem)
 {
     _config = config;
     _directoryWatchers = directoryWatchers;
     _fileSystem = fileSystem;
     _remoteImageCache = new FileSystemRepository(config.ApplicationPaths.DownloadedImagesDataPath);
 }
Exemple #6
0
 public HdHomerunDiscovery(IDeviceDiscovery deviceDiscovery, IServerConfigurationManager config, ILogger logger, ILiveTvManager liveTvManager)
 {
     _deviceDiscovery = deviceDiscovery;
     _config = config;
     _logger = logger;
     _liveTvManager = liveTvManager;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SessionManager"/> class.
 /// </summary>
 /// <param name="userDataRepository">The user data repository.</param>
 /// <param name="configurationManager">The configuration manager.</param>
 /// <param name="logger">The logger.</param>
 /// <param name="userRepository">The user repository.</param>
 public SessionManager(IUserDataRepository userDataRepository, IServerConfigurationManager configurationManager, ILogger logger, IUserRepository userRepository)
 {
     _userDataRepository = userDataRepository;
     _configurationManager = configurationManager;
     _logger = logger;
     _userRepository = userRepository;
 }
 public EpisodeProviderFromXml(ILogManager logManager, IServerConfigurationManager configurationManager, IItemRepository itemRepo, IFileSystem fileSystem)
     : base(logManager, configurationManager)
 {
     _itemRepo = itemRepo;
     _fileSystem = fileSystem;
     Current = this;
 }
 public FanArtMovieUpdatesPrescanTask(IJsonSerializer jsonSerializer, IServerConfigurationManager config, ILogger logger, IHttpClient httpClient)
 {
     _jsonSerializer = jsonSerializer;
     _config = config;
     _logger = logger;
     _httpClient = httpClient;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindow" /> class.
        /// </summary>
        /// <param name="logManager">The log manager.</param>
        /// <param name="appHost">The app host.</param>
        /// <param name="configurationManager">The configuration manager.</param>
        /// <param name="userManager">The user manager.</param>
        /// <param name="libraryManager">The library manager.</param>
        /// <param name="jsonSerializer">The json serializer.</param>
        /// <param name="displayPreferencesManager">The display preferences manager.</param>
        /// <exception cref="System.ArgumentNullException">logger</exception>
        public MainWindow(ILogManager logManager, IServerApplicationHost appHost, IServerConfigurationManager configurationManager, IUserManager userManager, ILibraryManager libraryManager, IJsonSerializer jsonSerializer, IDisplayPreferencesRepository displayPreferencesManager)
        {
            if (logManager == null)
            {
                throw new ArgumentNullException("logManager");
            }
            if (appHost == null)
            {
                throw new ArgumentNullException("appHost");
            }
            if (configurationManager == null)
            {
                throw new ArgumentNullException("configurationManager");
            }

            _logger = logManager.GetLogger("MainWindow");
            _appHost = appHost;
            _logManager = logManager;
            _configurationManager = configurationManager;
            _userManager = userManager;
            _libraryManager = libraryManager;
            _jsonSerializer = jsonSerializer;
            _displayPreferencesManager = displayPreferencesManager;

            InitializeComponent();

            Loaded += MainWindowLoaded;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="FanArtAlbumProvider"/> class.
 /// </summary>
 /// <param name="httpClient">The HTTP client.</param>
 /// <param name="logManager">The log manager.</param>
 /// <param name="configurationManager">The configuration manager.</param>
 /// <param name="providerManager">The provider manager.</param>
 public FanArtAlbumProvider(IHttpClient httpClient, ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager, IFileSystem fileSystem)
     : base(logManager, configurationManager)
 {
     _providerManager = providerManager;
     _fileSystem = fileSystem;
     HttpClient = httpClient;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="StartupWizard" /> class.
 /// </summary>
 /// <param name="appHost">The app host.</param>
 /// <param name="userManager">The user manager.</param>
 public StartupWizard(IServerApplicationHost appHost, IUserManager userManager, IServerConfigurationManager configurationManager, ILogger logger)
 {
     _appHost = appHost;
     _logger = logger;
     _userManager = userManager;
     _configurationManager = configurationManager;
 }
 public EpisodeXmlProvider(IItemRepository itemRepository, IServerConfigurationManager config, ILibraryManager libraryManager, IFileSystem fileSystem)
 {
     _itemRepository = itemRepository;
     _config = config;
     _libraryManager = libraryManager;
     _fileSystem = fileSystem;
 }
Exemple #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PeopleValidator" /> class.
 /// </summary>
 /// <param name="libraryManager">The library manager.</param>
 /// <param name="logger">The logger.</param>
 public PeopleValidator(ILibraryManager libraryManager, ILogger logger, IServerConfigurationManager config, IFileSystem fileSystem)
 {
     _libraryManager = libraryManager;
     _logger = logger;
     _config = config;
     _fileSystem = fileSystem;
 }
 public ItemImageProvider(ILogger logger, IProviderManager providerManager, IServerConfigurationManager config, IFileSystem fileSystem)
 {
     _logger = logger;
     _providerManager = providerManager;
     _config = config;
     _fileSystem = fileSystem;
 }
 public TvMazeSeasonImageProvider(IJsonSerializer jsonSerializer, IServerConfigurationManager config, IHttpClient httpClient, IFileSystem fileSystem)
 {
     _config = config;
     _httpClient = httpClient;
     _fileSystem = fileSystem;
     _jsonSerializer = jsonSerializer;
 }
 public AuthService(IUserManager userManager, ISessionManager sessionManager, IAuthorizationContext authorizationContext, IServerConfigurationManager config)
 {
     AuthorizationContext = authorizationContext;
     _config = config;
     SessionManager = sessionManager;
     UserManager = userManager;
 }
Exemple #18
0
 public FanartAlbumProvider(IServerConfigurationManager config, IHttpClient httpClient, IFileSystem fileSystem, IJsonSerializer jsonSerializer)
 {
     _config = config;
     _httpClient = httpClient;
     _fileSystem = fileSystem;
     _jsonSerializer = jsonSerializer;
 }
Exemple #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserManager" /> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="configurationManager">The configuration manager.</param>
 /// <param name="userRepository">The user repository.</param>
 public UserManager(ILogger logger, IServerConfigurationManager configurationManager, IUserRepository userRepository)
 {
     _logger = logger;
     UserRepository = userRepository;
     ConfigurationManager = configurationManager;
     Users = new List<User>();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MovieDbImagesProvider"/> class.
 /// </summary>
 /// <param name="logManager">The log manager.</param>
 /// <param name="configurationManager">The configuration manager.</param>
 /// <param name="providerManager">The provider manager.</param>
 /// <param name="jsonSerializer">The json serializer.</param>
 /// <param name="httpClient">The HTTP client.</param>
 public MovieDbImagesProvider(ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager, IJsonSerializer jsonSerializer, IHttpClient httpClient)
     : base(logManager, configurationManager)
 {
     _providerManager = providerManager;
     _jsonSerializer = jsonSerializer;
     _httpClient = httpClient;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LastfmArtistProvider"/> class.
 /// </summary>
 /// <param name="jsonSerializer">The json serializer.</param>
 /// <param name="httpClient">The HTTP client.</param>
 /// <param name="logManager">The log manager.</param>
 /// <param name="configurationManager">The configuration manager.</param>
 /// <param name="providerManager">The provider manager.</param>
 /// <param name="libraryManager">The library manager.</param>
 public LastfmArtistProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager, ILibraryManager libraryManager)
     : base(jsonSerializer, httpClient, logManager, configurationManager)
 {
     _providerManager = providerManager;
     LibraryManager = libraryManager;
     LocalMetaFileName = LastfmHelper.LocalArtistMetaFileName;
 }
 public SubtitleScheduledTask(ILibraryManager libraryManager, IServerConfigurationManager config, ISubtitleManager subtitleManager, ILogger logger)
 {
     _libraryManager = libraryManager;
     _config = config;
     _subtitleManager = subtitleManager;
     _logger = logger;
 }
Exemple #23
0
 public SharingManager(SharingRepository repository, IServerConfigurationManager config, ILibraryManager libraryManager, IServerApplicationHost appHost)
 {
     _repository = repository;
     _config = config;
     _libraryManager = libraryManager;
     _appHost = appHost;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UdpServerEntryPoint"/> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="networkManager">The network manager.</param>
 /// <param name="serverConfigurationManager">The server configuration manager.</param>
 /// <param name="httpServer">The HTTP server.</param>
 public UdpServerEntryPoint(ILogger logger, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager, IHttpServer httpServer)
 {
     _logger = logger;
     _networkManager = networkManager;
     _serverConfigurationManager = serverConfigurationManager;
     _httpServer = httpServer;
 }
 public DummySeasonProvider(IServerConfigurationManager config, ILogger logger, ILocalizationManager localization, ILibraryManager libraryManager)
 {
     _config = config;
     _logger = logger;
     _localization = localization;
     _libraryManager = libraryManager;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TvdbPrescanTask"/> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="httpClient">The HTTP client.</param>
 /// <param name="config">The config.</param>
 public TvdbPrescanTask(ILogger logger, IHttpClient httpClient, IServerConfigurationManager config, IFileSystem fileSystem)
 {
     _logger = logger;
     _httpClient = httpClient;
     _config = config;
     _fileSystem = fileSystem;
 }
 public DlnaEntryPoint(IServerConfigurationManager config, 
     ILogManager logManager, 
     IServerApplicationHost appHost, 
     INetworkManager network, 
     ISessionManager sessionManager, 
     IHttpClient httpClient, 
     ILibraryManager libraryManager, 
     IUserManager userManager, 
     IDlnaManager dlnaManager, 
     IImageProcessor imageProcessor, 
     IUserDataManager userDataManager, 
     ILocalizationManager localization, 
     IMediaSourceManager mediaSourceManager, 
     ISsdpHandler ssdpHandler)
 {
     _config = config;
     _appHost = appHost;
     _network = network;
     _sessionManager = sessionManager;
     _httpClient = httpClient;
     _libraryManager = libraryManager;
     _userManager = userManager;
     _dlnaManager = dlnaManager;
     _imageProcessor = imageProcessor;
     _userDataManager = userDataManager;
     _localization = localization;
     _mediaSourceManager = mediaSourceManager;
     _ssdpHandler = (SsdpHandler)ssdpHandler;
     _logger = logManager.GetLogger("Dlna");
 }
Exemple #28
0
        public DeviceDiscovery(ILogger logger, IServerConfigurationManager config)
        {
            _tokenSource = new CancellationTokenSource();

            _logger = logger;
            _config = config;
        }
 public MissingEpisodeProvider(ILogger logger, IServerConfigurationManager config, ILibraryManager libraryManager, ILocalizationManager localization)
 {
     _logger = logger;
     _config = config;
     _libraryManager = libraryManager;
     _localization = localization;
 }
        /// <summary>
        /// Opens the dashboard page.
        /// </summary>
        /// <param name="page">The page.</param>
        /// <param name="loggedInUser">The logged in user.</param>
        /// <param name="configurationManager">The configuration manager.</param>
        /// <param name="appHost">The app host.</param>
        /// <param name="logger">The logger.</param>
        public static void OpenDashboardPage(string page, User loggedInUser, IServerConfigurationManager configurationManager, IServerApplicationHost appHost, ILogger logger)
        {
            var url = "http://localhost:" + configurationManager.Configuration.HttpServerPortNumber + "/" +
                      appHost.WebApplicationName + "/dashboard/" + page;

            OpenUrl(url, logger);
        }
 public MovieXmlSaver(IItemRepository itemRepository, IServerConfigurationManager config)
 {
     _itemRepository = itemRepository;
     _config         = config;
 }
 public HlsSegmentService(IServerApplicationPaths appPaths, IServerConfigurationManager config)
 {
     _appPaths = appPaths;
     _config   = config;
 }
 public ImagesByNameImageProvider(IFileSystem fileSystem, IServerConfigurationManager config)
 {
     _fileSystem = fileSystem;
     _config     = config;
 }
Exemple #34
0
 public AudioEncoder(MediaEncoder mediaEncoder, ILogger logger, IServerConfigurationManager configurationManager, IFileSystem fileSystem, IIsoManager isoManager, ILibraryManager libraryManager, ISessionManager sessionManager, ISubtitleEncoder subtitleEncoder, IMediaSourceManager mediaSourceManager) : base(mediaEncoder, logger, configurationManager, fileSystem, isoManager, libraryManager, sessionManager, subtitleEncoder, mediaSourceManager)
 {
 }
Exemple #35
0
 public OmdbItemProvider(IJsonSerializer jsonSerializer, IApplicationHost appHost, IHttpClient httpClient, ILogger logger, ILibraryManager libraryManager, IFileSystem fileSystem, IServerConfigurationManager configurationManager)
 {
     _jsonSerializer       = jsonSerializer;
     _httpClient           = httpClient;
     _logger               = logger;
     _libraryManager       = libraryManager;
     _fileSystem           = fileSystem;
     _configurationManager = configurationManager;
     _appHost              = appHost;
 }
Exemple #36
0
 public UserService(IUserManager userManager, ISessionManager sessionMananger, IServerConfigurationManager config, INetworkManager networkManager, IDeviceManager deviceManager, IAuthorizationContext authContext)
 {
     _userManager     = userManager;
     _sessionMananger = sessionMananger;
     _config          = config;
     _networkManager  = networkManager;
     _deviceManager   = deviceManager;
     _authContext     = authContext;
 }
Exemple #37
0
 public FFProbeProvider(ILogger logger, IIsoManager isoManager, IMediaEncoder mediaEncoder, IItemRepository itemRepo, IBlurayExaminer blurayExaminer, ILocalizationManager localization, IApplicationPaths appPaths, IJsonSerializer json, IEncodingManager encodingManager, IFileSystem fileSystem, IServerConfigurationManager config, ISubtitleManager subtitleManager, IChapterManager chapterManager, ILibraryManager libraryManager)
 {
     _logger          = logger;
     _isoManager      = isoManager;
     _mediaEncoder    = mediaEncoder;
     _itemRepo        = itemRepo;
     _blurayExaminer  = blurayExaminer;
     _localization    = localization;
     _appPaths        = appPaths;
     _json            = json;
     _encodingManager = encodingManager;
     _fileSystem      = fileSystem;
     _config          = config;
     _subtitleManager = subtitleManager;
     _chapterManager  = chapterManager;
     _libraryManager  = libraryManager;
 }
Exemple #38
0
 public PlayToManager(ILogger logger, ISessionManager sessionManager, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IServerApplicationHost appHost, IImageProcessor imageProcessor, IDeviceDiscovery deviceDiscovery, IHttpClient httpClient, IServerConfigurationManager config, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, IMediaEncoder mediaEncoder, ITimerFactory timerFactory)
 {
     _logger             = logger;
     _sessionManager     = sessionManager;
     _libraryManager     = libraryManager;
     _userManager        = userManager;
     _dlnaManager        = dlnaManager;
     _appHost            = appHost;
     _imageProcessor     = imageProcessor;
     _deviceDiscovery    = deviceDiscovery;
     _httpClient         = httpClient;
     _config             = config;
     _userDataManager    = userDataManager;
     _localization       = localization;
     _mediaSourceManager = mediaSourceManager;
     _mediaEncoder       = mediaEncoder;
     _timerFactory       = timerFactory;
 }
Exemple #39
0
 public OmdbImageProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, IFileSystem fileSystem, IServerConfigurationManager configurationManager)
 {
     _jsonSerializer       = jsonSerializer;
     _httpClient           = httpClient;
     _fileSystem           = fileSystem;
     _configurationManager = configurationManager;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MoviesService" /> class.
 /// </summary>
 /// <param name="userManager">The user manager.</param>
 /// <param name="userDataRepository">The user data repository.</param>
 /// <param name="libraryManager">The library manager.</param>
 /// <param name="itemRepo">The item repo.</param>
 /// <param name="dtoService">The dto service.</param>
 public MoviesService(IUserManager userManager, IUserDataManager userDataRepository, ILibraryManager libraryManager, IItemRepository itemRepo, IDtoService dtoService, IServerConfigurationManager config)
 {
     _userManager        = userManager;
     _userDataRepository = userDataRepository;
     _libraryManager     = libraryManager;
     _itemRepo           = itemRepo;
     _dtoService         = dtoService;
     _config             = config;
 }
Exemple #41
0
        public FFProbeVideoInfoProvider(IIsoManager isoManager, IBlurayExaminer blurayExaminer, IJsonSerializer jsonSerializer, ILogManager logManager, IServerConfigurationManager configurationManager, IMediaEncoder mediaEncoder, ILocalizationManager localization, IItemRepository itemRepo)
            : base(logManager, configurationManager, mediaEncoder, jsonSerializer)
        {
            if (isoManager == null)
            {
                throw new ArgumentNullException("isoManager");
            }
            if (blurayExaminer == null)
            {
                throw new ArgumentNullException("blurayExaminer");
            }

            _blurayExaminer = blurayExaminer;
            _localization   = localization;
            _itemRepo       = itemRepo;
            _isoManager     = isoManager;
        }
 public ChannelMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager)
 {
 }
Exemple #43
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SeasonResolver"/> class.
 /// </summary>
 /// <param name="config">The config.</param>
 public SeasonResolver(IServerConfigurationManager config, ILibraryManager libraryManager, ILocalizationManager localization)
 {
     _config         = config;
     _libraryManager = libraryManager;
     _localization   = localization;
 }
Exemple #44
0
 public XmlTvListingsProvider(IServerConfigurationManager config, IHttpClient httpClient, ILogger logger)
 {
     _config     = config;
     _httpClient = httpClient;
     _logger     = logger;
 }
Exemple #45
0
 public StudiosImageProvider(IServerConfigurationManager config, IHttpClient httpClient, IFileSystem fileSystem)
 {
     _config     = config;
     _httpClient = httpClient;
     _fileSystem = fileSystem;
 }
Exemple #46
0
 public MissingEpisodeProvider(ILogger logger, IServerConfigurationManager config, ILibraryManager libraryManager)
 {
     _logger         = logger;
     _config         = config;
     _libraryManager = libraryManager;
 }
 public MovieDbEpisodeProvider(IHttpClient httpClient, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IFileSystem fileSystem, ILocalizationManager localization, ILogManager logManager)
     : base(httpClient, configurationManager, jsonSerializer, fileSystem, localization, logManager)
 {
 }
 public BoxSetMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, ILibraryManager libraryManager, ILocalizationManager iLocalizationManager)
     : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem)
 {
     _libraryManager       = libraryManager;
     _iLocalizationManager = iLocalizationManager;
 }
Exemple #49
0
 public NotificationManager(ILoggerFactory loggerFactory, IUserManager userManager, IServerConfigurationManager config)
 {
     _userManager = userManager;
     _config      = config;
     _logger      = loggerFactory.CreateLogger(GetType().Name);
 }
 public MovieDbPersonImageProvider(IServerConfigurationManager config, IJsonSerializer jsonSerializer, IHttpClient httpClient)
 {
     _config         = config;
     _jsonSerializer = jsonSerializer;
     _httpClient     = httpClient;
 }
 public MusicVideoMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager)
 {
 }
Exemple #52
0
 public CollectionsViewMigration(IServerConfigurationManager config, IUserManager userManager)
 {
     _config = config;
     _userManager = userManager;
 }
Exemple #53
0
 public TmdbPersonProvider(IHttpClient httpClient, IJsonSerializer jsonSerializer, ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager)
     : base(logManager, configurationManager)
 {
     if (jsonSerializer == null)
     {
         throw new ArgumentNullException("jsonSerializer");
     }
     if (httpClient == null)
     {
         throw new ArgumentNullException("httpClient");
     }
     HttpClient      = httpClient;
     JsonSerializer  = jsonSerializer;
     ProviderManager = providerManager;
 }
Exemple #54
0
 public AuthenticationRepository(ILogger logger, IServerConfigurationManager config)
     : base(logger)
 {
     _config    = config;
     DbFilePath = Path.Combine(config.ApplicationPaths.DataPath, "authentication.db");
 }
Exemple #55
0
        private static void AddActors(List <PersonInfo> people, XmlWriter writer, ILibraryManager libraryManager, IFileSystem fileSystem, IServerConfigurationManager config)
        {
            var actors = people
                         .Where(i => !IsPersonType(i, PersonType.Director) && !IsPersonType(i, PersonType.Writer))
                         .ToList();

            foreach (var person in actors)
            {
                writer.WriteStartElement("actor");

                if (!string.IsNullOrWhiteSpace(person.Name))
                {
                    writer.WriteElementString("name", person.Name);
                }

                if (!string.IsNullOrWhiteSpace(person.Role))
                {
                    writer.WriteElementString("role", person.Role);
                }

                if (!string.IsNullOrWhiteSpace(person.Type))
                {
                    writer.WriteElementString("type", person.Type);
                }

                if (person.SortOrder.HasValue)
                {
                    writer.WriteElementString("sortorder", person.SortOrder.Value.ToString(UsCulture));
                }

                try
                {
                    var personEntity = libraryManager.GetPerson(person.Name);
                    var image        = personEntity.GetImageInfo(ImageType.Primary, 0);

                    if (image != null && image.IsLocalFile)
                    {
                        writer.WriteElementString("thumb", GetPathToSave(image.Path, libraryManager, config));
                    }
                }
                catch (Exception)
                {
                    // Already logged in core
                }

                writer.WriteEndElement();
            }
        }
Exemple #56
0
 public TvdbPersonImageProvider(ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager)
     : base(logManager, configurationManager)
 {
     _providerManager = providerManager;
 }
Exemple #57
0
        /// <summary>
        /// Adds the common nodes.
        /// </summary>
        /// <returns>Task.</returns>
        public static void AddCommonNodes(BaseItem item, XmlWriter writer, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataRepo, IFileSystem fileSystem, IServerConfigurationManager config)
        {
            var overview = (item.Overview ?? string.Empty)
                           .StripHtml()
                           .Replace("&quot;", "'");

            var options = config.GetNfoConfiguration();

            if (item is MusicArtist)
            {
                writer.WriteElementString("biography", overview);
            }
            else if (item is MusicAlbum)
            {
                writer.WriteElementString("review", overview);
            }
            else
            {
                writer.WriteElementString("plot", overview);
            }

            var hasShortOverview = item as IHasShortOverview;

            if (hasShortOverview != null)
            {
                var outline = (hasShortOverview.ShortOverview ?? string.Empty)
                              .StripHtml()
                              .Replace("&quot;", "'");

                writer.WriteElementString("outline", outline);
            }
            else
            {
                writer.WriteElementString("outline", overview);
            }

            if (!string.IsNullOrWhiteSpace(item.CustomRating))
            {
                writer.WriteElementString("customrating", item.CustomRating);
            }

            writer.WriteElementString("lockdata", item.IsLocked.ToString().ToLower());

            if (item.LockedFields.Count > 0)
            {
                writer.WriteElementString("lockedfields", string.Join("|", item.LockedFields.Select(i => i.ToString()).ToArray()));
            }

            if (!string.IsNullOrEmpty(item.DisplayMediaType))
            {
                writer.WriteElementString("type", item.DisplayMediaType);
            }

            writer.WriteElementString("dateadded", item.DateCreated.ToLocalTime().ToString(DateAddedFormat));

            writer.WriteElementString("title", item.Name ?? string.Empty);
            writer.WriteElementString("originaltitle", item.Name ?? string.Empty);

            var hasOriginalTitle = item as IHasOriginalTitle;

            if (hasOriginalTitle != null)
            {
                if (!string.IsNullOrEmpty(hasOriginalTitle.OriginalTitle))
                {
                    writer.WriteElementString("originaltitle", hasOriginalTitle.OriginalTitle ?? string.Empty);
                }
            }

            var people = libraryManager.GetPeople(item);

            var directors = people
                            .Where(i => IsPersonType(i, PersonType.Director))
                            .Select(i => i.Name)
                            .ToList();

            foreach (var person in directors)
            {
                writer.WriteElementString("director", person);
            }

            var writers = people
                          .Where(i => IsPersonType(i, PersonType.Writer))
                          .Select(i => i.Name)
                          .Distinct(StringComparer.OrdinalIgnoreCase)
                          .ToList();

            foreach (var person in writers)
            {
                writer.WriteElementString("writer", person);
            }

            foreach (var person in writers)
            {
                writer.WriteElementString("credits", person);
            }

            var hasTrailer = item as IHasTrailers;

            if (hasTrailer != null)
            {
                foreach (var trailer in hasTrailer.RemoteTrailers)
                {
                    writer.WriteElementString("trailer", GetOutputTrailerUrl(trailer.Url));
                }
            }

            if (item.CommunityRating.HasValue)
            {
                writer.WriteElementString("rating", item.CommunityRating.Value.ToString(UsCulture));
            }

            if (item.ProductionYear.HasValue)
            {
                writer.WriteElementString("year", item.ProductionYear.Value.ToString(UsCulture));
            }

            if (!string.IsNullOrEmpty(item.ForcedSortName))
            {
                writer.WriteElementString("sorttitle", item.ForcedSortName);
            }

            if (!string.IsNullOrEmpty(item.OfficialRating))
            {
                writer.WriteElementString("mpaa", item.OfficialRating);
            }

            if (!string.IsNullOrEmpty(item.OfficialRatingDescription))
            {
                writer.WriteElementString("mpaadescription", item.OfficialRatingDescription);
            }

            var hasAspectRatio = item as IHasAspectRatio;

            if (hasAspectRatio != null)
            {
                if (!string.IsNullOrEmpty(hasAspectRatio.AspectRatio))
                {
                    writer.WriteElementString("aspectratio", hasAspectRatio.AspectRatio);
                }
            }

            if (!string.IsNullOrEmpty(item.HomePageUrl))
            {
                writer.WriteElementString("website", item.HomePageUrl);
            }

            var rt = item.GetProviderId(MetadataProviders.RottenTomatoes);

            if (!string.IsNullOrEmpty(rt))
            {
                writer.WriteElementString("rottentomatoesid", rt);
            }

            var tmdbCollection = item.GetProviderId(MetadataProviders.TmdbCollection);

            if (!string.IsNullOrEmpty(tmdbCollection))
            {
                writer.WriteElementString("collectionnumber", tmdbCollection);
            }

            var imdb = item.GetProviderId(MetadataProviders.Imdb);

            if (!string.IsNullOrEmpty(imdb))
            {
                if (item is Series)
                {
                    writer.WriteElementString("imdb_id", imdb);
                }
                else
                {
                    writer.WriteElementString("imdbid", imdb);
                }
            }

            // Series xml saver already saves this
            if (!(item is Series))
            {
                var tvdb = item.GetProviderId(MetadataProviders.Tvdb);
                if (!string.IsNullOrEmpty(tvdb))
                {
                    writer.WriteElementString("tvdbid", tvdb);
                }
            }

            var tmdb = item.GetProviderId(MetadataProviders.Tmdb);

            if (!string.IsNullOrEmpty(tmdb))
            {
                writer.WriteElementString("tmdbid", tmdb);
            }

            var tvcom = item.GetProviderId(MetadataProviders.Tvcom);

            if (!string.IsNullOrEmpty(tvcom))
            {
                writer.WriteElementString("tvcomid", tvcom);
            }

            if (!string.IsNullOrEmpty(item.PreferredMetadataLanguage))
            {
                writer.WriteElementString("language", item.PreferredMetadataLanguage);
            }
            if (!string.IsNullOrEmpty(item.PreferredMetadataCountryCode))
            {
                writer.WriteElementString("countrycode", item.PreferredMetadataCountryCode);
            }

            if (item.PremiereDate.HasValue && !(item is Episode))
            {
                var formatString = options.ReleaseDateFormat;

                if (item is MusicArtist)
                {
                    writer.WriteElementString("formed", item.PremiereDate.Value.ToString(formatString));
                }
                else
                {
                    writer.WriteElementString("premiered", item.PremiereDate.Value.ToString(formatString));
                    writer.WriteElementString("releasedate", item.PremiereDate.Value.ToString(formatString));
                }
            }

            if (item.EndDate.HasValue)
            {
                if (!(item is Episode))
                {
                    var formatString = options.ReleaseDateFormat;

                    writer.WriteElementString("enddate", item.EndDate.Value.ToString(formatString));
                }
            }

            var hasCriticRating = item as IHasCriticRating;

            if (hasCriticRating != null)
            {
                if (hasCriticRating.CriticRating.HasValue)
                {
                    writer.WriteElementString("criticrating", hasCriticRating.CriticRating.Value.ToString(UsCulture));
                }

                if (!string.IsNullOrEmpty(hasCriticRating.CriticRatingSummary))
                {
                    writer.WriteElementString("criticratingsummary", hasCriticRating.CriticRatingSummary);
                }
            }

            var hasDisplayOrder = item as IHasDisplayOrder;

            if (hasDisplayOrder != null)
            {
                if (!string.IsNullOrEmpty(hasDisplayOrder.DisplayOrder))
                {
                    writer.WriteElementString("displayorder", hasDisplayOrder.DisplayOrder);
                }
            }

            if (item.VoteCount.HasValue)
            {
                writer.WriteElementString("votes", item.VoteCount.Value.ToString(UsCulture));
            }

            var hasBudget = item as IHasBudget;

            if (hasBudget != null)
            {
                if (hasBudget.Budget.HasValue)
                {
                    writer.WriteElementString("budget", hasBudget.Budget.Value.ToString(UsCulture));
                }

                if (hasBudget.Revenue.HasValue)
                {
                    writer.WriteElementString("revenue", hasBudget.Revenue.Value.ToString(UsCulture));
                }
            }

            var hasMetascore = item as IHasMetascore;

            if (hasMetascore != null && hasMetascore.Metascore.HasValue)
            {
                writer.WriteElementString("metascore", hasMetascore.Metascore.Value.ToString(UsCulture));
            }

            // Use original runtime here, actual file runtime later in MediaInfo
            var runTimeTicks = item.RunTimeTicks;

            if (runTimeTicks.HasValue)
            {
                var timespan = TimeSpan.FromTicks(runTimeTicks.Value);

                writer.WriteElementString("runtime", Convert.ToInt32(timespan.TotalMinutes).ToString(UsCulture));
            }

            var hasTaglines = item as IHasTaglines;

            if (hasTaglines != null)
            {
                foreach (var tagline in hasTaglines.Taglines)
                {
                    writer.WriteElementString("tagline", tagline);
                }
            }

            var hasProductionLocations = item as IHasProductionLocations;

            if (hasProductionLocations != null)
            {
                foreach (var country in hasProductionLocations.ProductionLocations)
                {
                    writer.WriteElementString("country", country);
                }
            }

            foreach (var genre in item.Genres)
            {
                writer.WriteElementString("genre", genre);
            }

            foreach (var studio in item.Studios)
            {
                writer.WriteElementString("studio", studio);
            }

            var hasTags = item as IHasTags;

            if (hasTags != null)
            {
                foreach (var tag in hasTags.Tags)
                {
                    if (item is MusicAlbum || item is MusicArtist)
                    {
                        writer.WriteElementString("style", tag);
                    }
                    else
                    {
                        writer.WriteElementString("tag", tag);
                    }
                }
            }

            var hasKeywords = item as IHasKeywords;

            if (hasKeywords != null)
            {
                foreach (var tag in hasKeywords.Keywords)
                {
                    writer.WriteElementString("plotkeyword", tag);
                }
            }

            var hasAwards = item as IHasAwards;

            if (hasAwards != null && !string.IsNullOrEmpty(hasAwards.AwardSummary))
            {
                writer.WriteElementString("awardsummary", hasAwards.AwardSummary);
            }

            var externalId = item.GetProviderId(MetadataProviders.AudioDbArtist);

            if (!string.IsNullOrEmpty(externalId))
            {
                writer.WriteElementString("audiodbartistid", externalId);
            }

            externalId = item.GetProviderId(MetadataProviders.AudioDbAlbum);

            if (!string.IsNullOrEmpty(externalId))
            {
                writer.WriteElementString("audiodbalbumid", externalId);
            }

            externalId = item.GetProviderId(MetadataProviders.Zap2It);

            if (!string.IsNullOrEmpty(externalId))
            {
                writer.WriteElementString("zap2itid", externalId);
            }

            externalId = item.GetProviderId(MetadataProviders.MusicBrainzAlbum);

            if (!string.IsNullOrEmpty(externalId))
            {
                writer.WriteElementString("musicbrainzalbumid", externalId);
            }

            externalId = item.GetProviderId(MetadataProviders.MusicBrainzAlbumArtist);

            if (!string.IsNullOrEmpty(externalId))
            {
                writer.WriteElementString("musicbrainzalbumartistid", externalId);
            }

            externalId = item.GetProviderId(MetadataProviders.MusicBrainzArtist);

            if (!string.IsNullOrEmpty(externalId))
            {
                writer.WriteElementString("musicbrainzartistid", externalId);
            }

            externalId = item.GetProviderId(MetadataProviders.MusicBrainzReleaseGroup);

            if (!string.IsNullOrEmpty(externalId))
            {
                writer.WriteElementString("musicbrainzreleasegroupid", externalId);
            }

            externalId = item.GetProviderId(MetadataProviders.Gamesdb);
            if (!string.IsNullOrEmpty(externalId))
            {
                writer.WriteElementString("gamesdbid", externalId);
            }

            externalId = item.GetProviderId(MetadataProviders.TvRage);
            if (!string.IsNullOrEmpty(externalId))
            {
                writer.WriteElementString("tvrageid", externalId);
            }

            if (options.SaveImagePathsInNfo)
            {
                AddImages(item, writer, libraryManager, config);
            }

            AddUserData(item, writer, userManager, userDataRepo, options);

            AddActors(people, writer, libraryManager, fileSystem, config);

            var folder = item as BoxSet;

            if (folder != null)
            {
                AddCollectionItems(folder, writer);
            }
        }
        public OpenSubtitleDownloader(ILoggerFactory loggerFactory, IHttpClient httpClient, IServerConfigurationManager config, IJsonSerializer json, IFileSystem fileSystem)
        {
            _logger     = loggerFactory.CreateLogger(GetType().Name);
            _httpClient = httpClient;
            _config     = config;
            _json       = json;
            _fileSystem = fileSystem;

            Utilities.HttpClient = httpClient;
            OpenSubtitlesHandler.OpenSubtitles.SetUserAgent("jellyfin");
        }
Exemple #59
0
        private static string GetPathToSave(string path, ILibraryManager libraryManager, IServerConfigurationManager config)
        {
            foreach (var map in config.Configuration.PathSubstitutions)
            {
                path = libraryManager.SubstitutePath(path, map.From, map.To);
            }

            return(path);
        }
Exemple #60
0
        private static void AddImages(BaseItem item, XmlWriter writer, ILibraryManager libraryManager, IServerConfigurationManager config)
        {
            writer.WriteStartElement("art");

            var image = item.GetImageInfo(ImageType.Primary, 0);

            if (image != null && image.IsLocalFile)
            {
                writer.WriteElementString("poster", GetPathToSave(image.Path, libraryManager, config));
            }

            foreach (var backdrop in item.GetImages(ImageType.Backdrop))
            {
                if (backdrop.IsLocalFile)
                {
                    writer.WriteElementString("fanart", GetPathToSave(backdrop.Path, libraryManager, config));
                }
            }

            writer.WriteEndElement();
        }