Пример #1
0
        private void PrepareEncodingHistory()
        {
            Stopwatch stopwatch = ConsolePrintHelpers.PrintHeaderAndStartStopWatch();

            ConsolePrintHelpers.PrintWhiteText("  Preparing Encoding History...");

            _History = new AudioEncoderHistory(this);

            _History.ReadHistoryFromFiles();

            ConsolePrintHelpers.PrintDuration(stopwatch, "Preparing History");

            Console.WriteLine();

            _History.PrintHistoryStats();

            ConsolePrintHelpers.Wait();
        }
Пример #2
0
        public void EncodeAudioFiles()
        {
            if (!_IsQueueBuilt)
            {
                BuildEncodingQueue();
            }

            Stopwatch stopwatch = ConsolePrintHelpers.PrintHeaderAndStartStopWatch();

            ConsolePrintHelpers.PrintWhiteText("  Encoding Audio Files...");

            PrintEncodingQueueAndHistoryStats();

            _History.WriteApprovalHistoryToFile(true);

            ConsolePrintHelpers.Wait();

            CleanTranscodeTempDirectory();

            _LoadSheetUpdateInterval = Globals.InitialLoadSheetUpdateInterval;

            _ActiveEncodings.Clear();

            _FinishedEncodings.Clear();

            _WaitingEncodings.Clear();

            _EncodedFilesCount = 0;

            _CopiedFilesCount = 0;

            int encodingQueueCount = _EncodingQueues.EncodingQueue.Count;

            for (int i = 0; i < encodingQueueCount; i++)
            {
                AudioFileEncoding encoding = _EncodingQueues.EncodingQueue.Dequeue();

                CopyOrEncodeAudioFile(encoding);

                AddToActiveOrWaitingList(encoding);

                IncrementalUpdateLoadSheet();

                encoding.PrintAudioFileEncoding();

                PrintEncodingStatsHeaders();

                CheckForFinishedEncodings(Globals.MaxDegreeOfParallelism);
            }

            foreach (AudioFileEncoding waitingEncoding in _WaitingEncodings)
            {
                _ActiveEncodings.Add(waitingEncoding);
            }

            foreach (AODLoadSheetRow skippedLSR in _EncodingQueues.SkippedQueue)
            {
                _FinishedEncodings.Add(new AudioFileEncoding(skippedLSR, 0, false));  //Add skipped rows for updating back to loadsheet
            }

            if (encodingQueueCount > 0)
            {
                CheckForFinishedEncodings(1);
            }

            _History.WriteEncodingHistoryToFile(true);

            UpdateLoadSheet();   //final update to AOD Loadsheet with remaining rows not saved yet (including skipped rows)

            ConsolePrintHelpers.PrintDuration(stopwatch, "Encoding");
            ConsolePrintHelpers.PrintYellowText("\n\n\n  Encoding Run Completed");

            if (_EncodingQueues.SkippedQueue.Count == 0)
            {
                ConsolePrintHelpers.PressAnyKeyToExit();
            }
            else
            {
                _EncodingQueues.PrintAndEmptySkippedQueue();
            }
        }