633
633
// the exact given depth (not including the mount point/audio_folder).
634
634
if (FolderDepth != -1) {
635
635
int depth = FolderDepth;
637
bool is_album_unknown = String.IsNullOrEmpty (track.AlbumTitle);
636
639
string album_artist = FileNamePattern.Escape (track.DisplayAlbumArtistName);
637
640
string track_album = FileNamePattern.Escape (track.DisplayAlbumTitle);
638
641
string track_number = FileNamePattern.Escape (String.Format ("{0:00}", track.TrackNumber));
641
644
if (depth == 0) {
642
645
// Artist - Album - 01 - Title
643
646
string track_artist = FileNamePattern.Escape (track.DisplayArtistName);
644
file_path = String.Format ("{0} - {1} - {2} - {3}", track_artist, track_album, track_number, track_title);
647
file_path = is_album_unknown ?
648
String.Format ("{0} - {1} - {2}", track_artist, track_number, track_title) :
649
String.Format ("{0} - {1} - {2} - {3}", track_artist, track_album, track_number, track_title);
645
650
} else if (depth == 1) {
646
651
// Artist - Album/01 - Title
647
file_path = String.Format ("{0} - {1}", album_artist, track_album);
652
file_path = is_album_unknown ?
654
String.Format ("{0} - {1}", album_artist, track_album);
648
655
file_path = System.IO.Path.Combine (file_path, String.Format ("{0} - {1}", track_number, track_title));
649
656
} else if (depth == 2) {
650
657
// Artist/Album/01 - Title
651
658
file_path = album_artist;
652
file_path = System.IO.Path.Combine (file_path, track_album);
659
if (!is_album_unknown || ms_device.MinimumFolderDepth == depth) {
660
file_path = System.IO.Path.Combine (file_path, track_album);
653
662
file_path = System.IO.Path.Combine (file_path, String.Format ("{0} - {1}", track_number, track_title));
655
664
// If the *required* depth is more than 2..go nuts!