Ejemplo n.º 1
0
        public void SearchForSourceAudioFiles(AudioLibrary audioLibrary)
        {
            Stopwatch stopwatch = ConsolePrintHelpers.PrintHeaderAndStartStopWatch();

            ConsolePrintHelpers.PrintWhiteText("  Searching For Source Audio Files...\n\n\n");

            _ActiveSearches.Clear();

            _SearchRowsRemaining = _LoadSheet.GetAODLoadSheetRows.Count;

            ConsolePrintHelpers.PrintWhiteText("  Search Pass 1...\n\n");

            PrintSearchStatsHeaders();

            Search_Pass1(audioLibrary);

            ConsolePrintHelpers.PrintWhiteText("\n\n  Search Pass 2...\n\n");

            PrintSearchStatsHeaders();

            Search_Pass2(audioLibrary);

            ConsolePrintHelpers.PrintWhiteText("\n\n  Search Pass 3...\n\n");

            PrintSearchStatsHeaders();

            Search_Pass3(audioLibrary);

            ConsolePrintHelpers.PrintDurationAndWait(stopwatch, "Search");
        }
Ejemplo n.º 2
0
        public void PrintAndEmptySkippedQueue()
        {
            bool choice = PromptToViewSkippedEncodings();

            if (choice)
            {
                Environment.Exit(0);
            }

            ConsolePrintHelpers.PrintHeader();

            ConsolePrintHelpers.PrintWhiteText("  Printing Skipped Load Sheet Rows...");

            ConsolePrintHelpers.Wait();

            int skippedQueueCount = _SkippedQueue.Count;

            for (int i = 0; i < skippedQueueCount; i++)
            {
                AODLoadSheetRow skippedLSR = _SkippedQueue.Dequeue();

                skippedLSR.PrintAllLSRInfo();

                ConsolePrintHelpers.PressAnyKeyToContinue();
            }
        }
        public void ReadHistoryFromFiles()
        {
            ConsolePrintHelpers.PrintYellowText("\n\n\n  Reading And Validating History Files");
            ConsolePrintHelpers.PrintWhiteText(" ► ");

            bool cancelProgressTicker = false;

            Task ticker = Task.Run(() => ConsolePrintHelpers.PrintProgressTicker(ref cancelProgressTicker));

            List <Task> readingTasks = new List <Task>();

            readingTasks.Add(Task.Run(() => ReadApprovedLoadSheetRowsFromFile()));
            readingTasks.Add(Task.Run(() => ReadAlreadyEncodedFilesFromFile()));

            Task.WaitAll(readingTasks.ToArray());

            DeleteSeveredAlreadyEncodedFiles();

            GC.Collect();

            cancelProgressTicker = true;

            ticker.Wait();

            ConsolePrintHelpers.PrintYellowText("Done");
        }
        public void PrintAudioFileOptionsStatistics(string statsHeaderToPrint)
        {
            ConsolePrintHelpers.PrintWhiteText("  ____________________________");
            ConsolePrintHelpers.PrintWhiteText("\n  " + statsHeaderToPrint);
            Console.WriteLine();

            ConsolePrintHelpers.PrintWhiteText("     -Best Accuracy Score      :");
            Console.CursorLeft = Globals.CursorsLeft[0];
            ConsolePrintHelpers.PrintCyanText(_BestAccuracyScore.ToString());
            Console.WriteLine();

            ConsolePrintHelpers.PrintWhiteText("     -Best Total Points        :");
            Console.CursorLeft = Globals.CursorsLeft[0];
            ConsolePrintHelpers.PrintCyanText(_BestTotalPoints.ToString());
            Console.WriteLine();

            ConsolePrintHelpers.PrintWhiteText("     -Best Artist/Album Points :");
            Console.CursorLeft = Globals.CursorsLeft[0];
            ConsolePrintHelpers.PrintCyanText(_BestArtistAlbumPoints.ToString());
            Console.WriteLine();

            ConsolePrintHelpers.PrintWhiteText("     -Best Track Points        :");
            Console.CursorLeft = Globals.CursorsLeft[0];
            ConsolePrintHelpers.PrintCyanText(_BestTrackPoints.ToString());

            Console.WriteLine();
        }
