public GracenoteSong(RESPONSE response)
 {
     _response = response;
     _artist   = StringCleaner.ToCleanTitleCase(response.ALBUM.ARTIST);
     _album    = StringCleaner.ToCleanTitleCase(response.ALBUM.TITLE);
     _title    = StringCleaner.ToCleanTitleCase(response.ALBUM.TRACK.TITLE);
     _track    = response.ALBUM.TRACK.TRACK_NUM;
     _year     = response.ALBUM.DATE;
     _genres   = response.ALBUM.GENRE;
 }
Example #2
0
 public Dictionary <string, bool> CheckMetadataEquality(MasterFile file)
 {
     // Threw an unhandled NullReferenceException
     return(new Dictionary <string, bool>()
     {
         { "Artist", file.TagLibProps["Artist"].ToString() == StringCleaner.ToCleanTitleCase(ALBUM.ARTIST) ? true : false },
         { "Album", file.TagLibProps["Album"].ToString() == StringCleaner.ToCleanTitleCase(ALBUM.TITLE) ? true : false },
         { "Title", file.TagLibProps["Title"].ToString() == StringCleaner.ToCleanTitleCase(ALBUM.TRACK.TITLE) ? true : false },
         { "Track", Convert.ToInt32(file.TagLibProps["Track"]) == ALBUM.TRACK.TRACK_NUM ? true : false },
         { "Year", file.TagLibProps["Year"].ToString() == ALBUM.DATE ? true : false },
         { "Genres", file.TagLibProps["Genres"].ToString() == ALBUM.GENRE ? true : false }
     });
 }
        private void RenameFile()
        {
            var currentFileName = SysIOProps["Name"].ToString();
            var newFileName     = TagLibProps["Title"].ToString() + SysIOProps["Extension"].ToString();
            var validFileName   = StringCleaner.RemoveInvalidFileNameCharacters(newFileName);

            if (currentFileName != validFileName)
            {
                FileManipulator.RenameFile(Filepath, validFileName);
                SysIOProps["Name"] = validFileName;
            }
            Filepath = Path.Combine(SysIOProps["Directory"].ToString(), SysIOProps["Name"].ToString());
        }
        private void MoveToCorrectAlbumLocation()
        {
            Regex directoryAlbumRegex    = new Regex(@"([^\\]+)\\([^\\]+)$");
            var   currentAlbumFolderName = directoryAlbumRegex.Match(Filepath).Groups[1].ToString();
            var   validAlbumFolderName   = StringCleaner.RemoveInvalidDirectoryChars(TagLibProps["Album"].ToString());

            if (currentAlbumFolderName != validAlbumFolderName)
            {
                var currentDirectory = SysIOProps["Directory"].ToString();
                var newDirectory     = currentDirectory.Replace(currentAlbumFolderName, validAlbumFolderName);
                FileManipulator.RenameFolder(this, currentDirectory, newDirectory);
                FileManipulator.DeleteEmptyFolders(new DirectoryInfo(currentDirectory));
            }
        }