diff --git a/Snip/Globals.cs b/Snip/Globals.cs index 4b18fa7..b65ddea 100644 --- a/Snip/Globals.cs +++ b/Snip/Globals.cs @@ -32,6 +32,7 @@ public static class Globals public const string ArtistVariable = "$a"; public const string AlbumVariable = "$l"; public const string NewLineVariable = "$n"; + public const string TrackIdVariable = "$i"; #endregion diff --git a/Snip/TextHandler.cs b/Snip/TextHandler.cs index 0f5cdc8..9de11f7 100644 --- a/Snip/TextHandler.cs +++ b/Snip/TextHandler.cs @@ -133,6 +133,7 @@ public static void UpdateText(string title, string artist, string album, string output = output.Replace(Globals.TrackVariable, title); output = output.Replace(Globals.ArtistVariable, artist); output = output.Replace(Globals.NewLineVariable, "\r\n"); + output = output.Replace(Globals.TrackIdVariable, trackId); if (!string.IsNullOrEmpty(album)) { @@ -158,9 +159,9 @@ public static void UpdateText(string title, string artist, string album, string // Check if we want to save artist and track to separate files. if (Globals.SaveSeparateFiles) { - File.WriteAllText(@Application.StartupPath + @"\Snip_Artist.txt", Globals.ArtistFormat.Replace(Globals.ArtistVariable, artist)); - File.WriteAllText(@Application.StartupPath + @"\Snip_Track.txt", Globals.TrackFormat.Replace(Globals.TrackVariable, title)); - File.WriteAllText(@Application.StartupPath + @"\Snip_Album.txt", Globals.AlbumFormat.Replace(Globals.AlbumVariable, album)); + File.WriteAllText(@Application.StartupPath + @"\Snip_Artist.txt", artist); + File.WriteAllText(@Application.StartupPath + @"\Snip_Track.txt", title); + File.WriteAllText(@Application.StartupPath + @"\Snip_Album.txt", album); File.WriteAllText(@Application.StartupPath + @"\Snip_TrackId.txt", trackId); } @@ -178,21 +179,22 @@ public static string UnifyTitles(string title) { title = title.ToUpper(CultureInfo.InvariantCulture); - title = title.Replace(@".", string.Empty); - title = title.Replace(@"/", string.Empty); - title = title.Replace(@"\", string.Empty); - title = title.Replace(@",", string.Empty); - title = title.Replace(@"'", string.Empty); - title = title.Replace(@"(", string.Empty); - title = title.Replace(@")", string.Empty); - title = title.Replace(@"[", string.Empty); - title = title.Replace(@"]", string.Empty); - title = title.Replace(@"!", string.Empty); - title = title.Replace(@"$", string.Empty); - title = title.Replace(@"%", string.Empty); - title = title.Replace(@"&", string.Empty); - title = title.Replace(@"?", string.Empty); - title = title.Replace(@":", string.Empty); + // title = title.Replace(@".", " "); // Causes failed search result from Spotify + title = title.Replace(@"/", " "); + title = title.Replace(@"\", " "); + title = title.Replace(@",", " "); + // title = title.Replace(@"'", " "); // Causes failed search result from Spotify + title = title.Replace(@"(", " "); + title = title.Replace(@")", " "); + title = title.Replace(@"[", " "); + title = title.Replace(@"]", " "); + title = title.Replace(@"!", " "); + title = title.Replace(@"$", " "); + title = title.Replace(@"%", " "); + title = title.Replace(@"&", " "); + title = title.Replace(@"?", " "); + title = title.Replace(@":", " "); + title = title.Replace(@"*", " "); title = CompactWhitespace(title);