From 37d91c463202ed9ecb0ae02f2834b2d2a02e2e86 Mon Sep 17 00:00:00 2001 From: Waleed Date: Sun, 15 Jul 2012 05:30:27 +0600 Subject: [PATCH 1/5] Add %TRACKNUMINPLAYLIST% pattern translation to get track.PlayOrderIndex --- SyncPatternTranslator.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/SyncPatternTranslator.cs b/SyncPatternTranslator.cs index 4f31219..d7d1387 100644 --- a/SyncPatternTranslator.cs +++ b/SyncPatternTranslator.cs @@ -21,6 +21,7 @@ public class SyncPatternTranslator /// %ALBUM% = The album name /// %ALBUMINITIAL% = The album initial /// %NAME% = The track name + /// %TRACKNUMINPLAYLIST% = Play order in playlist /// %TRACKNUMSPACE% = The track number with a trailing space /// %TRACKNUM% = The track number (no trailing space) /// %DISCNUMDASH% = The disc number with a trailing minus and space @@ -46,6 +47,7 @@ public static string Translate(SyncPattern pattern, IITFileOrCDTrack track) patternstring = TranslateArtist(pattern, track, patternstring); patternstring = TranslateArtistInitial(pattern, track, patternstring); + patternstring = TranslateTrackNumberInPlaylist(track, patternstring); patternstring = TranslateAlbumArtist(pattern, track, patternstring); patternstring = TranslateDiscNumber(track, patternstring); patternstring = TranslateAlbum(track.Album, patternstring); @@ -82,6 +84,22 @@ private static string TranslateArtistInitial(SyncPattern pattern, IITFileOrCDTra return patternstring; } + /// + /// Translate track playorder in playlist. + /// + /// + /// + /// + private static string TranslateTrackNumberInPlaylist(IITFileOrCDTrack track, string patternstring) + { + //%TRACKNUMINPLAYLIST% + patternstring = patternstring.Replace("%TRACKNUMINPLAYLIST%", + (track.PlayOrderIndex.ToString().Length >= 1 ? + "00" + track.TrackNumber.ToString() : track.PlayOrderIndex.ToString()) + ); + return patternstring; + } + /// /// Translate file extension. /// @@ -215,4 +233,4 @@ private static string TranslateDiscNumber(IITFileOrCDTrack track, string pattern } } -} +} \ No newline at end of file From d28fc824ae43b5dc3c18f644909e503a256881ab Mon Sep 17 00:00:00 2001 From: Waleed Date: Sun, 15 Jul 2012 05:32:29 +0600 Subject: [PATCH 2/5] Add 'playorder-flat' sync pattern for %TRACKNUMINPLAYLIST% --- Resources/syncpatterns.xml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Resources/syncpatterns.xml b/Resources/syncpatterns.xml index 881b064..778d49b 100644 --- a/Resources/syncpatterns.xml +++ b/Resources/syncpatterns.xml @@ -1,7 +1,15 @@ - + + playorder-flat + # Title - Artist + %TRACKNUMINPLAYLIST% - %NAME% - %ARTIST% + This pattern appends the track position according to playlist and then places the tracks in a flat folder. + + + + itunes-style Artist\Album\Track %ARTIST%\%ALBUM%\%TRACKNUMSPACE%%NAME% From f842415d489e8d7d05c29114a5c92a41a3df7baf Mon Sep 17 00:00:00 2001 From: Waleed Date: Sun, 15 Jul 2012 15:58:49 +0500 Subject: [PATCH 3/5] added leading zeroes to PlayOrderIndex --- SyncPatternTranslator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SyncPatternTranslator.cs b/SyncPatternTranslator.cs index d7d1387..df4625e 100644 --- a/SyncPatternTranslator.cs +++ b/SyncPatternTranslator.cs @@ -94,8 +94,8 @@ private static string TranslateTrackNumberInPlaylist(IITFileOrCDTrack track, str { //%TRACKNUMINPLAYLIST% patternstring = patternstring.Replace("%TRACKNUMINPLAYLIST%", - (track.PlayOrderIndex.ToString().Length >= 1 ? - "00" + track.TrackNumber.ToString() : track.PlayOrderIndex.ToString()) + (track.PlayOrderIndex.ToString().Length == 1 ? "00" + track.PlayOrderIndex.ToString() + : "0" + track.PlayOrderIndex.ToString()) ); return patternstring; } From 2dc10a88e5f2c69d49fb361d0c8ec01fb53c2b6e Mon Sep 17 00:00:00 2001 From: Waleed Date: Sun, 15 Jul 2012 16:11:45 +0500 Subject: [PATCH 4/5] update TranslateTrackNumberInPlaylist definition --- SyncPatternTranslator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SyncPatternTranslator.cs b/SyncPatternTranslator.cs index df4625e..6f6471d 100644 --- a/SyncPatternTranslator.cs +++ b/SyncPatternTranslator.cs @@ -21,7 +21,7 @@ public class SyncPatternTranslator /// %ALBUM% = The album name /// %ALBUMINITIAL% = The album initial /// %NAME% = The track name - /// %TRACKNUMINPLAYLIST% = Play order in playlist + /// %TRACKNUMINPLAYLIST% = Play order index from playlist with leading zero /// %TRACKNUMSPACE% = The track number with a trailing space /// %TRACKNUM% = The track number (no trailing space) /// %DISCNUMDASH% = The disc number with a trailing minus and space @@ -85,7 +85,7 @@ private static string TranslateArtistInitial(SyncPattern pattern, IITFileOrCDTra } /// - /// Translate track playorder in playlist. + /// Translate track playorder index from playlist. /// /// /// From d504f420aff4e9bb4fd8c3fc63f4b83ac6f017ed Mon Sep 17 00:00:00 2001 From: Waleed Date: Thu, 19 Jul 2012 09:35:07 +0500 Subject: [PATCH 5/5] Added support for up to 3 digit (000) file numbering --- SyncPatternTranslator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SyncPatternTranslator.cs b/SyncPatternTranslator.cs index 6f6471d..5238423 100644 --- a/SyncPatternTranslator.cs +++ b/SyncPatternTranslator.cs @@ -95,7 +95,8 @@ private static string TranslateTrackNumberInPlaylist(IITFileOrCDTrack track, str //%TRACKNUMINPLAYLIST% patternstring = patternstring.Replace("%TRACKNUMINPLAYLIST%", (track.PlayOrderIndex.ToString().Length == 1 ? "00" + track.PlayOrderIndex.ToString() - : "0" + track.PlayOrderIndex.ToString()) + : track.PlayOrderIndex.ToString().Length == 2 ? "0" + track.PlayOrderIndex.ToString() + : track.PlayOrderIndex.ToString()) ); return patternstring; }