public void authStationTest() { //** bool result = handler.authStation(stationId, authCode); Assert.AreEqual(result, true); }
//-------------------------------------------------------------------------------------------- /// <summary> /// Recording loop, called in main loop. Called by timer to start every hour on the hour. /// </summary> public async void record(Object obj = null) { int count = 0; while (!recordStop) { Console.WriteLine("\n\n\n"); Console.WriteLine("---------------- " + ++count + " -------------------"); StatusMessage = "Creating new recording at " + DateTime.Now + "..."; LogWriter.Write("Creating new recording at " + DateTime.Now + "..."); Console.WriteLine("\n\n\n"); String localFileName = ""; timeLeft = (uint)setRecordingTime(); //timeLeft = 5; // ### ADD BACK IN ON RELEASE // Get the bitrate through authStation, in case it has been updated. var handler = new BroadcastLoggerHandler(); bool succeeded = handler.authStation(stationId, authCode); if (succeeded) { bitRate = handler.BitRate; } else { StatusMessage = handler.ErrorMessage + "\nBacklogging record."; LogWriter.Write("Backlogging record"); } localFileName = new FFmpegHandler("ffmpeg", "ffmpeg.exe") .beginRecording(audioDevice, timeLeft, bitRate); storage.AddToQueue(stationId, localFileName); await Task.Delay((int)timeLeft * 1000); } }
/// <summary> /// Calls authStation handler and updates status if success. /// </summary> /// <param name="handler">BroadcastLoggerHandler instance.</param> /// <param name="cur">Current item in queue.</param> private void authHelper(BroadcastLoggerHandler handler, StorageResult cur) { // boolean var is used to help with code clarity. // handler has a Status property, but we used this var to avoid // the possibility of overwriting the property. bool succeeded = handler.authStation(cur.StationID, authCode); if (succeeded) { cur.Status = Status.AUTHORIZED; storage.UpdateStatus(Int32.Parse(cur.UploadID), Status.AUTHORIZED); } }
//-------------------------------------------------------------------------------------------- /// <summary> /// Setup database/queue. /// </summary> public void Initialization() { //ffmpegFirst = new FFmpegHandler("ffmpeg", "ffmpeg.exe"); //ffmpegSecond = new FFmpegHandler("ffmpeg", "ffmpeg.exe"); //ffmpegFirst.FinishedRecording += ffmpegFirst_FinishedRecording; storage = new Storage(); //storage2 = new Storage(); var handler = new BroadcastLoggerHandler(); handler.authStation(stationId, authCode); BitRate = handler.BitRate; storage.AddStation(stationId, authCode); storage.SetStationName(stationId, "Example DB"); //ffmpegFirstDone = true; //ffmpegSecondDone = true; }