public static FFmpegConfiguration LoadApplicationConfiguration() { FFmpegConfiguration configuration = new FFmpegConfiguration(); #region FFmpeg configuration if (ConfigurationManager.AppSettings["UseCustomFFmpeg"] == "true") { configuration.useCustomFFmpeg = true; if (ConfigurationManager.AppSettings["FFmpegLocation"] != string.Empty) { configuration.FFmpegLocation = ConfigurationManager.AppSettings["FFmpegLocation"]; } else { configuration.useCustomFFmpeg = false; } } else { configuration.useCustomFFmpeg = false; } #endregion FFmpeg configuration #region FFProbe configuration if (ConfigurationManager.AppSettings["UseCustomFFProbe"] == "true") { configuration.useCustomFFProbe = true; if (ConfigurationManager.AppSettings["FFProbeLocation"] != string.Empty) { configuration.FFProbeLocation = ConfigurationManager.AppSettings["FFProbeLocation"]; } else { configuration.useCustomFFProbe = false; } } else { configuration.useCustomFFProbe = false; } #endregion FFProbe configuration return(configuration); }
public static LogInformation GenerateLog(ProcessedVideoInformation videoInfo, VideoInformation processedVideoInformation, ProcessingInformation processingInfo, UserInformation userInfo, Requester requester) { #region Preparation DatabaseConfiguration configuration = LoadDatabaseConfiguration(); LogInformation logInformation = new LogInformation(); FFmpegConfiguration applicationConfiguration = LoadApplicationConfiguration(); #endregion Preparation #region FFmpeg's log if (applicationConfiguration.useCustomFFmpeg) { logInformation.FFmpegLocation = applicationConfiguration.FFmpegLocation; } else { logInformation.FFmpegLocation = string.Empty; } #endregion FFmpeg's log #region FFProbe's log if (applicationConfiguration.useCustomFFProbe) { logInformation.FFProbeLocation = applicationConfiguration.FFProbeLocation; } else { logInformation.FFProbeLocation = string.Empty; } #endregion FFProbe's log #region Request time logInformation.requestTime = processingInfo.processingStartTime; logInformation.finishedTime = processingInfo.processingEndTime; #endregion Request time #region UserID string userID = string.Empty; if (Peralatan.PeriksaDataDatabase(userInfo.UserSessionID, "SessionID", configuration.databaseName, configuration.userTableName, configuration.databaseConnectionString)) { userID = Peralatan.MintaDataDatabase(configuration.databaseName, "UserID", configuration.userTableName, "SessionID", userInfo.UserSessionID, configuration.databaseConnectionString); } logInformation.userID = userID; #endregion UserID #region Processed video location logInformation.processedVideoLocation = videoInfo.target; #endregion Processed video location #region Delete original file logInformation.isDeleteWhenCompleteRequested = videoInfo.deleteOriginal; #endregion Delete original file #region Processing duration logInformation.totalProcessingDuration = processingInfo.totalVideoDuration; logInformation.audioProcessingDuration = processingInfo.processedAudioDuration; logInformation.videoProcessingDuration = processingInfo.processedVideoDuration; #endregion Processing duration #region Video information logInformation.originalVideoWidth = processedVideoInformation.videoHeight; logInformation.originalVideoHeight = processedVideoInformation.videoHeight; logInformation.videoDuration = processedVideoInformation.videoDuration; logInformation.scaledVideoWidth = videoInfo.width; logInformation.scaledVideoHeight = videoInfo.height; #endregion Video information return(logInformation); }