From 83e9ee64afc844ee05e11e1c7393335b3d124e57 Mon Sep 17 00:00:00 2001 From: AiiR <22158489+ImAiiR@users.noreply.github.com> Date: Sat, 2 Nov 2024 13:54:05 -0400 Subject: [PATCH] 1.0.0.5 1.0.0.5 --- QobuzDownloaderX/Download/RenameTemplates.cs | 188 +++++++++++------ QobuzDownloaderX/Download/TagFile.cs | 16 +- QobuzDownloaderX/Properties/AssemblyInfo.cs | 4 +- QobuzDownloaderX/qbdlxForm.Designer.cs | 211 ++++++------------- QobuzDownloaderX/qbdlxForm.cs | 116 ++-------- QobuzDownloaderX/qbdlxForm.resx | 14 +- 6 files changed, 231 insertions(+), 318 deletions(-) diff --git a/QobuzDownloaderX/Download/RenameTemplates.cs b/QobuzDownloaderX/Download/RenameTemplates.cs index 262678d..574cb49 100644 --- a/QobuzDownloaderX/Download/RenameTemplates.cs +++ b/QobuzDownloaderX/Download/RenameTemplates.cs @@ -7,6 +7,8 @@ using QobuzDownloaderX; using QopenAPI; using System.Text.RegularExpressions; +using ZetaLongPaths; +using QobuzDownloaderX.Properties; namespace QobuzDownloaderX { @@ -34,57 +36,102 @@ public string renameTemplates(string template, int paddedTrackLength, int padded // Track Templates if (QoItem != null) { - template = GetSafeFilename(template.Replace("%TrackID%", QoItem.Id.ToString())); - template = GetSafeFilename(template.Replace("%TrackArtist%", QoItem.Performer.Name.ToString())); - if (QoItem.Composer != null) { template = GetSafeFilename(template.Replace("%TrackComposer%", QoItem.Composer.Name.ToString())); } - if (QoItem.Version == null) { template = GetSafeFilename(template.Replace("%TrackTitle%", QoItem.Title)); } else { template = GetSafeFilename(template.Replace("%TrackTitle%", QoItem.Title.TrimEnd() + " (" + QoItem.Version + ")")); } - template = GetSafeFilename(template.Replace("%TrackNumber%", QoItem.TrackNumber.ToString().PadLeft(paddedTrackLength, '0'))); - template = GetSafeFilename(template.Replace("%ISRC%", QoItem.ISRC.ToString())); + /* Parent warning tags */ if (QoItem.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%TrackPA%", "Explicit")); } else { template = GetSafeFilename(template.Replace("%TrackPA%", "Clean")); } + if (QoItem.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%TrackPAShort%", "E")); } else { template = GetSafeFilename(template.Replace("%TrackPAShort%", "C")); } if (QoItem.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%TrackPAifEx%", "Explicit")); } else { template = GetSafeFilename(template.Replace("%TrackPAifEx%", "")); } + if (QoItem.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%TrackPAifExShort%", "E")); } else { template = GetSafeFilename(template.Replace("%TrackPAifExShort%", "")); } if (QoItem.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%TrackPAifCl%", "")); } else { template = GetSafeFilename(template.Replace("%TrackPAifCl%", "Clean")); } + if (QoItem.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%TrackPAifClShort%", "")); } else { template = GetSafeFilename(template.Replace("%TrackPAifClShort%", "C")); } if (QoItem.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%TrackPAEnclosed%", "(Explicit)")); } else { template = GetSafeFilename(template.Replace("%TrackPAEnclosed%", "(Clean)")); } + if (QoItem.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%TrackPAEnclosed[]%", "[Explicit]")); } else { template = GetSafeFilename(template.Replace("%TrackPAEnclosed[]%", "[Clean]")); } + if (QoItem.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%TrackPAEnclosedShort%", "(E)")); } else { template = GetSafeFilename(template.Replace("%TrackPAEnclosedShort%", "(C)")); } + if (QoItem.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%TrackPAEnclosedShort[]%", "[E]")); } else { template = GetSafeFilename(template.Replace("%TrackPAEnclosedShort[]%", "[C]")); } if (QoItem.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%TrackPAifExEnclosed%", "(Explicit)")); } else { template = GetSafeFilename(template.Replace("%TrackPAifExEnclosed%", "")); } + if (QoItem.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%TrackPAifExEnclosed[]%", "[Explicit]")); } else { template = GetSafeFilename(template.Replace("%TrackPAifExEnclosed[]%", "")); } + if (QoItem.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%TrackPAifExEnclosedShort%", "(E)")); } else { template = GetSafeFilename(template.Replace("%TrackPAifExEnclosedShort%", "")); } + if (QoItem.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%TrackPAifExEnclosedShort[]%", "[E]")); } else { template = GetSafeFilename(template.Replace("%TrackPAifExEnclosedShort[]%", "")); } if (QoItem.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%TrackPAifClEnclosed%", "")); } else { template = GetSafeFilename(template.Replace("%TrackPAifClEnclosed%", "(Clean)")); } + if (QoItem.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%TrackPAifClEnclosed[]%", "")); } else { template = GetSafeFilename(template.Replace("%TrackPAifClEnclosed[]%", "[Clean]")); } + if (QoItem.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%TrackPAifClEnclosedShort%", "")); } else { template = GetSafeFilename(template.Replace("%TrackPAifClEnclosedShort%", "(C)")); } + if (QoItem.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%TrackPAifClEnclosedShort[]%", "")); } else { template = GetSafeFilename(template.Replace("%TrackPAifClEnclosedShort[]%", "[C]")); } + + template = GetSafeFilename(template.Replace("%TrackID%", QoItem.Id.ToString())); + template = GetSafeFilename(template.Replace("%TrackArtist%", QoItem?.Performer?.Name?.ToString())); + if (QoItem.Composer != null) { template = GetSafeFilename(template.Replace("%TrackComposer%", QoItem.Composer.Name.ToString())); } + if (QoItem.Version == null) { template = GetSafeFilename(template.Replace("%TrackTitle%", QoItem.Title)); } else { template = GetSafeFilename(template.Replace("%TrackTitle%", QoItem.Title.TrimEnd() + " (" + QoItem.Version + ")")); } + template = GetSafeFilename(template.Replace("%TrackNumber%", QoItem.TrackNumber.ToString().PadLeft(paddedTrackLength, '0'))); + template = GetSafeFilename(template.Replace("%ISRC%", QoItem.ISRC.ToString())); // Track Format Templates template = GetSafeFilename(template.Replace("%TrackFormat%", fileFormat.ToUpper().TrimStart('.'))); - if (qbdlxForm._qbdlxForm.format_id == "5" || qbdlxForm._qbdlxForm.format_id == "6") + switch (qbdlxForm._qbdlxForm.format_id) { - template = GetSafeFilename(template.Replace("%TrackFormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.'))); - } - else if (qbdlxForm._qbdlxForm.format_id == "7" || qbdlxForm._qbdlxForm.format_id == "27") - { - if (QoItem.MaximumBitDepth == 16) - { + case "5": template = GetSafeFilename(template.Replace("%TrackFormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.'))); - } - else if (QoItem.MaximumSamplingRate < 192) - { - if (QoItem.MaximumSamplingRate < 96) + template = GetSafeFilename(template.Replace("%TrackFormatWithQuality%", fileFormat.ToUpper().TrimStart('.'))); + break; + case "6": + template = GetSafeFilename(template.Replace("%TrackFormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.'))); + template = GetSafeFilename(template.Replace("%TrackFormatWithQuality%", fileFormat.ToUpper().TrimStart('.') + " (" + QoItem.MaximumBitDepth.ToString() + "bit-" + QoItem.MaximumSamplingRate.ToString() + "kHz)")); + break; + case "7": + case "27": + if (QoItem.MaximumBitDepth == 16) { - template = GetSafeFilename(template.Replace("%TrackFormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (" + QoItem.MaximumBitDepth.ToString() + "bit-" + QoItem.MaximumSamplingRate.ToString() + "kHz)")); + template = GetSafeFilename(template.Replace("%TrackFormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.'))); + template = GetSafeFilename(template.Replace("%TrackFormatWithQuality%", fileFormat.ToUpper().TrimStart('.') + " (" + QoItem.MaximumBitDepth.ToString() + "bit-" + QoItem.MaximumSamplingRate.ToString() + "kHz)")); } - else if (QoItem.MaximumSamplingRate > 96 && QoItem.MaximumSamplingRate < 192) + else if (QoItem.MaximumSamplingRate < 192) { - if (qbdlxForm._qbdlxForm.format_id == "7" && QoItem.MaximumSamplingRate == 176.4) { template = GetSafeFilename(template.Replace("%TrackFormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (24bit-88.2kHz)")); } - else if (qbdlxForm._qbdlxForm.format_id == "7") { template = GetSafeFilename(template.Replace("%TrackFormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (24bit-96kHz)")); } - else { template = GetSafeFilename(template.Replace("%TrackFormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (" + QoItem.MaximumBitDepth.ToString() + "bit-" + QoItem.MaximumSamplingRate.ToString() + "kHz)")); } + template = template.Replace("%TrackFormatWithQuality%", "%TrackFormatWithHiResQuality%"); + + if (QoItem.MaximumSamplingRate < 96) + { + template = GetSafeFilename(template.Replace("%TrackFormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (" + QoItem.MaximumBitDepth.ToString() + "bit-" + QoItem.MaximumSamplingRate.ToString() + "kHz)")); + } + else if (QoItem.MaximumSamplingRate > 96 && QoItem.MaximumSamplingRate < 192) + { + if (qbdlxForm._qbdlxForm.format_id == "7" && QoItem.MaximumSamplingRate == 176.4) { template = GetSafeFilename(template.Replace("%TrackFormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (24bit-88.2kHz)")); } + else if (qbdlxForm._qbdlxForm.format_id == "7") { template = GetSafeFilename(template.Replace("%TrackFormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (24bit-96kHz)")); } + else { template = GetSafeFilename(template.Replace("%TrackFormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (" + QoItem.MaximumBitDepth.ToString() + "bit-" + QoItem.MaximumSamplingRate.ToString() + "kHz)")); } + } + else + { + template = GetSafeFilename(template.Replace("%TrackFormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (24bit-96kHz)")); + } } else { - template = GetSafeFilename(template.Replace("%TrackFormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (24bit-96kHz)")); + template = template.Replace("%TrackFormatWithQuality%", "%TrackFormatWithHiResQuality%"); + template = GetSafeFilename(template.Replace("%TrackFormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (24bit-192kHz)")); } - } - else - { - template = GetSafeFilename(template.Replace("%FormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (24bit-192kHz)")); - } + break; } } - + // Album Templates + /* Parental warning tags */ + if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPA%", "Explicit")); } else { template = GetSafeFilename(template.Replace("%AlbumPA%", "Clean")); } + if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAShort%", "E")); } else { template = GetSafeFilename(template.Replace("%AlbumPAShort%", "C")); } + if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAifEx%", "Explicit")); } else { template = GetSafeFilename(template.Replace("%AlbumPAifEx%", "")); } + if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAifExShort%", "E")); } else { template = GetSafeFilename(template.Replace("%AlbumPAifExShort%", "")); } + if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAifCl%", "")); } else { template = GetSafeFilename(template.Replace("%AlbumPAifCl%", "Clean")); } + if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAifClShort%", "")); } else { template = GetSafeFilename(template.Replace("%AlbumPAifClShort%", "C")); } + if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAEnclosed%", "(Explicit)")); } else { template = GetSafeFilename(template.Replace("%AlbumPAEnclosed%", "(Clean)")); } + if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAEnclosed[]%", "[Explicit]")); } else { template = GetSafeFilename(template.Replace("%AlbumPAEnclosed[]%", "[Clean]")); } + if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAEnclosedShort%", "(E)")); } else { template = GetSafeFilename(template.Replace("%AlbumPAEnclosedShort%", "(C)")); } + if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAEnclosedShort[]%", "[E]")); } else { template = GetSafeFilename(template.Replace("%AlbumPAEnclosedShort[]%", "[C]")); } + if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAifExEnclosed%", "(Explicit)")); } else { template = GetSafeFilename(template.Replace("%AlbumPAifExEnclosed%", "")); } + if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAifExEnclosed[]%", "[Explicit]")); } else { template = GetSafeFilename(template.Replace("%AlbumPAifExEnclosed[]%", "")); } + if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAifExEnclosedShort%", "(E)")); } else { template = GetSafeFilename(template.Replace("%AlbumPAifExEnclosedShort%", "")); } + if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAifExEnclosedShort[]%", "[E]")); } else { template = GetSafeFilename(template.Replace("%AlbumPAifExEnclosedShort[]%", "")); } + if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAifClEnclosed%", "")); } else { template = GetSafeFilename(template.Replace("%AlbumPAifClEnclosed%", "(Clean)")); } + if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAifClEnclosed[]%", "")); } else { template = GetSafeFilename(template.Replace("%AlbumPAifClEnclosed[]%", "[Clean]")); } + if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAifClEnclosedShort%", "")); } else { template = GetSafeFilename(template.Replace("%AlbumPAifClEnclosedShort%", "(C)")); } + if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAifClEnclosedShort[]%", "")); } else { template = GetSafeFilename(template.Replace("%AlbumPAifClEnclosedShort[]%", "[C]")); } + if (QoAlbum != null) { template = GetSafeFilename(template.Replace("%AlbumID%", QoAlbum.Id.ToString())); @@ -98,21 +145,26 @@ public string renameTemplates(string template, int paddedTrackLength, int padded template = GetSafeFilename(template.Replace("%ReleaseDate%", QoAlbum.ReleaseDateOriginal)); template = GetSafeFilename(template.Replace("%Year%", UInt32.Parse(QoAlbum.ReleaseDateOriginal.Substring(0, 4)).ToString())); template = GetSafeFilename(template.Replace("%ReleaseType%", char.ToUpper(QoAlbum.ProductType.First()) + QoAlbum.ProductType.Substring(1).ToLower())); - if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPA%", "Explicit")); } else { template = GetSafeFilename(template.Replace("%AlbumPA%", "Clean")); } - if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAifEx%", "Explicit")); } else { template = GetSafeFilename(template.Replace("%AlbumPAifEx%", "")); } - if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAifCl%", "")); } else { template = GetSafeFilename(template.Replace("%AlbumPAifCl%", "Clean")); } - if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAEnclosed%", "(Explicit)")); } else { template = GetSafeFilename(template.Replace("%AlbumPAEnclosed%", "(Clean)")); } - if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAifExEnclosed%", "(Explicit)")); } else { template = GetSafeFilename(template.Replace("%AlbumPAifExEnclosed%", "")); } - if (QoAlbum.ParentalWarning == true) { template = GetSafeFilename(template.Replace("%AlbumPAifClEnclosed%", "")); } else { template = GetSafeFilename(template.Replace("%AlbumPAifClEnclosed%", "(Clean)")); } + template = GetSafeFilename(template.Replace("%Format%", fileFormat.ToUpper().TrimStart('.'))); // For albums with multiple main artists listed if (QoAlbum.Artists.Count > 1) { var mainArtists = QoAlbum.Artists.Where(a => a.Roles.Contains("main-artist")).ToList(); - string allButLastArtist = string.Join(", ", mainArtists.Take(QoAlbum.Artists.Count - 1).Select(a => a.Name)); + string allButLastArtist = string.Join(", ", mainArtists.Take(mainArtists.Count - 1).Select(a => a.Name)); string lastArtist = mainArtists.Last().Name; - template = GetSafeFilename(template.Replace("%ArtistName%", allButLastArtist + " & " + lastArtist)); + + if (mainArtists.Count > 1) + { + template = GetSafeFilename(template.Replace("%ArtistName%", allButLastArtist + " & " + lastArtist)); + } + else + { + template = GetSafeFilename(template.Replace("%ArtistName%", lastArtist)); + } + + } else { @@ -127,49 +179,59 @@ public string renameTemplates(string template, int paddedTrackLength, int padded template = GetSafeFilename(template.Replace("%PlaylistTitle%", QoPlaylist.Name)); template = GetSafeFilename(template.Replace("%Format%", fileFormat.ToUpper().TrimStart('.'))); template = GetSafeFilename(template.Replace("%FormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.'))); + template = GetSafeFilename(template.Replace("%FormatWithQuality%", fileFormat.ToUpper().TrimStart('.'))); } // Release Format Templates if (QoPlaylist == null) { - template = GetSafeFilename(template.Replace("%Format%", fileFormat.ToUpper().TrimStart('.'))); - - if (qbdlxForm._qbdlxForm.format_id == "5" || qbdlxForm._qbdlxForm.format_id == "6") + switch (qbdlxForm._qbdlxForm.format_id) { - template = GetSafeFilename(template.Replace("%FormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.'))); - } - else if (qbdlxForm._qbdlxForm.format_id == "7" || qbdlxForm._qbdlxForm.format_id == "27") - { - if (QoAlbum.MaximumBitDepth == 16) - { + case "5": template = GetSafeFilename(template.Replace("%FormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.'))); - } - else if (QoAlbum.MaximumSamplingRate < 192) - { - if (QoAlbum.MaximumSamplingRate < 96) + template = GetSafeFilename(template.Replace("%FormatWithQuality%", fileFormat.ToUpper().TrimStart('.'))); + break; + case "6": + template = GetSafeFilename(template.Replace("%FormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.'))); + template = GetSafeFilename(template.Replace("%FormatWithQuality%", fileFormat.ToUpper().TrimStart('.') + " (16bit-44.1kHz)")); + break; + case "7": + case "27": + if (QoAlbum.MaximumBitDepth == 16) { - template = GetSafeFilename(template.Replace("%FormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (" + QoAlbum.MaximumBitDepth.ToString() + "bit-" + QoAlbum.MaximumSamplingRate.ToString() + "kHz)")); + template = GetSafeFilename(template.Replace("%FormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.'))); + template = GetSafeFilename(template.Replace("%FormatWithQuality%", fileFormat.ToUpper().TrimStart('.') + " (" + QoAlbum.MaximumBitDepth.ToString() + "bit-" + QoAlbum.MaximumSamplingRate.ToString() + "kHz)")); } - else if (QoAlbum.MaximumSamplingRate > 96 && QoAlbum.MaximumSamplingRate < 192) + else if (QoAlbum.MaximumSamplingRate < 192) { - if (qbdlxForm._qbdlxForm.format_id == "7" && QoAlbum.MaximumSamplingRate == 176.4) { template = GetSafeFilename(template.Replace("%FormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (24bit-88.2kHz)")); } - else if (qbdlxForm._qbdlxForm.format_id == "7") { template = GetSafeFilename(template.Replace("%FormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (24bit-96kHz)")); } - else { template = GetSafeFilename(template.Replace("%FormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (" + QoAlbum.MaximumBitDepth.ToString() + "bit-" + QoAlbum.MaximumSamplingRate.ToString() + "kHz)")); } + template = template.Replace("%FormatWithQuality%", "%FormatWithHiResQuality%"); + + if (QoAlbum.MaximumSamplingRate < 96) + { + template = GetSafeFilename(template.Replace("%FormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (" + QoAlbum.MaximumBitDepth.ToString() + "bit-" + QoAlbum.MaximumSamplingRate.ToString() + "kHz)")); + } + else if (QoAlbum.MaximumSamplingRate > 96 && QoAlbum.MaximumSamplingRate < 192) + { + if (qbdlxForm._qbdlxForm.format_id == "7" && QoAlbum.MaximumSamplingRate == 176.4) { template = GetSafeFilename(template.Replace("%FormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (24bit-88.2kHz)")); } + else if (qbdlxForm._qbdlxForm.format_id == "7") { template = GetSafeFilename(template.Replace("%FormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (24bit-96kHz)")); } + else { template = GetSafeFilename(template.Replace("%FormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (" + QoAlbum.MaximumBitDepth.ToString() + "bit-" + QoAlbum.MaximumSamplingRate.ToString() + "kHz)")); } + } + else + { + template = GetSafeFilename(template.Replace("%FormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (24bit-96kHz)")); + } } else { - template = GetSafeFilename(template.Replace("%FormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (24bit-96kHz)")); + template = template.Replace("%FormatWithQuality%", "%FormatWithHiResQuality%"); + template = GetSafeFilename(template.Replace("%FormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (24bit-192kHz)")); } - } - else - { - template = GetSafeFilename(template.Replace("%FormatWithHiResQuality%", fileFormat.ToUpper().TrimStart('.') + " (24bit-192kHz)")); - } + break; } } - qbdlxForm._qbdlxForm.logger.Debug("Template output - " + template.Replace("{backslash}", @"\").Replace("{forwardslash}", @"/")); - return template.Replace("{backslash}", @"\").Replace("{forwardslash}", @"/"); + qbdlxForm._qbdlxForm.logger.Debug("Template output - " + Regex.Replace(Regex.Replace(template.Replace("{backslash}", @"\").Replace("{forwardslash}", @"/"), @"\s+", " ").Replace(@" \", @"\"), @"\s+\\", " ")); + return Regex.Replace(Regex.Replace(template.Replace("{backslash}", @"\").Replace("{forwardslash}", @"/"), @"\s+", " ").Replace(@" \", @"\"), @"\s+\\", " "); } } } diff --git a/QobuzDownloaderX/Download/TagFile.cs b/QobuzDownloaderX/Download/TagFile.cs index ade725e..1830f7a 100644 --- a/QobuzDownloaderX/Download/TagFile.cs +++ b/QobuzDownloaderX/Download/TagFile.cs @@ -30,6 +30,7 @@ public static void WriteToFile(string tempPath, string artworkPath, Album QoAlbu if (Settings.Default.upcTag == true) { customTagsFLAC.SetField("BARCODE", QoAlbum.UPC); } // UPC / Barcode (FLAC) if (Settings.Default.labelTag == true) { customTagsFLAC.SetField("LABEL", Regex.Replace(QoAlbum.Label.Name, @"\s+", " ")); } // Record Label (FLAC) [Removing any chance of double spaces] if (Settings.Default.explicitTag == true) { if (QoItem.ParentalWarning == true) { customTagsFLAC.SetField("ITUNESADVISORY", "1"); } else { customTagsFLAC.SetField("ITUNESADVISORY", "0"); } } // Parental Advisory (FLAC) + if (Settings.Default.commentTag == true && Settings.Default.commentText != string.Empty) { customTagsFLAC.SetField("COMMENT", new string[] { Settings.Default.commentText.Replace("%description%", "%Description%").Replace("%Description%", QoAlbum.Description).Replace("
", System.Environment.NewLine).Replace("
", System.Environment.NewLine) }); } // Comment (FLAC) } else { @@ -46,10 +47,11 @@ public static void WriteToFile(string tempPath, string artworkPath, Album QoAlbu if (Settings.Default.isrcTag == true) { mp3Tag.SetTextFrame("TSRC", QoItem.ISRC); } // ISRC (MP3) if (Settings.Default.labelTag == true) { mp3Tag.SetTextFrame("TPUB", Regex.Replace(QoAlbum.Label.Name, @"\s+", " ")); } // Record Label (MP3) [Removing any chance of double spaces] if (Settings.Default.typeTag == true) { mp3Tag.SetTextFrame("TMED", QoAlbum.ProductType.ToUpper()); } // Type of release (MP3) + if (Settings.Default.commentTag == true && Settings.Default.commentText != string.Empty) { file.Tag.Comment = Settings.Default.commentText.Replace("%description%", "%Description%").Replace("%Description%", QoAlbum.Description).Replace("
", System.Environment.NewLine).Replace("
", System.Environment.NewLine); } // Comment (MP3) } qbdlxForm._qbdlxForm.logger.Debug("Writing all other tags"); if (Settings.Default.trackTitleTag == true) { file.Tag.Title = QoItem.Title; } // Track Title - if (Settings.Default.artistTag == true) { file.Tag.Performers = new[] { QoItem.Performer.Name }; } // Track Artist + if (Settings.Default.artistTag == true) { file.Tag.Performers = new[] { QoItem?.Performer?.Name }; } // Track Artist if (Settings.Default.genreTag == true) { file.Tag.Genres = new[] { QoAlbum.Genre.Name }; } // Genre if (Settings.Default.albumTag == true) { if (QoAlbum.Version == null) { file.Tag.Album = QoAlbum.Title; } else { file.Tag.Album = QoAlbum.Title.TrimEnd() + " (" + QoAlbum.Version + ")"; } } // Album Title if (Settings.Default.trackTitleTag == true) { if (QoItem.Version == null) { file.Tag.Title = QoItem.Title; } else { file.Tag.Title = QoItem.Title.TrimEnd() + " (" + QoItem.Version + ")"; } } // Track Title @@ -64,9 +66,17 @@ public static void WriteToFile(string tempPath, string artworkPath, Album QoAlbu if (QoAlbum.Artists.Count > 1) { var mainArtists = QoAlbum.Artists.Where(a => a.Roles.Contains("main-artist")).ToList(); - string allButLastArtist = string.Join(", ", mainArtists.Take(QoAlbum.Artists.Count - 1).Select(a => a.Name)); + string allButLastArtist = string.Join(", ", mainArtists.Take(mainArtists.Count - 1).Select(a => a.Name)); string lastArtist = mainArtists.Last().Name; - if (Settings.Default.albumArtistTag == true) { if (QoAlbum.Artist.Name != null) { file.Tag.AlbumArtists = new[] { allButLastArtist + " & " + lastArtist }; } } + + if (mainArtists.Count > 1) + { + if (Settings.Default.albumArtistTag == true) { if (QoAlbum.Artist.Name != null) { file.Tag.AlbumArtists = new[] { allButLastArtist + " & " + lastArtist }; } } + } + else + { + if (Settings.Default.albumArtistTag == true) { if (QoAlbum.Artist.Name != null) { file.Tag.AlbumArtists = new[] { lastArtist }; } } + } } else { diff --git a/QobuzDownloaderX/Properties/AssemblyInfo.cs b/QobuzDownloaderX/Properties/AssemblyInfo.cs index caff39c..825eaf9 100644 --- a/QobuzDownloaderX/Properties/AssemblyInfo.cs +++ b/QobuzDownloaderX/Properties/AssemblyInfo.cs @@ -33,5 +33,5 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.4")] -[assembly: AssemblyFileVersion("1.0.0.4")] +[assembly: AssemblyVersion("1.0.0.5")] +[assembly: AssemblyFileVersion("1.0.0.5")] diff --git a/QobuzDownloaderX/qbdlxForm.Designer.cs b/QobuzDownloaderX/qbdlxForm.Designer.cs index 3afd9e2..05462c2 100644 --- a/QobuzDownloaderX/qbdlxForm.Designer.cs +++ b/QobuzDownloaderX/qbdlxForm.Designer.cs @@ -56,14 +56,6 @@ private void InitializeComponent() this.templatesListLabel = new System.Windows.Forms.Label(); this.templatesListTextbox = new System.Windows.Forms.TextBox(); this.additionalSettingsButton = new System.Windows.Forms.Button(); - this.mp3Button = new System.Windows.Forms.RadioButton(); - this.flacLowButton = new System.Windows.Forms.RadioButton(); - this.flacMidButton = new System.Windows.Forms.RadioButton(); - this.flacHighButton = new System.Windows.Forms.RadioButton(); - this.mp3Label = new System.Windows.Forms.Label(); - this.flacLowLabel = new System.Windows.Forms.Label(); - this.flacMidLabel = new System.Windows.Forms.Label(); - this.flacHighLabel = new System.Windows.Forms.Label(); this.trackTemplateTextbox = new System.Windows.Forms.TextBox(); this.trackTemplateLabel = new System.Windows.Forms.Label(); this.playlistTemplateTextbox = new System.Windows.Forms.TextBox(); @@ -72,7 +64,6 @@ private void InitializeComponent() this.favoritesTemplateTextbox = new System.Windows.Forms.TextBox(); this.albumTemplateTextbox = new System.Windows.Forms.TextBox(); this.downloadFolderTextbox = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); this.artistTemplateLabel = new System.Windows.Forms.Label(); this.favoritesTemplateLabel = new System.Windows.Forms.Label(); this.albumTemplateLabel = new System.Windows.Forms.Label(); @@ -91,6 +82,9 @@ private void InitializeComponent() this.aboutLabel = new System.Windows.Forms.Label(); this.folderBrowser = new System.Windows.Forms.FolderBrowserDialog(); this.extraSettingsPanel = new System.Windows.Forms.Panel(); + this.commentCheckbox = new System.Windows.Forms.CheckBox(); + this.commentTextbox = new System.Windows.Forms.TextBox(); + this.commentLabel = new System.Windows.Forms.Label(); this.downloadSpeedCheckbox = new System.Windows.Forms.CheckBox(); this.fixMD5sCheckbox = new System.Windows.Forms.CheckBox(); this.streamableCheckbox = new System.Windows.Forms.CheckBox(); @@ -489,14 +483,6 @@ private void InitializeComponent() this.settingsPanel.Controls.Add(this.templatesListLabel); this.settingsPanel.Controls.Add(this.templatesListTextbox); this.settingsPanel.Controls.Add(this.additionalSettingsButton); - this.settingsPanel.Controls.Add(this.mp3Button); - this.settingsPanel.Controls.Add(this.flacLowButton); - this.settingsPanel.Controls.Add(this.flacMidButton); - this.settingsPanel.Controls.Add(this.flacHighButton); - this.settingsPanel.Controls.Add(this.mp3Label); - this.settingsPanel.Controls.Add(this.flacLowLabel); - this.settingsPanel.Controls.Add(this.flacMidLabel); - this.settingsPanel.Controls.Add(this.flacHighLabel); this.settingsPanel.Controls.Add(this.trackTemplateTextbox); this.settingsPanel.Controls.Add(this.trackTemplateLabel); this.settingsPanel.Controls.Add(this.playlistTemplateTextbox); @@ -505,7 +491,6 @@ private void InitializeComponent() this.settingsPanel.Controls.Add(this.favoritesTemplateTextbox); this.settingsPanel.Controls.Add(this.albumTemplateTextbox); this.settingsPanel.Controls.Add(this.downloadFolderTextbox); - this.settingsPanel.Controls.Add(this.label1); this.settingsPanel.Controls.Add(this.artistTemplateLabel); this.settingsPanel.Controls.Add(this.favoritesTemplateLabel); this.settingsPanel.Controls.Add(this.albumTemplateLabel); @@ -516,7 +501,7 @@ private void InitializeComponent() this.settingsPanel.Controls.Add(this.selectFolderButton); this.settingsPanel.Controls.Add(this.templatesLabel); this.settingsPanel.Controls.Add(this.settingsLabel); - this.settingsPanel.Location = new System.Drawing.Point(507, 463); + this.settingsPanel.Location = new System.Drawing.Point(531, 449); this.settingsPanel.Name = "settingsPanel"; this.settingsPanel.Size = new System.Drawing.Size(771, 577); this.settingsPanel.TabIndex = 1; @@ -525,7 +510,7 @@ private void InitializeComponent() // this.templatesListLabel.Font = new System.Drawing.Font("Nirmala UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.templatesListLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(147)))), ((int)(((byte)(147)))), ((int)(((byte)(147))))); - this.templatesListLabel.Location = new System.Drawing.Point(0, 422); + this.templatesListLabel.Location = new System.Drawing.Point(0, 384); this.templatesListLabel.Name = "templatesListLabel"; this.templatesListLabel.Size = new System.Drawing.Size(771, 25); this.templatesListLabel.TabIndex = 28; @@ -539,13 +524,13 @@ private void InitializeComponent() this.templatesListTextbox.Cursor = System.Windows.Forms.Cursors.IBeam; this.templatesListTextbox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.templatesListTextbox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(147)))), ((int)(((byte)(147)))), ((int)(((byte)(147))))); - this.templatesListTextbox.Location = new System.Drawing.Point(96, 450); + this.templatesListTextbox.Location = new System.Drawing.Point(96, 416); this.templatesListTextbox.Multiline = true; this.templatesListTextbox.Name = "templatesListTextbox"; this.templatesListTextbox.ReadOnly = true; this.templatesListTextbox.RightToLeft = System.Windows.Forms.RightToLeft.No; this.templatesListTextbox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.templatesListTextbox.Size = new System.Drawing.Size(595, 67); + this.templatesListTextbox.Size = new System.Drawing.Size(595, 101); this.templatesListTextbox.TabIndex = 27; this.templatesListTextbox.Text = resources.GetString("templatesListTextbox.Text"); this.templatesListTextbox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; @@ -567,106 +552,6 @@ private void InitializeComponent() this.additionalSettingsButton.UseVisualStyleBackColor = false; this.additionalSettingsButton.Click += new System.EventHandler(this.additionalSettingsButton_Click); // - // mp3Button - // - this.mp3Button.AutoSize = true; - this.mp3Button.FlatAppearance.BorderSize = 0; - this.mp3Button.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.mp3Button.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); - this.mp3Button.Location = new System.Drawing.Point(622, 395); - this.mp3Button.Name = "mp3Button"; - this.mp3Button.Size = new System.Drawing.Size(13, 12); - this.mp3Button.TabIndex = 5; - this.mp3Button.UseVisualStyleBackColor = true; - this.mp3Button.CheckedChanged += new System.EventHandler(this.mp3Button_CheckedChanged); - // - // flacLowButton - // - this.flacLowButton.AutoSize = true; - this.flacLowButton.FlatAppearance.BorderSize = 0; - this.flacLowButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.flacLowButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); - this.flacLowButton.Location = new System.Drawing.Point(490, 395); - this.flacLowButton.Name = "flacLowButton"; - this.flacLowButton.Size = new System.Drawing.Size(13, 12); - this.flacLowButton.TabIndex = 5; - this.flacLowButton.UseVisualStyleBackColor = true; - this.flacLowButton.CheckedChanged += new System.EventHandler(this.flacLowButton_CheckedChanged); - // - // flacMidButton - // - this.flacMidButton.AutoSize = true; - this.flacMidButton.FlatAppearance.BorderSize = 0; - this.flacMidButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.flacMidButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); - this.flacMidButton.Location = new System.Drawing.Point(368, 395); - this.flacMidButton.Name = "flacMidButton"; - this.flacMidButton.Size = new System.Drawing.Size(13, 12); - this.flacMidButton.TabIndex = 5; - this.flacMidButton.UseVisualStyleBackColor = true; - this.flacMidButton.CheckedChanged += new System.EventHandler(this.flacMidButton_CheckedChanged); - // - // flacHighButton - // - this.flacHighButton.AutoSize = true; - this.flacHighButton.FlatAppearance.BorderSize = 0; - this.flacHighButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.flacHighButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); - this.flacHighButton.Location = new System.Drawing.Point(248, 395); - this.flacHighButton.Name = "flacHighButton"; - this.flacHighButton.Size = new System.Drawing.Size(13, 12); - this.flacHighButton.TabIndex = 5; - this.flacHighButton.UseVisualStyleBackColor = true; - this.flacHighButton.CheckedChanged += new System.EventHandler(this.flacHighButton_CheckedChanged); - // - // mp3Label - // - this.mp3Label.AutoSize = true; - this.mp3Label.Font = new System.Drawing.Font("Nirmala UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.mp3Label.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(147)))), ((int)(((byte)(147)))), ((int)(((byte)(147))))); - this.mp3Label.Location = new System.Drawing.Point(641, 395); - this.mp3Label.Name = "mp3Label"; - this.mp3Label.Size = new System.Drawing.Size(50, 13); - this.mp3Label.TabIndex = 4; - this.mp3Label.Text = "MP3 320"; - this.mp3Label.Click += new System.EventHandler(this.mp3Label_Click); - // - // flacLowLabel - // - this.flacLowLabel.AutoSize = true; - this.flacLowLabel.Font = new System.Drawing.Font("Nirmala UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.flacLowLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(147)))), ((int)(((byte)(147)))), ((int)(((byte)(147))))); - this.flacLowLabel.Location = new System.Drawing.Point(509, 395); - this.flacLowLabel.Name = "flacLowLabel"; - this.flacLowLabel.Size = new System.Drawing.Size(78, 13); - this.flacLowLabel.TabIndex = 4; - this.flacLowLabel.Text = "FLAC (16/44.1)"; - this.flacLowLabel.Click += new System.EventHandler(this.flacLowLabel_Click); - // - // flacMidLabel - // - this.flacMidLabel.AutoSize = true; - this.flacMidLabel.Font = new System.Drawing.Font("Nirmala UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.flacMidLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(147)))), ((int)(((byte)(147)))), ((int)(((byte)(147))))); - this.flacMidLabel.Location = new System.Drawing.Point(387, 395); - this.flacMidLabel.Name = "flacMidLabel"; - this.flacMidLabel.Size = new System.Drawing.Size(69, 13); - this.flacMidLabel.TabIndex = 4; - this.flacMidLabel.Text = "FLAC (24/96)"; - this.flacMidLabel.Click += new System.EventHandler(this.flacMidLabel_Click); - // - // flacHighLabel - // - this.flacHighLabel.AutoSize = true; - this.flacHighLabel.Font = new System.Drawing.Font("Nirmala UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.flacHighLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(147)))), ((int)(((byte)(147)))), ((int)(((byte)(147))))); - this.flacHighLabel.Location = new System.Drawing.Point(264, 395); - this.flacHighLabel.Name = "flacHighLabel"; - this.flacHighLabel.Size = new System.Drawing.Size(75, 13); - this.flacHighLabel.TabIndex = 4; - this.flacHighLabel.Text = "FLAC (24/192)"; - this.flacHighLabel.Click += new System.EventHandler(this.flacHighLabel_Click); - // // trackTemplateTextbox // this.trackTemplateTextbox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); @@ -772,17 +657,6 @@ private void InitializeComponent() this.downloadFolderTextbox.TabIndex = 2; this.downloadFolderTextbox.Text = "no folder selected"; // - // label1 - // - this.label1.Font = new System.Drawing.Font("Nirmala UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(147)))), ((int)(((byte)(147)))), ((int)(((byte)(147))))); - this.label1.Location = new System.Drawing.Point(0, 387); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(242, 25); - this.label1.TabIndex = 1; - this.label1.Text = "QUALITY"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // // artistTemplateLabel // this.artistTemplateLabel.Font = new System.Drawing.Font("Nirmala UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -1001,6 +875,9 @@ private void InitializeComponent() // // extraSettingsPanel // + this.extraSettingsPanel.Controls.Add(this.commentCheckbox); + this.extraSettingsPanel.Controls.Add(this.commentTextbox); + this.extraSettingsPanel.Controls.Add(this.commentLabel); this.extraSettingsPanel.Controls.Add(this.downloadSpeedCheckbox); this.extraSettingsPanel.Controls.Add(this.fixMD5sCheckbox); this.extraSettingsPanel.Controls.Add(this.streamableCheckbox); @@ -1031,18 +908,56 @@ private void InitializeComponent() this.extraSettingsPanel.Controls.Add(this.albumArtistCheckbox); this.extraSettingsPanel.Controls.Add(this.extraSettingsLabel); this.extraSettingsPanel.Font = new System.Drawing.Font("Nirmala UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.extraSettingsPanel.Location = new System.Drawing.Point(595, 400); + this.extraSettingsPanel.Location = new System.Drawing.Point(595, 411); this.extraSettingsPanel.Name = "extraSettingsPanel"; this.extraSettingsPanel.Size = new System.Drawing.Size(771, 577); this.extraSettingsPanel.TabIndex = 3; this.extraSettingsPanel.Visible = false; // + // commentCheckbox + // + this.commentCheckbox.AutoSize = true; + this.commentCheckbox.Font = new System.Drawing.Font("Nirmala UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.commentCheckbox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(147)))), ((int)(((byte)(147)))), ((int)(((byte)(147))))); + this.commentCheckbox.Location = new System.Drawing.Point(327, 157); + this.commentCheckbox.Name = "commentCheckbox"; + this.commentCheckbox.Size = new System.Drawing.Size(117, 17); + this.commentCheckbox.TabIndex = 32; + this.commentCheckbox.Text = "Custom Comment"; + this.commentCheckbox.UseVisualStyleBackColor = true; + this.commentCheckbox.CheckedChanged += new System.EventHandler(this.commentCheckbox_CheckedChanged); + // + // commentTextbox + // + this.commentTextbox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); + this.commentTextbox.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.commentTextbox.Font = new System.Drawing.Font("Nirmala UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.commentTextbox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(147)))), ((int)(((byte)(147)))), ((int)(((byte)(147))))); + this.commentTextbox.Location = new System.Drawing.Point(288, 185); + this.commentTextbox.Multiline = true; + this.commentTextbox.Name = "commentTextbox"; + this.commentTextbox.Size = new System.Drawing.Size(276, 21); + this.commentTextbox.TabIndex = 31; + this.commentTextbox.WordWrap = false; + this.commentTextbox.TextChanged += new System.EventHandler(this.commentTextbox_TextChanged); + // + // commentLabel + // + this.commentLabel.Font = new System.Drawing.Font("Nirmala UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.commentLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(147)))), ((int)(((byte)(147)))), ((int)(((byte)(147))))); + this.commentLabel.Location = new System.Drawing.Point(40, 182); + this.commentLabel.Name = "commentLabel"; + this.commentLabel.Size = new System.Drawing.Size(242, 25); + this.commentLabel.TabIndex = 30; + this.commentLabel.Text = "CUSTOM COMMENT"; + this.commentLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // // downloadSpeedCheckbox // this.downloadSpeedCheckbox.AutoSize = true; this.downloadSpeedCheckbox.Font = new System.Drawing.Font("Nirmala UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.downloadSpeedCheckbox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(147)))), ((int)(((byte)(147)))), ((int)(((byte)(147))))); - this.downloadSpeedCheckbox.Location = new System.Drawing.Point(314, 336); + this.downloadSpeedCheckbox.Location = new System.Drawing.Point(314, 400); this.downloadSpeedCheckbox.Name = "downloadSpeedCheckbox"; this.downloadSpeedCheckbox.Size = new System.Drawing.Size(142, 17); this.downloadSpeedCheckbox.TabIndex = 29; @@ -1057,7 +972,7 @@ private void InitializeComponent() this.fixMD5sCheckbox.CheckState = System.Windows.Forms.CheckState.Checked; this.fixMD5sCheckbox.Font = new System.Drawing.Font("Nirmala UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.fixMD5sCheckbox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(147)))), ((int)(((byte)(147)))), ((int)(((byte)(147))))); - this.fixMD5sCheckbox.Location = new System.Drawing.Point(230, 308); + this.fixMD5sCheckbox.Location = new System.Drawing.Point(230, 372); this.fixMD5sCheckbox.Name = "fixMD5sCheckbox"; this.fixMD5sCheckbox.Size = new System.Drawing.Size(311, 17); this.fixMD5sCheckbox.TabIndex = 28; @@ -1072,7 +987,7 @@ private void InitializeComponent() this.streamableCheckbox.CheckState = System.Windows.Forms.CheckState.Checked; this.streamableCheckbox.Font = new System.Drawing.Font("Nirmala UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.streamableCheckbox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(147)))), ((int)(((byte)(147)))), ((int)(((byte)(147))))); - this.streamableCheckbox.Location = new System.Drawing.Point(327, 280); + this.streamableCheckbox.Location = new System.Drawing.Point(327, 344); this.streamableCheckbox.Name = "streamableCheckbox"; this.streamableCheckbox.Size = new System.Drawing.Size(117, 17); this.streamableCheckbox.TabIndex = 27; @@ -1084,7 +999,7 @@ private void InitializeComponent() // this.label5.Font = new System.Drawing.Font("Nirmala UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(147)))), ((int)(((byte)(147)))), ((int)(((byte)(147))))); - this.label5.Location = new System.Drawing.Point(0, 238); + this.label5.Location = new System.Drawing.Point(0, 302); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(771, 25); this.label5.TabIndex = 26; @@ -1112,7 +1027,7 @@ private void InitializeComponent() // this.label4.AutoSize = true; this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(147)))), ((int)(((byte)(147)))), ((int)(((byte)(147))))); - this.label4.Location = new System.Drawing.Point(282, 192); + this.label4.Location = new System.Drawing.Point(282, 256); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(104, 13); this.label4.TabIndex = 24; @@ -1130,7 +1045,7 @@ private void InitializeComponent() "150", "100", "50"}); - this.savedArtSizeSelect.Location = new System.Drawing.Point(392, 189); + this.savedArtSizeSelect.Location = new System.Drawing.Point(392, 253); this.savedArtSizeSelect.Name = "savedArtSizeSelect"; this.savedArtSizeSelect.Size = new System.Drawing.Size(121, 21); this.savedArtSizeSelect.TabIndex = 23; @@ -1151,7 +1066,7 @@ private void InitializeComponent() // this.label2.AutoSize = true; this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(147)))), ((int)(((byte)(147)))), ((int)(((byte)(147))))); - this.label2.Location = new System.Drawing.Point(257, 160); + this.label2.Location = new System.Drawing.Point(257, 224); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(129, 13); this.label2.TabIndex = 21; @@ -1169,7 +1084,7 @@ private void InitializeComponent() "150", "100", "50"}); - this.embeddedArtSizeSelect.Location = new System.Drawing.Point(392, 157); + this.embeddedArtSizeSelect.Location = new System.Drawing.Point(392, 221); this.embeddedArtSizeSelect.Name = "embeddedArtSizeSelect"; this.embeddedArtSizeSelect.Size = new System.Drawing.Size(121, 21); this.embeddedArtSizeSelect.TabIndex = 20; @@ -1814,15 +1729,6 @@ private void InitializeComponent() private System.Windows.Forms.Label favoritesTemplateLabel; private System.Windows.Forms.TextBox artistTemplateTextbox; private System.Windows.Forms.Label artistTemplateLabel; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label mp3Label; - private System.Windows.Forms.Label flacLowLabel; - private System.Windows.Forms.Label flacMidLabel; - private System.Windows.Forms.Label flacHighLabel; - private System.Windows.Forms.RadioButton mp3Button; - private System.Windows.Forms.RadioButton flacLowButton; - private System.Windows.Forms.RadioButton flacMidButton; - private System.Windows.Forms.RadioButton flacHighButton; private System.Windows.Forms.Panel extraSettingsPanel; private System.Windows.Forms.Label extraSettingsLabel; private System.Windows.Forms.CheckBox albumArtistCheckbox; @@ -1879,5 +1785,8 @@ private void InitializeComponent() public System.Windows.Forms.Button downloadButton; public System.Windows.Forms.CheckBox downloadSpeedCheckbox; public System.Windows.Forms.Label progressLabel; + private System.Windows.Forms.CheckBox commentCheckbox; + private System.Windows.Forms.TextBox commentTextbox; + private System.Windows.Forms.Label commentLabel; } } \ No newline at end of file diff --git a/QobuzDownloaderX/qbdlxForm.cs b/QobuzDownloaderX/qbdlxForm.cs index 624fa6a..6e608cf 100644 --- a/QobuzDownloaderX/qbdlxForm.cs +++ b/QobuzDownloaderX/qbdlxForm.cs @@ -150,13 +150,9 @@ private void qbdlxForm_Load(object sender, EventArgs e) updateTemplates(); // Saved Quality Selection - mp3Button.Checked = Settings.Default.quality1; mp3Button2.Checked = Settings.Default.quality1; - flacLowButton.Checked = Settings.Default.quality2; flacLowButton2.Checked = Settings.Default.quality2; - flacMidButton.Checked = Settings.Default.quality3; flacMidButton2.Checked = Settings.Default.quality3; - flacHighButton.Checked = Settings.Default.quality4; flacHighButton2.Checked = Settings.Default.quality4; format_id = Settings.Default.qualityFormat; audio_format = Settings.Default.audioType; @@ -185,7 +181,6 @@ private void qbdlxForm_Load(object sender, EventArgs e) embeddedArtSizeSelect.SelectedIndex = Settings.Default.savedEmbeddedArtSize; embeddedArtSize = embeddedArtSizeSelect.Text; savedArtSizeSelect.SelectedIndex = Settings.Default.savedSavedArtSize; savedArtSize = savedArtSizeSelect.Text; - // Move all panels to correct spot downloaderPanel.Location = new Point(179, 0); aboutPanel.Location = new Point(179, 0); @@ -524,9 +519,17 @@ public async Task updateAlbumInfoLabels(Album QoAlbum) if (QoAlbum.Artists.Count > 1) { var mainArtists = QoAlbum.Artists.Where(a => a.Roles.Contains("main-artist")).ToList(); - string allButLastArtist = string.Join(", ", mainArtists.Take(QoAlbum.Artists.Count - 1).Select(a => a.Name)); + string allButLastArtist = string.Join(", ", mainArtists.Take(mainArtists.Count - 1).Select(a => a.Name)); string lastArtist = mainArtists.Last().Name; - artistLabel.Text = allButLastArtist + " && " + lastArtist; + + if (mainArtists.Count > 1) + { + artistLabel.Text = allButLastArtist + " && " + lastArtist; + } + else + { + artistLabel.Text = lastArtist; + } } else { @@ -632,21 +635,6 @@ private void saveTemplatesButton_Click(object sender, EventArgs e) } #region Quality Selection - private void flacHighButton_CheckedChanged(object sender, EventArgs e) - { - Settings.Default.quality4 = flacHighButton.Checked; - Settings.Default.Save(); - - if (flacHighButton.Checked == true) - { - logger.Debug("Setting format ID to 27"); - format_id = "27"; - audio_format = ".flac"; - flacHighButton2.Checked = true; - Settings.Default.qualityFormat = format_id; - Settings.Default.audioType = audio_format; - } - } private void flacHighButton2_CheckedChanged(object sender, EventArgs e) { @@ -658,23 +646,6 @@ private void flacHighButton2_CheckedChanged(object sender, EventArgs e) logger.Debug("Setting format ID to 27"); format_id = "27"; audio_format = ".flac"; - flacHighButton.Checked = true; - Settings.Default.qualityFormat = format_id; - Settings.Default.audioType = audio_format; - } - } - - private void flacMidButton_CheckedChanged(object sender, EventArgs e) - { - Settings.Default.quality3 = flacMidButton.Checked; - Settings.Default.Save(); - - if (flacMidButton.Checked == true) - { - logger.Debug("Setting format ID to 7"); - format_id = "7"; - audio_format = ".flac"; - flacMidButton2.Checked = true; Settings.Default.qualityFormat = format_id; Settings.Default.audioType = audio_format; } @@ -690,23 +661,6 @@ private void flacMidButton2_CheckedChanged(object sender, EventArgs e) logger.Debug("Setting format ID to 7"); format_id = "7"; audio_format = ".flac"; - flacMidButton.Checked = true; - Settings.Default.qualityFormat = format_id; - Settings.Default.audioType = audio_format; - } - } - - private void flacLowButton_CheckedChanged(object sender, EventArgs e) - { - Settings.Default.quality2 = flacLowButton.Checked; - Settings.Default.Save(); - - if (flacLowButton.Checked == true) - { - logger.Debug("Setting format ID to 6"); - format_id = "6"; - audio_format = ".flac"; - flacLowButton2.Checked = true; Settings.Default.qualityFormat = format_id; Settings.Default.audioType = audio_format; } @@ -722,23 +676,6 @@ private void flacLowButton2_CheckedChanged(object sender, EventArgs e) logger.Debug("Setting format ID to 6"); format_id = "6"; audio_format = ".flac"; - flacLowButton.Checked = true; - Settings.Default.qualityFormat = format_id; - Settings.Default.audioType = audio_format; - } - } - - private void mp3Button_CheckedChanged(object sender, EventArgs e) - { - Settings.Default.quality1 = mp3Button.Checked; - Settings.Default.Save(); - - if (mp3Button.Checked == true) - { - logger.Debug("Setting format ID to 5"); - format_id = "5"; - audio_format = ".mp3"; - mp3Button2.Checked = true; Settings.Default.qualityFormat = format_id; Settings.Default.audioType = audio_format; } @@ -754,47 +691,26 @@ private void mp3Button2_CheckedChanged(object sender, EventArgs e) logger.Debug("Setting format ID to 5"); format_id = "5"; audio_format = ".mp3"; - mp3Button.Checked = true; Settings.Default.qualityFormat = format_id; Settings.Default.audioType = audio_format; } } - private void flacHighLabel_Click(object sender, EventArgs e) - { - flacHighButton.Checked = true; - } - private void flacHighLabel2_Click(object sender, EventArgs e) { flacHighButton2.Checked = true; } - private void flacMidLabel_Click(object sender, EventArgs e) - { - flacMidButton.Checked = true; - } - private void flacMidLabel2_Click(object sender, EventArgs e) { flacMidButton2.Checked = true; } - private void flacLowLabel_Click(object sender, EventArgs e) - { - flacLowButton.Checked = true; - } - private void flacLowLabel2_Click(object sender, EventArgs e) { flacLowButton2.Checked = true; } - private void mp3Label_Click(object sender, EventArgs e) - { - mp3Button.Checked = true; - } - private void mp3Label2_Click(object sender, EventArgs e) { mp3Button2.Checked = true; @@ -910,6 +826,18 @@ private void coverArtCheckbox_CheckedChanged(object sender, EventArgs e) Settings.Default.imageTag = coverArtCheckbox.Checked; Settings.Default.Save(); } + + private void commentCheckbox_CheckedChanged(object sender, EventArgs e) + { + Settings.Default.commentTag = commentCheckbox.Checked; + Settings.Default.Save(); + } + + private void commentTextbox_TextChanged(object sender, EventArgs e) + { + Settings.Default.commentText = commentTextbox.Text; + Settings.Default.Save(); + } private void embeddedArtSizeSelect_SelectedIndexChanged(object sender, EventArgs e) { diff --git a/QobuzDownloaderX/qbdlxForm.resx b/QobuzDownloaderX/qbdlxForm.resx index 98dfae1..e51abcd 100644 --- a/QobuzDownloaderX/qbdlxForm.resx +++ b/QobuzDownloaderX/qbdlxForm.resx @@ -358,13 +358,17 @@ === RELEASE SPECIFIC === -%AlbumID%, %AlbumURL%, %AlbumGenre%, %AlbumComposer%, %AlbumTitle%, %AlbumTitle%, %Label%, %Copyright%, %UPC%, %ReleaseDate%, %Year%, %ReleaseType%, %ArtistName%, %Format%, %FormatWithHiResQuality%, %AlbumPA%, %AlbumPAifEx%, %AlbumPAifCl%, %AlbumPAEnclosed%, %AlbumPAifExEnclosed%, %AlbumPAifClEnclosed% - -=== PLAYLIST SPECIFIC === -%PlaylistID%, %PlaylistTitle%, %Format%, %FormatWithHiResQuality% +%AlbumID%, %AlbumURL%, %AlbumGenre%, %AlbumComposer%, %AlbumTitle%, %AlbumTitle%, %Label%, %Copyright%, %UPC%, %ReleaseDate%, %Year%, %ReleaseType%, %ArtistName%, %Format%, %FormatWithQuality%, %FormatWithHiResQuality% +// Parental warning templates // +%AlbumPA%, %AlbumPAShort%, %AlbumPAifEx%, %AlbumPAifExShort%, %AlbumPAifCl%, %AlbumPAifClShort%, %AlbumPAEnclosed%, %AlbumPAEnclosed[]%, %AlbumPAEnclosedShort%, %AlbumPAEnclosedShort[]%, %AlbumPAifExEnclosed%, %AlbumPAifExEnclosed[]%, %AlbumPAifExEnclosedShort%, %AlbumPAifExEnclosedShort[]%, %AlbumPAifClEnclosed%, %AlbumPAifClEnclosed[]%, %AlbumPAifClEnclosedShort%, %AlbumPAifClEnclosedShort[]% === TRACK SPECIFIC === -%TrackArtist%, %TrackComposer%, %TrackID%, %TrackNumber%, %TrackTitle%, %ISRC%, %TrackFormat%, %TrackFormatWithHiResQuality%, %TrackPA%, %TrackPAifEx%, %TrackPAifCl%, %TrackPAEnclosed%, %TrackPAifExEnclosed%, %TrackPAifClEnclosed% +%TrackArtist%, %TrackComposer%, %TrackID%, %TrackNumber%, %TrackTitle%, %ISRC%, %TrackFormat%, %TrackFormatWithHiResQuality%, %TrackFormatWithQuality% +// Parental warning templates // +%TrackPA%, %TrackPAShort%, %TrackPAifEx%, %TrackPAifExShort%, %TrackPAifCl%, %TrackPAifClShort%, %TrackPAEnclosed%, %TrackPAEnclosed[]%, %TrackPAEnclosedShort%, %TrackPAEnclosedShort[]%, %TrackPAifExEnclosed%, %TrackPAifExEnclosed[]%, %TrackPAifExEnclosedShort%, %TrackPAifExEnclosedShort[]%, %TrackPAifClEnclosed%, %TrackPAifClEnclosed[]%, %TrackPAifClEnclosedShort%, %TrackPAifClEnclosedShort[]% + +=== PLAYLIST SPECIFIC === +%PlaylistID%, %PlaylistTitle%, %Format%, %FormatWithHiResQuality%, %FormatWithQuality% 17, 17