private static void CreateRandomizedJSONCollection(TMDBSnapshot tmdbSnapshot, ILogger logger) { logger.LogInformation($"DataCollector creating json collection started at: {DateTime.Now}"); RandomizedJSONSnapshot jsonSnapshot = CreateRandomizedCollection(tmdbSnapshot); string json = JsonConvert.SerializeObject(jsonSnapshot); var compressionService = new CompressionServiceImpl(); string compressedJsonData = compressionService.CompressJSONAsBase64(json); tmdbSnapshot.CompressedBase64JSONData = compressedJsonData; logger.LogInformation($"DataCollector creating json collection finished at: {DateTime.Now}"); }
private static void WriteDailyDownloadsIntoDatabase(List <DailyDownloadCollection> dailyDownloadCollections, List <DailyDownloadNetwork> dailyDownloadNetworks, List <DailyDownloadKeyword> dailyDownloadKeywords, ILogger logger) { logger.LogInformation($"TMDBDailyFileExportDownloader writing daily downloads into database started at: {DateTime.Now}"); string dailyDownloadCollectionsJSON = string.Empty; string dailyDownloadNetworksJSON = string.Empty; string dailyDownloadKeywordsJSON = string.Empty; var compressionService = new CompressionServiceImpl(); if (dailyDownloadCollections != null) { string json = JsonConvert.SerializeObject(dailyDownloadCollections); dailyDownloadCollectionsJSON = compressionService.CompressJSONAsBase64(json); } if (dailyDownloadNetworks != null) { string json = JsonConvert.SerializeObject(dailyDownloadNetworks); dailyDownloadNetworksJSON = compressionService.CompressJSONAsBase64(json); } if (dailyDownloadKeywords != null) { string json = JsonConvert.SerializeObject(dailyDownloadKeywords); dailyDownloadKeywordsJSON = compressionService.CompressJSONAsBase64(json); } if (!string.IsNullOrEmpty(dailyDownloadCollectionsJSON) && !string.IsNullOrEmpty(dailyDownloadNetworksJSON) && !string.IsNullOrEmpty(dailyDownloadKeywordsJSON)) { using var databaseService = new DatabaseServiceImpl(_databaseConnection); databaseService.WriteDailyDownloadsIntoDatabase(dailyDownloadCollectionsJSON, dailyDownloadNetworksJSON, dailyDownloadKeywordsJSON); } logger.LogInformation($"TMDBDailyFileExportDownloader writing daily downloads into database finished at: {DateTime.Now}"); }