public override void Save() { if (!Enabled) { return; } base.Save(); ISettingsManager localSettings = ServiceRegistration.Get <ISettingsManager>(); IServerSettingsClient serverSettings = ServiceRegistration.Get <IServerSettingsClient>(); MovieMetadataExtractorSettings mainSettings = serverSettings.Load <MovieMetadataExtractorSettings>(); mainSettings.IncludeActorDetails = _selected.Contains(0); mainSettings.IncludeCharacterDetails = _selected.Contains(1); mainSettings.IncludeDirectorDetails = _selected.Contains(2); mainSettings.IncludeWriterDetails = _selected.Contains(3); mainSettings.IncludeProductionCompanyDetails = _selected.Contains(4); serverSettings.Save(mainSettings); localSettings.Save(mainSettings); NfoMovieMetadataExtractorSettings nfoSettings = serverSettings.Load <NfoMovieMetadataExtractorSettings>(); nfoSettings.IncludeActorDetails = mainSettings.IncludeActorDetails; nfoSettings.IncludeCharacterDetails = mainSettings.IncludeCharacterDetails; nfoSettings.IncludeDirectorDetails = mainSettings.IncludeDirectorDetails; serverSettings.Save(nfoSettings); localSettings.Save(nfoSettings); }
/// <summary> /// Instantiates a new <see cref="NfoMovieMetadataExtractor"/> object /// </summary> public NfoMovieMetadataExtractor() { // The metadataExtractorPriority is intentionally set wrong to "Extended" although, depending on the // content of the nfo-file, it may download thumbs from the internet (and should therefore be // "External"). This is a temporary workaround for performance purposes. It ensures that this // MetadataExtractor is applied before the VideoThumbnailer (which is intentionally set to "External" // although it only uses local files). Creating thumbs with the VideoThumbnailer takes much longer // than downloading them from the internet. // ToDo: Correct this once we have a better priority system _metadata = new MetadataExtractorMetadata( metadataExtractorId: METADATAEXTRACTOR_ID, name: "Nfo movie metadata extractor", metadataExtractorPriority: MetadataExtractorPriority.Extended, processesNonFiles: true, shareCategories: MEDIA_CATEGORIES, extractedAspectTypes: new[] { MediaAspect.Metadata, VideoAspect.Metadata, MovieAspect.Metadata, ThumbnailLargeAspect.Metadata }); _settings = ServiceRegistration.Get <ISettingsManager>().Load <NfoMovieMetadataExtractorSettings>(); // The following save operation makes sure that in any case an xml-file is written for the NfoMovieMetadataExtractorSettings // ToDo: Remove this once the SettingsManager does this automatically ServiceRegistration.Get <ISettingsManager>().Save(_settings); if (_settings.EnableDebugLogging) { _debugLogger = FileLogger.CreateFileLogger(ServiceRegistration.Get <IPathManager>().GetPath(@"<LOG>\NfoMovieMetadataExtractorDebug.log"), LogLevel.Debug, false, true); LogSettings(); } else { _debugLogger = new NoLogger(); } var handler = new HttpClientHandler(); if (handler.SupportsAutomaticDecompression) { // This enables the automatic decompression of the content. It does not automatically send an "Accept-Encoding" header! // We therefore have to add the Accept-Encoding header(s) manually below. // Additionally, due to the automatic decompression, HttpResponseMessage.Content.Headers DOES NOT contain // a "Content-Encoding" header anymore when we try to access it. It is automatically removed when decompressing. handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; } else { _debugLogger.Warn("HttpClient does not support compression"); } _httpClient = new HttpClient(handler); _httpClient.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip")); _httpClient.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate")); }
public override void Save() { if (!Enabled) { return; } base.Save(); ISettingsManager localSettings = ServiceRegistration.Get <ISettingsManager>(); IServerSettingsClient serverSettings = ServiceRegistration.Get <IServerSettingsClient>(); MovieMetadataExtractorSettings settings = serverSettings.Load <MovieMetadataExtractorSettings>(); if (Selected == 0) { settings.SkipOnlineSearches = false; settings.SkipFanArtDownload = false; } else if (Selected == 1) { settings.SkipOnlineSearches = false; settings.SkipFanArtDownload = true; } else if (Selected == 2) { settings.SkipOnlineSearches = true; settings.SkipFanArtDownload = false; } else { settings.SkipOnlineSearches = true; settings.SkipFanArtDownload = true; } serverSettings.Save(settings); localSettings.Save(settings); NfoMovieMetadataExtractorSettings nfoSettings = serverSettings.Load <NfoMovieMetadataExtractorSettings>(); nfoSettings.SkipFanArtDownload = settings.SkipFanArtDownload; serverSettings.Save(nfoSettings); localSettings.Save(nfoSettings); }