public static UserInformation GetUserID(string SessionID) { ApplicationConfiguration applicationConfiguration = new ApplicationConfiguration(); string connectionString = ConfigurationManager.AppSettings["DatabaseConnectionString"]; UserInformation userInfo = new UserInformation(); string receivedValue = Peralatan.MintaDataDatabase("MediaPlayerDatabase", "UserID", "SessionInfo", "SessionID", SessionID, connectionString); userInfo.UserID = Convert.ToInt32(receivedValue); userInfo.UserSessionID = SessionID; #region Old worker //MintaDataDatabase mintaDataDatabase = new MintaDataDatabase("UserID", "SessionInfo", "SessionID", SessionID, connectionString); //userInfo.UserID = Convert.ToInt32(mintaDataDatabase.DataDiterima); //userInfo.UserSessionID = SessionID; #endregion Old worker return(userInfo); }
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); }
public static VideoPlayerSettings ReadPlayerSettings(string sessionID, string database, string table, string connectionString) { VideoPlayerSettings UserSettings = new VideoPlayerSettings(); string userID = Peralatan.MintaDataDatabase(database, "UserID", "SessionInfo", "SessionID", sessionID, connectionString); #region Video string receivedHeight = Peralatan.MintaDataDatabase(database, "VideoHeight", table, "UserID", userID, connectionString); if (receivedHeight == ((int)Resolution.Original).ToString()) { UserSettings.resolution = Resolution.Original; } else if (receivedHeight == ((int)Resolution.SD_360p).ToString()) { UserSettings.resolution = Resolution.SD_360p; } else if (receivedHeight == ((int)Resolution.SD_480p).ToString()) { UserSettings.resolution = Resolution.SD_480p; } else if (receivedHeight == ((int)Resolution.HD_720p).ToString()) { UserSettings.resolution = Resolution.HD_720p; } else if (receivedHeight == ((int)Resolution.HD_1080p).ToString()) { UserSettings.resolution = Resolution.HD_1080p; } else if (receivedHeight == ((int)Resolution.SUHD_1440p).ToString()) { UserSettings.resolution = Resolution.SUHD_1440p; } else { UserSettings.resolution = Resolution.SD_480p; } #endregion Video resolution #region Video framerate string receivedFrameRate = Peralatan.MintaDataDatabase(database, "FrameRate", table, "UserID", userID, connectionString); if (receivedFrameRate == ((int)FrameRate.Default).ToString()) { UserSettings.frameRate = FrameRate.Default; } else if (receivedFrameRate == ((int)FrameRate._24fps).ToString()) { UserSettings.frameRate = FrameRate._24fps; } else if (receivedFrameRate == ((int)FrameRate._30fps).ToString()) { UserSettings.frameRate = FrameRate._30fps; } else if (receivedFrameRate == ((int)FrameRate._60fps).ToString()) { UserSettings.frameRate = FrameRate._60fps; } else if (receivedFrameRate == ((int)FrameRate._120fps).ToString()) { UserSettings.frameRate = FrameRate._120fps; } else { UserSettings.frameRate = FrameRate.Default; } #endregion Video framerate #region Video buffer mode string receivedBufferMode = Peralatan.MintaDataDatabase(database, "BufferMode", table, "UserID", userID, connectionString); if (receivedBufferMode == ((int)BufferMode.SingleBuffer).ToString()) { UserSettings.bufferMode = BufferMode.SingleBuffer; } else if (receivedBufferMode == ((int)BufferMode.DoubleBuffer).ToString()) { UserSettings.bufferMode = BufferMode.DoubleBuffer; } else if (receivedBufferMode == ((int)BufferMode.TripleBuffer).ToString()) { UserSettings.bufferMode = BufferMode.TripleBuffer; } else { UserSettings.bufferMode = BufferMode.SingleBuffer; } #endregion Video buffer mode #region Video preload frames string receivedPreload = Peralatan.MintaDataDatabase(database, "PreloadFrames", table, "UserID", userID, connectionString); if (receivedPreload == ((int)PreloadFrames.DisablePreload).ToString()) { UserSettings.preloadFrames = PreloadFrames.DisablePreload; } else if (receivedPreload == ((int)PreloadFrames.EnablePreload).ToString()) { UserSettings.preloadFrames = PreloadFrames.EnablePreload; } else { UserSettings.preloadFrames = PreloadFrames.DisablePreload; } #endregion Video preload frames return(UserSettings); }