static void DropRemainingReferences(ref AudioEncoderConfig config, ref AODLoadSheet loadSheet, ref AudioEncoderController controller)
 {
     //Release the rest of used memory
     config     = null;
     loadSheet  = null;
     controller = null;
     GC.Collect();
 }
示例#2
0
        public AudioLibrarySubDirectory(string subDirectoryToScan, string rootPath, AudioEncoderConfig config)
        {
            _Config = config;

            _SubDirectoryToScan            = subDirectoryToScan;
            _AudioLibraryRootDirectoryPath = rootPath;

            _HasFinished = false;
        }
示例#3
0
        public AudioLibraryRootDirectory(string rootPath, AudioEncoderConfig config)
        {
            _AudioLibraryRootDirectoryPath = rootPath;

            _Config = config;

            _AreShortcutsValid = true;

            _HasFinished = false;
        }
        static void Main()
        {
            AudioEncoderConfig config = new AudioEncoderConfig();


            AudioLibrary audioLibrary = new AudioLibrary(config);

            audioLibrary.ScanAudioLibrary();
            //DEBUG Methods------------------------------------------
            //audioLibrary.PrintAudioLibraryFileInfo_DEBUG();
            //audioLibrary.PrintUniqueTrackNumberPatterns_DEBUG();
            //audioLibrary.PrintUniqueFileExtensions_DEBUG();
            //-------------------------------------------------------


            AODLoadSheet loadSheet = new AODLoadSheet(config);

            loadSheet.ReadLoadSheet();
            //DEBUG Methods------------------------------------------
            //loadSheet.PrintAODLoadSheetPretty_DEBUG();
            //loadSheet.PrintCharactersFoundList_DEBUG();
            //loadSheet.PrintTokensPerRowAllRows_DEBUG();
            //loadSheet.SortAODLoadSheetByLSRCharCount_DEBUG();
            //-------------------------------------------------------


            AudioEncoderController controller = new AudioEncoderController(loadSheet);

            controller.SearchForSourceAudioFiles(audioLibrary);
            //DEBUG Methods------------------------------------------
            //controller.PrintApprovedLoadSheetRows_DEBUG();
            //controller.PrintAlreadyEncodedFiles_DEBUG();
            //controller.PrintEncodingQueue_DEBUG();
            //-------------------------------------------------------


            DropAudioLibrary(ref audioLibrary);

            controller.EncodeAudioFiles();

            DropRemainingReferences(ref config, ref loadSheet, ref controller);

            ConsolePrintHelpers.PressAnyKeyToExit();
        }
        public AudioLibraryFile(FileInfo fileInfo, string rootDirectoryPath, AudioEncoderConfig config)
        {
            _FullPath = fileInfo.FullName;

            //SubDirectory section
            if (rootDirectoryPath.Contains(Globals.CD_Repository))
            {
                //re-capture "AOD CDs" (last directory in root path) for following _SubDirectoriesPath. This helps CD scoring because it looks for "AOD CDs".
                //Rootpath is set 1 directory deeper initially for better parallel file scanning performance.
                rootDirectoryPath = Path.GetDirectoryName(rootDirectoryPath);

                int index = rootDirectoryPath.LastIndexOf(@"\");

                //re-capture "CD_Repository" for following _SubDirectoriesPath. This helps CD scoring because it looks for "CD_Repository".
                rootDirectoryPath = rootDirectoryPath.Substring(0, index);
            }

            if (!config.UseManualShortcutsDirectory)
            {
                _SubDirectoriesPath = Path.GetDirectoryName(_FullPath.Substring(rootDirectoryPath.Length));
            }
            else
            {
                _SubDirectoriesPath = Path.GetDirectoryName(_FullPath);
            }

            _NoDiacriticsSubDirectoriesPath = RemoveDiacritics(_SubDirectoriesPath);

            if (_NoDiacriticsSubDirectoriesPath == _SubDirectoriesPath)  //Conserve Memory
            {
                _NoDiacriticsSubDirectoriesPath = _SubDirectoriesPath;
            }

            _NormalizedSubDirectoriesPath = NormalizeText(_NoDiacriticsSubDirectoriesPath);

            if (_NormalizedSubDirectoriesPath == _NoDiacriticsSubDirectoriesPath)  //Conserve Memory
            {
                _NormalizedSubDirectoriesPath = _NoDiacriticsSubDirectoriesPath;
            }

            //Filename Section
            _Filename = Path.GetFileNameWithoutExtension(_FullPath);

            while (true)
            {
                string extraExt = Path.GetExtension(_Filename);

                if (extraExt.Length != 4)
                {
                    break;
                }

                if (Globals.IncludedAudioLibraryExtensions.Any(ext => ext == extraExt) || Globals.ExcludedAudioLibraryExtensions.Any(ext => ext == extraExt))
                {
                    _Filename = Path.GetFileNameWithoutExtension(_Filename);
                }
                else
                {
                    break;
                }
            }

            _NoDiacriticsFilename = RemoveDiacritics(_Filename);

            if (_NoDiacriticsFilename == _Filename)
            {
                _NoDiacriticsFilename = _Filename;  //Conserve Memory
            }

            _NormalizedFilename = NormalizeText(_NoDiacriticsFilename);

            if (_NormalizedFilename == _NoDiacriticsFilename)
            {
                _NormalizedFilename = _NoDiacriticsFilename;  //Conserve Memory
            }

            //Other Assignments
            _NoDiacriticsSubDirectoriesFilePath = _NoDiacriticsSubDirectoriesPath + "\\" + _NoDiacriticsFilename;

            _NormalizedSubDirectoriesFilePath = _NormalizedSubDirectoriesPath + "\\" + _NormalizedFilename;

            _ModifiedDate = fileInfo.LastWriteTime.ToString();

            _FileSize = fileInfo.Length;

            DetectTrackNumber();                 //Detect TrackNumber before setting _NormalizedSubDirectoriesFilePathNoTrackNumber  and   _NormalizedFilenameNoTrackNumber

            SetNormalizedNoTrackNumberMembers(); //Needs to be done before SetApplicableSubDirectoriesFilePath()

            DetectAirline();                     //Detect airline before detecting cycle tokens as _AirlineCode might be needed

            DetectCycleTokens();                 //Detect Cycle Codes before setting _NormalizedFilenameNoCycleCodes

            SetCycle();

            DetectAirlineFromCycleCodes();

            DetectAudioType();

            SetNormalizedFilenameNoCycleCodes();

            SetApplicableSubDirectoriesFilePath();

            _ApplicableTokens = null;
        }
 public AODLoadSheet(AudioEncoderConfig config)
 {
     _Config = config;
 }
        public AODLoadSheetRow(int loadSheetRowNumber, List <string> loadSheetRowCells, AudioEncoderConfig config)
        {
            _LoadSheetRowNumber = loadSheetRowNumber;

            _Airline        = loadSheetRowCells[0];
            _AltCycle       = loadSheetRowCells[1];
            _Artist         = loadSheetRowCells[2];
            _Album          = loadSheetRowCells[3];
            _TrackNumber    = loadSheetRowCells[4];
            _Track          = loadSheetRowCells[5];
            _OutputFilename = loadSheetRowCells[6];
            _AudioType      = loadSheetRowCells[7];
            _ShipTo         = loadSheetRowCells[8];
            _Status         = loadSheetRowCells[9];

            _Config = config;

            _Cycle = _Config.Cycle;

            _AirlineFullName = GetAirlineFullName();

            _OutputFilenameExtension = Path.GetExtension(_OutputFilename).ToLower();

            _DestinationPath = GetDestinationPath();  //Uses loadsheet's cycle (_Cycle) for file output directory

            _Tokens = new TokensCollection(this);

            _OriginalSearchStrategy = _Tokens.SearchStrategy;

            if (CycleValidator.Validate4DigitCycle(_AltCycle) && _AltCycle != _Cycle)
            {
                //If altCycle was detected in album text, it is overwritten again with the value from the "Alt. Cycle" loadsheet column
                _Tokens.CycleTokens.SetAlternativeCycle(_AltCycle, _Airline);
            }

            _SearchCycle = _Tokens.CycleTokens.FullToken;

            if (NormalizeText(_ShipTo).Contains(Globals.ROCKWELL))
            {
                _LoadSheetRowHash = NormalizeText(_SearchCycle + _Airline + _Artist + _Album + _TrackNumber + _Track + _AudioType + _ShipTo);
            }
            else
            {
                _LoadSheetRowHash = NormalizeText(_SearchCycle + _Airline + _Artist + _Album + _TrackNumber + _Track + _AudioType);
            }

            _AirlineAudioTypeHash = NormalizeText(_Airline + _AudioType);

            _AirlineAlbumAudioTypeHash = NormalizeText(_Airline + _Album + _AudioType);

            _TrackNumberTrackHash = NormalizeText(_TrackNumber + _Track);

            _CharCountArtistAlbumTrackNumberTrack = _Artist.Length
                                                    + _Album.Length
                                                    + _TrackNumber.Length
                                                    + _Track.Length;

            _IsApproved = false;

            _EncodingResult             = Globals.Failed;
            _EncodedFileDurationPretty  = Globals.Failed;
            _EncodedFileDurationSeconds = 0;

            _IsQuickSearchActive = false;

            _QuickSearchNotePastLSR     = "None";
            _QuickSearchNotePreviousLSR = "None";

            _SearchCollection = null;

            _SuggestedAudioFile = null;

            _IsSuggestedAudioFileAssigned = false;
        }
        public AudioLibrary(AudioEncoderConfig config)
        {
            _Config = config;

            _AudioLibraryRootDirectories = _Config.AudioLibraryRootDirectories;
        }