Ejemplo n.º 5
0
        private void WriteWorkbook(IWorkbook workbook, int cursorLeft)
        {
            if (!File.Exists(_Config.AODLoadSheetFilePath))
            {
                ConsolePrintHelpers.PrintRedText("\n\n  ERROR  Missing AOD Loadsheet:  ");
                ConsolePrintHelpers.PrintWhiteText(_Config.AODLoadSheetFilePath);
                ConsolePrintHelpers.PressAnyKeyToExit();
            }

            try
            {
                using (FileStream fsWrite = new FileStream(_Config.AODLoadSheetFilePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
                {
                    workbook.Write(fsWrite);
                    fsWrite.Close();
                }

                workbook.Close();

                Console.CursorLeft = cursorLeft;
                ConsolePrintHelpers.PrintYellowText("Updated");
            }
            catch (Exception)
            {
                Console.WriteLine("\n\n");
                ConsolePrintHelpers.PrintRedText("  ERROR: Unable To Update AOD Loadsheet Already Open In Excel\n\n\n");
                ConsolePrintHelpers.PrintRedText("  This Software Will Continue Once The Open Loadsheet Is Closed :  ");
                ConsolePrintHelpers.PrintWhiteText(_Config.AODLoadSheetFilePath);
                Console.WriteLine("\n\n");

                bool updateSuccessful = false;

                while (!updateSuccessful)
                {
                    try
                    {
                        using (FileStream fsWrite = new FileStream(_Config.AODLoadSheetFilePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
                        {
                            workbook.Write(fsWrite);
                            fsWrite.Close();
                        }

                        workbook.Close();

                        Console.CursorTop -= 9;
                        Console.CursorLeft = cursorLeft;
                        ConsolePrintHelpers.PrintYellowText("Updated");
                        Console.CursorTop += 9;

                        updateSuccessful = true;
                    }
                    catch (Exception)
                    {
                        ConsolePrintHelpers.Retry();
                    }
                }
            }

            IncrementalLoadSheetBackup();
        }
Ejemplo n.º 6
0
        public void PrintPendingCopyOrEncodeStats()
        {
            int encodeCount = 0;
            int copyCount   = 0;

            foreach (AudioFileEncoding encoding in _EncodingQueue)
            {
                if (encoding.TryToCopyAlreadyEncodedFile == false)
                {
                    encodeCount++;
                }
                else
                {
                    copyCount++;
                }
            }

            Console.WriteLine("\n\n");

            ConsolePrintHelpers.PrintGreenText("  Pending File Encodes  ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText(encodeCount.ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));
            Console.WriteLine();

            ConsolePrintHelpers.PrintGreenText("  Pending File Copies   ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText(copyCount.ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));
            Console.WriteLine();

            ConsolePrintHelpers.PrintGreenText("  Skipped Encodings     ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText(_SkippedQueue.Count.ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));
        }
        public void PrintApprovedLoadSheetRows_DEBUG()
        {
            ConsolePrintHelpers.PrintHeader();

            ConsolePrintHelpers.PrintWhiteText("  Printing Approved Load Sheet Rows...");

            Console.WriteLine("\n\n");
            ConsolePrintHelpers.PrintWhiteText("  Approved Load Sheet Rows Count :  ");
            ConsolePrintHelpers.PrintCyanText(_ApprovedLoadSheetRows.Count.ToString());

            ConsolePrintHelpers.Wait();

            if (_ApprovedLoadSheetRows.Count > 0)
            {
                Console.WriteLine("\n\n");
            }

            foreach (ApprovedLoadSheetRow approvedLSR in _ApprovedLoadSheetRows)
            {
                ConsolePrintHelpers.PrintFullWidthLine();

                ConsolePrintHelpers.PrintWhiteText("  Is Valid?         :  ");
                if (approvedLSR.ReCheckIfValid())
                {
                    ConsolePrintHelpers.PrintYellowText(approvedLSR.IsValid.ToString());
                }
                else
                {
                    ConsolePrintHelpers.PrintRedText(approvedLSR.IsValid.ToString());
                }
                Console.WriteLine();

                ConsolePrintHelpers.PrintWhiteText("  Source File Path  :  ");
                ConsolePrintHelpers.PrintCyanText(approvedLSR.SourceFilePath);
                Console.WriteLine();

                ConsolePrintHelpers.PrintWhiteText("  Source File Date  :  ");
                ConsolePrintHelpers.PrintCyanText(approvedLSR.SourceFileModifiedDate);
                Console.WriteLine();

                ConsolePrintHelpers.PrintWhiteText("  Source File Size  :  ");
                ConsolePrintHelpers.PrintCyanText((approvedLSR.SourceFileSize / 1024 / 1024).ToString() + " MB");
                Console.WriteLine("\n");

                ConsolePrintHelpers.PrintWhiteText("  LSR Hash          :  ");
                ConsolePrintHelpers.PrintCyanText(approvedLSR.LoadSheetRowHash);
                Console.WriteLine();

                ConsolePrintHelpers.PrintWhiteText("  Accuracy Score    :  ");
                ConsolePrintHelpers.PrintCyanText(approvedLSR.AccuracyScore.ToString());
                Console.WriteLine();

                ConsolePrintHelpers.PrintWhiteText("  Accuracy Type     :  ");
                ConsolePrintHelpers.PrintCyanText(approvedLSR.AccuracyType.ToString());
                Console.WriteLine();
            }

            ConsolePrintHelpers.PressAnyKeyToContinue();
        }
        public void WriteEncodingHistoryToFile(bool printProgress)
        {
            bool cancelProgressTicker = false;
            Task ticker = null;

            if (printProgress)
            {
                ConsolePrintHelpers.PrintYellowText("\n\n\n  [DO NOT CLOSE CONSOLE WINDOW]  Updating Encoding History File");
                ConsolePrintHelpers.PrintWhiteText(" ► ");

                int cursorLeft = Console.CursorLeft;

                Console.WriteLine("\n\n");
                Console.CursorTop -= 3;
                Console.CursorLeft = cursorLeft;

                ticker = Task.Run(() => ConsolePrintHelpers.PrintProgressTicker(ref cancelProgressTicker));
            }

            foreach (AlreadyEncodedFile file in _AlreadyEncodedFiles.Skip(Globals.MaximumLinesForHistoryFiles))  //If history is too large, delete oldest files (end of list)
            {
                DeleteAlreadyEncodedFile(file);
            }

            List <string> linesList = new List <string>();

            foreach (AlreadyEncodedFile file in _AlreadyEncodedFiles.Take(Globals.MaximumLinesForHistoryFiles)) //If history is too large, only keep records of newest files (front of list)
            {
                if (file.IsValid)                                                                               //No Re-checkIfValid() because when lines are read back in from file they are re-checked.
                {
                    string line = file.EncodedFilePath + "*" +
                                  file.EncodedFileModifiedDate + "*" +
                                  file.EncodedFileSize.ToString() + "*" +
                                  file.SourceFilePath + "*" +
                                  file.SourceFileModifiedDate + "*" +
                                  file.SourceFileSize.ToString() + "*" +
                                  file.EncodedStatus;

                    linesList.Add(line);
                }
            }

            try
            {
                File.WriteAllLines(_EncodingHistoryFilePath, linesList);
            }
            catch (Exception) { }

            if (printProgress)
            {
                cancelProgressTicker = true;

                ticker.Wait();

                ConsolePrintHelpers.PrintYellowText("Updated");
            }
        }
Ejemplo n.º 9
0
 private void PrintSearchStatsHeaders()
 {
     ConsolePrintHelpers.PrintGreenText("  Active Searches ");
     ConsolePrintHelpers.PrintWhiteText(":  ");
     ConsolePrintHelpers.PrintCyanText("000000");
     Console.WriteLine();
     ConsolePrintHelpers.PrintGreenText("  Remaining Rows  ");
     ConsolePrintHelpers.PrintWhiteText(":  ");
     ConsolePrintHelpers.PrintCyanText("000000");
 }
        public void PrintHistoryStats()
        {
            Console.WriteLine("\n");
            ConsolePrintHelpers.PrintGreenText("  History Approved Rows ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText(_ApprovedLoadSheetRows.Count.ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));

            Console.WriteLine();
            ConsolePrintHelpers.PrintGreenText("  History Encoded Files ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText(_AlreadyEncodedFiles.Count.ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));
        }
Ejemplo n.º 11
0
        private bool PromptToViewSkippedEncodings()
        {
            ConsolePrintHelpers.PrintWhiteText("\n\n\n  Please Select...\n\n");

            ConsolePrintHelpers.PrintGreenText("    1");
            ConsolePrintHelpers.PrintWhiteText(" ► Exit Application\n\n");

            ConsolePrintHelpers.PrintGreenText("    2");
            ConsolePrintHelpers.PrintWhiteText(" ► View Skipped Encodings\n\n");

            Console.WriteLine("\n\n");
            Console.CursorTop -= 3;

            ConsolePrintHelpers.PrintWhiteText("  Choice ►");

            ConsolePrintHelpers.PrintGreenText(" ");

            while (true)
            {
                int cursorLeft = Console.CursorLeft;

                while (Console.KeyAvailable)
                {
                    ConsoleKeyInfo key = Console.ReadKey(true);  //flush keyboard buffer
                }

                ConsoleKeyInfo keyPressed = Console.ReadKey();

                Thread.Sleep(500);

                if (keyPressed.KeyChar != '1' && keyPressed.KeyChar != '2')
                {
                    Console.CursorLeft = cursorLeft + 1; //in case user presses "enter"
                    ConsolePrintHelpers.PrintYellowText("  Incorrect Key Pressed!");
                    Thread.Sleep(1000);
                    Console.CursorLeft = cursorLeft;
                    ConsolePrintHelpers.PrintGreenText("                         ");
                    Console.CursorLeft = cursorLeft;
                }
                else
                {
                    if (keyPressed.KeyChar == '1')
                    {
                        return(true);
                    }

                    if (keyPressed.KeyChar == '2')
                    {
                        return(false);
                    }
                }
            }
        }
        public void PrintAudioFileOptions(AudioFileOption bestOption, string headerToPrint)
        {
            ConsolePrintHelpers.PrintWhiteText("\n  " + headerToPrint + " Option(s) :  ");

            int longestPathLength = 0;
            int currentPathLength;

            foreach (AudioFileOption option in _AudioFileOptions)
            {
                currentPathLength = Globals.CursorsLeft[0] + option.LibraryFile.FullPath.Length;

                if (currentPathLength > longestPathLength)
                {
                    longestPathLength = currentPathLength;
                }
            }

            foreach (AudioFileOption option in _AudioFileOptions)
            {
                Console.CursorLeft = Globals.CursorsLeft[0];

                if (option.LibraryFile.FullPath == bestOption.LibraryFile.FullPath)
                {
                    ConsolePrintHelpers.PrintGrayText(option.LibraryFile.FullPath);
                }
                else
                {
                    ConsolePrintHelpers.PrintDarkGrayText(option.LibraryFile.FullPath);
                }

                Console.CursorLeft = longestPathLength;

                ConsolePrintHelpers.PrintWhiteText("     [");
                ConsolePrintHelpers.PrintGrayText("S: ");
                ConsolePrintHelpers.PrintCyanText(option.AccuracyScore.ToString().PadLeft(4));
                ConsolePrintHelpers.PrintGrayText(",  T: ");
                ConsolePrintHelpers.PrintYellowText(option.GetTotalPoints().ToString().PadLeft(3));
                ConsolePrintHelpers.PrintGrayText(",  A/A: " + option.ArtistAlbumPoints.ToString().PadLeft(3) + ",  Tr: " + option.TrackPoints.ToString().PadLeft(3) + ", Size: " + option.LibraryFile.FileSize + " bytes");
                ConsolePrintHelpers.PrintWhiteText("]\n");
            }

            if (_AudioFileOptionsOriginalCount > _AudioFileOptions.Count)
            {
                Console.CursorLeft = Globals.CursorsLeft[0];
                ConsolePrintHelpers.PrintWhiteText((_AudioFileOptionsOriginalCount - _AudioFileOptions.Count).ToString());
                ConsolePrintHelpers.PrintDarkGrayText(" Remaining Files Not Printed...\n");
            }

            Console.WriteLine();
        }
Ejemplo n.º 13
0
        private bool PromptToManuallyAssignSkippedEncodings()
        {
            ConsolePrintHelpers.PrintWhiteText("\n\n\n  Please Select...\n\n");

            ConsolePrintHelpers.PrintGreenText("    1");
            ConsolePrintHelpers.PrintWhiteText(" ► Manually Assign Source Files For Skipped Encodings\n\n");

            ConsolePrintHelpers.PrintGreenText("    2");
            ConsolePrintHelpers.PrintWhiteText(" ► Continue With Skipped Encodings\n\n");

            ConsolePrintHelpers.PrintWhiteText("  Choice ►");
            ConsolePrintHelpers.PrintGreenText(" ");

            while (true)
            {
                int cursorLeft = Console.CursorLeft;

                while (Console.KeyAvailable)
                {
                    ConsoleKeyInfo key = Console.ReadKey(true);  //flush keyboard buffer
                }

                ConsoleKeyInfo keyPressed = Console.ReadKey();

                Thread.Sleep(500);

                if (keyPressed.KeyChar != '1' && keyPressed.KeyChar != '2')
                {
                    Console.CursorLeft = cursorLeft + 1; //in case user presses "enter"
                    ConsolePrintHelpers.PrintYellowText("  Incorrect Key Pressed!");
                    Thread.Sleep(1000);
                    Console.CursorLeft = cursorLeft;
                    ConsolePrintHelpers.PrintGreenText("                         ");
                    Console.CursorLeft = cursorLeft;
                }
                else
                {
                    if (keyPressed.KeyChar == '1')
                    {
                        return(true);
                    }

                    if (keyPressed.KeyChar == '2')
                    {
                        return(false);
                    }
                }
            }
        }
Ejemplo n.º 14
0
        private void ValidateLoadSheet()
        {
            ConsolePrintHelpers.PrintWhiteText("  Path:  ");

            if (File.Exists(_Config.AODLoadSheetFilePath))
            {
                ConsolePrintHelpers.PrintGreenText(_Config.AODLoadSheetFilePath + "\n\n");
            }
            else
            {
                ConsolePrintHelpers.PrintRedText(_Config.AODLoadSheetFilePath);
                ConsolePrintHelpers.PrintWhiteText("   ERROR: Missing Loadsheet at this path");
                ConsolePrintHelpers.PressAnyKeyToExit();
            }
        }
        private void AssignLoadSheet()
        {
            _AODLoadSheetFilePath = @"None";

            DirectoryInfo di = new DirectoryInfo(_AODLoadSheetDirectoryPath);

            IEnumerable <FileInfo> finfo = di.GetFiles("*.xlsx");

            if (finfo.Count() > 2)
            {
                ConsolePrintHelpers.PrintRedText("\n\n  ERROR  More Than 1 AOD Loadsheet Found In Directory:  ");
                ConsolePrintHelpers.PrintWhiteText(_AODLoadSheetDirectoryPath);
                ConsolePrintHelpers.PressAnyKeyToExit();
            }
            else if (finfo.Count() == 2)  //Might have a hidden temporary file "~$file.xlsx"
            {
                bool foundTempFile = false;

                foreach (FileInfo fi in finfo)
                {
                    if (fi.Name.Contains(@"~$"))
                    {
                        foundTempFile = true;
                    }
                    else
                    {
                        _AODLoadSheetFilePath = fi.FullName;
                    }
                }

                if (!foundTempFile)
                {
                    ConsolePrintHelpers.PrintRedText("\n\n  ERROR  More Than 1 AOD Loadsheet Found In Directory:  ");
                    ConsolePrintHelpers.PrintWhiteText(_AODLoadSheetDirectoryPath);
                    ConsolePrintHelpers.PressAnyKeyToExit();
                }
            }
            else if (finfo.Count() == 0)
            {
                ConsolePrintHelpers.PrintRedText("\n\n  ERROR  Missing AOD Loadsheet In Directory:  ");
                ConsolePrintHelpers.PrintWhiteText(_AODLoadSheetDirectoryPath);
                ConsolePrintHelpers.PressAnyKeyToExit();
            }
            else //only 1 .xlsx file found
            {
                _AODLoadSheetFilePath = finfo.First().FullName;
            }
        }
        public void WriteApprovalHistoryToFile(bool printProgress)
        {
            bool cancelProgressTicker = false;
            Task ticker = null;

            if (printProgress)
            {
                ConsolePrintHelpers.PrintYellowText("\n\n\n  [DO NOT CLOSE CONSOLE WINDOW]  Updating Approval History File");
                ConsolePrintHelpers.PrintWhiteText(" ► ");

                ticker = Task.Run(() => ConsolePrintHelpers.PrintProgressTicker(ref cancelProgressTicker));
            }

            List <string> linesList = new List <string>();

            foreach (ApprovedLoadSheetRow approvedLSR in _ApprovedLoadSheetRows.Take(Globals.MaximumLinesForHistoryFiles)) //Trim history if too large (long term performance concerns)
            {
                if (approvedLSR.IsValid)                                                                                   //No Re-checkIfValid() because when lines are read back in from file they are re-checked.
                {
                    string line = approvedLSR.SourceFilePath + "*" +
                                  approvedLSR.SourceFileModifiedDate + "*" +
                                  approvedLSR.SourceFileSize.ToString() + "*" +
                                  approvedLSR.LoadSheetRowHash + "*" +
                                  approvedLSR.TotalPoints + "*" +
                                  approvedLSR.AccuracyScore.ToString() + "*" +
                                  approvedLSR.AccuracyType.ToString();

                    linesList.Add(line);
                }
            }

            try
            {
                File.WriteAllLines(_ApprovalHistoryFilePath, linesList);
            }
            catch (Exception) { }

            if (printProgress)
            {
                cancelProgressTicker = true;

                ticker.Wait();

                ConsolePrintHelpers.PrintYellowText("Updated");
            }
        }
Ejemplo n.º 17
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();
        }
Ejemplo n.º 18
0
        public void BuildEncodingQueue()
        {
            _EncodingQueue = new Queue <AudioFileEncoding>();
            _SkippedQueue  = new Queue <AODLoadSheetRow>();

            _TempEncodingOrCopyList = new List <AODLoadSheetRow>();
            _TempSkippedList        = new List <AODLoadSheetRow>();

            ConsolePrintHelpers.PrintHeader();

            ConsolePrintHelpers.PrintWhiteText("  Building Encoding Queue...");

            DetermineSkippedLoadsheetRows();

            ManuallyAssignSkippedEncodings();

            FinishEncodingQueue();
        }
Ejemplo n.º 19
0
        public void AssignSuggestedAudioFileFromManualApproval(AudioFileOption bestOption)
        {
            if (_SearchCollection != null)
            {
                _SearchCollection.AssignBestOptionFromManualOptions(bestOption);

                AssignSuggestedAudioFile();

                _IsApproved = true;

                _SuggestedAudioFile.AccuracyNote = Globals.WasApprovedNote;
            }
            else
            {
                ConsolePrintHelpers.PrintRedText("\n\n  ERROR  Trying To Assign Suggested Audio File With Null Search Collection at LSR #:  ");
                ConsolePrintHelpers.PrintWhiteText((_LoadSheetRowNumber + 1).ToString());
                ConsolePrintHelpers.PressAnyKeyToExit();
            }
        }
        public void WriteHistoryToFiles()
        {
            ConsolePrintHelpers.PrintYellowText("\n\n\n  [DO NOT CLOSE CONSOLE WINDOW]  Updating All History Files");
            ConsolePrintHelpers.PrintWhiteText(" ► ");
            int cursorLeft = Console.CursorLeft;

            Console.WriteLine("\n\n");
            Console.CursorTop -= 3;

            List <Task> writingTasks = new List <Task>();

            writingTasks.Add(Task.Run(() => WriteApprovalHistoryToFile(false)));
            writingTasks.Add(Task.Run(() => WriteEncodingHistoryToFile(false)));

            Task.WaitAll(writingTasks.ToArray());

            Console.CursorLeft = cursorLeft;
            ConsolePrintHelpers.PrintYellowText("Updated");
        }
Ejemplo n.º 21
0
        private IWorkbook ReadWorkBook()
        {
            if (!File.Exists(_Config.AODLoadSheetFilePath))
            {
                ConsolePrintHelpers.PrintRedText("\n\n  ERROR  Missing AOD Loadsheet:  ");
                ConsolePrintHelpers.PrintWhiteText(_Config.AODLoadSheetFilePath);
                ConsolePrintHelpers.PressAnyKeyToExit();
            }

            IWorkbook workbook;

            using (FileStream fsRead = new FileStream(_Config.AODLoadSheetFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                workbook = WorkbookFactory.Create(fsRead);

                fsRead.Close();
            }

            return(workbook);
        }
        public void AddNewApprovedLoadSheetRow(AODLoadSheetRow lsr)
        {
            ConsolePrintHelpers.PrintYellowText("\n\n  Adding New Approved Row To History");
            ConsolePrintHelpers.PrintWhiteText(" ► ");

            if (lsr.IsSuggestedAudioFileAssigned && lsr.SuggestedAudioFile.AccuracyType != AccuracyType.Accurate && lsr.IsApproved)      //Inaccurate and already manually 'Approved'
            {
                ApprovedLoadSheetRow approvedLSR = new ApprovedLoadSheetRow(lsr);

                if (approvedLSR.IsValid)                          //No check on unique lsr hashes, as they would all be unique at this point (would be already re-approved)
                {
                    _ApprovedLoadSheetRows.AddFirst(approvedLSR); //Add to BEGINNING of list (most recent NEW approvedLSRs first)

                    ConsolePrintHelpers.PrintYellowText("Added");

                    return;
                }
            }

            ConsolePrintHelpers.PrintRedText("Not Added");
        }
Ejemplo n.º 23
0
        private void PrintEncodingStatsHeaders()
        {
            ConsolePrintHelpers.PrintGreenText("  Active Encodings             ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText("000000");
            Console.WriteLine();

            ConsolePrintHelpers.PrintGreenText("  Pending LS Row Updates       ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText("000000");
            Console.WriteLine();

            ConsolePrintHelpers.PrintGreenText("  New Encoded Files            ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText("000000");
            Console.WriteLine();

            ConsolePrintHelpers.PrintGreenText("  New Copied Files             ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText("000000");
            Console.WriteLine();

            ConsolePrintHelpers.PrintGreenText("  History Encoded Files        ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText("000000");
            Console.WriteLine();

            ConsolePrintHelpers.PrintGreenText("  Skipped Encodings            ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText("000000");
            Console.WriteLine();

            ConsolePrintHelpers.PrintGreenText("  Remaining Encodings          ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText("000000");
            Console.WriteLine("\n\n");

            Console.CursorTop -= 3;
        }
Ejemplo n.º 24
0
        public void PrintUniqueFileExtensions_DEBUG()
        {
            ConsolePrintHelpers.PrintHeader();

            ConsolePrintHelpers.PrintWhiteText("  Printing File Extensions Found in Audio Library...");

            ConsolePrintHelpers.Wait();

            Console.WriteLine("\n\n");

            List <string> uniqueFileExtensions = new List <string>();

            foreach (AudioLibraryFile file in _AudioLibraryFiles)
            {
                string extension = Path.GetExtension(file.FullPath);

                if (!uniqueFileExtensions.Contains(extension))
                {
                    uniqueFileExtensions.Add(extension);
                }
            }

            uniqueFileExtensions.Sort();

            int counter    = 1;
            int cursorLeft = 18;

            foreach (string ext in uniqueFileExtensions)
            {
                ConsolePrintHelpers.PrintWhiteText("  Extension " + counter + ":  ");
                Console.CursorLeft = cursorLeft;
                ConsolePrintHelpers.PrintCyanText(ext);
                Console.WriteLine("\n");
                counter++;
            }

            ConsolePrintHelpers.PressAnyKeyToContinue();
        }
Ejemplo n.º 25
0
        private void DetermineSkippedLoadsheetRows()
        {
            ConsolePrintHelpers.PrintYellowText("\n\n\n  Determining Skipped Loadsheet Rows");
            ConsolePrintHelpers.PrintWhiteText(" ► ");

            bool cancelProgressTicker = false;

            Task ticker = Task.Run(() => ConsolePrintHelpers.PrintProgressTicker(ref cancelProgressTicker));

            foreach (AODLoadSheetRow lsr in _Controller.LoadSheet.GetAODLoadSheetRows)
            {
                if (IsLSREligibleForEncodingOrCopying(lsr))
                {
                    _TempEncodingOrCopyList.Add(lsr);   //Ordered by load sheet row number (1 -> n)
                }
                else
                {
                    _TempSkippedList.Add(lsr);          //Ordered by load sheet row number (1 -> n)
                }
            }

            PrepareManualOptions();

            foreach (AODLoadSheetRow skippedRow in _TempSkippedList.ToList())
            {
                CheckApprovalHistoryAgain(skippedRow);  //Approval history can look at the 'Manual Options' list for each skippedRow and possibly find an approved source file included in that list
            }

            cancelProgressTicker = true;

            ticker.Wait();

            ConsolePrintHelpers.PrintYellowText("Done");

            ConsolePrintHelpers.PrintWhiteText("\n\n\n  Skipped Loadsheet Rows Count : ");
            ConsolePrintHelpers.PrintCyanText(_TempSkippedList.Count.ToString());
        }
Ejemplo n.º 26
0
        public void PrintUniqueTrackNumberPatterns_DEBUG()
        {
            ConsolePrintHelpers.PrintHeader();

            ConsolePrintHelpers.PrintWhiteText("  Printing Unique Tracknumber Patterns...");

            ConsolePrintHelpers.Wait();

            Console.WriteLine("\n\n");

            List <string> uniqueTrackNumberPatterns = new List <string>();

            foreach (AudioLibraryFile file in _AudioLibraryFiles)
            {
                string pattern = file.TrackNumberPattern;

                if (!uniqueTrackNumberPatterns.Contains(pattern))
                {
                    uniqueTrackNumberPatterns.Add(pattern);
                }
            }

            foreach (string pattern in uniqueTrackNumberPatterns)
            {
                Console.WriteLine();
                ConsolePrintHelpers.PrintWhiteText("  Pattern :  ");
                ConsolePrintHelpers.PrintWhiteText("[");
                ConsolePrintHelpers.PrintGreenText(pattern);
                ConsolePrintHelpers.PrintWhiteText("]");
            }

            Console.WriteLine("\n");
            ConsolePrintHelpers.PrintWhiteText("  Pattern Count :  ");
            ConsolePrintHelpers.PrintCyanText(uniqueTrackNumberPatterns.Count.ToString());

            ConsolePrintHelpers.PressAnyKeyToContinue();
        }
Ejemplo n.º 27
0
        public void AssignSuggestedAudioFile()
        {
            if (_SearchCollection != null)
            {
                _SuggestedAudioFile = _SearchCollection.GetSuggestedAudioFile();

                if (_SuggestedAudioFile == null)  //should never be the case, and if so, something is wrong
                {
                    ConsolePrintHelpers.PrintRedText("\n\n  ERROR  Unassigned Suggested Audio File at LSR #:  ");
                    ConsolePrintHelpers.PrintWhiteText((_LoadSheetRowNumber + 1).ToString());
                    ConsolePrintHelpers.PressAnyKeyToExit();
                }

                _PotentialFile = new AlreadyEncodedFile(this, false);  //Non-validated AlreadyEncodedFile (Used For Faster Queue Building)

                _IsSuggestedAudioFileAssigned = true;
            }
            else
            {
                ConsolePrintHelpers.PrintRedText("\n\n  ERROR  Trying To Assign Suggested Audio File With Null Search Collection at LSR #:  ");
                ConsolePrintHelpers.PrintWhiteText((_LoadSheetRowNumber + 1).ToString());
                ConsolePrintHelpers.PressAnyKeyToExit();
            }
        }
        public void PrintSuggestedAudioFileInfo(bool isManuallySelected)
        {
            ConsolePrintHelpers.PrintWhiteText("  Suggested Audio File Path    :  ");
            Console.CursorLeft = Globals.CursorsLeft[0];
            if (_AccuracyType == AccuracyType.Accurate || isManuallySelected)
            {
                ConsolePrintHelpers.PrintGreenText(_FullPath);
            }
            else if (_AccuracyType == AccuracyType.Questionable)
            {
                ConsolePrintHelpers.PrintYellowText(_FullPath);
            }
            else
            {
                ConsolePrintHelpers.PrintRedText(_FullPath);
            }
            Console.WriteLine("\n");

            ConsolePrintHelpers.PrintWhiteText("  Accuracy Score               :  ");
            Console.CursorLeft = Globals.CursorsLeft[0];
            if (_AccuracyType == AccuracyType.Accurate || isManuallySelected)
            {
                ConsolePrintHelpers.PrintGreenText(_AccuracyScore.ToString());
            }
            else if (_AccuracyType == AccuracyType.Questionable)
            {
                ConsolePrintHelpers.PrintYellowText(_AccuracyScore.ToString());
            }
            else
            {
                ConsolePrintHelpers.PrintRedText(_AccuracyScore.ToString());
            }
            Console.WriteLine("\n");

            ConsolePrintHelpers.PrintWhiteText("  Total Points                 :  ");
            Console.CursorLeft = Globals.CursorsLeft[0];
            if (_AccuracyType == AccuracyType.Accurate || isManuallySelected)
            {
                ConsolePrintHelpers.PrintGreenText(_TotalPoints.ToString());
            }
            else if (_AccuracyType == AccuracyType.Questionable)
            {
                ConsolePrintHelpers.PrintYellowText(_TotalPoints.ToString());
            }
            else
            {
                ConsolePrintHelpers.PrintRedText(_TotalPoints.ToString());
            }
            Console.WriteLine("\n");

            ConsolePrintHelpers.PrintWhiteText("  Accuracy Note                :  ");
            Console.CursorLeft = Globals.CursorsLeft[0];
            if (_AccuracyType == AccuracyType.Accurate || isManuallySelected)
            {
                ConsolePrintHelpers.PrintGreenText(_AccuracyNote);
            }
            else if (_AccuracyType == AccuracyType.Questionable)
            {
                ConsolePrintHelpers.PrintYellowText(_AccuracyNote);
            }
            else
            {
                ConsolePrintHelpers.PrintRedText(_AccuracyNote);
            }
            Console.WriteLine("\n");

            ConsolePrintHelpers.PrintWhiteText("  Suggested Audio File Size    :  ");
            Console.CursorLeft = Globals.CursorsLeft[0];
            ConsolePrintHelpers.PrintCyanText((_FileSize / 1024 / 1024).ToString() + " MB");
            Console.WriteLine("\n");
        }
Ejemplo n.º 29
0
        public void PrintAudioFileEncoding()
        {
            if (Globals.IsDevelopmentEnvironment)
            {
                _LSR.PrintAllLSRInfo();
            }
            else
            {
                _LSR.PrintProductionLSRInfo();
            }

            ConsolePrintHelpers.PrintGreenText("  Encoding ID                  ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            Console.CursorLeft = Globals.CursorsLeft[0];
            ConsolePrintHelpers.PrintCyanText(_EncodingID.ToString());
            Console.WriteLine();

            ConsolePrintHelpers.PrintGreenText("  Is Approved                  ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            Console.CursorLeft = Globals.CursorsLeft[0];
            if (_LSR.IsApproved)
            {
                ConsolePrintHelpers.PrintYellowText("True");
            }
            else
            {
                ConsolePrintHelpers.PrintCyanText("False");
            }
            Console.WriteLine();

            ConsolePrintHelpers.PrintGreenText("  Action Taken                 ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            Console.CursorLeft = Globals.CursorsLeft[0];
            ConsolePrintHelpers.PrintCyanText(_CopyOrEncodeActionTaken);

            if (_FileToCopy != null)
            {
                Console.WriteLine("\n");

                if (_FileToCopy.LoadSheetRowNumber >= 0)  //Only print row number if it came from the load sheet with positive row number (Skip if from Encoding History File; LSRow# = -1)
                {
                    ConsolePrintHelpers.PrintGreenText("  Already Encoded LS Row #     ");
                    ConsolePrintHelpers.PrintWhiteText(":  ");
                    Console.CursorLeft = Globals.CursorsLeft[0];
                    ConsolePrintHelpers.PrintCyanText((_FileToCopy.LoadSheetRowNumber + 1).ToString());
                    Console.WriteLine();
                }

                ConsolePrintHelpers.PrintGreenText("  Source File Path             ");
                ConsolePrintHelpers.PrintWhiteText(":  ");
                Console.CursorLeft = Globals.CursorsLeft[0];
                ConsolePrintHelpers.PrintCyanText(_FileToCopy.SourceFilePath.ToString());
                Console.WriteLine();

                ConsolePrintHelpers.PrintGreenText("  Already Encoded File Path    ");
                ConsolePrintHelpers.PrintWhiteText(":  ");
                Console.CursorLeft = Globals.CursorsLeft[0];
                ConsolePrintHelpers.PrintCyanText(_FileToCopy.EncodedFilePath.ToString());
            }

            Console.WriteLine("\n");
        }
Ejemplo n.º 30
0
        public void PrintTokensPerRowAllRows_DEBUG()
        {
            ConsolePrintHelpers.PrintHeader();

            ConsolePrintHelpers.PrintWhiteText("  Printing AOD Loadsheet Tokens Per Row...");

            ConsolePrintHelpers.Wait();

            Console.WriteLine("\n\n");

            foreach (AODLoadSheetRow lsr in _AODLoadSheetRows)
            {
                ConsolePrintHelpers.PrintFullWidthLine();

                ConsolePrintHelpers.PrintWhiteText("  Cycle            :  ");
                Console.CursorLeft = Globals.CursorsLeft[0];
                ConsolePrintHelpers.PrintCyanText(lsr.Cycle);
                Console.CursorLeft = Globals.CursorsLeft[1];
                ConsolePrintHelpers.PrintWhiteText("Tokens:  ");

                foreach (string cycleToken in lsr.Tokens.CycleTokens.GetTokens)
                {
                    ConsolePrintHelpers.PrintWhiteText("[");
                    ConsolePrintHelpers.PrintGreenText(cycleToken);
                    ConsolePrintHelpers.PrintWhiteText("]  ");
                }
                Console.WriteLine();

                ConsolePrintHelpers.PrintWhiteText("  Airline          :  ");
                Console.CursorLeft = Globals.CursorsLeft[0];
                ConsolePrintHelpers.PrintCyanText(lsr.Airline);
                Console.CursorLeft = Globals.CursorsLeft[1];
                ConsolePrintHelpers.PrintWhiteText("Tokens:  ");

                foreach (string airlineToken in lsr.Tokens.AirlineTokens.GetTokens)
                {
                    ConsolePrintHelpers.PrintWhiteText("[");
                    ConsolePrintHelpers.PrintGreenText(airlineToken);
                    ConsolePrintHelpers.PrintWhiteText("]  ");
                }
                Console.WriteLine();

                ConsolePrintHelpers.PrintWhiteText("  Audio Type       :  ");
                Console.CursorLeft = Globals.CursorsLeft[0];
                ConsolePrintHelpers.PrintCyanText(lsr.AudioType);
                Console.CursorLeft = Globals.CursorsLeft[1];
                ConsolePrintHelpers.PrintWhiteText("Tokens:  ");

                foreach (string audioTypeToken in lsr.Tokens.AudioTypeTokens.GetTokens)
                {
                    ConsolePrintHelpers.PrintWhiteText("[");
                    ConsolePrintHelpers.PrintGreenText(audioTypeToken);
                    ConsolePrintHelpers.PrintWhiteText("]  ");
                }
                Console.WriteLine();

                ConsolePrintHelpers.PrintWhiteText("  Artist           :  ");
                Console.CursorLeft = Globals.CursorsLeft[0];
                ConsolePrintHelpers.PrintCyanText(lsr.Artist);
                Console.CursorLeft = Globals.CursorsLeft[1];
                ConsolePrintHelpers.PrintWhiteText("Tokens:  ");

                foreach (string artistToken in lsr.Tokens.ArtistTokens.GetTokens)
                {
                    ConsolePrintHelpers.PrintWhiteText("[");
                    ConsolePrintHelpers.PrintGreenText(artistToken);
                    ConsolePrintHelpers.PrintWhiteText("]  ");
                }
                Console.WriteLine();

                ConsolePrintHelpers.PrintWhiteText("  Album            :  ");
                Console.CursorLeft = Globals.CursorsLeft[0];
                ConsolePrintHelpers.PrintCyanText(lsr.Album);
                Console.CursorLeft = Globals.CursorsLeft[1];
                ConsolePrintHelpers.PrintWhiteText("Tokens:  ");

                foreach (string albumToken in lsr.Tokens.AlbumTokens.GetTokens)
                {
                    ConsolePrintHelpers.PrintWhiteText("[");
                    ConsolePrintHelpers.PrintGreenText(albumToken);
                    ConsolePrintHelpers.PrintWhiteText("]  ");
                }
                Console.WriteLine();

                ConsolePrintHelpers.PrintWhiteText("  Track #          :  ");
                Console.CursorLeft = Globals.CursorsLeft[0];
                ConsolePrintHelpers.PrintCyanText(lsr.TrackNumber);
                Console.CursorLeft = Globals.CursorsLeft[1];
                ConsolePrintHelpers.PrintWhiteText("Tokens:  ");

                foreach (string trackNumberToken in lsr.Tokens.TrackNumberTokens.GetTokens)
                {
                    ConsolePrintHelpers.PrintWhiteText("[");
                    ConsolePrintHelpers.PrintGreenText(trackNumberToken);
                    ConsolePrintHelpers.PrintWhiteText("]  ");
                }
                Console.WriteLine();

                ConsolePrintHelpers.PrintWhiteText("  Track            :  ");
                Console.CursorLeft = Globals.CursorsLeft[0];
                ConsolePrintHelpers.PrintCyanText(lsr.Track);
                Console.CursorLeft = Globals.CursorsLeft[1];
                ConsolePrintHelpers.PrintWhiteText("Tokens:  ");

                foreach (string trackToken in lsr.Tokens.TrackTokens.GetTokens)
                {
                    ConsolePrintHelpers.PrintWhiteText("[");
                    ConsolePrintHelpers.PrintGreenText(trackToken);
                    ConsolePrintHelpers.PrintWhiteText("]  ");
                }
                Console.WriteLine("\n");
            }

            ConsolePrintHelpers.PressAnyKeyToContinue();
        }