예제 #1
0
 /// <summary>
 /// Returns the Full path (FQDN) for given Track details
 /// </summary>
 /// <param name="metaData">Populated Track MetaData</param>
 /// <param name="destinationFolder">Optional Root folder defaults to Library Folder from Settings</param>
 /// <param name="artistFolder">Optional ArtistFolder default is to get from MetaData artist</param>
 public static string TrackFullPath(IRoadieSettings configuration, AudioMetaData metaData, string destinationFolder = null, string artistFolder = null, string releaseFolder = null)
 {
     return(FolderPathHelper.TrackFullPath(configuration, metaData.Artist, metaData.Release, SafeParser.ToDateTime(metaData.Year).Value,
                                           metaData.Title, metaData.TrackNumber ?? 0, destinationFolder, metaData.Disc ?? 0,
                                           metaData.TotalTrackNumbers ?? 0,
                                           artistFolder: artistFolder,
                                           releaseFolder: releaseFolder));
 }
예제 #2
0
        /// <summary>
        /// Return the full path (FQDN) for given Track details
        /// </summary>
        /// <param name="artistSortName">Sort name of Artist to use for folder name</param>
        /// <param name="releaseTitle">Title of Release</param>
        /// <param name="releaseDate">Date of Release</param>
        /// <param name="trackNumber">Track Number</param>
        /// <param name="destinationFolder">Optional Root folder defaults to Library Folder from Settings</param>
        /// <param name="discNumber">Optional disc number defaults to 0</param>
        /// <param name="totalTrackNumber">Optional Total Tracks defaults to TrackNumber</param>
        /// <param name="fileExtension">Optional File Extension defaults to mp3</param>
        public static string TrackFullPath(IRoadieSettings configuration, string artistSortName, string releaseTitle, DateTime releaseDate, string trackTitle, short trackNumber, string destinationFolder = null, int?discNumber = null, int?totalTrackNumber = null, string fileExtension = "mp3", string artistFolder = null, string releaseFolder = null)
        {
            destinationFolder = destinationFolder ?? configuration.LibraryFolder;
            artistFolder      = artistFolder ?? FolderPathHelper.ArtistPath(configuration, artistSortName, destinationFolder);
            releaseFolder     = releaseFolder ?? FolderPathHelper.ReleasePath(artistFolder, releaseTitle, releaseDate);
            var trackFileName = FolderPathHelper.TrackFileName(configuration, trackTitle, trackNumber, discNumber, totalTrackNumber, fileExtension);

            var result     = Path.Combine(artistFolder, releaseFolder, trackFileName);
            var resultInfo = new DirectoryInfo(result);

            Trace.WriteLine(string.Format("TrackPath [{0}] For ArtistName [{1}], ReleaseTitle [{2}], ReleaseDate [{3}], ReleaseYear [{4}], TrackNumber [{5}]", resultInfo.FullName, artistSortName, releaseTitle, releaseDate.ToString("s"), releaseDate.ToString("yyyy"), trackNumber));
            return(resultInfo.FullName);
        }
예제 #3
0
 /// <summary>
 /// For given artist delete any empty folders
 /// </summary>
 /// <param name="artist">Populated Artist database record</param>
 /// <param name="destinationFolder">Optional Root folder defaults to Library Folder from Settings</param>
 /// <returns></returns>
 public static bool DeleteEmptyFoldersForArtist(IRoadieSettings configuration, Data.Artist artist, string destinationFolder = null)
 {
     destinationFolder = destinationFolder ?? configuration.LibraryFolder;
     SimpleContract.Requires <ArgumentException>(artist != null, "Invalid Artist");
     return(FolderPathHelper.DeleteEmptyFolders(new DirectoryInfo(artist.ArtistFileFolder(configuration, destinationFolder))));
 }
예제 #4
0
        /// <summary>
        /// Returns the Directory for a Track (just directory not Track FileName)
        /// </summary>
        /// <param name="artistSortName">Sort name of Artist to use for folder name</param>
        /// <param name="releaseTitle">Title of Release</param>
        /// <param name="releaseDate">Date of Release</param>
        /// <param name="trackNumber">Track Number</param>
        /// <param name="destinationFolder">Optional Root folder defaults to Library Folder from Settings</param>
        /// <param name="discNumber">Optional disc number defaults to 0</param>
        /// <param name="totalTrackNumber">Optional Total Tracks defaults to TrackNumber</param>
        /// <param name="fileExtension">Optional File Extension defaults to mp3</param>
        public static string TrackPath(IRoadieSettings configuration, string artistSortName, string releaseTitle, DateTime releaseDate, string trackTitle, short trackNumber, string destinationFolder = null, int?discNumber = null, int?totalTrackNumber = null, string fileExtension = "mp3")
        {
            var fileInfo = new FileInfo(FolderPathHelper.TrackFullPath(configuration, artistSortName, releaseTitle, releaseDate, trackTitle, trackNumber, destinationFolder, discNumber, totalTrackNumber));

            return(fileInfo.Directory.Name);
        }
예제 #5
0
        /// <summary>
        /// Returns the Directory for a Track (just directory not Track FileName)
        /// </summary>
        /// <param name="artist">Artist For release</param>
        /// <param name="release">Release</param>
        /// <param name="track">Track</param>
        /// <param name="destinationFolder">Optional Root folder defaults to Library Folder from Settings</param>
        public static string TrackPath(IRoadieSettings configuration, Data.Artist artist, Data.Release release, Data.Track track, string destinationFolder = null)
        {
            var fileInfo = new FileInfo(FolderPathHelper.TrackFullPath(configuration, artist.SortNameValue, release.Title, release.ReleaseDate.Value, track.Title, track.TrackNumber, destinationFolder));

            return(fileInfo.Directory.Name);
        }
예제 #6
0
        /// <summary>
        /// Returns the Directory for a Track (just directory not Track FileName)
        /// </summary>
        /// <param name="metaData">Populated Track MetaData</param>
        /// <param name="destinationFolder">Optional Root folder defaults to Library Folder from Settings</param>
        /// <param name="artistFolder">Optional ArtistFolder default is to get from MetaData artist</param>///
        public static string TrackPath(IRoadieSettings configuration, AudioMetaData metaData, string destinationFolder = null, string artistFolder = null)
        {
            var fileInfo = new FileInfo(FolderPathHelper.TrackFullPath(configuration, metaData, destinationFolder, artistFolder));

            return(fileInfo.Directory.Name);
        }
예제 #7
0
        /// <summary>
        /// Returns the FileName for given Track details, this is not the Full Path (FQDN) only the FileName
        /// </summary>
        /// <param name="metaData">Populated Track MetaData</param>
        public static string TrackFileName(IRoadieSettings configuration, AudioMetaData metaData)
        {
            var fileInfo = new FileInfo(metaData.Filename);

            return(FolderPathHelper.TrackFileName(configuration, metaData.Release, metaData.TrackNumber ?? 0, metaData.Disc, metaData.TotalTrackNumbers, fileInfo.Extension.ToLower()));
        }